2024-04-22 13:42:02 +07:00
|
|
|
<script setup lang="ts">
|
2024-08-02 16:13:07 +07:00
|
|
|
import { ref, watch, onMounted } from 'vue';
|
|
|
|
|
import { useI18n } from 'vue-i18n';
|
2024-08-02 13:58:44 +07:00
|
|
|
import { useQuasar } from 'quasar';
|
2024-08-05 15:09:36 +07:00
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
2024-07-10 13:21:32 +07:00
|
|
|
import { getUserId, getRole } from 'src/services/keycloak';
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
import { calculateAge, dateFormat } from 'src/utils/datetime';
|
2024-04-22 12:16:17 +07:00
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
import useCustomerStore from 'stores/customer';
|
|
|
|
|
import useEmployeeStore from 'stores/employee';
|
|
|
|
|
import useMyBranchStore from 'stores/my-branch';
|
2024-08-02 16:13:07 +07:00
|
|
|
import useUtilsStore, { dialog } from 'stores/utils';
|
|
|
|
|
import useFlowStore from 'stores/flow';
|
|
|
|
|
import { Status } from 'stores/types';
|
2024-08-05 10:15:06 +07:00
|
|
|
import { CustomerStats, Customer, CustomerBranch } from 'stores/customer/types';
|
2024-08-02 13:58:44 +07:00
|
|
|
import { Employee, EmployeeHistory } from 'stores/employee/types';
|
2024-06-10 11:25:38 +00:00
|
|
|
|
2024-08-02 16:13:07 +07:00
|
|
|
import ButtonAddComponent from 'components/ButtonAddCompoent.vue';
|
|
|
|
|
import PersonCard from 'components/home/PersonCard.vue';
|
|
|
|
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
|
|
|
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
|
|
|
|
import AddButton from 'components/AddButton.vue';
|
|
|
|
|
import NoData from 'components/NoData.vue';
|
|
|
|
|
import PaginationComponent from 'components/PaginationComponent.vue';
|
2024-08-05 15:09:36 +07:00
|
|
|
import SideMenu from 'components/SideMenu.vue';
|
2024-08-05 10:15:06 +07:00
|
|
|
import DialogForm from 'components/DialogForm.vue';
|
2024-08-02 16:13:07 +07:00
|
|
|
|
2024-08-05 15:09:36 +07:00
|
|
|
import FormBasicInfo from './components/FormBasicInfo.vue';
|
2024-08-02 13:58:44 +07:00
|
|
|
import { columnsCustomer, columnsEmployee } from './constant';
|
2024-08-05 10:15:06 +07:00
|
|
|
import { useCustomerForm } from './form';
|
|
|
|
|
import { storeToRefs } from 'pinia';
|
2024-08-05 15:09:36 +07:00
|
|
|
import ProfileBanner from 'src/components/ProfileBanner.vue';
|
|
|
|
|
import ImageUploadDialog from 'src/components/ImageUploadDialog.vue';
|
2024-06-07 14:56:51 +07:00
|
|
|
|
2024-06-10 16:00:52 +07:00
|
|
|
const { t, locale } = useI18n();
|
2024-08-02 16:13:07 +07:00
|
|
|
const $q = useQuasar();
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
const flowStore = useFlowStore();
|
2024-07-02 09:43:06 +00:00
|
|
|
const utilsStore = useUtilsStore();
|
2024-08-02 16:13:07 +07:00
|
|
|
const customerStore = useCustomerStore();
|
2024-07-10 13:21:32 +07:00
|
|
|
const userBranchStore = useMyBranchStore();
|
2024-06-10 11:25:38 +00:00
|
|
|
const employeeStore = useEmployeeStore();
|
2024-08-05 10:15:06 +07:00
|
|
|
const customerFormStore = useCustomerForm();
|
|
|
|
|
|
2024-08-05 15:09:36 +07:00
|
|
|
const { state: customerFormState, currentFormData: customerFormData } =
|
|
|
|
|
storeToRefs(customerFormStore);
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
async function init() {
|
2024-08-02 16:38:49 +07:00
|
|
|
utilsStore.currentTitle.title = 'customerManagement';
|
|
|
|
|
utilsStore.currentTitle.path = [
|
|
|
|
|
{
|
|
|
|
|
text: 'customerManagementCaption',
|
|
|
|
|
handler: () => router.push('/customer-management'),
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
gridView.value = $q.screen.lt.md ? true : false;
|
|
|
|
|
|
|
|
|
|
if (route.name === 'CustomerManagement') await fetchListCustomer(true);
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
route.name === 'CustomerBranchManagement' &&
|
|
|
|
|
typeof route.params.customerId === 'string'
|
|
|
|
|
) {
|
|
|
|
|
const _data = await customerStore.fetchById(route.params.customerId);
|
2024-08-02 16:38:49 +07:00
|
|
|
|
|
|
|
|
if (_data) {
|
|
|
|
|
currentCustomer.value = _data;
|
|
|
|
|
utilsStore.currentTitle.path.push({
|
|
|
|
|
text: currentCustomer.value.customerName,
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
router.push('/customer-management');
|
|
|
|
|
}
|
2024-08-02 16:13:07 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
onMounted(init);
|
|
|
|
|
|
2024-08-02 17:05:55 +07:00
|
|
|
// NOTE: Page Data
|
|
|
|
|
const currentCustomer = ref<Customer>();
|
|
|
|
|
const listCustomer = ref<(Customer & { branch: CustomerBranch[] })[]>([]);
|
|
|
|
|
const listEmployee = ref<Employee[]>([]);
|
|
|
|
|
const hideStats = ref(false);
|
|
|
|
|
const statsCustomerType = ref<CustomerStats>({
|
|
|
|
|
CORP: 0,
|
|
|
|
|
PERS: 0,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// NOTE: Page State
|
2024-08-02 16:38:49 +07:00
|
|
|
const currentTab = ref<'employer' | 'employee'>('employer');
|
|
|
|
|
const inputSearch = ref('');
|
|
|
|
|
const currentStatus = ref<Status | 'All'>('All');
|
2024-08-02 17:05:55 +07:00
|
|
|
const customerTypeSelected = ref<{
|
|
|
|
|
label: string;
|
|
|
|
|
value: 'all' | 'customerLegalEntity' | 'customerNaturalPerson';
|
|
|
|
|
}>({
|
2024-06-10 16:00:52 +07:00
|
|
|
label: t('all'),
|
|
|
|
|
value: 'all',
|
2024-04-23 17:20:31 +07:00
|
|
|
});
|
2024-08-02 17:05:55 +07:00
|
|
|
const employeeStats = ref(0);
|
|
|
|
|
const gridView = ref(false);
|
|
|
|
|
const splitPercent = ref(15); // Customer only
|
2024-08-02 17:23:07 +07:00
|
|
|
const currentPageCustomer = ref<number>(1);
|
|
|
|
|
const maxPageCustomer = ref<number>(1);
|
|
|
|
|
const currentPageEmployee = ref<number>(1);
|
|
|
|
|
const maxPageEmployee = ref<number>(1);
|
|
|
|
|
const pageSize = ref<number>(10);
|
2024-08-05 15:09:36 +07:00
|
|
|
const dialogCustomerImageUpload = ref<InstanceType<typeof ImageUploadDialog>>();
|
2024-08-02 17:05:55 +07:00
|
|
|
|
|
|
|
|
watch(() => route.name, init);
|
|
|
|
|
watch(
|
|
|
|
|
[currentTab, currentStatus, inputSearch, customerTypeSelected],
|
|
|
|
|
async ([tabName]) => {
|
|
|
|
|
if (tabName === 'employer') {
|
|
|
|
|
currentPageCustomer.value = 1;
|
|
|
|
|
await fetchListCustomer(true);
|
|
|
|
|
}
|
|
|
|
|
if (tabName === 'employee') {
|
|
|
|
|
currentPageEmployee.value = 1;
|
|
|
|
|
await fetchListEmployee(true);
|
|
|
|
|
}
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
watch(locale, () => {
|
|
|
|
|
customerTypeSelected.value = {
|
|
|
|
|
label: `${customerTypeSelected.value.label}`,
|
|
|
|
|
value: customerTypeSelected.value?.value,
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
watch(
|
|
|
|
|
() => $q.screen.lt.md,
|
|
|
|
|
() => $q.screen.lt.md && (gridView.value = true),
|
|
|
|
|
);
|
2024-04-23 17:20:31 +07:00
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
const fieldDisplayEmployer = ref<{ label: string; value: string }[]>([
|
|
|
|
|
{ label: 'corporation', value: 'customerName' },
|
|
|
|
|
{ label: 'type', value: 'type' },
|
|
|
|
|
{ label: 'name', value: 'personName' },
|
2024-07-08 11:21:00 +07:00
|
|
|
{
|
2024-07-23 04:25:09 +00:00
|
|
|
label: 'telephone',
|
2024-07-08 11:21:00 +07:00
|
|
|
value: 'telephoneNo',
|
|
|
|
|
},
|
2024-08-02 13:58:44 +07:00
|
|
|
{ label: 'formDialogInputEmail', value: 'branchEmail' },
|
2024-07-08 11:05:07 +07:00
|
|
|
]);
|
2024-07-08 16:38:17 +07:00
|
|
|
|
|
|
|
|
const fieldDisplayEmployee = ref<
|
|
|
|
|
{
|
|
|
|
|
label: string;
|
|
|
|
|
value: string;
|
|
|
|
|
}[]
|
|
|
|
|
>([
|
2024-08-02 13:58:44 +07:00
|
|
|
{ label: 'nameEmployee', value: 'firstName' },
|
|
|
|
|
{ label: 'formDialogInputNationality', value: 'formDialogInputNationality' },
|
|
|
|
|
{ label: 'formDialogInputPassportNo', value: 'formDialogInputPassportNo' },
|
|
|
|
|
{ label: 'formDialogInputAge', value: 'formDialogInputAge' },
|
|
|
|
|
{ label: 'passportExpire', value: 'passportExpiryDate' },
|
2024-07-16 11:27:47 +07:00
|
|
|
{
|
2024-07-23 04:25:09 +00:00
|
|
|
label: 'formDialogEmployeeNRCNo',
|
2024-07-16 11:27:47 +07:00
|
|
|
value: 'formDialogEmployeeNRCNo',
|
|
|
|
|
},
|
2024-08-02 13:58:44 +07:00
|
|
|
{ label: 'branchLabel', value: 'branchLabel' },
|
|
|
|
|
{ label: 'type', value: 'type' },
|
2024-07-08 16:38:17 +07:00
|
|
|
]);
|
|
|
|
|
|
2024-07-08 11:05:07 +07:00
|
|
|
const fieldSelected = ref<
|
|
|
|
|
(
|
2024-07-08 11:21:00 +07:00
|
|
|
| 'customerName'
|
2024-07-08 16:38:17 +07:00
|
|
|
| 'type'
|
2024-07-08 11:05:07 +07:00
|
|
|
| 'personName'
|
|
|
|
|
| 'telephoneNo'
|
|
|
|
|
| 'branchEmail'
|
2024-07-08 16:38:17 +07:00
|
|
|
| 'firstName'
|
|
|
|
|
| 'formDialogInputNationality'
|
2024-07-16 11:27:47 +07:00
|
|
|
| 'formDialogInputPassportNo'
|
|
|
|
|
| 'passportExpiryDate'
|
2024-07-08 16:38:17 +07:00
|
|
|
| 'formDialogEmployeeNRCNo'
|
|
|
|
|
| 'formDialogInputAge'
|
|
|
|
|
| 'branchLabel'
|
2024-07-16 13:24:10 +07:00
|
|
|
| 'action'
|
2024-07-08 11:05:07 +07:00
|
|
|
)[]
|
2024-07-08 16:38:17 +07:00
|
|
|
>([
|
|
|
|
|
'customerName',
|
|
|
|
|
'personName',
|
|
|
|
|
'telephoneNo',
|
|
|
|
|
'branchEmail',
|
|
|
|
|
'firstName',
|
|
|
|
|
'formDialogInputNationality',
|
2024-07-16 11:27:47 +07:00
|
|
|
'formDialogInputPassportNo',
|
|
|
|
|
'passportExpiryDate',
|
|
|
|
|
'type',
|
2024-07-08 16:38:17 +07:00
|
|
|
'formDialogEmployeeNRCNo',
|
|
|
|
|
'formDialogInputAge',
|
|
|
|
|
'branchLabel',
|
2024-07-16 13:24:10 +07:00
|
|
|
'action',
|
2024-07-08 16:38:17 +07:00
|
|
|
]);
|
2024-07-08 11:05:07 +07:00
|
|
|
|
2024-08-02 16:38:49 +07:00
|
|
|
const registerAbleBranchOption = ref<{ id: string; name: string }[]>();
|
|
|
|
|
|
2024-06-10 12:00:16 +07:00
|
|
|
const branch = ref<CustomerBranch[]>();
|
|
|
|
|
|
2024-04-22 16:21:34 +07:00
|
|
|
const customerStats = [
|
2024-08-02 13:58:44 +07:00
|
|
|
{ id: 1, count: 2, name: 'CORP' },
|
|
|
|
|
{ id: 2, count: 3, name: 'PERS' },
|
2024-06-07 12:24:09 +00:00
|
|
|
];
|
|
|
|
|
|
2024-08-02 17:05:55 +07:00
|
|
|
const fieldCustomer = [
|
2024-06-11 15:31:00 +07:00
|
|
|
'all',
|
|
|
|
|
'customerLegalEntity',
|
|
|
|
|
'customerNaturalPerson',
|
2024-08-02 17:05:55 +07:00
|
|
|
] as const;
|
2024-06-10 16:00:52 +07:00
|
|
|
|
2024-06-28 08:10:14 +00:00
|
|
|
const employeeHistoryDialog = ref(false);
|
|
|
|
|
const employeeHistory = ref<EmployeeHistory[]>();
|
|
|
|
|
|
2024-06-10 16:17:38 +07:00
|
|
|
function deleteCustomerById(id: string) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
2024-08-02 16:13:07 +07:00
|
|
|
await customerStore.deleteById(id);
|
2024-06-10 16:17:38 +07:00
|
|
|
|
2024-08-02 16:38:49 +07:00
|
|
|
await fetchListCustomer(true);
|
2024-06-28 13:27:38 +07:00
|
|
|
flowStore.rotate();
|
2024-06-10 16:17:38 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-04 13:27:58 +07:00
|
|
|
async function fetchListOfOptionBranch() {
|
2024-08-02 16:38:49 +07:00
|
|
|
if (registerAbleBranchOption.value) return;
|
2024-08-02 13:58:44 +07:00
|
|
|
|
2024-07-10 13:21:32 +07:00
|
|
|
const uid = getUserId();
|
|
|
|
|
const role = getRole();
|
|
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
if (!uid) return; // should not possible as the system require login to be able to access resource.
|
2024-07-03 17:55:12 +07:00
|
|
|
|
2024-07-10 13:21:32 +07:00
|
|
|
if (role?.includes('system')) {
|
|
|
|
|
const result = await userBranchStore.fetchListOptionBranch();
|
2024-08-02 16:38:49 +07:00
|
|
|
if (result && result.total > 0)
|
|
|
|
|
registerAbleBranchOption.value = result.result;
|
2024-07-10 13:21:32 +07:00
|
|
|
} else {
|
|
|
|
|
const result = await userBranchStore.fetchListMyBranch(uid);
|
2024-08-02 16:38:49 +07:00
|
|
|
if (result && result.total > 0)
|
|
|
|
|
registerAbleBranchOption.value = result.result;
|
2024-07-10 13:21:32 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
// TODO: Assign (first) branch of the user as register branch of the data
|
2024-07-03 17:55:12 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-02 16:13:07 +07:00
|
|
|
async function fetchListCustomer(fetchStats = false) {
|
2024-08-02 17:05:55 +07:00
|
|
|
const resultList = await customerStore.fetchList({
|
2024-06-11 11:24:37 +07:00
|
|
|
includeBranch: true,
|
|
|
|
|
page: currentPageCustomer.value,
|
2024-07-01 11:53:33 +07:00
|
|
|
pageSize: pageSize.value,
|
2024-06-14 13:03:20 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'All'
|
|
|
|
|
? undefined
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: 'INACTIVE',
|
2024-06-28 13:27:38 +07:00
|
|
|
query: inputSearch.value,
|
2024-08-02 17:05:55 +07:00
|
|
|
customerType: (
|
|
|
|
|
{
|
|
|
|
|
all: undefined,
|
|
|
|
|
customerLegalEntity: 'CORP',
|
|
|
|
|
customerNaturalPerson: 'PERS',
|
|
|
|
|
} as const
|
|
|
|
|
)[customerTypeSelected.value.value],
|
2024-06-11 11:24:37 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (resultList) {
|
|
|
|
|
currentPageCustomer.value = resultList.page;
|
2024-07-01 11:53:33 +07:00
|
|
|
maxPageCustomer.value = Math.ceil(resultList.total / pageSize.value);
|
2024-06-11 11:24:37 +07:00
|
|
|
listCustomer.value = resultList.result;
|
|
|
|
|
}
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
if (fetchStats) {
|
2024-08-02 16:38:49 +07:00
|
|
|
statsCustomerType.value = await customerStore
|
|
|
|
|
.getStatsCustomer()
|
|
|
|
|
.then((value) => (value ? value : { CORP: 0, PERS: 0 }));
|
2024-08-02 16:13:07 +07:00
|
|
|
}
|
2024-06-11 11:24:37 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-02 16:38:49 +07:00
|
|
|
async function fetchListEmployee(fetchStats = false) {
|
2024-06-28 13:27:38 +07:00
|
|
|
const resultListEmployee = await employeeStore.fetchList({
|
2024-07-01 11:53:33 +07:00
|
|
|
page: currentPageEmployee.value,
|
|
|
|
|
pageSize: pageSize.value,
|
2024-06-28 13:27:38 +07:00
|
|
|
status:
|
|
|
|
|
currentStatus.value === 'All'
|
|
|
|
|
? undefined
|
|
|
|
|
: currentStatus.value === 'ACTIVE'
|
|
|
|
|
? 'ACTIVE'
|
|
|
|
|
: 'INACTIVE',
|
|
|
|
|
query: inputSearch.value,
|
|
|
|
|
});
|
2024-06-13 11:58:51 +07:00
|
|
|
if (resultListEmployee) {
|
|
|
|
|
maxPageEmployee.value = Math.ceil(
|
2024-07-01 11:53:33 +07:00
|
|
|
resultListEmployee.total / pageSize.value,
|
2024-06-13 11:58:51 +07:00
|
|
|
);
|
|
|
|
|
listEmployee.value = resultListEmployee.result;
|
|
|
|
|
}
|
2024-08-02 16:38:49 +07:00
|
|
|
|
2024-08-02 17:05:55 +07:00
|
|
|
if (fetchStats) employeeStats.value = await employeeStore.getStatsEmployee();
|
2024-06-13 11:58:51 +07:00
|
|
|
}
|
|
|
|
|
|
2024-07-25 10:49:43 +00:00
|
|
|
async function triggerChangeStatus(id: string, status: string) {
|
|
|
|
|
return await new Promise((resolve, reject) => {
|
|
|
|
|
dialog({
|
|
|
|
|
color: status !== 'INACTIVE' ? 'warning' : 'info',
|
|
|
|
|
icon: status !== 'INACTIVE' ? 'mdi-alert' : 'mdi-comment-alert',
|
|
|
|
|
title: t('confirmChangeStatusTitle'),
|
|
|
|
|
actionText:
|
|
|
|
|
status !== 'INACTIVE' ? t('switchOffLabel') : t('switchOnLabel'),
|
|
|
|
|
message:
|
|
|
|
|
status !== 'INACTIVE'
|
|
|
|
|
? t('confirmChangeStatusOffMessage')
|
|
|
|
|
: t('confirmChangeStatusOnMessage'),
|
|
|
|
|
action: async () => {
|
|
|
|
|
if (currentTab.value === 'employee') {
|
|
|
|
|
await toggleStatusEmployee(id, status === 'ACTIVE' ? true : false)
|
|
|
|
|
.then(resolve)
|
|
|
|
|
.catch(reject);
|
|
|
|
|
} else {
|
|
|
|
|
await toggleStatusCustomer(id, status === 'ACTIVE' ? true : false)
|
|
|
|
|
.then(resolve)
|
|
|
|
|
.catch(reject);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 16:21:14 +07:00
|
|
|
async function toggleStatusEmployee(id: string, status: boolean) {
|
|
|
|
|
await employeeStore.editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
2024-06-19 16:31:11 +07:00
|
|
|
|
|
|
|
|
await fetchListEmployee();
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-06-19 16:21:14 +07:00
|
|
|
}
|
|
|
|
|
|
2024-06-19 14:54:03 +07:00
|
|
|
async function toggleStatusCustomer(id: string, status: boolean) {
|
2024-08-02 16:38:49 +07:00
|
|
|
await customerStore.editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
2024-06-19 14:54:03 +07:00
|
|
|
await fetchListCustomer();
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-06-19 14:54:03 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-02 16:13:07 +07:00
|
|
|
async function deleteEmployeeById(id: string) {
|
2024-06-10 11:25:38 +00:00
|
|
|
if (!id) return;
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('deleteConfirmTitle'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('deleteConfirmMessage'),
|
|
|
|
|
action: async () => {
|
|
|
|
|
await employeeStore.deleteById(id);
|
|
|
|
|
const resultList = await employeeStore.fetchList();
|
|
|
|
|
if (resultList) listEmployee.value = resultList.result;
|
2024-06-26 17:03:49 +07:00
|
|
|
flowStore.rotate();
|
2024-08-02 13:58:44 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
2024-06-13 03:50:14 +00:00
|
|
|
}
|
|
|
|
|
|
2024-06-27 10:23:54 +00:00
|
|
|
async function openHistory(id: string) {
|
2024-06-28 08:10:14 +00:00
|
|
|
const res = await employeeStore.getEditHistory(id);
|
|
|
|
|
employeeHistory.value = res.reverse();
|
2024-06-27 10:23:54 +00:00
|
|
|
employeeHistoryDialog.value = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-05 15:09:36 +07:00
|
|
|
async function editCustomerForm(id: string) {
|
|
|
|
|
await customerFormStore.assignFormData(id);
|
|
|
|
|
customerFormState.value.dialogType = 'edit';
|
|
|
|
|
customerFormState.value.dialogModal = true;
|
2024-08-05 15:42:00 +07:00
|
|
|
customerFormState.value.editCustomerId = id;
|
2024-08-05 15:09:36 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-05 15:29:11 +07:00
|
|
|
function createCustomerForm(customerType: 'CORP' | 'PERS') {
|
|
|
|
|
customerFormState.value.dialogModal = true;
|
|
|
|
|
customerFormState.value.dialogType = 'create';
|
|
|
|
|
customerFormData.value.customerType = customerType;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
// TODO: When in employee form, if select address same as customer then auto fill
|
2024-04-22 13:42:02 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-07-03 06:52:44 +00:00
|
|
|
<ButtonAddComponent style="z-index: 999">
|
2024-08-02 16:38:49 +07:00
|
|
|
<div v-if="$route.name === 'CustomerManagement'">
|
2024-07-24 11:34:45 +07:00
|
|
|
<q-fab-action
|
2024-08-02 16:38:49 +07:00
|
|
|
v-if="currentTab === 'employer'"
|
2024-07-24 11:34:45 +07:00
|
|
|
id="add-customer-legal-entity"
|
|
|
|
|
style="color: white; background-color: hsla(var(--violet-11-hsl))"
|
2024-08-05 15:29:11 +07:00
|
|
|
@click="createCustomerForm('CORP')"
|
2024-07-24 11:34:45 +07:00
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-office-building"
|
|
|
|
|
:label="$t('add') + ' ' + $t('customerLegalEntity')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
/>
|
|
|
|
|
<q-fab-action
|
2024-08-02 16:38:49 +07:00
|
|
|
v-if="currentTab === 'employer'"
|
2024-07-24 11:34:45 +07:00
|
|
|
id="add-customer-natural-person"
|
|
|
|
|
:label="$t('add') + ' ' + $t('customerNaturalPerson')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
2024-08-05 15:29:11 +07:00
|
|
|
@click="createCustomerForm('PERS')"
|
2024-07-24 11:34:45 +07:00
|
|
|
style="color: white; background-color: hsla(var(--teal-10-hsl))"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-account-plus"
|
|
|
|
|
/>
|
|
|
|
|
<q-fab-action
|
2024-08-02 16:38:49 +07:00
|
|
|
v-if="currentTab === 'employee'"
|
2024-07-24 11:34:45 +07:00
|
|
|
:label="$t('add') + ' ' + $t('EMPLOYEE')"
|
|
|
|
|
external-label
|
|
|
|
|
id="add-employee"
|
|
|
|
|
label-position="left"
|
2024-08-02 13:58:44 +07:00
|
|
|
@click=""
|
2024-07-24 11:34:45 +07:00
|
|
|
color="primary"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-account-plus"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-else>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
id="add-branch"
|
2024-08-02 16:13:07 +07:00
|
|
|
:style="{
|
|
|
|
|
color: 'white',
|
|
|
|
|
'background-color':
|
2024-08-02 17:05:55 +07:00
|
|
|
currentCustomer?.customerType === 'CORP'
|
2024-08-02 16:13:07 +07:00
|
|
|
? 'hsla(var(--violet-11-hsl))'
|
|
|
|
|
: 'hsla(var(--pink-6-hsl))',
|
|
|
|
|
}"
|
|
|
|
|
@click=""
|
2024-07-24 11:34:45 +07:00
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-office-building"
|
|
|
|
|
:label="$t('formDialogTitleCreateSubBranch')"
|
|
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-13 17:13:09 +07:00
|
|
|
</ButtonAddComponent>
|
|
|
|
|
|
2024-07-02 09:43:06 +00:00
|
|
|
<div class="column full-height no-wrap">
|
2024-08-02 16:13:07 +07:00
|
|
|
<div v-if="$route.name === 'CustomerManagement'" class="column full-height">
|
2024-07-05 09:29:46 +00:00
|
|
|
<div class="text-body-2 text-weight-medium q-mb-xs flex items-center">
|
2024-07-05 03:53:08 +00:00
|
|
|
{{ $t('dataSum') }}
|
2024-07-05 09:29:46 +00:00
|
|
|
<q-badge
|
|
|
|
|
v-if="listCustomer"
|
|
|
|
|
rounded
|
|
|
|
|
class="q-ml-sm"
|
|
|
|
|
style="
|
|
|
|
|
background-color: hsla(var(--info-bg) / 0.15);
|
|
|
|
|
color: hsl(var(--info-bg));
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer'
|
2024-07-05 09:29:46 +00:00
|
|
|
? listCustomer?.length
|
|
|
|
|
: listEmployee.length
|
|
|
|
|
}}
|
|
|
|
|
</q-badge>
|
2024-07-05 03:53:08 +00:00
|
|
|
<q-btn
|
2024-07-05 11:01:53 +00:00
|
|
|
class="q-ml-sm"
|
2024-07-05 03:53:08 +00:00
|
|
|
icon="mdi-pin"
|
|
|
|
|
color="primary"
|
|
|
|
|
size="sm"
|
|
|
|
|
flat
|
|
|
|
|
dense
|
|
|
|
|
rounded
|
2024-08-02 17:05:55 +07:00
|
|
|
@click="hideStats = !hideStats"
|
|
|
|
|
:style="hideStats ? 'rotate: 90deg' : ''"
|
2024-07-05 03:53:08 +00:00
|
|
|
style="transition: 0.1s ease-in-out"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2024-07-04 13:14:21 +07:00
|
|
|
<div class="row full-width">
|
2024-06-07 13:59:36 +07:00
|
|
|
<!-- stat -->
|
2024-07-05 03:53:08 +00:00
|
|
|
<transition name="slide">
|
2024-08-02 17:05:55 +07:00
|
|
|
<div v-if="!hideStats" class="col-12 q-mb-md">
|
2024-07-05 03:53:08 +00:00
|
|
|
<div class="scroll">
|
|
|
|
|
<StatCardComponent
|
|
|
|
|
v-if="customerStats"
|
|
|
|
|
labelI18n
|
|
|
|
|
:branch="
|
|
|
|
|
customerStats &&
|
2024-08-02 16:38:49 +07:00
|
|
|
(currentTab === 'employer'
|
2024-07-05 03:53:08 +00:00
|
|
|
? customerStats.map((v) => ({
|
|
|
|
|
count:
|
|
|
|
|
v.name === 'CORP'
|
|
|
|
|
? statsCustomerType?.CORP ?? 0
|
|
|
|
|
: statsCustomerType?.PERS ?? 0,
|
|
|
|
|
label:
|
|
|
|
|
v.name === 'CORP'
|
|
|
|
|
? 'customerLegalEntity'
|
|
|
|
|
: 'customerNaturalPerson',
|
|
|
|
|
icon:
|
|
|
|
|
v.name === 'CORP'
|
|
|
|
|
? 'mdi-office-building'
|
|
|
|
|
: 'mdi-account',
|
|
|
|
|
color: v.name === 'CORP' ? 'purple' : 'green',
|
|
|
|
|
}))
|
|
|
|
|
: [
|
|
|
|
|
{
|
|
|
|
|
label: 'EMPLOYEE',
|
2024-08-02 17:05:55 +07:00
|
|
|
count: employeeStats,
|
2024-07-05 03:53:08 +00:00
|
|
|
icon: 'mdi-account',
|
|
|
|
|
color: 'pink',
|
|
|
|
|
},
|
|
|
|
|
])
|
|
|
|
|
"
|
|
|
|
|
:dark="$q.dark.isActive"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-06-07 13:59:36 +07:00
|
|
|
</div>
|
2024-07-05 03:53:08 +00:00
|
|
|
</transition>
|
2024-06-07 13:59:36 +07:00
|
|
|
</div>
|
2024-04-22 13:42:02 +07:00
|
|
|
|
2024-06-07 13:59:36 +07:00
|
|
|
<!-- main -->
|
2024-07-08 14:08:57 +07:00
|
|
|
<div
|
2024-07-17 08:31:31 +00:00
|
|
|
class="surface-2 bordered rounded col column full-width"
|
|
|
|
|
style="overflow: hidden"
|
2024-07-08 14:08:57 +07:00
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
<!-- tabs -->
|
|
|
|
|
<div class="column">
|
2024-07-17 08:31:31 +00:00
|
|
|
<div
|
|
|
|
|
class="row q-px-md q-py-sm justify-between full-width surface-3 bordered-b"
|
|
|
|
|
>
|
2024-07-17 07:38:44 +00:00
|
|
|
<q-input
|
2024-07-26 11:05:07 +07:00
|
|
|
lazy-rules="ondemand"
|
2024-07-17 07:38:44 +00:00
|
|
|
for="input-search"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
|
|
|
|
:label="$t('search')"
|
|
|
|
|
class="col-12 col-md-3"
|
|
|
|
|
:bg-color="$q.dark.isActive ? 'dark' : 'white'"
|
|
|
|
|
v-model="inputSearch"
|
|
|
|
|
debounce="200"
|
|
|
|
|
>
|
|
|
|
|
<template #prepend>
|
|
|
|
|
<q-icon name="mdi-magnify" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="row col-md-5 col-12"
|
|
|
|
|
:class="{ 'q-pt-xs': $q.screen.lt.md }"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
>
|
|
|
|
|
<q-select
|
2024-07-26 11:05:07 +07:00
|
|
|
lazy-rules="ondemand"
|
2024-07-18 14:18:16 +07:00
|
|
|
id="select-status"
|
|
|
|
|
for="select-status"
|
2024-07-17 07:38:44 +00:00
|
|
|
v-model="currentStatus"
|
2024-07-05 09:29:46 +00:00
|
|
|
outlined
|
|
|
|
|
dense
|
2024-07-17 07:38:44 +00:00
|
|
|
option-value="value"
|
|
|
|
|
option-label="label"
|
|
|
|
|
class="col"
|
2024-08-02 16:13:07 +07:00
|
|
|
:class="{ 'offset-md-5': gridView }"
|
2024-07-17 07:38:44 +00:00
|
|
|
map-options
|
|
|
|
|
emit-value
|
2024-07-18 04:51:09 +00:00
|
|
|
:hide-dropdown-icon="$q.screen.lt.sm"
|
2024-07-17 07:38:44 +00:00
|
|
|
:options="[
|
|
|
|
|
{ label: $t('all'), value: 'All' },
|
|
|
|
|
{ label: $t('statusACTIVE'), value: 'ACTIVE' },
|
|
|
|
|
{ label: $t('statusINACTIVE'), value: 'INACTIVE' },
|
|
|
|
|
]"
|
|
|
|
|
></q-select>
|
|
|
|
|
<q-select
|
2024-07-26 11:05:07 +07:00
|
|
|
lazy-rules="ondemand"
|
2024-07-17 07:38:44 +00:00
|
|
|
id="select-field"
|
2024-08-02 16:13:07 +07:00
|
|
|
v-if="gridView === false"
|
2024-07-17 07:38:44 +00:00
|
|
|
for="select-field"
|
2024-07-18 09:10:51 +00:00
|
|
|
class="q-ml-sm col"
|
2024-07-17 07:38:44 +00:00
|
|
|
:options="
|
|
|
|
|
currentTab === 'employer'
|
|
|
|
|
? fieldDisplayEmployer
|
|
|
|
|
: fieldDisplayEmployee
|
|
|
|
|
"
|
|
|
|
|
:display-value="$t('displayField')"
|
2024-07-18 04:51:09 +00:00
|
|
|
:hide-dropdown-icon="$q.screen.lt.sm"
|
2024-07-17 07:38:44 +00:00
|
|
|
v-model="fieldSelected"
|
2024-07-23 04:25:09 +00:00
|
|
|
:option-label="(l) => $t(l.label)"
|
2024-07-17 07:38:44 +00:00
|
|
|
option-value="value"
|
|
|
|
|
map-options
|
|
|
|
|
emit-value
|
|
|
|
|
outlined
|
|
|
|
|
multiple
|
|
|
|
|
dense
|
|
|
|
|
/>
|
2024-07-05 09:29:46 +00:00
|
|
|
|
2024-07-17 07:38:44 +00:00
|
|
|
<q-btn-toggle
|
|
|
|
|
id="btn-mode"
|
2024-08-02 16:13:07 +07:00
|
|
|
v-model="gridView"
|
2024-07-17 07:38:44 +00:00
|
|
|
dense
|
2024-07-18 09:10:51 +00:00
|
|
|
class="no-shadow bordered rounded surface-1 q-ml-sm"
|
2024-07-17 07:38:44 +00:00
|
|
|
:toggle-color="$q.dark.isActive ? 'grey-9' : 'grey-2'"
|
|
|
|
|
size="xs"
|
|
|
|
|
:options="[
|
|
|
|
|
{ value: true, slot: 'folder' },
|
|
|
|
|
{ value: false, slot: 'list' },
|
|
|
|
|
]"
|
2024-07-16 02:53:06 +00:00
|
|
|
>
|
2024-07-17 07:38:44 +00:00
|
|
|
<template v-slot:folder>
|
|
|
|
|
<q-icon
|
2024-07-18 14:18:16 +07:00
|
|
|
id="icon-mode-grid"
|
2024-07-17 07:38:44 +00:00
|
|
|
name="mdi-view-grid-outline"
|
|
|
|
|
size="16px"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
2024-08-02 16:13:07 +07:00
|
|
|
? gridView
|
2024-07-17 07:38:44 +00:00
|
|
|
? '#C9D3DB '
|
|
|
|
|
: '#787B7C'
|
2024-08-02 16:13:07 +07:00
|
|
|
: gridView
|
2024-07-17 07:38:44 +00:00
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:list>
|
|
|
|
|
<q-icon
|
2024-07-18 14:18:16 +07:00
|
|
|
id="icon-mode-list"
|
2024-07-17 07:38:44 +00:00
|
|
|
name="mdi-format-list-bulleted"
|
|
|
|
|
class="q-px-sm q-py-xs rounded"
|
|
|
|
|
size="16px"
|
|
|
|
|
:style="{
|
|
|
|
|
color: $q.dark.isActive
|
2024-08-02 16:13:07 +07:00
|
|
|
? gridView === false
|
2024-07-17 07:38:44 +00:00
|
|
|
? '#C9D3DB'
|
|
|
|
|
: '#787B7C'
|
2024-08-02 16:13:07 +07:00
|
|
|
: gridView === false
|
2024-07-17 07:38:44 +00:00
|
|
|
? '#787B7C'
|
|
|
|
|
: '#C9D3DB',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-btn-toggle>
|
2024-07-05 09:29:46 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="surface-2 bordered-b q-px-md">
|
|
|
|
|
<q-tabs
|
2024-06-10 16:00:52 +07:00
|
|
|
dense
|
2024-07-05 09:29:46 +00:00
|
|
|
v-model="currentTab"
|
|
|
|
|
align="left"
|
|
|
|
|
class="full-height"
|
|
|
|
|
active-color="info"
|
2024-06-13 13:33:47 +07:00
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
<q-tab
|
|
|
|
|
name="employer"
|
2024-07-19 14:04:02 +07:00
|
|
|
id="tab-employer"
|
2024-07-05 09:29:46 +00:00
|
|
|
@click="
|
2024-08-02 16:38:49 +07:00
|
|
|
() => {
|
2024-07-05 09:29:46 +00:00
|
|
|
currentPageCustomer = 1;
|
|
|
|
|
inputSearch = '';
|
|
|
|
|
currentStatus = 'All';
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-06-13 13:33:47 +07:00
|
|
|
<div
|
2024-07-05 09:29:46 +00:00
|
|
|
class="row"
|
|
|
|
|
:class="
|
|
|
|
|
currentTab === 'employer' ? 'text-bold' : 'app-text-muted'
|
2024-06-13 11:07:04 +00:00
|
|
|
"
|
2024-06-13 13:33:47 +07:00
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t('EMPLOYER') }}
|
2024-06-13 13:33:47 +07:00
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
</q-tab>
|
|
|
|
|
<q-tab
|
|
|
|
|
name="employee"
|
2024-07-19 14:04:02 +07:00
|
|
|
id="tab-employee"
|
2024-07-05 09:29:46 +00:00
|
|
|
@click="
|
2024-08-02 16:38:49 +07:00
|
|
|
() => {
|
2024-07-05 09:29:46 +00:00
|
|
|
currentPageEmployee = 1;
|
|
|
|
|
inputSearch = '';
|
|
|
|
|
currentStatus = 'All';
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-06-13 13:33:47 +07:00
|
|
|
<div
|
2024-07-05 09:29:46 +00:00
|
|
|
class="row"
|
|
|
|
|
:class="
|
|
|
|
|
currentTab === 'employee' ? 'text-bold' : 'app-text-muted'
|
2024-06-13 11:07:04 +00:00
|
|
|
"
|
2024-06-13 13:33:47 +07:00
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t('EMPLOYEE') }}
|
2024-06-13 13:33:47 +07:00
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
</q-tab>
|
|
|
|
|
</q-tabs>
|
2024-06-10 16:00:52 +07:00
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
</div>
|
2024-06-10 16:00:52 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<!-- body -->
|
2024-07-17 07:38:44 +00:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<q-splitter
|
2024-08-02 16:13:07 +07:00
|
|
|
v-model="splitPercent"
|
2024-07-18 11:01:39 +00:00
|
|
|
:limits="[0, 100]"
|
2024-07-19 09:15:55 +00:00
|
|
|
class="col full-width"
|
2024-07-18 11:01:39 +00:00
|
|
|
before-class="overflow-hidden"
|
2024-07-17 08:16:59 +00:00
|
|
|
after-class="overflow-hidden"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
|
|
|
|
<template v-slot:before>
|
2024-07-16 02:11:18 +00:00
|
|
|
<div
|
2024-07-19 07:39:23 +00:00
|
|
|
class="column q-pa-md surface-1 full-height full-width"
|
2024-07-16 02:11:18 +00:00
|
|
|
style="gap: var(--size-1)"
|
|
|
|
|
>
|
2024-08-02 16:38:49 +07:00
|
|
|
<template v-if="currentTab === 'employer'">
|
2024-06-10 16:00:52 +07:00
|
|
|
<q-item
|
2024-07-10 13:21:32 +07:00
|
|
|
v-close-popup
|
|
|
|
|
clickable
|
2024-07-05 09:29:46 +00:00
|
|
|
v-for="v in fieldCustomer"
|
|
|
|
|
:key="v"
|
|
|
|
|
dense
|
2024-07-19 07:39:23 +00:00
|
|
|
class="no-padding items-center rounded full-width"
|
2024-07-05 09:29:46 +00:00
|
|
|
active-class="employer-active"
|
2024-08-02 17:05:55 +07:00
|
|
|
:active="customerTypeSelected.value === v"
|
|
|
|
|
@click="customerTypeSelected = { label: v, value: v }"
|
2024-06-10 16:00:52 +07:00
|
|
|
>
|
2024-07-19 07:39:23 +00:00
|
|
|
<span class="q-px-md ellipsis">
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t(v) }}
|
|
|
|
|
</span>
|
2024-06-10 16:00:52 +07:00
|
|
|
</q-item>
|
2024-07-08 14:26:30 +07:00
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
2024-06-10 16:00:52 +07:00
|
|
|
<q-item
|
2024-07-05 09:29:46 +00:00
|
|
|
active
|
|
|
|
|
dense
|
|
|
|
|
active-class="employer-active"
|
2024-07-19 07:39:23 +00:00
|
|
|
class="no-padding items-center rounded full-width"
|
2024-07-10 13:21:32 +07:00
|
|
|
v-close-popup
|
|
|
|
|
clickable
|
2024-06-10 16:00:52 +07:00
|
|
|
>
|
2024-07-19 07:39:23 +00:00
|
|
|
<span class="q-px-md ellipsis">
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t('totalEmployee') }}
|
|
|
|
|
</span>
|
2024-06-10 16:00:52 +07:00
|
|
|
</q-item>
|
2024-07-08 14:26:30 +07:00
|
|
|
</template>
|
2024-07-05 09:29:46 +00:00
|
|
|
</div>
|
|
|
|
|
</template>
|
2024-06-07 18:04:08 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<template v-slot:after>
|
2024-07-17 08:16:59 +00:00
|
|
|
<div class="column full-height no-wrap">
|
2024-07-05 09:29:46 +00:00
|
|
|
<!-- employer -->
|
|
|
|
|
<template
|
|
|
|
|
v-if="
|
|
|
|
|
listCustomer &&
|
|
|
|
|
statsCustomerType.PERS + statsCustomerType.CORP > 0 &&
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer'
|
2024-07-05 09:29:46 +00:00
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="listCustomer.length === 0"
|
|
|
|
|
class="row col full-width items-center justify-center"
|
|
|
|
|
style="min-height: 250px"
|
|
|
|
|
>
|
|
|
|
|
<NoData :not-found="!!inputSearch" />
|
|
|
|
|
</div>
|
2024-07-17 08:16:59 +00:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div
|
|
|
|
|
v-if="listCustomer.length !== 0"
|
2024-07-17 08:16:59 +00:00
|
|
|
class="col q-pa-md scroll full-width"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
2024-07-17 08:16:59 +00:00
|
|
|
<q-table
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
2024-08-02 16:13:07 +07:00
|
|
|
:grid="gridView"
|
2024-07-17 08:16:59 +00:00
|
|
|
:rows="listCustomer"
|
|
|
|
|
:columns="columnsCustomer"
|
2024-07-19 09:15:55 +00:00
|
|
|
class="full-width"
|
2024-07-18 09:10:51 +00:00
|
|
|
card-container-class="q-col-gutter-md"
|
2024-07-17 08:16:59 +00:00
|
|
|
row-key="name"
|
|
|
|
|
:rows-per-page-options="[0]"
|
|
|
|
|
hide-pagination
|
|
|
|
|
:visible-columns="fieldSelected"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:header="props">
|
2024-07-31 06:18:52 +00:00
|
|
|
<q-tr
|
|
|
|
|
style="background-color: hsla(var(--info-bg) / 0.07)"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
2024-07-17 08:16:59 +00:00
|
|
|
<q-th
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
2024-07-08 11:05:07 +07:00
|
|
|
:props="props"
|
|
|
|
|
>
|
2024-07-17 08:16:59 +00:00
|
|
|
{{ $t(col.label) }}
|
|
|
|
|
</q-th>
|
|
|
|
|
<q-th auto-width />
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-muted': props.row.status === 'INACTIVE',
|
|
|
|
|
'status-active': props.row.status !== 'INACTIVE',
|
|
|
|
|
'status-inactive': props.row.status === 'INACTIVE',
|
|
|
|
|
}"
|
2024-07-25 13:31:32 +07:00
|
|
|
:id="`row-table-${props.row.customerName}`"
|
2024-07-17 08:16:59 +00:00
|
|
|
:props="props"
|
|
|
|
|
@click="
|
2024-08-02 16:13:07 +07:00
|
|
|
$router.push(
|
|
|
|
|
`/customer-management/${props.row.id}/branch`,
|
|
|
|
|
)
|
2024-07-17 08:16:59 +00:00
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('customerName')">
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<div
|
2024-08-02 13:58:44 +07:00
|
|
|
class="q-mr-sm"
|
2024-07-17 08:16:59 +00:00
|
|
|
style="
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: var(--size-2);
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div class="branch-card__icon">
|
|
|
|
|
<q-avatar size="md">
|
|
|
|
|
<q-img
|
|
|
|
|
:src="
|
|
|
|
|
props.row.imageUrl ?? '/no-profile.png'
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<template #error>
|
|
|
|
|
<q-img src="/no-profile.png" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-img>
|
|
|
|
|
</q-avatar>
|
|
|
|
|
|
|
|
|
|
<!-- <q-icon
|
2024-07-08 11:05:07 +07:00
|
|
|
size="md"
|
|
|
|
|
style="scale: 0.8"
|
|
|
|
|
:name="props.row.imageUrl"
|
|
|
|
|
/> -->
|
|
|
|
|
</div>
|
2024-07-17 08:16:59 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
2024-07-08 11:05:07 +07:00
|
|
|
<div class="col">
|
2024-07-17 08:16:59 +00:00
|
|
|
{{ props.row.customerName || '-' }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col app-text-muted">
|
|
|
|
|
{{ props.row.customerNameEN || '-' }}
|
2024-07-08 11:05:07 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-17 08:16:59 +00:00
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('type')">
|
|
|
|
|
<span
|
|
|
|
|
class="tags"
|
|
|
|
|
:class="{
|
|
|
|
|
[`tags__${props.row.customerType === 'CORP' ? 'purple' : 'green'}`]: true,
|
2024-07-08 11:05:07 +07:00
|
|
|
}"
|
2024-07-17 08:16:59 +00:00
|
|
|
>
|
|
|
|
|
{{
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? $t('customerLegalEntity')
|
|
|
|
|
: $t('customerNaturalPerson')
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('personName')">
|
|
|
|
|
{{ props.row.personName }}
|
|
|
|
|
</q-td>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('telephoneNo')">
|
2024-07-31 12:43:22 +07:00
|
|
|
{{ props.row.branch[0]?.telephoneNo || '-' }}
|
2024-07-17 08:16:59 +00:00
|
|
|
</q-td>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('branchEmail')">
|
2024-07-31 12:43:22 +07:00
|
|
|
{{ props.row.branch[0]?.email || '-' }}
|
2024-07-17 08:16:59 +00:00
|
|
|
</q-td>
|
|
|
|
|
<q-td>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-eye-outline"
|
|
|
|
|
:id="`btn-eye-${props.row.customerName}`"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
2024-08-05 15:09:36 +07:00
|
|
|
@click.stop="editCustomerForm(props.row.id)"
|
2024-07-08 11:05:07 +07:00
|
|
|
/>
|
2024-07-17 08:16:59 +00:00
|
|
|
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-dots-vertical"
|
2024-07-23 10:59:09 +07:00
|
|
|
:id="`btn-dots-${props.row.code}`"
|
2024-07-17 08:16:59 +00:00
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop
|
|
|
|
|
:key="props.row.id"
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-view`"
|
|
|
|
|
@click.stop="
|
|
|
|
|
() => {
|
|
|
|
|
const { branch, ...payload } = props.row;
|
|
|
|
|
currentCustomer = payload;
|
2024-08-02 13:58:44 +07:00
|
|
|
// assignFormData(props.row.id);
|
|
|
|
|
// openDialogInputForm('INFO', props.row.id);
|
2024-07-17 08:16:59 +00:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
v-close-popup
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-eye-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--green-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('viewDetail') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-edit`"
|
|
|
|
|
v-close-popup
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
2024-08-02 16:38:49 +07:00
|
|
|
@click="() => {}"
|
2024-07-17 08:16:59 +00:00
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-pencil-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--cyan-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('edit') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-delete`"
|
|
|
|
|
dense
|
|
|
|
|
v-close-popup
|
|
|
|
|
:clickable="props.row.status === 'CREATED'"
|
|
|
|
|
class="row"
|
|
|
|
|
:class="{
|
|
|
|
|
'surface-3': props.row.status !== 'CREATED',
|
|
|
|
|
'app-text-muted':
|
|
|
|
|
props.row.status !== 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click="deleteCustomerById(props.row.id)"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-trash-can-outline"
|
|
|
|
|
size="xs"
|
|
|
|
|
class="col-3"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-negative':
|
|
|
|
|
props.row.status === 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('delete') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item dense>
|
|
|
|
|
<q-item-section class="q-py-sm">
|
|
|
|
|
<div class="q-pa-sm surface-2 rounded">
|
|
|
|
|
<q-toggle
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-status`"
|
|
|
|
|
dense
|
|
|
|
|
size="sm"
|
|
|
|
|
:label="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
? $t('switchOnLabel')
|
|
|
|
|
: $t('switchOffLabel')
|
|
|
|
|
"
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
2024-07-25 10:49:43 +00:00
|
|
|
triggerChangeStatus(
|
2024-07-17 08:16:59 +00:00
|
|
|
props.row.id,
|
2024-07-25 10:49:43 +00:00
|
|
|
props.row.status,
|
2024-07-17 08:16:59 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:model-value="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item="props">
|
2024-07-19 07:39:23 +00:00
|
|
|
<div class="col-12 col-md-3 col-sm-6">
|
2024-07-17 08:16:59 +00:00
|
|
|
<PersonCard
|
2024-07-25 13:31:32 +07:00
|
|
|
:id="`card-${props.row.customerName}`"
|
2024-07-17 08:16:59 +00:00
|
|
|
:field-selected="fieldSelected"
|
2024-07-30 11:05:39 +00:00
|
|
|
separateEnter
|
2024-07-17 08:16:59 +00:00
|
|
|
history
|
2024-07-30 15:49:38 +07:00
|
|
|
:prefix-id="
|
|
|
|
|
props.row.customerNameEN ?? props.rowIndex
|
|
|
|
|
"
|
2024-07-17 08:16:59 +00:00
|
|
|
:data="{
|
|
|
|
|
code: props.row.code,
|
|
|
|
|
name:
|
|
|
|
|
$i18n.locale === 'en-US'
|
|
|
|
|
? `${props.row.customerName} `.trim()
|
|
|
|
|
: `${props.row.customerNameEN} `.trim(),
|
|
|
|
|
img: props.row.imageUrl,
|
|
|
|
|
male: undefined,
|
|
|
|
|
female: undefined,
|
|
|
|
|
detail: [
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-cellphone',
|
2024-07-31 12:01:15 +07:00
|
|
|
value: props.row.branch[0]?.telephoneNo || '-',
|
2024-07-17 08:16:59 +00:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-account',
|
2024-07-31 12:01:15 +07:00
|
|
|
value: props.row.personName || '-',
|
2024-07-17 08:16:59 +00:00
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}"
|
|
|
|
|
:tag="[
|
|
|
|
|
{
|
|
|
|
|
color:
|
|
|
|
|
{
|
|
|
|
|
CORP: 'purple',
|
|
|
|
|
PERS: 'green',
|
|
|
|
|
}[props.row.customerType as string] || 'CORP',
|
|
|
|
|
value: $t(
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? 'customerLegalEntity'
|
|
|
|
|
: 'customerNaturalPerson',
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
:disabled="props.row.status === 'INACTIVE'"
|
|
|
|
|
@history="openHistory(props.row.id)"
|
2024-08-02 16:38:49 +07:00
|
|
|
@update-card="() => {}"
|
2024-07-17 08:16:59 +00:00
|
|
|
@enter-card="
|
2024-08-02 16:38:49 +07:00
|
|
|
$router.push(
|
|
|
|
|
`/customer-management/${props.row.id}/branch`,
|
|
|
|
|
)
|
2024-07-30 11:05:39 +00:00
|
|
|
"
|
2024-08-02 16:38:49 +07:00
|
|
|
@view-card=""
|
2024-07-17 08:16:59 +00:00
|
|
|
@delete-card="deleteCustomerById(props.row.id)"
|
|
|
|
|
@toggle-status="
|
2024-07-25 10:49:43 +00:00
|
|
|
triggerChangeStatus(props.row.id, props.row.status)
|
2024-07-17 08:16:59 +00:00
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
2024-07-05 09:29:46 +00:00
|
|
|
</div>
|
2024-06-11 12:55:46 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div
|
|
|
|
|
v-if="listCustomer.length !== 0"
|
2024-07-17 10:49:21 +00:00
|
|
|
class="row justify-between items-center q-px-md q-py-sm"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
|
|
|
|
<div class="row col-4 items-center">
|
2024-07-18 09:10:51 +00:00
|
|
|
<div
|
|
|
|
|
class="app-text-muted"
|
|
|
|
|
style="width: 80px"
|
|
|
|
|
v-if="$q.screen.gt.sm"
|
|
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t('showing') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn-dropdown
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
class="bordered q-pl-md rounded"
|
|
|
|
|
:label="pageSize"
|
|
|
|
|
style="background-color: var(--surface-1)"
|
|
|
|
|
>
|
|
|
|
|
<q-list>
|
|
|
|
|
<q-item
|
|
|
|
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
|
|
|
|
:key="v"
|
|
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
pageSize = v;
|
|
|
|
|
await fetchListCustomer();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ v }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-11 12:55:46 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div class="col-4 flex justify-center app-text-muted">
|
|
|
|
|
{{
|
|
|
|
|
$t('recordsPage', {
|
|
|
|
|
resultcurrentPage: listCustomer.length,
|
|
|
|
|
total: statsCustomerType.PERS + statsCustomerType.CORP,
|
|
|
|
|
})
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
2024-06-18 13:29:45 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div class="col-4 flex justify-end">
|
|
|
|
|
<PaginationComponent
|
|
|
|
|
v-model:current-page="currentPageCustomer"
|
|
|
|
|
v-model:max-page="maxPageCustomer"
|
|
|
|
|
:fetch-data="
|
|
|
|
|
async () => {
|
|
|
|
|
await fetchListCustomer();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-07-04 14:35:19 +07:00
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
</template>
|
2024-07-04 14:35:19 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<!-- employee -->
|
|
|
|
|
<template
|
|
|
|
|
v-if="
|
2024-08-02 17:05:55 +07:00
|
|
|
listEmployee && employeeStats > 0 && currentTab === 'employee'
|
2024-07-04 14:35:19 +07:00
|
|
|
"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
v-if="listEmployee.length === 0"
|
2024-07-19 09:15:55 +00:00
|
|
|
class="row col full-width items-center justify-center"
|
|
|
|
|
style="min-height: 250px"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
|
|
|
|
<NoData :not-found="!!inputSearch" />
|
|
|
|
|
</div>
|
2024-06-18 13:29:45 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div
|
|
|
|
|
v-if="listEmployee.length !== 0"
|
2024-07-19 09:15:55 +00:00
|
|
|
class="surface-2 q-pa-md scroll col full-width"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-table
|
|
|
|
|
flat
|
|
|
|
|
bordered
|
2024-08-02 16:13:07 +07:00
|
|
|
:grid="gridView"
|
2024-07-08 16:38:17 +07:00
|
|
|
:rows="listEmployee"
|
|
|
|
|
:columns="columnsEmployee"
|
2024-07-19 09:15:55 +00:00
|
|
|
class="full-width"
|
|
|
|
|
card-container-class="q-col-gutter-md"
|
2024-07-08 16:38:17 +07:00
|
|
|
row-key="name"
|
|
|
|
|
:rows-per-page-options="[0]"
|
|
|
|
|
hide-pagination
|
|
|
|
|
:visible-columns="fieldSelected"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:header="props">
|
2024-07-31 06:18:52 +00:00
|
|
|
<q-tr
|
|
|
|
|
style="background-color: hsla(var(--info-bg) / 0.07)"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-th
|
|
|
|
|
v-for="col in props.cols"
|
|
|
|
|
:key="col.name"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
2024-07-23 04:25:09 +00:00
|
|
|
<span v-if="col.label !== ''">
|
|
|
|
|
{{ $t(col.label) }}
|
|
|
|
|
</span>
|
2024-07-08 16:38:17 +07:00
|
|
|
</q-th>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:body="props">
|
|
|
|
|
<q-tr
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-muted': props.row.status === 'INACTIVE',
|
|
|
|
|
'status-active': props.row.status !== 'INACTIVE',
|
|
|
|
|
'status-inactive': props.row.status === 'INACTIVE',
|
|
|
|
|
}"
|
|
|
|
|
:props="props"
|
2024-07-25 13:31:32 +07:00
|
|
|
:id="`row-table-${props.row.firstNameEN}`"
|
2024-07-08 16:38:17 +07:00
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-08-02 13:58:44 +07:00
|
|
|
// openDialogInputForm('INFO', props.row.id);
|
2024-07-08 16:38:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-td v-if="fieldSelected.includes('firstName')">
|
2024-07-16 11:27:47 +07:00
|
|
|
<div
|
|
|
|
|
class="row items-center"
|
|
|
|
|
style="flex-wrap: nowrap"
|
|
|
|
|
>
|
2024-07-08 16:38:17 +07:00
|
|
|
<div
|
|
|
|
|
style="
|
|
|
|
|
width: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-bottom: var(--size-2);
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div class="branch-card__icon">
|
|
|
|
|
<q-avatar size="md">
|
|
|
|
|
<q-img
|
|
|
|
|
:src="
|
|
|
|
|
props.row.profileImageUrl ??
|
|
|
|
|
'/no-profile.png'
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<template #error>
|
|
|
|
|
<q-img src="/no-profile.png" />
|
|
|
|
|
</template>
|
|
|
|
|
</q-img>
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="col">
|
|
|
|
|
<div class="col">
|
|
|
|
|
{{
|
|
|
|
|
`${props.row.firstName} ${props.row.lastName}` ||
|
|
|
|
|
'-'
|
|
|
|
|
}}
|
2024-07-09 11:56:24 +07:00
|
|
|
|
|
|
|
|
<q-icon
|
|
|
|
|
class="q-pl-xs"
|
|
|
|
|
:class="{
|
|
|
|
|
'symbol-gender': props.row.gender,
|
|
|
|
|
'symbol-gender__male':
|
|
|
|
|
props.row.gender === 'male',
|
|
|
|
|
'symbol-gender__female':
|
|
|
|
|
props.row.gender === 'female',
|
|
|
|
|
}"
|
|
|
|
|
:name="`mdi-gender-${props.row.gender === 'male' ? 'male' : 'female'}`"
|
|
|
|
|
width="24px"
|
|
|
|
|
/>
|
2024-07-08 16:38:17 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col app-text-muted">
|
|
|
|
|
{{
|
|
|
|
|
`${props.row.firstNameEN} ${props.row.lastNameEN}` ||
|
|
|
|
|
'-'
|
|
|
|
|
}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
2024-07-16 11:27:47 +07:00
|
|
|
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
fieldSelected.includes('formDialogInputNationality')
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ props.row.nationality || '-' }}
|
|
|
|
|
</q-td>
|
2024-07-16 11:27:47 +07:00
|
|
|
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="
|
2024-07-16 11:27:47 +07:00
|
|
|
fieldSelected.includes('formDialogInputPassportNo')
|
2024-07-08 16:38:17 +07:00
|
|
|
"
|
|
|
|
|
>
|
2024-07-16 11:27:47 +07:00
|
|
|
{{ props.row.passportNumber || '-' }}
|
2024-07-08 16:38:17 +07:00
|
|
|
</q-td>
|
2024-07-16 11:27:47 +07:00
|
|
|
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('formDialogInputAge')"
|
|
|
|
|
>
|
2024-07-16 03:24:13 +00:00
|
|
|
{{ calculateAge(props.row.dateOfBirth) }}
|
2024-07-08 16:38:17 +07:00
|
|
|
</q-td>
|
|
|
|
|
|
2024-07-16 11:27:47 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('passportExpiryDate')"
|
|
|
|
|
>
|
2024-07-19 09:15:55 +00:00
|
|
|
{{ dateFormat(props.row.passportExpiryDate) }}
|
2024-07-16 11:27:47 +07:00
|
|
|
</q-td>
|
|
|
|
|
|
|
|
|
|
<q-td
|
|
|
|
|
v-if="
|
|
|
|
|
fieldSelected.includes('formDialogEmployeeNRCNo')
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
{{ props.row.nrcNo || '-' }}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('formDialogInputAge')"
|
|
|
|
|
>
|
|
|
|
|
<div class="row items-center">
|
2024-07-08 17:55:53 +07:00
|
|
|
<div class="col">
|
2024-07-08 16:38:17 +07:00
|
|
|
<div class="col">
|
2024-07-08 17:55:53 +07:00
|
|
|
{{ props.row.customerBranch.code }}
|
2024-07-08 16:38:17 +07:00
|
|
|
</div>
|
|
|
|
|
<div class="col app-text-muted">
|
2024-07-08 17:55:53 +07:00
|
|
|
{{
|
|
|
|
|
$i18n.locale === 'en-US'
|
|
|
|
|
? `${props.row.customerBranch.nameEN}`
|
|
|
|
|
: `${props.row.customerBranch.name}`
|
2024-07-08 16:38:17 +07:00
|
|
|
}}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
2024-07-16 11:27:47 +07:00
|
|
|
|
|
|
|
|
<q-td v-if="fieldSelected.includes('type')">
|
|
|
|
|
<span class="tags tags__pink">
|
|
|
|
|
{{ $t('EMPLOYEE') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-td>
|
2024-07-08 16:38:17 +07:00
|
|
|
<q-td>
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-eye-outline"
|
|
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop="
|
|
|
|
|
() => {
|
2024-08-02 13:58:44 +07:00
|
|
|
// openDialogInputForm('INFO', props.row.id);
|
2024-07-08 17:55:53 +07:00
|
|
|
}
|
2024-07-08 16:38:17 +07:00
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
|
|
|
|
|
<q-btn
|
|
|
|
|
icon="mdi-dots-vertical"
|
2024-07-23 10:59:09 +07:00
|
|
|
:id="`btn-dots-${props.row.code}`"
|
2024-07-08 16:38:17 +07:00
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
|
|
|
|
@click.stop
|
|
|
|
|
:key="props.row.id"
|
|
|
|
|
>
|
|
|
|
|
<q-menu class="bordered">
|
|
|
|
|
<q-list v-close-popup>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-view`"
|
|
|
|
|
@click.stop="
|
|
|
|
|
() => {
|
2024-08-02 13:58:44 +07:00
|
|
|
// openDialogInputForm('INFO', props.row.id);
|
2024-07-08 16:38:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-eye-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--green-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('viewDetail') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-edit`"
|
|
|
|
|
clickable
|
|
|
|
|
dense
|
|
|
|
|
class="row q-py-sm"
|
|
|
|
|
style="white-space: nowrap"
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
2024-08-02 13:58:44 +07:00
|
|
|
// openDialogInputForm(
|
|
|
|
|
// 'INFO',
|
|
|
|
|
// props.row.id,
|
|
|
|
|
// true,
|
|
|
|
|
// );
|
2024-07-08 16:38:17 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-pencil-outline"
|
|
|
|
|
class="col-3"
|
|
|
|
|
size="xs"
|
|
|
|
|
style="color: hsl(var(--cyan-6-hsl))"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('edit') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
<q-item
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-delete`"
|
|
|
|
|
dense
|
|
|
|
|
:clickable="props.row.status === 'CREATED'"
|
|
|
|
|
class="row"
|
|
|
|
|
:class="{
|
|
|
|
|
'surface-3': props.row.status !== 'CREATED',
|
|
|
|
|
'app-text-muted':
|
|
|
|
|
props.row.status !== 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
style="white-space: nowrap"
|
2024-08-02 16:13:07 +07:00
|
|
|
@click="deleteEmployeeById(props.row.id)"
|
2024-07-08 16:38:17 +07:00
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
name="mdi-trash-can-outline"
|
|
|
|
|
size="xs"
|
|
|
|
|
class="col-3"
|
|
|
|
|
:class="{
|
|
|
|
|
'app-text-negative':
|
|
|
|
|
props.row.status === 'CREATED',
|
|
|
|
|
}"
|
|
|
|
|
/>
|
|
|
|
|
<span class="col-9 q-px-md flex items-center">
|
|
|
|
|
{{ $t('delete') }}
|
|
|
|
|
</span>
|
|
|
|
|
</q-item>
|
|
|
|
|
|
|
|
|
|
<q-item dense>
|
|
|
|
|
<q-item-section class="q-py-sm">
|
|
|
|
|
<div class="q-pa-sm surface-2 rounded">
|
|
|
|
|
<q-toggle
|
|
|
|
|
:id="`view-detail-btn-${props.row.name}-status`"
|
|
|
|
|
dense
|
|
|
|
|
size="sm"
|
|
|
|
|
:label="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
? $t('switchOnLabel')
|
|
|
|
|
: $t('switchOffLabel')
|
|
|
|
|
"
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
2024-07-25 10:49:43 +00:00
|
|
|
triggerChangeStatus(
|
2024-07-08 16:38:17 +07:00
|
|
|
props.row.id,
|
2024-07-25 10:49:43 +00:00
|
|
|
props.row.status,
|
2024-07-08 16:38:17 +07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:model-value="
|
|
|
|
|
props.row.status !== 'INACTIVE'
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-menu>
|
|
|
|
|
</q-btn>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item="props">
|
2024-07-19 07:39:23 +00:00
|
|
|
<div class="col-12 col-md-3 col-sm-6">
|
2024-07-08 16:38:17 +07:00
|
|
|
<PersonCard
|
2024-07-25 13:31:32 +07:00
|
|
|
:id="`card-${props.row.firstNameEN}`"
|
2024-07-08 16:38:17 +07:00
|
|
|
:field-selected="fieldSelected"
|
|
|
|
|
history
|
2024-07-30 15:49:38 +07:00
|
|
|
:prefix-id="props.row.firstNameEN ?? props.rowIndex"
|
2024-07-08 16:38:17 +07:00
|
|
|
:data="{
|
|
|
|
|
code: props.row.code,
|
|
|
|
|
name:
|
|
|
|
|
$i18n.locale === 'en-US'
|
2024-07-08 17:46:37 +07:00
|
|
|
? `${props.row.firstNameEN} ${props.row.lastNameEN} `.trim()
|
2024-07-08 17:55:53 +07:00
|
|
|
: `${props.row.firstName} ${props.row.lastName} `.trim(),
|
2024-07-08 17:46:37 +07:00
|
|
|
img: props.row.profileImageUrl,
|
2024-07-08 16:38:17 +07:00
|
|
|
male: props.row.gender === 'male',
|
|
|
|
|
female: props.row.gender === 'female',
|
|
|
|
|
detail: [
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-passport',
|
|
|
|
|
value: props.row.nationality,
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-clock-outline',
|
|
|
|
|
value: props.row.dateOfBirth
|
2024-07-16 03:24:13 +00:00
|
|
|
? calculateAge(props.row.dateOfBirth) ?? ''
|
2024-07-08 16:38:17 +07:00
|
|
|
: '',
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}"
|
2024-07-09 11:56:24 +07:00
|
|
|
:tag="[
|
|
|
|
|
{
|
|
|
|
|
color: 'pink',
|
|
|
|
|
value: $t('EMPLOYEE'),
|
|
|
|
|
},
|
|
|
|
|
]"
|
2024-07-08 16:38:17 +07:00
|
|
|
:disabled="props.row.status === 'INACTIVE'"
|
|
|
|
|
@history="openHistory(props.row.id)"
|
2024-08-02 13:58:44 +07:00
|
|
|
@update-card=""
|
|
|
|
|
@enter-card=""
|
2024-08-02 16:13:07 +07:00
|
|
|
@delete-card="deleteEmployeeById(props.row.id)"
|
2024-07-08 16:38:17 +07:00
|
|
|
@toggle-status="
|
2024-07-25 10:49:43 +00:00
|
|
|
triggerChangeStatus(props.row.id, props.row.status)
|
2024-07-08 16:38:17 +07:00
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-table>
|
2024-07-05 09:29:46 +00:00
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
v-if="listEmployee.length !== 0"
|
2024-07-17 10:49:21 +00:00
|
|
|
class="row justify-between items-center q-px-md q-py-sm"
|
2024-07-05 09:29:46 +00:00
|
|
|
>
|
|
|
|
|
<div class="row col-4 items-center">
|
2024-07-18 09:10:51 +00:00
|
|
|
<div
|
|
|
|
|
class="app-text-muted"
|
|
|
|
|
style="width: 80px"
|
|
|
|
|
v-if="$q.screen.gt.sm"
|
|
|
|
|
>
|
2024-07-05 09:29:46 +00:00
|
|
|
{{ $t('showing') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<q-btn-dropdown
|
|
|
|
|
dense
|
|
|
|
|
unelevated
|
|
|
|
|
:label="pageSize"
|
|
|
|
|
class="bordered q-pl-md"
|
|
|
|
|
style="background-color: var(--surface-1)"
|
|
|
|
|
>
|
|
|
|
|
<q-list>
|
|
|
|
|
<q-item
|
|
|
|
|
v-for="v in [10, 30, 50, 100, 500, 1000]"
|
|
|
|
|
:key="v"
|
|
|
|
|
clickable
|
|
|
|
|
v-close-popup
|
|
|
|
|
@click="
|
|
|
|
|
async () => {
|
|
|
|
|
pageSize = v;
|
|
|
|
|
await fetchListEmployee();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<q-item-section>
|
|
|
|
|
<q-item-label>{{ v }}</q-item-label>
|
|
|
|
|
</q-item-section>
|
|
|
|
|
</q-item>
|
|
|
|
|
</q-list>
|
|
|
|
|
</q-btn-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-06-13 11:58:51 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div class="col-4 flex justify-center app-text-muted">
|
|
|
|
|
{{
|
|
|
|
|
$t('recordsPage', {
|
|
|
|
|
resultcurrentPage: listEmployee.length,
|
2024-08-02 17:05:55 +07:00
|
|
|
total: employeeStats,
|
2024-07-05 09:29:46 +00:00
|
|
|
})
|
|
|
|
|
}}
|
2024-07-04 14:46:10 +07:00
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
|
|
|
|
|
<div class="col-4 flex justify-end">
|
|
|
|
|
<PaginationComponent
|
|
|
|
|
v-model:current-page="currentPageEmployee"
|
|
|
|
|
v-model:max-page="maxPageEmployee"
|
|
|
|
|
:fetch-data="
|
|
|
|
|
async () => {
|
|
|
|
|
await fetchListEmployee();
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
2024-07-04 14:46:10 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-05 09:29:46 +00:00
|
|
|
</template>
|
2024-07-04 14:46:10 +07:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<template
|
|
|
|
|
v-if="
|
|
|
|
|
(statsCustomerType.CORP + statsCustomerType.PERS === 0 &&
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer') ||
|
2024-08-02 17:05:55 +07:00
|
|
|
(employeeStats === 0 && currentTab === 'employee')
|
2024-07-05 09:29:46 +00:00
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<TooltipComponent
|
2024-07-15 07:20:32 +00:00
|
|
|
class="self-end q-ma-md"
|
2024-07-05 09:29:46 +00:00
|
|
|
:title="
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer'
|
2024-07-05 09:29:46 +00:00
|
|
|
? 'customerEmployerTooltipTitle'
|
|
|
|
|
: 'customerEmployeeTooltipTitle'
|
|
|
|
|
"
|
|
|
|
|
:caption="
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer'
|
2024-07-05 09:29:46 +00:00
|
|
|
? 'customerEmployerTooltipCaption'
|
|
|
|
|
: 'customerEmployeeTooltipCaption'
|
2024-07-04 14:46:10 +07:00
|
|
|
"
|
2024-07-05 09:29:46 +00:00
|
|
|
imgSrc="personnel-table-"
|
2024-07-04 14:46:10 +07:00
|
|
|
/>
|
2024-06-07 12:24:09 +00:00
|
|
|
|
2024-07-05 09:29:46 +00:00
|
|
|
<div
|
|
|
|
|
class="row items-center justify-center"
|
|
|
|
|
style="flex-grow: 1"
|
|
|
|
|
>
|
|
|
|
|
<AddButton
|
|
|
|
|
:label="
|
2024-08-02 16:38:49 +07:00
|
|
|
currentTab === 'employer'
|
2024-07-05 09:29:46 +00:00
|
|
|
? 'customerEmployerAdd'
|
|
|
|
|
: 'customerEmployeeAdd'
|
|
|
|
|
"
|
2024-08-02 13:58:44 +07:00
|
|
|
@trigger="() => {}"
|
2024-07-05 09:29:46 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</q-splitter>
|
2024-07-02 09:43:06 +00:00
|
|
|
</div>
|
2024-06-07 13:59:36 +07:00
|
|
|
</div>
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
<div class="col column" v-if="$route.name === 'CustomerBranchManagement'">
|
2024-06-07 14:40:01 +07:00
|
|
|
<CustomerInfoComponent
|
2024-08-02 16:13:07 +07:00
|
|
|
v-if="currentCustomer"
|
|
|
|
|
:customer-id="currentCustomer.id"
|
|
|
|
|
:customer-type="currentCustomer.customerType"
|
|
|
|
|
v-model:mode-view="gridView"
|
|
|
|
|
@back="$router.push('/customer-management')"
|
|
|
|
|
@view-detail="
|
2024-08-02 16:38:49 +07:00
|
|
|
async (value) => {
|
2024-07-30 10:42:24 +00:00
|
|
|
await fetchListOfOptionBranch();
|
2024-08-02 16:38:49 +07:00
|
|
|
// TODO: Assign data to form
|
2024-06-10 16:02:14 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-06-10 12:00:16 +07:00
|
|
|
v-model:branch="branch"
|
2024-08-02 16:13:07 +07:00
|
|
|
v-model:current-customer-name="currentCustomer.customerName"
|
|
|
|
|
v-model:current-customer-url-image="currentCustomer.imageUrl"
|
2024-06-07 14:40:01 +07:00
|
|
|
/>
|
2024-06-07 13:59:36 +07:00
|
|
|
</div>
|
2024-06-07 11:58:27 +07:00
|
|
|
</div>
|
2024-08-05 10:15:06 +07:00
|
|
|
|
|
|
|
|
<DialogForm
|
|
|
|
|
v-model:modal="customerFormState.dialogModal"
|
2024-08-05 15:09:36 +07:00
|
|
|
:title="$t('form.title.create', { name: 'Employer' })"
|
|
|
|
|
:show="
|
|
|
|
|
async () =>
|
2024-08-05 15:29:11 +07:00
|
|
|
await fetchListOfOptionBranch().then(() => {
|
|
|
|
|
customerFormStore.resetForm(
|
|
|
|
|
customerFormState.dialogType === 'create',
|
|
|
|
|
);
|
|
|
|
|
})
|
2024-08-05 15:09:36 +07:00
|
|
|
"
|
|
|
|
|
:submit="
|
2024-08-05 15:42:00 +07:00
|
|
|
async () => {
|
|
|
|
|
await customerFormStore.submitForm();
|
|
|
|
|
await fetchListCustomer();
|
2024-08-05 15:09:36 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:close="() => (customerFormState.dialogModal = false)"
|
|
|
|
|
no-footer
|
|
|
|
|
>
|
|
|
|
|
<div class="q-mx-lg q-mt-lg">
|
|
|
|
|
<ProfileBanner
|
|
|
|
|
active
|
|
|
|
|
v-model:cover-url="customerFormState.customerImageUrl"
|
|
|
|
|
:hide-fade="
|
|
|
|
|
customerFormState.customerImageUrl === '' ||
|
|
|
|
|
customerFormState.customerImageUrl === null
|
|
|
|
|
"
|
2024-08-05 15:42:00 +07:00
|
|
|
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
|
2024-08-05 15:09:36 +07:00
|
|
|
:img="
|
|
|
|
|
customerFormState.customerImageUrl ||
|
2024-08-05 15:42:00 +07:00
|
|
|
`/images/customer-${customerFormData.customerType}-avartar.png`
|
2024-08-05 15:09:36 +07:00
|
|
|
"
|
|
|
|
|
color="hsla(var(--pink-6-hsl)/1)"
|
|
|
|
|
bg-color="hsla(var(--pink-6-hsl)/0.15)"
|
|
|
|
|
@view="customerFormState.imageDialog = true"
|
|
|
|
|
@edit="dialogCustomerImageUpload?.browse()"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="col surface-1 q-ma-lg rounded bordered scroll row relative-position"
|
|
|
|
|
id="customer-form"
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
class="col"
|
|
|
|
|
style="height: 100%; max-height: 100; overflow-y: auto"
|
|
|
|
|
v-if="$q.screen.gt.sm"
|
|
|
|
|
>
|
|
|
|
|
<div class="q-py-md q-pl-md">
|
|
|
|
|
<SideMenu
|
|
|
|
|
:menu="[
|
|
|
|
|
{
|
|
|
|
|
name: $t('customer.form.group.basicInfo'),
|
|
|
|
|
anchor: 'form-basic-info-customer',
|
|
|
|
|
},
|
|
|
|
|
]"
|
|
|
|
|
background="transparent"
|
|
|
|
|
:active="{
|
|
|
|
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
|
|
|
|
foreground: 'var(--blue-6)',
|
|
|
|
|
}"
|
|
|
|
|
scroll-element="#customer-form-content"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="col-12 col-md-10 q-pa-md"
|
|
|
|
|
id="customer-form-content"
|
|
|
|
|
style="height: 100%; max-height: 100%; overflow-y: auto"
|
|
|
|
|
>
|
|
|
|
|
<FormBasicInfo
|
2024-08-05 15:45:26 +07:00
|
|
|
:readonly="
|
|
|
|
|
customerFormState.dialogType === 'edit' &&
|
|
|
|
|
customerFormState.editReadonly === true
|
|
|
|
|
"
|
2024-08-05 15:09:36 +07:00
|
|
|
id="form-basic-info-customer"
|
|
|
|
|
@save="customerFormState.saveMode = 'customer'"
|
|
|
|
|
:customer-type="customerFormData.customerType"
|
|
|
|
|
v-model:tax-no="customerFormData.taxNo"
|
|
|
|
|
v-model:customer-name="customerFormData.customerName"
|
|
|
|
|
v-model:customer-name-en="customerFormData.customerNameEN"
|
|
|
|
|
v-model:person-name="customerFormData.personName"
|
|
|
|
|
v-model:registered-branch-id="customerFormData.registeredBranchId"
|
|
|
|
|
v-model:branch-options="registerAbleBranchOption"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<!-- <q-btn -->
|
|
|
|
|
<!-- @click="customerFormState.saveMode = 'customer'" -->
|
|
|
|
|
<!-- type="submit" -->
|
|
|
|
|
<!-- label="Save" -->
|
|
|
|
|
<!-- /> -->
|
|
|
|
|
<!-- <q-btn -->
|
|
|
|
|
<!-- @click="customerFormState.saveMode = 'branch'" -->
|
|
|
|
|
<!-- type="submit" -->
|
|
|
|
|
<!-- label="Save" -->
|
|
|
|
|
<!-- /> -->
|
|
|
|
|
</DialogForm>
|
|
|
|
|
|
|
|
|
|
<ImageUploadDialog
|
|
|
|
|
ref="dialogCustomerImageUpload"
|
|
|
|
|
v-model:dialog-state="customerFormState.imageDialog"
|
|
|
|
|
v-model:file="customerFormData.image"
|
|
|
|
|
v-model:image-url="customerFormState.customerImageUrl"
|
|
|
|
|
:hidden-footer="
|
|
|
|
|
!customerFormData.image ||
|
|
|
|
|
!customerFormState.customerImageUrl ||
|
|
|
|
|
customerFormState.dialogType === 'edit'
|
|
|
|
|
"
|
2024-08-05 15:42:00 +07:00
|
|
|
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
|
2024-08-05 15:09:36 +07:00
|
|
|
clear-button
|
|
|
|
|
@save="() => {}"
|
|
|
|
|
></ImageUploadDialog>
|
2024-04-22 13:42:02 +07:00
|
|
|
</template>
|
2024-04-22 12:16:17 +07:00
|
|
|
|
2024-04-23 11:15:25 +00:00
|
|
|
<style scoped>
|
|
|
|
|
.customer-row {
|
|
|
|
|
display: grid;
|
|
|
|
|
gap: var(--size-6);
|
2024-06-10 12:00:16 +07:00
|
|
|
transition: 0.3s ease-in-out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.hover-card:hover {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
box-shadow: var(--shadow-3);
|
2024-04-23 11:15:25 +00:00
|
|
|
}
|
2024-07-05 03:53:08 +00:00
|
|
|
|
|
|
|
|
.slide-enter-active {
|
|
|
|
|
transition: all 0.1s ease-out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.slide-leave-active {
|
|
|
|
|
transition: all 0.1s cubic-bezier(1, 0.5, 0.8, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.slide-enter-from,
|
|
|
|
|
.slide-leave-to {
|
|
|
|
|
transform: translateY(-20px);
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
2024-07-05 09:29:46 +00:00
|
|
|
|
|
|
|
|
.employer-active {
|
|
|
|
|
background-color: hsla(var(--info-bg) / 0.1);
|
|
|
|
|
color: hsl(var(--info-bg));
|
|
|
|
|
}
|
2024-07-08 11:05:07 +07:00
|
|
|
|
|
|
|
|
.tags {
|
|
|
|
|
display: inline-block;
|
|
|
|
|
color: hsla(var(--_color) / 1);
|
|
|
|
|
background: hsla(var(--_color) / 0.15);
|
|
|
|
|
border-radius: var(--radius-2);
|
|
|
|
|
padding-inline: var(--size-2);
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-09 11:56:24 +07:00
|
|
|
.tags__pink {
|
|
|
|
|
--_color: var(--pink-6-hsl);
|
2024-07-08 16:38:17 +07:00
|
|
|
}
|
|
|
|
|
|
2024-07-08 11:05:07 +07:00
|
|
|
.tags__purple {
|
|
|
|
|
--_color: var(--violet-11-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.tags__green {
|
|
|
|
|
--_color: var(--teal-10-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .tags__purple {
|
|
|
|
|
--_color: var(--violet-10-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.dark .tags__green {
|
|
|
|
|
--_color: var(--teal-8-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-active {
|
|
|
|
|
--_branch-status-color: var(--green-6-hsl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status-inactive {
|
|
|
|
|
--_branch-status-color: var(--red-4-hsl);
|
|
|
|
|
--_branch-badge-bg: var(--red-4-hsl);
|
2024-07-08 16:38:17 +07:00
|
|
|
filter: grayscale(0.5);
|
2024-07-08 11:05:07 +07:00
|
|
|
opacity: 0.5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.branch-card__icon {
|
|
|
|
|
background-color: hsla(var(--_branch-card-bg) / 0.15);
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
padding: var(--size-1);
|
|
|
|
|
position: relative;
|
|
|
|
|
transform: rotate(45deg);
|
|
|
|
|
|
|
|
|
|
&::after {
|
|
|
|
|
content: ' ';
|
|
|
|
|
display: block;
|
|
|
|
|
block-size: 0.5rem;
|
|
|
|
|
aspect-ratio: 1;
|
|
|
|
|
position: absolute;
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
right: -0.1rem;
|
|
|
|
|
top: calc(50% - 0.25rem);
|
|
|
|
|
bottom: calc(50% - 0.25rem);
|
|
|
|
|
background-color: hsla(var(--_branch-status-color) / 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
& :deep(.q-avatar) {
|
|
|
|
|
transform: rotate(-45deg);
|
|
|
|
|
color: hsla(var(--_branch-card-bg) / 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-09 11:56:24 +07:00
|
|
|
|
|
|
|
|
& .symbol-gender {
|
|
|
|
|
color: hsla(var(--_fg));
|
|
|
|
|
|
|
|
|
|
&.symbol-gender__male {
|
|
|
|
|
--_fg: var(--gender-male);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.symbol-gender__female {
|
|
|
|
|
--_fg: var(--gender-female);
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-04-23 11:15:25 +00:00
|
|
|
</style>
|