2024-04-22 13:42:02 +07:00
|
|
|
<script setup lang="ts">
|
2024-09-17 10:00:35 +07:00
|
|
|
import { ref, watch, onMounted, computed } from 'vue';
|
2024-08-02 16:13:07 +07:00
|
|
|
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-09-19 10:15:03 +07:00
|
|
|
import { baseUrl, waitAll } from 'src/stores/utils';
|
2024-08-02 16:13:07 +07:00
|
|
|
|
2024-08-26 18:04:04 +07:00
|
|
|
import useOcrStore from 'stores/ocr';
|
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-09-05 10:37:14 +07:00
|
|
|
import useUtilsStore, { dialog, notify, resetScrollBar } from 'stores/utils';
|
2024-08-02 16:13:07 +07:00
|
|
|
import useFlowStore from 'stores/flow';
|
|
|
|
|
import { Status } from 'stores/types';
|
2024-08-22 17:44:34 +07:00
|
|
|
import {
|
|
|
|
|
CustomerStats,
|
|
|
|
|
Customer,
|
|
|
|
|
CustomerBranch,
|
|
|
|
|
CustomerBranchCreate,
|
|
|
|
|
} from 'stores/customer/types';
|
2024-08-02 13:58:44 +07:00
|
|
|
import { Employee, EmployeeHistory } from 'stores/employee/types';
|
2024-08-16 16:47:13 +07:00
|
|
|
import {
|
|
|
|
|
EditButton,
|
|
|
|
|
DeleteButton,
|
|
|
|
|
SaveButton,
|
|
|
|
|
UndoButton,
|
|
|
|
|
} from 'components/button';
|
2024-06-10 11:25:38 +00:00
|
|
|
|
2024-08-09 15:09:46 +07:00
|
|
|
import { AddressForm } from 'components/form';
|
2024-09-17 18:01:13 +07:00
|
|
|
import BranchCard from 'src/components/01_branch-management/BranchCard.vue';
|
2024-08-13 20:55:13 +07:00
|
|
|
import ItemCard from 'src/components/ItemCard.vue';
|
2024-08-05 16:48:19 +07:00
|
|
|
import DrawerInfo from 'components/DrawerInfo.vue';
|
2024-08-02 16:13:07 +07:00
|
|
|
import ButtonAddComponent from 'components/ButtonAddCompoent.vue';
|
|
|
|
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
|
|
|
|
import TooltipComponent from 'components/TooltipComponent.vue';
|
2024-08-07 17:56:59 +07:00
|
|
|
import EmptyAddButton from 'components/AddButton.vue';
|
2024-08-02 16:13:07 +07:00
|
|
|
import NoData from 'components/NoData.vue';
|
|
|
|
|
import PaginationComponent from 'components/PaginationComponent.vue';
|
2024-08-09 14:02:40 +07:00
|
|
|
import BasicInformation from 'components/03_customer-management/employee/BasicInformation.vue';
|
|
|
|
|
import FormPerson from 'components/02_personnel-management/FormPerson.vue';
|
2024-08-09 15:09:46 +07:00
|
|
|
import { EmployerFormBasicInfo, EmployerFormBranch } from './components';
|
|
|
|
|
import BranchPage from './BranchPage.vue';
|
2024-08-09 14:02:40 +07:00
|
|
|
import FormEmployeePassport from 'components/03_customer-management/FormEmployeePassport.vue';
|
|
|
|
|
import FormEmployeeVisa from 'components/03_customer-management/FormEmployeeVisa.vue';
|
2024-08-09 15:09:46 +07:00
|
|
|
import DialogForm from 'components/DialogForm.vue';
|
|
|
|
|
import SideMenu from 'components/SideMenu.vue';
|
2024-08-15 14:23:52 +07:00
|
|
|
import TableEmpoloyee from 'src/components/03_customer-management/TableEmpoloyee.vue';
|
2024-08-28 13:49:57 +07:00
|
|
|
import { calculateAge, toISOStringWithTimezone } from 'src/utils/datetime';
|
2024-09-25 10:58:46 +07:00
|
|
|
import {
|
|
|
|
|
UploadFileGroup,
|
|
|
|
|
FormTm6,
|
|
|
|
|
noticeJobEmployment,
|
|
|
|
|
} from 'components/upload-file';
|
2024-08-26 18:04:04 +07:00
|
|
|
|
2024-08-05 16:48:19 +07:00
|
|
|
import {
|
|
|
|
|
columnsCustomer,
|
|
|
|
|
columnsEmployee,
|
|
|
|
|
formMenuIconEmployee,
|
2024-08-27 16:19:59 +07:00
|
|
|
uploadFileListEmployee,
|
2024-09-18 10:58:08 +07:00
|
|
|
columnsAttachment,
|
2024-08-05 16:48:19 +07:00
|
|
|
} from './constant';
|
|
|
|
|
import { useCustomerForm, useEmployeeForm } from './form';
|
2024-08-05 10:15:06 +07:00
|
|
|
import { storeToRefs } from 'pinia';
|
2024-08-09 14:02:40 +07:00
|
|
|
import ProfileBanner from 'components/ProfileBanner.vue';
|
|
|
|
|
import ImageUploadDialog from 'components/ImageUploadDialog.vue';
|
|
|
|
|
import FormEmployeeHealthCheck from 'components/03_customer-management/FormEmployeeHealthCheck.vue';
|
|
|
|
|
import FormEmployeeWorkHistory from 'components/03_customer-management/FormEmployeeWorkHistory.vue';
|
|
|
|
|
import FormEmployeeOther from 'components/03_customer-management/FormEmployeeOther.vue';
|
2024-08-09 15:08:25 +07:00
|
|
|
import useOptionStore from 'stores/options';
|
2024-08-09 14:02:40 +07:00
|
|
|
import { DialogContainer, DialogHeader } from 'components/dialog';
|
2024-08-27 11:46:26 +07:00
|
|
|
import KebabAction from 'src/components/shared/KebabAction.vue';
|
2024-09-18 10:58:08 +07:00
|
|
|
|
|
|
|
|
const currentSelectedMenu = ref<{ label: string; value: string }>({
|
|
|
|
|
label: '',
|
|
|
|
|
value: '',
|
|
|
|
|
});
|
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 16:48:19 +07:00
|
|
|
const employeeFormStore = useEmployeeForm();
|
2024-08-06 03:14:31 +00:00
|
|
|
const optionStore = useOptionStore();
|
2024-08-26 18:04:04 +07:00
|
|
|
const ocrStore = useOcrStore();
|
2024-08-05 10:15:06 +07:00
|
|
|
|
2024-09-16 14:41:59 +07:00
|
|
|
const tabFieldRequired = ref<{ [key: string]: (keyof CustomerBranchCreate)[] }>(
|
|
|
|
|
{
|
2024-09-16 15:11:03 +07:00
|
|
|
main: [],
|
2024-09-17 18:01:13 +07:00
|
|
|
business: ['businessType', 'jobPosition'],
|
|
|
|
|
address: [
|
|
|
|
|
'homeCode',
|
|
|
|
|
'address',
|
|
|
|
|
'addressEN',
|
|
|
|
|
'provinceId',
|
|
|
|
|
'districtId',
|
|
|
|
|
'subDistrictId',
|
|
|
|
|
],
|
|
|
|
|
contact: [],
|
2024-09-16 14:41:59 +07:00
|
|
|
},
|
|
|
|
|
);
|
2024-08-22 17:44:34 +07:00
|
|
|
|
2024-09-17 18:01:13 +07:00
|
|
|
const formMenuIcon = ref<{ icon: string; color: string; bgColor: string }[]>([
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-office-building-outline',
|
|
|
|
|
color: 'hsl(var(--info-bg))',
|
|
|
|
|
bgColor: 'var(--surface-1)',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi-briefcase-outline',
|
|
|
|
|
color: 'hsl(var(--info-bg))',
|
|
|
|
|
bgColor: 'var(--surface-1)',
|
|
|
|
|
},
|
|
|
|
|
]);
|
|
|
|
|
|
2024-08-05 15:09:36 +07:00
|
|
|
const { state: customerFormState, currentFormData: customerFormData } =
|
|
|
|
|
storeToRefs(customerFormStore);
|
2024-08-05 16:48:19 +07:00
|
|
|
const { state: employeeFormState, currentFromDataEmployee } =
|
|
|
|
|
storeToRefs(employeeFormStore);
|
2024-08-02 16:13:07 +07:00
|
|
|
|
|
|
|
|
async function init() {
|
2024-08-26 16:24:08 +07:00
|
|
|
utilsStore.currentTitle.title = 'menu.customer';
|
2024-08-02 16:38:49 +07:00
|
|
|
utilsStore.currentTitle.path = [
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
text: 'menu.customerCaption',
|
2024-08-06 13:26:38 +07:00
|
|
|
i18n: true,
|
2024-08-02 16:38:49 +07:00
|
|
|
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({
|
2024-09-17 10:00:35 +07:00
|
|
|
text: `${
|
|
|
|
|
_data.customerType === 'CORP'
|
|
|
|
|
? _data.branch[0].registerName
|
|
|
|
|
: locale.value === 'eng'
|
|
|
|
|
? _data.branch[0].firstNameEN + ' ' + _data.branch[0].lastNameEN
|
|
|
|
|
: _data.branch[0].firstName + ' ' + _data.branch[0].lastName
|
|
|
|
|
}`,
|
2024-08-06 09:22:45 +07:00
|
|
|
i18n: false,
|
2024-08-02 16:38:49 +07:00
|
|
|
});
|
|
|
|
|
} 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-08-26 16:24:08 +07:00
|
|
|
label: t('general.all'),
|
2024-06-10 16:00:52 +07:00
|
|
|
value: 'all',
|
2024-04-23 17:20:31 +07:00
|
|
|
});
|
2024-08-19 11:39:10 +07:00
|
|
|
|
2024-09-17 10:00:35 +07:00
|
|
|
const customerNameInfo = computed(() => {
|
2024-09-18 10:58:08 +07:00
|
|
|
if (customerFormData.value.customerBranch === undefined) return;
|
|
|
|
|
|
2024-09-17 10:00:35 +07:00
|
|
|
const name =
|
|
|
|
|
locale.value === 'eng'
|
2024-09-17 18:01:13 +07:00
|
|
|
? `${customerFormData.value.customerBranch[0]?.firstNameEN} ${customerFormData.value.customerBranch[0]?.lastNameEN}`
|
|
|
|
|
: `${customerFormData.value.customerBranch[0]?.firstName} ${customerFormData.value.customerBranch[0]?.lastName}`;
|
2024-09-17 10:00:35 +07:00
|
|
|
return name || '-';
|
|
|
|
|
});
|
2024-08-19 11:39:10 +07:00
|
|
|
const currentBtnOpen = ref<boolean[]>([]);
|
2024-08-02 17:05:55 +07:00
|
|
|
const employeeStats = ref(0);
|
|
|
|
|
const gridView = ref(false);
|
|
|
|
|
const splitPercent = ref(15); // Customer only
|
2024-09-18 10:58:08 +07:00
|
|
|
|
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);
|
2024-08-14 13:40:04 +07:00
|
|
|
const pageSize = ref<number>(30);
|
2024-08-05 15:09:36 +07:00
|
|
|
const dialogCustomerImageUpload = ref<InstanceType<typeof ImageUploadDialog>>();
|
2024-08-06 07:55:05 +00:00
|
|
|
const dialogEmployeeImageUpload = ref<InstanceType<typeof ImageUploadDialog>>();
|
2024-08-13 20:55:13 +07:00
|
|
|
const dialogCreateCustomerItem = [
|
|
|
|
|
{
|
|
|
|
|
icon: 'mdi:office-building',
|
2024-08-27 21:02:43 +07:00
|
|
|
text: 'customer.employerLegalEntity',
|
2024-09-06 11:11:28 +07:00
|
|
|
iconColor: '--purple-10',
|
|
|
|
|
color: 'var(--purple-8-hsl)',
|
2024-08-13 20:55:13 +07:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon: 'heroicons:user-solid',
|
2024-08-27 21:02:43 +07:00
|
|
|
text: 'customer.employerNaturalPerson',
|
2024-09-06 11:11:28 +07:00
|
|
|
iconColor: '--green-11',
|
|
|
|
|
color: 'var(--green-9-hsl)',
|
2024-08-13 20:55:13 +07:00
|
|
|
},
|
|
|
|
|
];
|
2024-08-02 17:05:55 +07:00
|
|
|
|
2024-09-11 16:43:41 +07:00
|
|
|
// image
|
|
|
|
|
const refreshImageState = ref(false);
|
|
|
|
|
const imageList = ref<{ selectedImage: string; list: string[] }>();
|
|
|
|
|
const onCreateImageList = ref<{
|
|
|
|
|
selectedImage: string;
|
|
|
|
|
list: { url: string; imgFile: File | null; name: string }[];
|
|
|
|
|
}>({ selectedImage: '', list: [] });
|
|
|
|
|
|
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;
|
2024-08-19 16:11:14 +07:00
|
|
|
currentBtnOpen.value = [];
|
2024-08-02 17:05:55 +07:00
|
|
|
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-20 18:01:05 +07:00
|
|
|
const fieldDisplayCustomer = ref<
|
2024-07-08 11:21:00 +07:00
|
|
|
{
|
2024-08-20 18:01:05 +07:00
|
|
|
label: string;
|
|
|
|
|
value: string;
|
|
|
|
|
}[]
|
|
|
|
|
>(
|
|
|
|
|
columnsCustomer
|
|
|
|
|
.filter((v) => v.name !== 'action')
|
|
|
|
|
.map((v) => ({ label: v.label, value: v.name })),
|
|
|
|
|
);
|
2024-07-08 16:38:17 +07:00
|
|
|
|
|
|
|
|
const fieldDisplayEmployee = ref<
|
|
|
|
|
{
|
|
|
|
|
label: string;
|
|
|
|
|
value: string;
|
|
|
|
|
}[]
|
2024-08-20 18:01:05 +07:00
|
|
|
>(
|
|
|
|
|
columnsEmployee
|
|
|
|
|
.filter((v) => v.name !== 'action')
|
|
|
|
|
.map((v) => ({ label: v.label, value: v.name })),
|
|
|
|
|
);
|
2024-07-08 16:38:17 +07:00
|
|
|
|
2024-08-20 18:01:05 +07:00
|
|
|
const fieldSelected = ref<string[]>(
|
|
|
|
|
[
|
|
|
|
|
...columnsEmployee.map((v) => v.name),
|
|
|
|
|
...columnsCustomer.map((v) => v.name),
|
|
|
|
|
].filter((v, index, self) => self.indexOf(v) === index),
|
|
|
|
|
);
|
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-09-16 14:40:41 +07:00
|
|
|
function validateTabField<T = CustomerBranchCreate>(
|
2024-08-22 17:44:34 +07:00
|
|
|
value: T,
|
|
|
|
|
fieldRequired: { [key: string]: (keyof T)[] },
|
|
|
|
|
) {
|
|
|
|
|
const list: string[] = [];
|
|
|
|
|
|
|
|
|
|
for (const tab in fieldRequired) {
|
|
|
|
|
for (const field of fieldRequired[tab]) {
|
|
|
|
|
if (!value[field] && !list.includes(tab)) list.push(tab);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-10 16:17:38 +07:00
|
|
|
function deleteCustomerById(id: string) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
2024-08-27 11:46:26 +07:00
|
|
|
title: t('dialog.title.confirmDelete'),
|
|
|
|
|
actionText: t('general.delete'),
|
2024-06-10 16:17:38 +07:00
|
|
|
persistent: true,
|
2024-08-27 11:46:26 +07:00
|
|
|
message: t('dialog.message.confirmDelete'),
|
2024-06-10 16:17:38 +07:00
|
|
|
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-08-05 15:57:05 +07:00
|
|
|
customerFormState.value.dialogModal = false;
|
2024-06-28 13:27:38 +07:00
|
|
|
flowStore.rotate();
|
2024-06-10 16:17:38 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-08 13:32:46 +07:00
|
|
|
async function deleteCustomerBranchById(id: string) {
|
|
|
|
|
return await new Promise((resolve) => {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
2024-08-27 11:46:26 +07:00
|
|
|
title: t('dialog.title.confirmDelete'),
|
|
|
|
|
actionText: t('general.delete'),
|
2024-08-08 13:32:46 +07:00
|
|
|
persistent: true,
|
2024-08-27 11:46:26 +07:00
|
|
|
message: t('dialog.message.confirmDelete'),
|
2024-08-08 13:32:46 +07:00
|
|
|
action: async () => {
|
|
|
|
|
await customerStore.deleteBranchById(id);
|
|
|
|
|
flowStore.rotate();
|
|
|
|
|
resolve(true);
|
|
|
|
|
},
|
|
|
|
|
cancel: () => {
|
|
|
|
|
resolve(false);
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
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',
|
2024-08-09 06:18:26 +00:00
|
|
|
icon:
|
|
|
|
|
status !== 'INACTIVE' ? 'mdi-alert' : 'mdi-message-processing-outline',
|
2024-08-27 11:46:26 +07:00
|
|
|
title: t('dialog.title.confirmChangeStatus'),
|
2024-07-25 10:49:43 +00:00
|
|
|
actionText:
|
2024-08-27 11:46:26 +07:00
|
|
|
status !== 'INACTIVE' ? t('general.close') : t('general.open'),
|
2024-07-25 10:49:43 +00:00
|
|
|
message:
|
|
|
|
|
status !== 'INACTIVE'
|
2024-08-27 11:46:26 +07:00
|
|
|
? t('dialog.message.confirmChangeStatusOff')
|
|
|
|
|
: t('dialog.message.confirmChangeStatusOn'),
|
2024-07-25 10:49:43 +00:00
|
|
|
action: async () => {
|
|
|
|
|
if (currentTab.value === 'employee') {
|
2024-08-16 09:39:30 +07:00
|
|
|
await toggleStatusEmployee(id, status === 'INACTIVE' ? false : true)
|
2024-07-25 10:49:43 +00:00
|
|
|
.then(resolve)
|
|
|
|
|
.catch(reject);
|
|
|
|
|
} else {
|
2024-08-16 09:39:30 +07:00
|
|
|
await toggleStatusCustomer(id, status === 'INACTIVE' ? false : true)
|
2024-07-25 10:49:43 +00:00
|
|
|
.then(resolve)
|
|
|
|
|
.catch(reject);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-19 16:21:14 +07:00
|
|
|
async function toggleStatusEmployee(id: string, status: boolean) {
|
2024-08-28 13:49:57 +07:00
|
|
|
const res = await employeeStore.editById(id, {
|
|
|
|
|
status: !status ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
if (res && employeeFormState.value.drawerModal)
|
|
|
|
|
currentFromDataEmployee.value.status = res.status;
|
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-09-17 18:01:13 +07:00
|
|
|
const res = await customerStore.editById(id, {
|
|
|
|
|
status: !status ? 'ACTIVE' : 'INACTIVE',
|
|
|
|
|
});
|
|
|
|
|
if (res && customerFormState.value.drawerModal)
|
|
|
|
|
customerFormData.value.status = res.status;
|
|
|
|
|
|
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-09 17:05:42 +07:00
|
|
|
async function deleteEmployeeById(opts: {
|
|
|
|
|
id?: string;
|
|
|
|
|
type?: 'healthCheck' | 'work';
|
|
|
|
|
}) {
|
2024-06-10 11:25:38 +00:00
|
|
|
dialog({
|
|
|
|
|
color: 'negative',
|
|
|
|
|
icon: 'mdi-alert',
|
2024-08-27 11:46:26 +07:00
|
|
|
title: t('dialog.title.confirmDelete'),
|
|
|
|
|
actionText: t('general.delete'),
|
2024-06-10 11:25:38 +00:00
|
|
|
persistent: true,
|
2024-08-27 11:46:26 +07:00
|
|
|
message: t('dialog.message.confirmDelete'),
|
2024-06-10 11:25:38 +00:00
|
|
|
action: async () => {
|
2024-08-09 17:05:42 +07:00
|
|
|
if (opts.type === 'healthCheck') {
|
|
|
|
|
await employeeFormStore.deleteHealthCheck();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (opts.type === 'work') {
|
|
|
|
|
await employeeFormStore.deleteWorkHistory();
|
|
|
|
|
} else {
|
|
|
|
|
if (!!opts.id) {
|
2024-08-22 17:58:19 +07:00
|
|
|
const result = await employeeStore.deleteById(opts.id);
|
|
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
|
employeeFormState.value.drawerModal = false;
|
|
|
|
|
employeeFormState.value.dialogModal = false;
|
|
|
|
|
}
|
2024-08-09 17:05:42 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-06-10 11:25:38 +00:00
|
|
|
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-09-17 18:01:13 +07:00
|
|
|
async function editCustomerForm(id: string) {
|
2024-08-05 15:09:36 +07:00
|
|
|
await customerFormStore.assignFormData(id);
|
2024-08-27 15:43:00 +07:00
|
|
|
await fetchListOfOptionBranch();
|
2024-09-11 16:53:08 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
id,
|
|
|
|
|
customerFormData.value.selectedImage || '',
|
|
|
|
|
'customer',
|
|
|
|
|
);
|
2024-09-17 10:00:35 +07:00
|
|
|
customerFormState.value.branchIndex = -1;
|
2024-08-05 15:09:36 +07:00
|
|
|
customerFormState.value.dialogType = 'edit';
|
2024-08-26 11:04:18 +07:00
|
|
|
customerFormState.value.drawerModal = true;
|
2024-08-05 15:42:00 +07:00
|
|
|
customerFormState.value.editCustomerId = id;
|
2024-08-05 15:09:36 +07:00
|
|
|
}
|
|
|
|
|
|
2024-08-07 13:30:05 +07:00
|
|
|
async function editEmployeeFormPersonal(id: string) {
|
|
|
|
|
await employeeFormStore.assignFormDataEmployee(id);
|
2024-09-11 16:53:08 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
id,
|
|
|
|
|
currentFromDataEmployee.value.selectedImage || '',
|
|
|
|
|
'employee',
|
|
|
|
|
);
|
2024-08-09 02:10:06 +00:00
|
|
|
employeeFormState.value.isEmployeeEdit = true;
|
2024-08-07 13:30:05 +07:00
|
|
|
employeeFormState.value.dialogType = 'edit';
|
|
|
|
|
employeeFormState.value.drawerModal = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 15:47:33 +07:00
|
|
|
function employeeConfirmUnsave(close = true) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'warning',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('form.warning.title'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('form.warning.unsave'),
|
|
|
|
|
action: () => {
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
2024-09-11 16:53:08 +07:00
|
|
|
onCreateImageList.value = { selectedImage: '', list: [] };
|
2024-08-06 15:47:33 +07:00
|
|
|
employeeFormState.value.editReadonly = true;
|
|
|
|
|
employeeFormState.value.dialogModal = !close;
|
2024-08-13 11:21:58 +07:00
|
|
|
employeeFormState.value.drawerModal = !close;
|
2024-08-06 15:47:33 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function employeeFormUndo(close = true) {
|
|
|
|
|
if (employeeFormStore.isFormDataDifferent()) {
|
|
|
|
|
return employeeConfirmUnsave(close);
|
|
|
|
|
}
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
|
|
|
|
employeeFormState.value.editReadonly = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 14:22:22 +07:00
|
|
|
function customerConfirmUnsave(close = true) {
|
2024-08-06 09:22:45 +07:00
|
|
|
dialog({
|
|
|
|
|
color: 'warning',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('form.warning.title'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('form.warning.unsave'),
|
2024-08-29 14:57:02 +07:00
|
|
|
|
2024-08-06 09:22:45 +07:00
|
|
|
action: () => {
|
|
|
|
|
customerFormStore.resetForm();
|
2024-08-07 17:56:59 +07:00
|
|
|
customerFormState.value.readonly = true;
|
2024-08-26 11:04:18 +07:00
|
|
|
|
2024-08-29 14:57:02 +07:00
|
|
|
if (!customerFormState.value.drawerModal) {
|
|
|
|
|
customerFormState.value.dialogModal = !close;
|
|
|
|
|
} else {
|
|
|
|
|
customerFormState.value.drawerModal = !close;
|
|
|
|
|
}
|
2024-08-06 09:22:45 +07:00
|
|
|
},
|
|
|
|
|
cancel: () => {},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 14:22:22 +07:00
|
|
|
function customerFormUndo(close = true) {
|
2024-08-06 09:22:45 +07:00
|
|
|
if (customerFormStore.isFormDataDifferent()) {
|
2024-08-06 14:22:22 +07:00
|
|
|
return customerConfirmUnsave(close);
|
2024-08-06 09:22:45 +07:00
|
|
|
}
|
|
|
|
|
customerFormStore.resetForm();
|
2024-08-07 17:56:59 +07:00
|
|
|
customerFormState.value.readonly = true;
|
2024-08-06 09:22:45 +07:00
|
|
|
}
|
|
|
|
|
|
2024-09-16 14:38:04 +07:00
|
|
|
async function createCustomerForm(customerType: 'CORP' | 'PERS') {
|
2024-08-05 15:29:11 +07:00
|
|
|
customerFormState.value.dialogModal = true;
|
|
|
|
|
customerFormState.value.dialogType = 'create';
|
|
|
|
|
customerFormData.value.customerType = customerType;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-06 03:14:31 +00:00
|
|
|
function createEmployeeForm() {
|
2024-08-07 18:34:50 +07:00
|
|
|
employeeFormStore.resetFormDataEmployee(true);
|
|
|
|
|
employeeFormState.value.dialogType = 'create';
|
2024-08-06 03:14:31 +00:00
|
|
|
employeeFormState.value.dialogModal = true;
|
2024-08-15 11:53:12 +07:00
|
|
|
employeeFormState.value.isEmployeeEdit = true;
|
2024-08-06 03:14:31 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-11 16:53:08 +07:00
|
|
|
async function fetchImageList(
|
|
|
|
|
id: string,
|
|
|
|
|
selectedName: string,
|
|
|
|
|
type: 'customer' | 'employee',
|
|
|
|
|
) {
|
|
|
|
|
const res =
|
|
|
|
|
type === 'customer'
|
|
|
|
|
? await customerStore.fetchImageListById(id)
|
|
|
|
|
: await employeeStore.fetchImageListById(id);
|
2024-09-11 16:43:41 +07:00
|
|
|
imageList.value = {
|
|
|
|
|
selectedImage: selectedName,
|
2024-09-11 16:53:08 +07:00
|
|
|
list: res.map((n: string) => `${type}/${id}/image/${n}`),
|
2024-09-11 16:43:41 +07:00
|
|
|
};
|
2024-09-11 16:53:08 +07:00
|
|
|
|
2024-09-11 16:43:41 +07:00
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-02 13:58:44 +07:00
|
|
|
// TODO: When in employee form, if select address same as customer then auto fill
|
2024-08-06 16:33:17 +07:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => employeeFormState.value.formDataEmployeeOwner,
|
|
|
|
|
(e) => {
|
|
|
|
|
if (!e) return;
|
|
|
|
|
if (employeeFormState.value.formDataEmployeeSameAddr) {
|
|
|
|
|
currentFromDataEmployee.value.address = e.address;
|
|
|
|
|
currentFromDataEmployee.value.addressEN = e.addressEN;
|
|
|
|
|
currentFromDataEmployee.value.provinceId = e.provinceId;
|
|
|
|
|
currentFromDataEmployee.value.districtId = e.districtId;
|
|
|
|
|
currentFromDataEmployee.value.subDistrictId = e.subDistrictId;
|
|
|
|
|
currentFromDataEmployee.value.zipCode = e.zipCode;
|
|
|
|
|
}
|
|
|
|
|
currentFromDataEmployee.value.customerBranchId = e.id;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => employeeFormState.value.formDataEmployeeSameAddr,
|
|
|
|
|
(isSame) => {
|
|
|
|
|
if (!employeeFormState.value.formDataEmployeeOwner) return;
|
|
|
|
|
if (isSame) {
|
|
|
|
|
currentFromDataEmployee.value.address =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.address;
|
|
|
|
|
currentFromDataEmployee.value.addressEN =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.addressEN;
|
|
|
|
|
currentFromDataEmployee.value.provinceId =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.provinceId;
|
|
|
|
|
currentFromDataEmployee.value.districtId =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.districtId;
|
|
|
|
|
currentFromDataEmployee.value.subDistrictId =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.subDistrictId;
|
|
|
|
|
currentFromDataEmployee.value.zipCode =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.zipCode;
|
|
|
|
|
}
|
|
|
|
|
currentFromDataEmployee.value.customerBranchId =
|
|
|
|
|
employeeFormState.value.formDataEmployeeOwner.id;
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-08-09 02:10:06 +00:00
|
|
|
|
|
|
|
|
watch(
|
|
|
|
|
() => employeeFormState.value.currentTab,
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.value.isEmployeeEdit = false;
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-08-13 20:55:13 +07:00
|
|
|
|
2024-08-28 13:49:57 +07:00
|
|
|
watch(
|
|
|
|
|
() => currentFromDataEmployee.value.dateOfBirth,
|
|
|
|
|
(v) => {
|
|
|
|
|
const isEdit =
|
|
|
|
|
employeeFormState.value.drawerModal &&
|
|
|
|
|
employeeFormState.value.isEmployeeEdit;
|
|
|
|
|
let currentFormDate = toISOStringWithTimezone(new Date(v));
|
|
|
|
|
let currentDate: string = '';
|
|
|
|
|
|
|
|
|
|
if (isEdit) {
|
|
|
|
|
currentDate = toISOStringWithTimezone(
|
|
|
|
|
new Date(employeeFormState.value.currentEmployee.dateOfBirth),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
employeeFormState.value.dialogModal ||
|
|
|
|
|
(isEdit && currentFormDate !== currentDate)
|
|
|
|
|
) {
|
|
|
|
|
const age = calculateAge(
|
|
|
|
|
currentFromDataEmployee.value.dateOfBirth,
|
|
|
|
|
'year',
|
|
|
|
|
);
|
|
|
|
|
if (currentFromDataEmployee.value.dateOfBirth && Number(age) < 18) {
|
|
|
|
|
dialog({
|
|
|
|
|
color: 'warning',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('dialog.title.youngWorker'),
|
|
|
|
|
actionText: t('dialog.action.ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('dialog.message.youngWorker'),
|
|
|
|
|
action: async () => {
|
|
|
|
|
return;
|
|
|
|
|
},
|
|
|
|
|
cancel: async () => {
|
|
|
|
|
currentFromDataEmployee.value.dateOfBirth = null;
|
|
|
|
|
return;
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-11 16:43:41 +07:00
|
|
|
watch(
|
|
|
|
|
() => customerFormData.value.image,
|
|
|
|
|
() => {
|
|
|
|
|
if (customerFormData.value.image !== null)
|
|
|
|
|
customerFormState.value.isImageEdit = true;
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-06 11:16:05 +07:00
|
|
|
const emptyCreateDialog = ref(false);
|
2024-04-22 13:42:02 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-08-09 17:58:35 +07:00
|
|
|
<ButtonAddComponent
|
|
|
|
|
style="z-index: 999"
|
|
|
|
|
v-if="$route.name === 'CustomerManagement'"
|
|
|
|
|
>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="currentTab === 'employer'"
|
|
|
|
|
id="add-customer-legal-entity"
|
|
|
|
|
style="color: white; background-color: hsla(var(--violet-11-hsl))"
|
|
|
|
|
@click="createCustomerForm('CORP')"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-office-building-outline"
|
2024-08-26 16:24:08 +07:00
|
|
|
:label="$t('general.add') + ' ' + $t('customer.employerLegalEntity')"
|
2024-08-09 17:58:35 +07:00
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
/>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="currentTab === 'employer'"
|
|
|
|
|
id="add-customer-natural-person"
|
2024-08-26 16:24:08 +07:00
|
|
|
:label="$t('general.add') + ' ' + $t('customer.employerNaturalPerson')"
|
2024-08-09 17:58:35 +07:00
|
|
|
external-label
|
|
|
|
|
label-position="left"
|
|
|
|
|
@click="createCustomerForm('PERS')"
|
|
|
|
|
style="color: white; background-color: hsla(var(--teal-10-hsl))"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-account-plus-outline"
|
|
|
|
|
/>
|
|
|
|
|
<q-fab-action
|
|
|
|
|
v-if="currentTab === 'employee'"
|
2024-08-26 16:24:08 +07:00
|
|
|
:label="$t('general.add') + ' ' + $t('customer.employee')"
|
2024-08-09 17:58:35 +07:00
|
|
|
external-label
|
|
|
|
|
id="add-employee"
|
|
|
|
|
label-position="left"
|
|
|
|
|
@click="createEmployeeForm()"
|
|
|
|
|
color="primary"
|
|
|
|
|
padding="xs"
|
|
|
|
|
icon="mdi-account-plus-outline"
|
|
|
|
|
/>
|
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-08-26 16:24:08 +07:00
|
|
|
{{ $t('general.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-08-09 02:10:06 +00:00
|
|
|
icon="mdi-pin-outline"
|
2024-07-05 03:53:08 +00:00
|
|
|
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'
|
2024-08-21 15:41:09 +07:00
|
|
|
? (statsCustomerType?.CORP ?? 0)
|
|
|
|
|
: (statsCustomerType?.PERS ?? 0),
|
2024-07-05 03:53:08 +00:00
|
|
|
label:
|
|
|
|
|
v.name === 'CORP'
|
2024-08-26 16:24:08 +07:00
|
|
|
? 'customer.employerLegalEntity'
|
|
|
|
|
: 'customer.employerNaturalPerson',
|
2024-07-05 03:53:08 +00:00
|
|
|
icon:
|
|
|
|
|
v.name === 'CORP'
|
2024-08-09 02:10:06 +00:00
|
|
|
? 'mdi-office-building-outline'
|
|
|
|
|
: 'mdi-account-outline',
|
2024-07-05 03:53:08 +00:00
|
|
|
color: v.name === 'CORP' ? 'purple' : 'green',
|
|
|
|
|
}))
|
|
|
|
|
: [
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
label: 'customer.employee',
|
2024-08-02 17:05:55 +07:00
|
|
|
count: employeeStats,
|
2024-08-09 02:10:06 +00:00
|
|
|
icon: 'mdi-account-outline',
|
2024-07-05 03:53:08 +00:00
|
|
|
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
|
|
|
|
|
for="input-search"
|
|
|
|
|
outlined
|
|
|
|
|
dense
|
2024-08-26 16:24:08 +07:00
|
|
|
:label="$t('general.search')"
|
2024-07-17 07:38:44 +00:00
|
|
|
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"
|
|
|
|
|
>
|
2024-09-17 18:01:13 +07:00
|
|
|
<!-- :class="{ 'offset-md-5': gridView }" -->
|
2024-07-17 07:38:44 +00:00
|
|
|
<q-select
|
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"
|
|
|
|
|
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="[
|
2024-08-26 16:24:08 +07:00
|
|
|
{ label: $t('general.all'), value: 'All' },
|
|
|
|
|
{ label: $t('status.ACTIVE'), value: 'ACTIVE' },
|
|
|
|
|
{ label: $t('status.INACTIVE'), value: 'INACTIVE' },
|
2024-07-17 07:38:44 +00:00
|
|
|
]"
|
|
|
|
|
></q-select>
|
2024-09-17 18:01:13 +07:00
|
|
|
<!-- v-if="gridView === false" -->
|
2024-07-17 07:38:44 +00:00
|
|
|
<q-select
|
|
|
|
|
id="select-field"
|
|
|
|
|
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'
|
2024-09-19 13:30:20 +07:00
|
|
|
? gridView
|
|
|
|
|
? fieldDisplayCustomer.filter((v) => {
|
|
|
|
|
return (
|
|
|
|
|
v.value !== 'orderNumber' &&
|
|
|
|
|
v.value !== 'titleName' &&
|
|
|
|
|
v.value !== 'address' &&
|
|
|
|
|
v.value !== 'contactName'
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
: fieldDisplayCustomer
|
2024-07-17 07:38:44 +00:00
|
|
|
: fieldDisplayEmployee
|
|
|
|
|
"
|
2024-08-26 16:24:08 +07:00
|
|
|
:display-value="$t('general.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-08-27 17:53:51 +07:00
|
|
|
class="text-capitalize"
|
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-08-26 16:24:08 +07:00
|
|
|
{{ $t('customer.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-08-27 17:53:51 +07:00
|
|
|
class="text-capitalize"
|
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-08-26 16:24:08 +07:00
|
|
|
{{ $t('customer.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-08-26 16:24:08 +07:00
|
|
|
{{
|
|
|
|
|
$t(
|
|
|
|
|
{
|
|
|
|
|
all: 'general.all',
|
|
|
|
|
customerLegalEntity: 'customer.employerLegalEntity',
|
|
|
|
|
customerNaturalPerson:
|
|
|
|
|
'customer.employerNaturalPerson',
|
|
|
|
|
}[v],
|
|
|
|
|
)
|
|
|
|
|
}}
|
2024-07-05 09:29:46 +00:00
|
|
|
</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-08-26 16:24:08 +07:00
|
|
|
{{ $t('general.all') }}
|
2024-07-05 09:29:46 +00:00
|
|
|
</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
|
|
|
"
|
2024-08-09 10:55:19 +00:00
|
|
|
:style="
|
|
|
|
|
props.rowIndex % 2 !== 0
|
|
|
|
|
? $q.dark.isActive
|
|
|
|
|
? 'background: hsl(var(--gray-11-hsl)/0.2)'
|
|
|
|
|
: `background: #f9fafc`
|
|
|
|
|
: ''
|
|
|
|
|
"
|
2024-07-17 08:16:59 +00:00
|
|
|
>
|
2024-08-21 15:41:09 +07:00
|
|
|
<q-td
|
|
|
|
|
class="text-center"
|
|
|
|
|
v-if="fieldSelected.includes('orderNumber')"
|
|
|
|
|
>
|
|
|
|
|
{{
|
|
|
|
|
(currentPageCustomer - 1) * pageSize +
|
|
|
|
|
props.rowIndex +
|
|
|
|
|
1
|
|
|
|
|
}}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
2024-09-25 11:25:41 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('titleName')"
|
|
|
|
|
style="max-width: 200px"
|
|
|
|
|
class="ellipsis"
|
|
|
|
|
>
|
2024-09-24 11:48:36 +07:00
|
|
|
<div class="row items-center no-wrap">
|
2024-07-17 08:16:59 +00:00
|
|
|
<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);
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-08-21 16:18:00 +07:00
|
|
|
<div
|
|
|
|
|
:style="`
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
border-style: solid;
|
|
|
|
|
border-width: 2px;
|
|
|
|
|
border-color: hsl(var(${props.row.customerType === 'CORP' ? '--violet-11-hsl' : '--teal-10-hsl'}));
|
|
|
|
|
`"
|
|
|
|
|
>
|
|
|
|
|
<div class="branch-card__icon">
|
|
|
|
|
<q-avatar size="md">
|
|
|
|
|
<q-img
|
2024-09-11 16:43:41 +07:00
|
|
|
:src="`${baseUrl}/customer/${props.row.id}/image/${props.row.selectedImage}`"
|
2024-08-23 17:00:37 +07:00
|
|
|
class="full-height full-width"
|
2024-08-21 16:18:00 +07:00
|
|
|
>
|
|
|
|
|
<template #error>
|
|
|
|
|
<q-img
|
2024-09-17 10:00:35 +07:00
|
|
|
:src="`/images/customer-${props.row.customerType}-avartar-${props.row.customerType === 'PERS' ? props.row.branch[0].gender : 'male'}.png`"
|
2024-08-21 16:18:00 +07:00
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-img>
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</div>
|
2024-07-08 11:05:07 +07:00
|
|
|
</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-09-17 10:00:35 +07:00
|
|
|
{{
|
|
|
|
|
props.row.customerType === 'CORP'
|
2024-09-17 18:01:13 +07:00
|
|
|
? props.row.branch[0]?.registerName || '-'
|
|
|
|
|
: props.row.branch[0]?.firstName +
|
2024-09-17 10:00:35 +07:00
|
|
|
' ' +
|
2024-09-17 18:01:13 +07:00
|
|
|
props.row.branch[0]?.lastName || '-'
|
2024-09-17 10:00:35 +07:00
|
|
|
}}
|
2024-07-17 08:16:59 +00:00
|
|
|
</div>
|
|
|
|
|
<div class="col app-text-muted">
|
2024-09-17 10:00:35 +07:00
|
|
|
{{
|
|
|
|
|
props.row.customerType === 'CORP'
|
2024-09-17 18:01:13 +07:00
|
|
|
? props.row.branch[0]?.registerNameEN || '-'
|
|
|
|
|
: props.row.branch[0]?.firstNameEN +
|
2024-09-17 10:00:35 +07:00
|
|
|
' ' +
|
2024-09-17 18:01:13 +07:00
|
|
|
props.row.branch[0]?.lastNameEN || '-'
|
2024-09-17 10:00:35 +07:00
|
|
|
}}
|
2024-07-08 11:05:07 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-07-17 08:16:59 +00:00
|
|
|
</div>
|
|
|
|
|
</q-td>
|
2024-09-19 13:30:20 +07:00
|
|
|
|
2024-09-25 11:25:41 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('businessTypePure')"
|
|
|
|
|
style="max-width: 150px"
|
|
|
|
|
class="ellipsis"
|
|
|
|
|
>
|
2024-08-21 16:44:27 +07:00
|
|
|
{{
|
|
|
|
|
props.row.branch.length !== 0
|
|
|
|
|
? props.row.branch[0].businessType !== null
|
2024-09-17 10:00:35 +07:00
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].businessType,
|
|
|
|
|
)
|
2024-09-19 10:15:03 +07:00
|
|
|
: ''
|
2024-08-21 16:44:27 +07:00
|
|
|
: '-'
|
|
|
|
|
}}
|
2024-09-25 11:25:41 +07:00
|
|
|
|
|
|
|
|
<q-tooltip>
|
|
|
|
|
{{
|
|
|
|
|
props.row.branch.length !== 0
|
|
|
|
|
? props.row.branch[0].businessType !== null
|
|
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].businessType,
|
|
|
|
|
)
|
|
|
|
|
: ''
|
|
|
|
|
: '-'
|
|
|
|
|
}}
|
|
|
|
|
</q-tooltip>
|
2024-07-17 08:16:59 +00:00
|
|
|
</q-td>
|
2024-08-21 15:41:09 +07:00
|
|
|
|
2024-09-25 11:25:41 +07:00
|
|
|
<q-td
|
|
|
|
|
v-if="fieldSelected.includes('jobPosition')"
|
|
|
|
|
style="max-width: 150px"
|
|
|
|
|
class="ellipsis"
|
|
|
|
|
>
|
2024-08-21 16:44:27 +07:00
|
|
|
{{
|
|
|
|
|
props.row.branch.length !== 0
|
2024-09-17 18:01:13 +07:00
|
|
|
? props.row.branch[0].jobPosition !== null
|
|
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].jobPosition,
|
|
|
|
|
)
|
2024-09-19 10:15:03 +07:00
|
|
|
: ''
|
2024-08-21 16:44:27 +07:00
|
|
|
: '-'
|
|
|
|
|
}}
|
2024-09-25 11:25:41 +07:00
|
|
|
|
|
|
|
|
<q-tooltip>
|
|
|
|
|
{{
|
|
|
|
|
props.row.branch.length !== 0
|
|
|
|
|
? props.row.branch[0].jobPosition !== null
|
|
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].jobPosition,
|
|
|
|
|
)
|
|
|
|
|
: ''
|
|
|
|
|
: '-'
|
|
|
|
|
}}
|
|
|
|
|
</q-tooltip>
|
2024-08-21 15:41:09 +07:00
|
|
|
</q-td>
|
|
|
|
|
|
2024-09-25 11:43:10 +07:00
|
|
|
<q-td v-if="fieldSelected.includes('address')">
|
2024-08-21 16:44:27 +07:00
|
|
|
{{
|
2024-09-19 13:30:20 +07:00
|
|
|
locale === 'eng'
|
2024-09-23 14:54:10 +07:00
|
|
|
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
|
|
|
|
|
'-'
|
2024-09-24 11:23:16 +07:00
|
|
|
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
|
2024-09-23 14:54:10 +07:00
|
|
|
'-'
|
2024-08-21 16:44:27 +07:00
|
|
|
}}
|
2024-09-25 11:25:41 +07:00
|
|
|
<q-tooltip>
|
|
|
|
|
{{
|
|
|
|
|
locale === 'eng'
|
|
|
|
|
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
|
|
|
|
|
'-'
|
|
|
|
|
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
|
|
|
|
|
'-'
|
|
|
|
|
}}
|
|
|
|
|
</q-tooltip>
|
2024-07-17 08:16:59 +00:00
|
|
|
</q-td>
|
2024-08-21 15:41:09 +07:00
|
|
|
|
2024-09-19 13:30:20 +07:00
|
|
|
<q-td v-if="fieldSelected.includes('contactName')">
|
|
|
|
|
{{ props.row.branch[0]?.contactName || '-' }}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
|
|
|
|
<q-td v-if="fieldSelected.includes('officeTel')">
|
|
|
|
|
{{ props.row.branch[0]?.officeTel || '-' }}
|
|
|
|
|
</q-td>
|
|
|
|
|
|
2024-07-17 08:16:59 +00:00
|
|
|
<q-td>
|
2024-08-19 11:39:10 +07:00
|
|
|
<q-btn
|
2024-09-25 18:01:27 +07:00
|
|
|
v-if="props.row.branch[0].customerName"
|
|
|
|
|
:id="`btn-eye-${props.row.branch[0].customerName}`"
|
2024-08-19 11:39:10 +07:00
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
@click.stop="
|
|
|
|
|
async () => {
|
|
|
|
|
const res = await employeeStore.fetchList({
|
|
|
|
|
customerId: props.row.id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
listEmployee = res.result;
|
2024-08-19 13:56:15 +07:00
|
|
|
|
|
|
|
|
currentBtnOpen.map((v, i) => {
|
|
|
|
|
if (i !== props.rowIndex) {
|
|
|
|
|
currentBtnOpen[i] = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2024-08-19 11:39:10 +07:00
|
|
|
currentBtnOpen[props.rowIndex] =
|
|
|
|
|
!currentBtnOpen[props.rowIndex];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div class="row items-center">
|
|
|
|
|
<q-icon name="mdi-account-group-outline" />
|
|
|
|
|
<q-icon
|
|
|
|
|
class="btn-arrow-right"
|
|
|
|
|
:class="{
|
|
|
|
|
active: currentBtnOpen[props.rowIndex],
|
|
|
|
|
}"
|
|
|
|
|
size="xs"
|
|
|
|
|
name="mdi-chevron-right"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-btn>
|
2024-07-17 08:16:59 +00:00
|
|
|
<q-btn
|
2024-09-25 18:01:27 +07:00
|
|
|
v-if="props.row.branch[0].customerName"
|
2024-07-17 08:16:59 +00:00
|
|
|
icon="mdi-eye-outline"
|
2024-09-25 18:01:27 +07:00
|
|
|
:id="`btn-eye-${props.row.branch[0].customerName}`"
|
2024-07-17 08:16:59 +00:00
|
|
|
size="sm"
|
|
|
|
|
dense
|
|
|
|
|
round
|
|
|
|
|
flat
|
2024-09-17 18:01:13 +07:00
|
|
|
@click.stop="editCustomerForm(props.row.id)"
|
2024-07-08 11:05:07 +07:00
|
|
|
/>
|
2024-07-17 08:16:59 +00:00
|
|
|
|
2024-08-27 11:46:26 +07:00
|
|
|
<KebabAction
|
|
|
|
|
:id-name="props.row.code"
|
|
|
|
|
:status="props.row.status"
|
|
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
const { branch, ...payload } = props.row;
|
|
|
|
|
currentCustomer = payload;
|
2024-09-17 18:01:13 +07:00
|
|
|
editCustomerForm(props.row.id);
|
2024-08-27 11:46:26 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
async () => {
|
|
|
|
|
await editCustomerForm(props.row.id);
|
2024-09-17 18:01:13 +07:00
|
|
|
customerFormState.branchIndex = 0;
|
2024-08-27 11:46:26 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@delete="deleteCustomerById(props.row.id)"
|
|
|
|
|
@change-status="
|
|
|
|
|
async () => {
|
|
|
|
|
triggerChangeStatus(
|
|
|
|
|
props.row.id,
|
|
|
|
|
props.row.status,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
2024-07-17 08:16:59 +00:00
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
2024-08-19 11:39:10 +07:00
|
|
|
|
|
|
|
|
<q-tr
|
|
|
|
|
v-show="currentBtnOpen[props.rowIndex]"
|
|
|
|
|
:props="props"
|
|
|
|
|
>
|
|
|
|
|
<q-td colspan="100%" style="padding: 16px">
|
|
|
|
|
<div class="text-center">
|
|
|
|
|
<TableEmpoloyee
|
2024-08-20 18:03:23 +07:00
|
|
|
in-table
|
2024-08-19 16:11:14 +07:00
|
|
|
v-model:page-size="pageSize"
|
|
|
|
|
v-model:current-page="currentPageEmployee"
|
2024-08-19 11:39:10 +07:00
|
|
|
:list-employee="listEmployee"
|
|
|
|
|
:columns-employee="columnsEmployee"
|
2024-08-22 09:48:27 +07:00
|
|
|
@history="(item: any) => {}"
|
2024-08-19 11:39:10 +07:00
|
|
|
@view="
|
2024-09-11 16:53:08 +07:00
|
|
|
async (item: any) => {
|
2024-08-19 11:39:10 +07:00
|
|
|
employeeFormState.drawerModal = true;
|
2024-08-27 11:46:26 +07:00
|
|
|
employeeFormState.isEmployeeEdit = false;
|
2024-08-19 11:39:10 +07:00
|
|
|
employeeFormStore.assignFormDataEmployee(
|
|
|
|
|
item.id,
|
|
|
|
|
);
|
2024-09-11 16:53:08 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
item.id,
|
|
|
|
|
item.selectedImage || '',
|
|
|
|
|
'employee',
|
|
|
|
|
);
|
2024-08-19 11:39:10 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-27 11:46:26 +07:00
|
|
|
@edit="
|
|
|
|
|
(item: any) => editEmployeeFormPersonal(item.id)
|
|
|
|
|
"
|
|
|
|
|
@delete="
|
|
|
|
|
(item: any) => {
|
|
|
|
|
deleteEmployeeById({ id: item.id });
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@toggle-status="
|
|
|
|
|
async (item: any) => {
|
|
|
|
|
triggerChangeStatus(item.id, item.status);
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-19 11:39:10 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</q-td>
|
|
|
|
|
</q-tr>
|
2024-07-17 08:16:59 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-slot:item="props">
|
2024-09-17 18:01:13 +07:00
|
|
|
<div class="col-12 col-md-6">
|
|
|
|
|
<BranchCard
|
|
|
|
|
i18nKey="customer.table"
|
|
|
|
|
class="surface-1"
|
|
|
|
|
:virtual-branch="props.row.virtual"
|
|
|
|
|
:id="`branch-card-${props.row.name}`"
|
|
|
|
|
:class="{
|
|
|
|
|
'cursor-pointer': props.row._count.branch !== 0,
|
2024-07-17 08:16:59 +00:00
|
|
|
}"
|
2024-09-17 18:01:13 +07:00
|
|
|
@click="
|
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-09-17 18:01:13 +07:00
|
|
|
:metadata="props.row"
|
|
|
|
|
:color="
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? 'hq'
|
|
|
|
|
: 'br-virtual'
|
2024-08-21 16:18:37 +07:00
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
:key="props.row.id"
|
|
|
|
|
:data="{
|
|
|
|
|
branchLabelName:
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? $i18n.locale === 'eng'
|
|
|
|
|
? props.row.branch[0]?.registerNameEN || '-'
|
|
|
|
|
: props.row.branch[0]?.registerName || '-'
|
|
|
|
|
: $i18n.locale === 'eng'
|
|
|
|
|
? props.row.branch[0]?.firstNameEN +
|
|
|
|
|
' ' +
|
|
|
|
|
props.row.branch[0]?.lastNameEN || '-'
|
|
|
|
|
: props.row.branch[0]?.firstName +
|
|
|
|
|
' ' +
|
|
|
|
|
props.row.branch[0]?.lastName || '-',
|
|
|
|
|
}"
|
|
|
|
|
:inactive="props.row.status === 'INACTIVE'"
|
|
|
|
|
:field-selected="
|
|
|
|
|
fieldSelected.filter((v) => {
|
|
|
|
|
return columnsCustomer.some((c) => c.name === v);
|
|
|
|
|
})
|
2024-07-17 08:16:59 +00:00
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
>
|
|
|
|
|
<template #image>
|
|
|
|
|
<q-avatar size="3rem">
|
|
|
|
|
<q-img
|
|
|
|
|
:src="`${baseUrl}/customer/${props.row.id}/image/${props.row.selectedImage}`"
|
|
|
|
|
class="full-height full-width"
|
|
|
|
|
>
|
|
|
|
|
<template #error>
|
|
|
|
|
<q-img
|
|
|
|
|
:src="`/images/customer-${props.row.customerType}-avartar-${props.row.customerType === 'PERS' ? props.row.branch[0].gender : 'male'}.png`"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-img>
|
|
|
|
|
<q-badge
|
|
|
|
|
class="absolute-bottom-right no-padding"
|
|
|
|
|
style="
|
|
|
|
|
border-radius: 50%;
|
2024-09-19 13:30:20 +07:00
|
|
|
min-width: 10px;
|
|
|
|
|
min-height: 10px;
|
2024-09-17 18:01:13 +07:00
|
|
|
"
|
|
|
|
|
:style="{
|
|
|
|
|
background: `var(--${props.row.status === 'INACTIVE' ? 'stone-5' : 'green-6'})`,
|
|
|
|
|
}"
|
|
|
|
|
></q-badge>
|
|
|
|
|
</q-avatar>
|
|
|
|
|
</template>
|
|
|
|
|
<template #data>
|
|
|
|
|
<div
|
|
|
|
|
class="row"
|
|
|
|
|
style="
|
|
|
|
|
display: flex;
|
|
|
|
|
padding-block: var(--size-2);
|
|
|
|
|
"
|
|
|
|
|
>
|
2024-09-19 13:30:20 +07:00
|
|
|
<div class="col-12 q-py-sm row">
|
|
|
|
|
<span class="col-4 app-text-muted">
|
|
|
|
|
{{
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? $t('customer.form.legalPersonCode')
|
|
|
|
|
: $t('customer.form.cardNumber')
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="col">
|
|
|
|
|
{{
|
|
|
|
|
props.row.customerType === 'CORP'
|
|
|
|
|
? props.row.branch[0]?.legalPersonNo
|
|
|
|
|
: props.row.branch[0]?.citizenId
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2024-09-17 18:01:13 +07:00
|
|
|
<div
|
|
|
|
|
class="col-12 q-py-sm row"
|
|
|
|
|
v-for="key in fieldSelected
|
|
|
|
|
.filter((v) => {
|
|
|
|
|
return columnsCustomer.some(
|
|
|
|
|
(c) => c.name === v,
|
|
|
|
|
);
|
|
|
|
|
})
|
|
|
|
|
.filter((v) => {
|
|
|
|
|
return (
|
2024-09-19 13:30:20 +07:00
|
|
|
v !== 'orderNumber' &&
|
|
|
|
|
v !== 'titleName' &&
|
|
|
|
|
v !== 'address' &&
|
|
|
|
|
v !== 'contactName'
|
2024-09-17 18:01:13 +07:00
|
|
|
);
|
|
|
|
|
})"
|
|
|
|
|
:key="key"
|
|
|
|
|
>
|
|
|
|
|
<span class="col-4 app-text-muted">
|
|
|
|
|
{{ $t(`customer.table.${key}`) }}
|
|
|
|
|
</span>
|
|
|
|
|
<span class="col">
|
|
|
|
|
{{
|
|
|
|
|
key === 'businessTypePure'
|
|
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].businessType,
|
|
|
|
|
)
|
|
|
|
|
: key === 'jobPosition'
|
|
|
|
|
? optionStore.mapOption(
|
|
|
|
|
props.row.branch[0].jobPosition,
|
|
|
|
|
)
|
|
|
|
|
: key === 'officeTel'
|
2024-09-19 13:30:20 +07:00
|
|
|
? props.row.branch[0].officeTel || '-'
|
2024-09-17 18:01:13 +07:00
|
|
|
: ''
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:action>
|
|
|
|
|
<KebabAction
|
|
|
|
|
:status="props.row.status"
|
|
|
|
|
:idName="props.row.name"
|
|
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
const { branch, ...payload } = props.row;
|
|
|
|
|
currentCustomer = payload;
|
|
|
|
|
editCustomerForm(props.row.id);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
async () => {
|
|
|
|
|
await editCustomerForm(props.row.id);
|
|
|
|
|
customerFormState.branchIndex = 0;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@delete="deleteCustomerById(props.row.id)"
|
|
|
|
|
@change-status="
|
|
|
|
|
triggerChangeStatus(
|
|
|
|
|
props.row.id,
|
|
|
|
|
props.row.status,
|
|
|
|
|
)
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</BranchCard>
|
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-08-26 16:24:08 +07:00
|
|
|
{{ $t('general.recordPerPage') }}
|
2024-07-05 09:29:46 +00:00
|
|
|
</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">
|
|
|
|
|
{{
|
2024-08-26 16:24:08 +07:00
|
|
|
$t('general.recordsPage', {
|
2024-07-05 09:29:46 +00:00
|
|
|
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-08-15 14:23:52 +07:00
|
|
|
<TableEmpoloyee
|
|
|
|
|
:grid-view="gridView"
|
|
|
|
|
:list-employee="listEmployee"
|
|
|
|
|
:columns-employee="columnsEmployee"
|
|
|
|
|
:field-selected="fieldSelected"
|
2024-08-22 09:48:27 +07:00
|
|
|
@history="(item: any) => {}"
|
2024-08-15 14:23:52 +07:00
|
|
|
@view="
|
2024-09-11 16:53:08 +07:00
|
|
|
async (item: any) => {
|
2024-08-15 14:23:52 +07:00
|
|
|
employeeFormState.drawerModal = true;
|
2024-08-16 11:22:19 +07:00
|
|
|
employeeFormState.isEmployeeEdit = false;
|
2024-08-15 14:23:52 +07:00
|
|
|
employeeFormStore.assignFormDataEmployee(item.id);
|
2024-09-11 16:53:08 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
item.id,
|
|
|
|
|
item.selectedImage || '',
|
|
|
|
|
'employee',
|
|
|
|
|
);
|
2024-08-15 14:23:52 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-22 09:48:27 +07:00
|
|
|
@edit="(item: any) => editEmployeeFormPersonal(item.id)"
|
2024-08-15 14:23:52 +07:00
|
|
|
@delete="
|
2024-08-22 09:48:27 +07:00
|
|
|
(item: any) => {
|
2024-08-15 14:23:52 +07:00
|
|
|
deleteEmployeeById({ id: item.id });
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@toggle-status="
|
2024-08-22 09:48:27 +07:00
|
|
|
async (item: any) => {
|
2024-08-15 14:23:52 +07:00
|
|
|
triggerChangeStatus(item.id, item.status);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
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-08-26 16:24:08 +07:00
|
|
|
{{ $t('general.recordPerPage') }}
|
2024-07-05 09:29:46 +00:00
|
|
|
</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">
|
|
|
|
|
{{
|
2024-08-26 16:24:08 +07:00
|
|
|
$t('general.recordsPage', {
|
2024-07-05 09:29:46 +00:00
|
|
|
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-08-26 16:24:08 +07:00
|
|
|
:title="'general.noData'"
|
|
|
|
|
:caption="'general.clickToCreate'"
|
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"
|
|
|
|
|
>
|
2024-08-07 17:56:59 +07:00
|
|
|
<EmptyAddButton
|
2024-08-26 16:24:08 +07:00
|
|
|
:label="'general.add'"
|
|
|
|
|
:i18n-args="{
|
|
|
|
|
text: $t(`customer.${currentTab}`),
|
|
|
|
|
}"
|
2024-08-23 10:53:34 +07:00
|
|
|
@trigger="
|
|
|
|
|
() => {
|
|
|
|
|
if (currentTab === 'employer') {
|
|
|
|
|
emptyCreateDialog = true;
|
|
|
|
|
} else {
|
|
|
|
|
createEmployeeForm();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
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
|
|
|
|
2024-08-09 15:09:46 +07:00
|
|
|
<div
|
|
|
|
|
class="col column rounded bordered"
|
|
|
|
|
style="overflow: hidden"
|
|
|
|
|
v-if="$route.name === 'CustomerBranchManagement'"
|
|
|
|
|
>
|
|
|
|
|
<BranchPage
|
2024-08-02 16:13:07 +07:00
|
|
|
v-if="currentCustomer"
|
|
|
|
|
:customer-type="currentCustomer.customerType"
|
2024-09-17 18:01:13 +07:00
|
|
|
:current-customer-name="
|
|
|
|
|
currentCustomer.customerType === 'PERS'
|
|
|
|
|
? locale === 'eng'
|
|
|
|
|
? `${currentCustomer.branch[0]?.firstNameEN} ${currentCustomer.branch[0]?.lastNameEN}`
|
|
|
|
|
: `${currentCustomer.branch[0]?.firstName} ${currentCustomer.branch[0]?.lastName}`
|
|
|
|
|
: locale === 'eng'
|
|
|
|
|
? currentCustomer.branch[0]?.registerNameEN
|
|
|
|
|
: currentCustomer.branch[0]?.registerName
|
|
|
|
|
"
|
2024-08-30 09:55:03 +07:00
|
|
|
:count-employee="currentCustomer._count.employee"
|
2024-09-17 18:01:13 +07:00
|
|
|
:selected-image="currentCustomer.selectedImage"
|
|
|
|
|
:gender="currentCustomer.branch[0]?.gender"
|
2024-08-20 18:02:15 +07:00
|
|
|
v-model:customer-id="currentCustomer.id"
|
2024-08-02 16:13:07 +07:00
|
|
|
v-model:mode-view="gridView"
|
|
|
|
|
@back="$router.push('/customer-management')"
|
2024-06-10 12:00:16 +07:00
|
|
|
v-model:branch="branch"
|
2024-08-02 16:13:07 +07:00
|
|
|
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
|
|
|
|
2024-08-27 15:03:56 +07:00
|
|
|
<!-- add customer -->
|
2024-08-13 20:55:13 +07:00
|
|
|
<DialogForm
|
|
|
|
|
v-model:modal="emptyCreateDialog"
|
2024-08-26 16:24:08 +07:00
|
|
|
:title="$t('customer.employerType')"
|
2024-08-13 20:55:13 +07:00
|
|
|
hide-footer
|
|
|
|
|
no-app-box
|
2024-09-06 11:11:28 +07:00
|
|
|
width="40vw"
|
|
|
|
|
height="250px"
|
2024-09-11 16:53:08 +07:00
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
emptyCreateDialog = false;
|
|
|
|
|
onCreateImageList = { selectedImage: '', list: [] };
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-13 20:55:13 +07:00
|
|
|
>
|
|
|
|
|
<div class="full-height row q-pa-md">
|
|
|
|
|
<ItemCard
|
|
|
|
|
class="col q-mx-sm full-height"
|
2024-09-06 11:11:28 +07:00
|
|
|
v-for="value in dialogCreateCustomerItem"
|
|
|
|
|
:key="value.text"
|
|
|
|
|
:icon="value.icon"
|
|
|
|
|
:text="value.text"
|
|
|
|
|
:icon-color="value.iconColor"
|
|
|
|
|
:bg-color="value.color"
|
2024-08-13 20:55:13 +07:00
|
|
|
@trigger="
|
|
|
|
|
() => {
|
|
|
|
|
createCustomerForm(
|
2024-09-06 11:11:28 +07:00
|
|
|
value.text === 'customer.employerLegalEntity' ? 'CORP' : 'PERS',
|
2024-08-13 20:55:13 +07:00
|
|
|
);
|
|
|
|
|
emptyCreateDialog = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</DialogForm>
|
|
|
|
|
|
2024-08-07 17:56:59 +07:00
|
|
|
<DialogContainer
|
|
|
|
|
:model-value="customerFormState.dialogModal"
|
2024-08-08 09:46:36 +07:00
|
|
|
:on-open="
|
2024-08-05 15:42:00 +07:00
|
|
|
async () => {
|
2024-08-07 17:56:59 +07:00
|
|
|
customerFormStore.resetForm(customerFormState.dialogType === 'create');
|
2024-09-11 16:53:08 +07:00
|
|
|
onCreateImageList = { selectedImage: '', list: [] };
|
2024-09-17 10:00:35 +07:00
|
|
|
customerFormState.customerImageUrl = '';
|
2024-09-05 15:36:48 +07:00
|
|
|
await fetchListOfOptionBranch();
|
2024-09-16 14:38:04 +07:00
|
|
|
await customerFormStore.addCurrentCustomerBranch();
|
2024-08-06 09:22:45 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-09-11 16:53:08 +07:00
|
|
|
:on-close="
|
|
|
|
|
() => {
|
|
|
|
|
customerFormState.dialogModal = false;
|
|
|
|
|
onCreateImageList = { selectedImage: '', list: [] };
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-05 15:09:36 +07:00
|
|
|
>
|
2024-08-07 17:56:59 +07:00
|
|
|
<template #header>
|
|
|
|
|
<DialogHeader
|
2024-08-08 10:33:29 +07:00
|
|
|
:title="
|
2024-09-17 18:01:13 +07:00
|
|
|
customerFormState.dialogType === 'create'
|
|
|
|
|
? $t(`general.add`, {
|
|
|
|
|
text: `${$t('customer.employer')} `,
|
|
|
|
|
})
|
|
|
|
|
: `${$t('customer.employer')} `
|
2024-08-08 10:33:29 +07:00
|
|
|
"
|
2024-08-07 17:56:59 +07:00
|
|
|
>
|
2024-09-16 14:38:04 +07:00
|
|
|
<template #title-after>
|
|
|
|
|
<span
|
|
|
|
|
:style="`color: hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/1)`"
|
|
|
|
|
>
|
|
|
|
|
:
|
|
|
|
|
{{
|
|
|
|
|
customerFormData.customerType === 'CORP'
|
|
|
|
|
? $t('customer.employerLegalEntity')
|
|
|
|
|
: $t('customer.employerNaturalPerson')
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
2024-08-08 10:33:29 +07:00
|
|
|
</template>
|
2024-08-07 17:56:59 +07:00
|
|
|
</DialogHeader>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<div class="q-px-lg q-pt-lg surface-2">
|
2024-08-05 15:09:36 +07:00
|
|
|
<ProfileBanner
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="customerFormData.customerBranch !== undefined"
|
2024-08-05 15:09:36 +07:00
|
|
|
active
|
2024-08-08 10:33:29 +07:00
|
|
|
hide-fade
|
2024-08-05 15:42:00 +07:00
|
|
|
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
|
2024-09-17 18:01:13 +07:00
|
|
|
:img="
|
|
|
|
|
customerFormState.customerImageUrl ||
|
|
|
|
|
`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.customerBranch[0]?.gender : 'male'}.png`
|
|
|
|
|
"
|
|
|
|
|
:fallbackImg="`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.customerBranch[0]?.gender : 'male'}.png`"
|
2024-09-05 15:57:30 +07:00
|
|
|
:color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/1)`"
|
|
|
|
|
:bg-color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/0.1)`"
|
|
|
|
|
:icon="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? 'mdi-account-plus-outline'
|
|
|
|
|
: 'mdi-office-building-outline'
|
2024-08-05 15:09:36 +07:00
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
:title="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? `${customerFormData.customerBranch[0]?.firstName} ${customerFormData.customerBranch[0]?.lastName}`
|
|
|
|
|
: customerFormData.customerBranch[0]?.registerName
|
|
|
|
|
"
|
|
|
|
|
:caption="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? `${customerFormData.customerBranch[0]?.firstNameEN} ${customerFormData.customerBranch[0]?.lastNameEN}`
|
|
|
|
|
: customerFormData.customerBranch[0]?.registerNameEN
|
|
|
|
|
"
|
2024-09-11 16:43:41 +07:00
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
customerFormState.imageDialog = true;
|
|
|
|
|
customerFormState.isImageEdit = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
customerFormState.imageDialog = customerFormState.isImageEdit = true
|
|
|
|
|
"
|
2024-08-05 15:09:36 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
2024-08-07 17:56:59 +07:00
|
|
|
style="flex: 1; width: 100%; overflow-y: auto"
|
|
|
|
|
class="surface-2 q-pa-lg"
|
2024-08-05 15:09:36 +07:00
|
|
|
id="customer-form"
|
|
|
|
|
>
|
2024-08-07 17:56:59 +07:00
|
|
|
<div class="col surface-1 full-height rounded bordered scroll row">
|
|
|
|
|
<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 q-pr-sm">
|
|
|
|
|
<SideMenu
|
|
|
|
|
:menu="[
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('form.field.basicInformation'),
|
2024-08-07 17:56:59 +07:00
|
|
|
anchor: 'form-basic-info-customer',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: $t('customer.form.group.branch'),
|
|
|
|
|
anchor: 'form-branch-customer-branch',
|
2024-09-19 13:30:20 +07:00
|
|
|
useBtn: true,
|
2024-08-07 17:56:59 +07:00
|
|
|
},
|
2024-08-21 14:44:28 +07:00
|
|
|
...(customerFormData.customerBranch?.map((v, i) => ({
|
2024-08-22 18:03:12 +07:00
|
|
|
name:
|
|
|
|
|
i === 0
|
|
|
|
|
? $t('customer.form.headQuarters.title')
|
|
|
|
|
: $t('customer.form.branch.title', {
|
|
|
|
|
name: i,
|
|
|
|
|
}),
|
2024-08-21 14:44:28 +07:00
|
|
|
anchor: `form-branch-customer-no-${i}`,
|
2024-08-13 12:52:31 +07:00
|
|
|
sub: true,
|
2024-08-07 17:56:59 +07:00
|
|
|
})) || []),
|
|
|
|
|
]"
|
|
|
|
|
background="transparent"
|
|
|
|
|
:active="{
|
|
|
|
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
|
|
|
|
foreground: 'var(--blue-6)',
|
|
|
|
|
}"
|
|
|
|
|
scroll-element="#customer-form-content"
|
2024-09-19 13:30:20 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:btn-form-branch-customer-branch>
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
icon="mdi-plus"
|
|
|
|
|
size="sm"
|
|
|
|
|
rounded
|
|
|
|
|
padding="0px 0px"
|
2024-09-25 11:43:10 +07:00
|
|
|
style="color: var(--stone-9)"
|
2024-09-19 13:30:20 +07:00
|
|
|
@click.stop="customerFormStore.addCurrentCustomerBranch()"
|
|
|
|
|
v-if="
|
|
|
|
|
customerFormState.branchIndex === -1 &&
|
|
|
|
|
!!customerFormState.editCustomerId &&
|
|
|
|
|
customerFormState.dialogType !== 'create'
|
|
|
|
|
"
|
|
|
|
|
:disabled="!customerFormState.readonly"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</SideMenu>
|
2024-08-07 17:56:59 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
|
|
|
|
|
id="customer-form-content"
|
|
|
|
|
style="height: 100%; max-height: 100%; overflow-y: auto"
|
|
|
|
|
>
|
2024-09-17 10:00:35 +07:00
|
|
|
<EmployerFormBasicInfo
|
2024-09-25 11:43:10 +07:00
|
|
|
prefixId="form"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="
|
|
|
|
|
customerFormData.customerBranch !== undefined &&
|
|
|
|
|
customerFormData.customerBranch.length > 0
|
|
|
|
|
"
|
2024-09-17 10:00:35 +07:00
|
|
|
class="q-mb-xl"
|
|
|
|
|
:readonly="
|
|
|
|
|
(customerFormState.dialogType === 'edit' &&
|
|
|
|
|
customerFormState.readonly === true) ||
|
|
|
|
|
customerFormState.dialogType === 'info'
|
2024-08-07 17:56:59 +07:00
|
|
|
"
|
2024-09-17 10:00:35 +07:00
|
|
|
:action-disabled="customerFormState.branchIndex !== -1"
|
|
|
|
|
id="form-basic-info-customer"
|
|
|
|
|
:onCreate="customerFormState.dialogType === 'create'"
|
|
|
|
|
@edit="
|
|
|
|
|
(customerFormState.dialogType = 'edit'),
|
|
|
|
|
(customerFormState.readonly = false)
|
|
|
|
|
"
|
|
|
|
|
@cancel="() => customerFormUndo(false)"
|
|
|
|
|
@delete="
|
|
|
|
|
customerFormState.editCustomerId &&
|
|
|
|
|
deleteCustomerById(customerFormState.editCustomerId)
|
|
|
|
|
"
|
|
|
|
|
:customer-type="customerFormData.customerType"
|
|
|
|
|
v-model:registered-branch-id="customerFormData.registeredBranchId"
|
2024-09-17 18:01:13 +07:00
|
|
|
v-model:customerName="customerNameInfo"
|
|
|
|
|
v-model:registerName="
|
|
|
|
|
customerFormData.customerBranch[0].registerName
|
|
|
|
|
"
|
|
|
|
|
v-model:citizenId="customerFormData.customerBranch[0].citizenId"
|
|
|
|
|
v-model:legalPersonNo="
|
|
|
|
|
customerFormData.customerBranch[0].legalPersonNo
|
|
|
|
|
"
|
|
|
|
|
v-model:businessType="
|
|
|
|
|
customerFormData.customerBranch[0].businessType
|
|
|
|
|
"
|
|
|
|
|
v-model:jobPosition="customerFormData.customerBranch[0].jobPosition"
|
|
|
|
|
v-model:telephoneNo="customerFormData.customerBranch[0].telephoneNo"
|
2024-09-17 10:00:35 +07:00
|
|
|
v-model:branch-options="registerAbleBranchOption"
|
|
|
|
|
/>
|
2024-08-07 17:56:59 +07:00
|
|
|
<div class="row q-col-gutter-sm" id="form-branch-customer-branch">
|
2024-09-16 14:38:04 +07:00
|
|
|
<div class="col-12 text-weight-bold text-body1 row items-center">
|
2024-08-07 17:56:59 +07:00
|
|
|
<q-icon
|
|
|
|
|
flat
|
|
|
|
|
size="xs"
|
|
|
|
|
class="q-pa-sm rounded q-mr-xs"
|
|
|
|
|
color="info"
|
2024-08-09 02:10:06 +00:00
|
|
|
name="mdi-briefcase-outline"
|
2024-08-07 17:56:59 +07:00
|
|
|
style="background-color: var(--surface-3)"
|
|
|
|
|
/>
|
|
|
|
|
<span>{{ $t('customer.form.group.branch') }}</span>
|
|
|
|
|
</div>
|
2024-09-16 14:38:04 +07:00
|
|
|
|
2024-08-09 10:29:54 +07:00
|
|
|
<template
|
2024-08-07 17:56:59 +07:00
|
|
|
v-for="(_, idx) in customerFormData.customerBranch"
|
2024-08-09 02:10:06 +00:00
|
|
|
:key="idx"
|
2024-08-09 10:29:54 +07:00
|
|
|
>
|
2024-09-16 14:38:04 +07:00
|
|
|
<!-- v-if="customerFormData.customerBranch" -->
|
2024-08-09 10:29:54 +07:00
|
|
|
<q-form
|
|
|
|
|
class="full-width"
|
|
|
|
|
greedy
|
|
|
|
|
@submit.prevent="
|
|
|
|
|
async () => {
|
|
|
|
|
if (!customerFormData.customerBranch) return;
|
|
|
|
|
|
2024-09-16 15:11:03 +07:00
|
|
|
if (customerFormData.customerType === 'PERS') {
|
|
|
|
|
tabFieldRequired.main = [
|
|
|
|
|
'citizenId',
|
|
|
|
|
'namePrefix',
|
|
|
|
|
'firstName',
|
|
|
|
|
'firstNameEN',
|
|
|
|
|
'lastName',
|
|
|
|
|
'lastNameEN',
|
|
|
|
|
'gender',
|
|
|
|
|
'birthDate',
|
|
|
|
|
];
|
|
|
|
|
}
|
2024-08-22 17:44:34 +07:00
|
|
|
if (customerFormData.customerType === 'CORP') {
|
2024-09-16 14:41:59 +07:00
|
|
|
tabFieldRequired.main = [
|
2024-09-16 14:38:04 +07:00
|
|
|
'legalPersonNo',
|
|
|
|
|
'registerName',
|
2024-09-16 15:11:03 +07:00
|
|
|
'registerNameEN',
|
|
|
|
|
'customerName',
|
2024-09-16 14:38:04 +07:00
|
|
|
];
|
2024-08-22 17:44:34 +07:00
|
|
|
}
|
2024-09-16 14:40:41 +07:00
|
|
|
let tapIsUndefined = validateTabField(
|
2024-08-22 17:44:34 +07:00
|
|
|
customerFormData.customerBranch?.[idx],
|
2024-09-16 14:41:59 +07:00
|
|
|
tabFieldRequired,
|
2024-08-22 17:44:34 +07:00
|
|
|
);
|
|
|
|
|
|
2024-08-22 18:08:35 +07:00
|
|
|
if (tapIsUndefined.length > 0) {
|
2024-09-16 14:47:29 +07:00
|
|
|
return dialog({
|
2024-08-22 17:44:34 +07:00
|
|
|
color: 'warning',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('dialog.title.incompleteDataEntry'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('dialog.message.incompleteDataEntry', {
|
|
|
|
|
tap: `${tapIsUndefined.map((v: string) => t(`customerBranch.tab.${v}`)).join(', ')}`,
|
|
|
|
|
}),
|
|
|
|
|
action: async () => {
|
|
|
|
|
return;
|
|
|
|
|
},
|
2024-08-09 10:29:54 +07:00
|
|
|
});
|
2024-09-16 14:47:29 +07:00
|
|
|
}
|
|
|
|
|
if (!customerFormData.customerBranch[idx].id) {
|
2024-09-17 18:01:13 +07:00
|
|
|
let res;
|
|
|
|
|
if (idx === 0) {
|
|
|
|
|
res =
|
|
|
|
|
await customerFormStore.submitFormCustomer(
|
|
|
|
|
onCreateImageList,
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
res = await customerStore.createBranch({
|
|
|
|
|
...customerFormData.customerBranch[idx],
|
|
|
|
|
customerId: customerFormState.editCustomerId,
|
|
|
|
|
id: undefined,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (res) {
|
|
|
|
|
customerFormState.readonly = true;
|
|
|
|
|
notify('create', $t('general.success'));
|
|
|
|
|
}
|
2024-08-09 10:29:54 +07:00
|
|
|
} else {
|
2024-09-16 15:11:03 +07:00
|
|
|
if (!customerFormState.editCustomerId) return;
|
2024-09-16 14:47:29 +07:00
|
|
|
await customerStore.editBranchById(
|
|
|
|
|
customerFormData.customerBranch[idx].id || '',
|
|
|
|
|
{
|
|
|
|
|
...customerFormData.customerBranch[idx],
|
|
|
|
|
id: undefined,
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-08-22 17:44:34 +07:00
|
|
|
|
2024-09-16 14:47:29 +07:00
|
|
|
const uploadResult =
|
|
|
|
|
customerFormData.customerBranch[idx].file?.map(
|
2024-08-29 14:57:49 +07:00
|
|
|
async (v) => {
|
|
|
|
|
if (!v.file) return;
|
|
|
|
|
|
|
|
|
|
const ext = v.file.name.split('.').at(-1);
|
|
|
|
|
let filename = v.group + '-' + new Date().getTime();
|
|
|
|
|
if (ext) filename += `.${ext}`;
|
|
|
|
|
|
|
|
|
|
const res = await customerStore.putAttachment({
|
|
|
|
|
branchId:
|
|
|
|
|
customerFormData.customerBranch?.[idx].id || '',
|
|
|
|
|
file: v.file,
|
|
|
|
|
filename,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
2024-09-16 14:47:29 +07:00
|
|
|
) || [];
|
2024-08-29 14:57:49 +07:00
|
|
|
|
2024-09-16 14:47:29 +07:00
|
|
|
for (const r of uploadResult) await r;
|
|
|
|
|
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
|
2024-09-25 14:21:39 +07:00
|
|
|
await fetchListCustomer(true);
|
2024-09-16 14:47:29 +07:00
|
|
|
customerFormStore.resetForm();
|
2024-08-08 13:32:46 +07:00
|
|
|
}
|
2024-08-07 17:56:59 +07:00
|
|
|
"
|
2024-08-09 10:29:54 +07:00
|
|
|
>
|
2024-09-16 14:38:04 +07:00
|
|
|
<!-- v-if="!!customerFormState.editCustomerId" -->
|
2024-09-17 18:01:13 +07:00
|
|
|
|
2024-08-09 10:29:54 +07:00
|
|
|
<EmployerFormBranch
|
2024-08-21 14:44:28 +07:00
|
|
|
:index="idx"
|
2024-09-25 11:43:10 +07:00
|
|
|
prefixId="form"
|
2024-08-27 19:37:46 +07:00
|
|
|
v-model:customer="customerFormData"
|
2024-08-09 10:29:54 +07:00
|
|
|
v-model:customer-branch="customerFormData.customerBranch[idx]"
|
2024-09-17 10:00:35 +07:00
|
|
|
:onCreate="customerFormState.dialogType === 'create'"
|
2024-08-09 10:29:54 +07:00
|
|
|
:customer-type="customerFormData.customerType"
|
2024-08-21 14:44:28 +07:00
|
|
|
:customer-name="`${customerFormData.firstName} ${customerFormData.lastName}`"
|
2024-08-09 10:29:54 +07:00
|
|
|
:readonly="customerFormState.branchIndex !== idx"
|
2024-09-17 18:01:13 +07:00
|
|
|
:action-disabled="
|
|
|
|
|
!customerFormState.readonly ||
|
|
|
|
|
(customerFormState.branchIndex !== -1 &&
|
|
|
|
|
customerFormState.branchIndex !== idx)
|
|
|
|
|
"
|
2024-08-09 10:29:54 +07:00
|
|
|
@edit="() => (customerFormState.branchIndex = idx)"
|
|
|
|
|
@cancel="() => customerFormUndo(false)"
|
|
|
|
|
@delete="
|
|
|
|
|
async () => {
|
2024-09-17 18:01:13 +07:00
|
|
|
if (idx === 0) {
|
|
|
|
|
deleteCustomerById(customerFormState.editCustomerId);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-08-09 10:29:54 +07:00
|
|
|
if (!!customerFormData.customerBranch?.[idx].id) {
|
|
|
|
|
const action = await deleteCustomerBranchById(
|
2024-08-15 11:56:44 +07:00
|
|
|
customerFormData.customerBranch[idx].id || '',
|
2024-08-08 13:32:46 +07:00
|
|
|
);
|
2024-08-09 10:29:54 +07:00
|
|
|
if (action) {
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
customerFormStore.resetForm();
|
2024-08-08 13:32:46 +07:00
|
|
|
}
|
|
|
|
|
}
|
2024-08-09 10:29:54 +07:00
|
|
|
"
|
|
|
|
|
@save="() => {}"
|
|
|
|
|
/>
|
|
|
|
|
</q-form>
|
|
|
|
|
</template>
|
2024-08-07 17:56:59 +07:00
|
|
|
</div>
|
2024-08-05 15:09:36 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-08-07 17:56:59 +07:00
|
|
|
</DialogContainer>
|
2024-08-06 03:14:31 +00:00
|
|
|
|
2024-08-27 15:03:56 +07:00
|
|
|
<!-- add employee -->
|
2024-08-06 03:14:31 +00:00
|
|
|
<DialogForm
|
2024-08-09 02:10:06 +00:00
|
|
|
hideFooter
|
|
|
|
|
:title="$t('form.title.create', { name: $t('customer.employee') })"
|
2024-08-06 03:14:31 +00:00
|
|
|
v-model:modal="employeeFormState.dialogModal"
|
2024-08-06 15:47:33 +07:00
|
|
|
:undo="() => employeeFormUndo(false)"
|
2024-08-07 13:30:05 +07:00
|
|
|
:submit="
|
|
|
|
|
async () => {
|
2024-08-07 18:34:50 +07:00
|
|
|
if (employeeFormState.currentTab === 'personalInfo') {
|
2024-09-11 16:53:08 +07:00
|
|
|
await employeeFormStore.submitPersonal(onCreateImageList);
|
2024-08-15 13:46:54 +07:00
|
|
|
employeeFormState.isEmployeeEdit = false;
|
|
|
|
|
employeeFormState.dialogType = 'info';
|
2024-08-07 18:34:50 +07:00
|
|
|
}
|
|
|
|
|
if (employeeFormState.currentTab === 'healthCheck') {
|
|
|
|
|
await employeeFormStore.submitHealthCheck();
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-09 15:28:48 +07:00
|
|
|
if (employeeFormState.currentTab === 'workHistory') {
|
|
|
|
|
await employeeFormStore.submitWorkHistory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (employeeFormState.currentTab === 'other') {
|
|
|
|
|
await employeeFormStore.submitOther();
|
2024-08-07 18:34:50 +07:00
|
|
|
}
|
2024-08-09 15:28:48 +07:00
|
|
|
|
2024-08-15 11:53:12 +07:00
|
|
|
employeeFormState.isEmployeeEdit = false;
|
2024-08-16 17:36:25 +07:00
|
|
|
employeeFormState.currentIndex = -1;
|
2024-08-15 11:53:12 +07:00
|
|
|
|
2024-08-07 13:30:05 +07:00
|
|
|
await fetchListEmployee();
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-07 18:34:50 +07:00
|
|
|
:show="
|
2024-08-07 13:30:05 +07:00
|
|
|
() => {
|
|
|
|
|
employeeFormStore.resetFormDataEmployee(true);
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-06 15:47:33 +07:00
|
|
|
:before-close="
|
|
|
|
|
() => {
|
|
|
|
|
if (employeeFormStore.isFormDataDifferent()) {
|
|
|
|
|
employeeConfirmUnsave();
|
|
|
|
|
return true;
|
2024-08-23 18:01:00 +07:00
|
|
|
} else {
|
|
|
|
|
fetchListEmployee();
|
2024-08-06 15:47:33 +07:00
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-06 03:14:31 +00:00
|
|
|
>
|
2024-08-16 17:36:25 +07:00
|
|
|
<div class="q-px-lg q-pt-lg surface-2">
|
2024-08-06 03:14:31 +00:00
|
|
|
<ProfileBanner
|
|
|
|
|
active
|
|
|
|
|
useToggle
|
|
|
|
|
color="white"
|
2024-08-09 02:10:06 +00:00
|
|
|
icon="mdi-account-plus-outline"
|
2024-08-28 14:13:22 +07:00
|
|
|
:bg-color="
|
|
|
|
|
employeeFormState.profileUrl
|
|
|
|
|
? 'white'
|
|
|
|
|
: 'linear-gradient(135deg, rgba(43,137,223,1) 0%, rgba(230,51,81,1) 100%)'
|
|
|
|
|
"
|
2024-08-06 03:14:31 +00:00
|
|
|
v-model:current-tab="employeeFormState.currentTab"
|
2024-08-06 07:55:05 +00:00
|
|
|
v-model:toggle-status="currentFromDataEmployee.status"
|
|
|
|
|
fallbackCover="/images/employee-banner.png"
|
|
|
|
|
:img="employeeFormState.profileUrl || `/images/employee-avatar.png`"
|
2024-08-07 13:30:05 +07:00
|
|
|
:tabs-list="
|
|
|
|
|
[
|
2024-08-26 16:24:08 +07:00
|
|
|
{
|
|
|
|
|
name: 'personalInfo',
|
|
|
|
|
label: 'customerEmployee.form.group.personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'healthCheck',
|
|
|
|
|
label: 'customerEmployee.form.group.healthCheck',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'workHistory',
|
|
|
|
|
label: 'customerEmployee.form.group.workHistory',
|
|
|
|
|
},
|
|
|
|
|
{ name: 'other', label: 'customerEmployee.form.group.other' },
|
2024-08-07 13:30:05 +07:00
|
|
|
].filter((v) => {
|
|
|
|
|
if (!employeeFormState.statusSavePersonal) {
|
|
|
|
|
return v.name === 'personalInfo';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
})
|
|
|
|
|
"
|
2024-08-06 03:14:31 +00:00
|
|
|
:menu="formMenuIconEmployee"
|
2024-08-26 16:24:08 +07:00
|
|
|
:toggleTitle="$t('status.title')"
|
2024-08-28 14:13:22 +07:00
|
|
|
hideFade
|
2024-09-11 16:53:08 +07:00
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.imageDialog = true;
|
|
|
|
|
employeeFormState.isImageEdit = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
employeeFormState.imageDialog = employeeFormState.isImageEdit = true
|
|
|
|
|
"
|
2024-08-06 07:55:05 +00:00
|
|
|
@update:toggle-status="
|
|
|
|
|
() => {
|
|
|
|
|
currentFromDataEmployee.status =
|
|
|
|
|
currentFromDataEmployee.status === 'CREATED'
|
|
|
|
|
? 'INACTIVE'
|
|
|
|
|
: 'CREATED';
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-06 03:14:31 +00:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
2024-08-16 17:36:25 +07:00
|
|
|
style="flex: 1; width: 100%; overflow-y: auto"
|
|
|
|
|
class="surface-2 q-pa-lg"
|
|
|
|
|
id="drawer-employee-form"
|
2024-08-06 03:14:31 +00:00
|
|
|
>
|
2024-08-16 17:36:25 +07:00
|
|
|
<div class="col surface-1 full-height rounded bordered scroll row">
|
|
|
|
|
<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 q-pr-sm">
|
|
|
|
|
<SideMenu
|
|
|
|
|
:menu="
|
2024-08-19 17:18:53 +07:00
|
|
|
[
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('form.field.basicInformation'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-information',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.personalInfo'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-personal',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('general.address'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-personal-address',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.passport'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-passport',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.visa'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-visa',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
2024-08-28 15:37:59 +07:00
|
|
|
{
|
|
|
|
|
name: $t('general.uploadFile'),
|
|
|
|
|
anchor: 'drawer-info-file-upload',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
2024-08-19 17:18:53 +07:00
|
|
|
...(currentFromDataEmployee.employeeCheckup?.map((v, i) => ({
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('general.times', { number: i + 1 }),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: `form-employee-checkup-${i}`,
|
|
|
|
|
tab: 'healthCheck',
|
|
|
|
|
})) || []),
|
|
|
|
|
|
|
|
|
|
...(currentFromDataEmployee.employeeWork?.map((v, i) => ({
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('general.times', { number: i + 1 }),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: `form-employee-work-history-${i}`,
|
|
|
|
|
tab: 'workHistory',
|
|
|
|
|
})) || []),
|
|
|
|
|
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.family'),
|
2024-08-19 17:18:53 +07:00
|
|
|
anchor: 'form-employee-other',
|
|
|
|
|
tab: 'other',
|
|
|
|
|
},
|
|
|
|
|
].filter((v) => v.tab === employeeFormState.currentTab)
|
2024-08-16 17:36:25 +07:00
|
|
|
"
|
|
|
|
|
background="transparent"
|
|
|
|
|
:active="{
|
|
|
|
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
|
|
|
|
foreground: 'var(--blue-6)',
|
|
|
|
|
}"
|
|
|
|
|
scroll-element="#employee-form-content"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-08-06 03:14:31 +00:00
|
|
|
</div>
|
|
|
|
|
|
2024-08-16 17:36:25 +07:00
|
|
|
<div
|
|
|
|
|
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
|
|
|
|
|
id="employee-form-content"
|
|
|
|
|
style="height: 100%; max-height: 100; overflow-y: auto"
|
|
|
|
|
>
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'personalInfo'">
|
|
|
|
|
<div
|
2024-08-19 10:50:46 +07:00
|
|
|
class="surface-1 rounded q-pt-sm row"
|
2024-08-16 17:36:25 +07:00
|
|
|
style="position: absolute; z-index: 999; right: 4%"
|
|
|
|
|
>
|
|
|
|
|
<UndoButton
|
|
|
|
|
v-if="
|
|
|
|
|
employeeFormState.isEmployeeEdit &&
|
|
|
|
|
employeeFormState.dialogType !== 'create'
|
|
|
|
|
"
|
|
|
|
|
id="btn-info-basic-undo"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
|
|
|
|
employeeFormState.isEmployeeEdit = false;
|
|
|
|
|
employeeFormState.dialogType = 'info';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
<SaveButton
|
|
|
|
|
v-if="employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-save"
|
|
|
|
|
icon-only
|
|
|
|
|
type="submit"
|
|
|
|
|
/>
|
|
|
|
|
<EditButton
|
|
|
|
|
v-if="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-edit"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.isEmployeeEdit = true;
|
|
|
|
|
employeeFormState.dialogType = 'edit';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
<DeleteButton
|
|
|
|
|
v-if="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-delete"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => deleteEmployeeById({ id: currentFromDataEmployee.id })
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-08-06 16:33:17 +07:00
|
|
|
|
2024-08-16 17:36:25 +07:00
|
|
|
<BasicInformation
|
|
|
|
|
no-action
|
|
|
|
|
id="form-information"
|
|
|
|
|
prefix-id="form-employee"
|
|
|
|
|
:show-btn-save="employeeFormState.dialogType === 'create'"
|
|
|
|
|
employee
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
2024-08-26 16:24:08 +07:00
|
|
|
title="form.field.basicInformation"
|
2024-08-16 17:36:25 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
:employee-owner-option="employeeStore.ownerOption"
|
|
|
|
|
v-model:customer-branch="employeeFormState.formDataEmployeeOwner"
|
|
|
|
|
v-model:employee-id="employeeFormState.currentEmployeeCode"
|
|
|
|
|
v-model:nrc-no="currentFromDataEmployee.nrcNo"
|
|
|
|
|
v-model:code="currentFromDataEmployee.code"
|
|
|
|
|
@filter-owner-branch="employeeFormStore.employeeFilterOwnerBranch"
|
2024-08-19 10:50:46 +07:00
|
|
|
class="q-mb-xl"
|
2024-08-16 17:36:25 +07:00
|
|
|
/>
|
|
|
|
|
<FormPerson
|
|
|
|
|
id="form-personal"
|
|
|
|
|
prefix-id="form-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
employee
|
|
|
|
|
separator
|
2024-08-26 16:24:08 +07:00
|
|
|
title="customerEmployee.form.group.personalInfo"
|
2024-08-28 15:37:59 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
2024-08-16 17:36:25 +07:00
|
|
|
v-model:open="employeeFormState.dialogModal"
|
2024-08-28 09:01:07 +07:00
|
|
|
v-model:prefixName="currentFromDataEmployee.namePrefix"
|
2024-08-16 17:36:25 +07:00
|
|
|
v-model:firstName="currentFromDataEmployee.firstName"
|
|
|
|
|
v-model:lastName="currentFromDataEmployee.lastName"
|
|
|
|
|
v-model:firstNameEN="currentFromDataEmployee.firstNameEN"
|
|
|
|
|
v-model:lastNameEN="currentFromDataEmployee.lastNameEN"
|
2024-08-27 15:03:56 +07:00
|
|
|
v-model:midName="currentFromDataEmployee.middleName"
|
|
|
|
|
v-model:midNameEN="currentFromDataEmployee.middleNameEN"
|
2024-08-16 17:36:25 +07:00
|
|
|
v-model:gender="currentFromDataEmployee.gender"
|
|
|
|
|
v-model:birthDate="currentFromDataEmployee.dateOfBirth"
|
|
|
|
|
v-model:nationality="currentFromDataEmployee.nationality"
|
2024-08-21 10:49:21 +07:00
|
|
|
class="q-mb-xl"
|
2024-08-16 17:36:25 +07:00
|
|
|
/>
|
|
|
|
|
<AddressForm
|
|
|
|
|
id="form-personal-address"
|
|
|
|
|
prefix-id="form-employee"
|
2024-08-28 15:37:59 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
2024-08-16 17:36:25 +07:00
|
|
|
v-model:same-with-employer="
|
|
|
|
|
employeeFormState.formDataEmployeeSameAddr
|
|
|
|
|
"
|
|
|
|
|
v-model:address="currentFromDataEmployee.address"
|
|
|
|
|
v-model:addressEN="currentFromDataEmployee.addressEN"
|
|
|
|
|
v-model:provinceId="currentFromDataEmployee.provinceId"
|
|
|
|
|
v-model:districtId="currentFromDataEmployee.districtId"
|
|
|
|
|
v-model:subDistrictId="currentFromDataEmployee.subDistrictId"
|
|
|
|
|
employee
|
|
|
|
|
dense
|
2024-08-19 10:50:46 +07:00
|
|
|
class="q-mb-xl"
|
2024-08-16 17:36:25 +07:00
|
|
|
/>
|
2024-08-06 16:33:17 +07:00
|
|
|
|
2024-08-28 16:22:57 +07:00
|
|
|
<div class="row q-mb-md" id="drawer-info-file-upload">
|
2024-08-28 15:37:59 +07:00
|
|
|
<div class="col-12 q-pb-sm text-weight-bold text-body1">
|
|
|
|
|
<q-icon
|
|
|
|
|
flat
|
|
|
|
|
size="xs"
|
|
|
|
|
class="q-pa-sm rounded q-mr-xs"
|
|
|
|
|
color="info"
|
|
|
|
|
name="mdi-upload"
|
|
|
|
|
style="background-color: var(--surface-3)"
|
|
|
|
|
/>
|
|
|
|
|
{{ $t(`general.uploadFile`) }}
|
|
|
|
|
</div>
|
2024-09-19 10:15:03 +07:00
|
|
|
<!-- สร้างลูกจ้าง -->
|
2024-09-18 10:58:08 +07:00
|
|
|
<UploadFileGroup
|
2024-09-19 10:15:03 +07:00
|
|
|
v-model:current-id="currentFromDataEmployee.id"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model="currentFromDataEmployee.file"
|
2024-08-28 15:37:59 +07:00
|
|
|
hide-action
|
2024-09-18 10:58:08 +07:00
|
|
|
:group-list="uploadFileListEmployee"
|
|
|
|
|
:menu="uploadFileListEmployee"
|
|
|
|
|
:columns="columnsAttachment"
|
2024-09-20 13:10:19 +07:00
|
|
|
:ocr="
|
|
|
|
|
async (group, file) => {
|
|
|
|
|
const res = await ocrStore.sendOcr({
|
|
|
|
|
file: file,
|
|
|
|
|
category: group,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
const tempValue = {
|
|
|
|
|
status: true,
|
|
|
|
|
group,
|
|
|
|
|
meta: res.fields,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return tempValue;
|
|
|
|
|
}
|
|
|
|
|
return { status: false, group, meta: [] };
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-19 10:15:03 +07:00
|
|
|
:auto-save="currentFromDataEmployee.id !== ''"
|
2024-09-19 11:33:22 +07:00
|
|
|
:download="
|
|
|
|
|
(obj) => {
|
|
|
|
|
employeeStore.getFile({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group: obj.group,
|
|
|
|
|
fileId: obj._meta.id,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-19 10:15:03 +07:00
|
|
|
:delete-item="
|
|
|
|
|
async (obj) => {
|
|
|
|
|
const res = await employeeStore.delMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group: obj.group,
|
|
|
|
|
metaId: obj._meta.id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:save="
|
|
|
|
|
async (
|
|
|
|
|
group: 'passport' | 'visa',
|
|
|
|
|
_meta: any,
|
|
|
|
|
file: File | undefined,
|
|
|
|
|
) => {
|
|
|
|
|
if (file !== undefined && currentFromDataEmployee.id) {
|
|
|
|
|
const res = await employeeStore.postMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
meta: _meta,
|
|
|
|
|
file,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const {
|
|
|
|
|
id,
|
|
|
|
|
employeeId,
|
|
|
|
|
createdAt,
|
|
|
|
|
updatedAt,
|
|
|
|
|
...payload
|
|
|
|
|
} = _meta;
|
|
|
|
|
const res = await employeeStore.putMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
metaId: _meta.id,
|
|
|
|
|
meta: payload,
|
|
|
|
|
file,
|
|
|
|
|
});
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-18 10:58:08 +07:00
|
|
|
:get-file-list="
|
|
|
|
|
async (group: 'passport' | 'visa') => {
|
|
|
|
|
if (!!currentFromDataEmployee.id) {
|
2024-09-19 10:15:03 +07:00
|
|
|
const resMeta = await employeeStore.getMetaList({
|
|
|
|
|
parentId: currentFromDataEmployee.id,
|
|
|
|
|
group,
|
|
|
|
|
});
|
|
|
|
|
|
2024-09-20 09:22:18 +07:00
|
|
|
const tempValue = resMeta.map(async (i: any) => {
|
|
|
|
|
return {
|
|
|
|
|
_meta: { ...i },
|
|
|
|
|
name: i.id || '',
|
|
|
|
|
group: group,
|
|
|
|
|
url: await employeeStore.getFile({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
fileId: i.id,
|
|
|
|
|
}),
|
|
|
|
|
file: undefined,
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-09-19 10:15:03 +07:00
|
|
|
|
2024-09-20 09:22:18 +07:00
|
|
|
return await waitAll(tempValue);
|
2024-08-29 16:59:58 +07:00
|
|
|
}
|
2024-09-18 10:58:08 +07:00
|
|
|
return [];
|
2024-08-28 15:37:59 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-29 11:39:09 +07:00
|
|
|
>
|
2024-09-19 11:33:22 +07:00
|
|
|
<template #form="{ mode, meta, isEdit }">
|
2024-09-18 10:58:08 +07:00
|
|
|
<FormCitizen
|
|
|
|
|
v-if="mode === 'citizen' && meta"
|
|
|
|
|
orc
|
2024-09-19 11:33:22 +07:00
|
|
|
ra
|
|
|
|
|
:readonly="!isEdit"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:citizen-id="meta.citizenId"
|
|
|
|
|
v-model:birth-date="meta.birthDate"
|
|
|
|
|
v-model:first-name="meta.firstName"
|
|
|
|
|
v-model:first-name-en="meta.firstNameEN"
|
|
|
|
|
v-model:last-name="meta.lastName"
|
|
|
|
|
v-model:last-name-en="meta.lastNameEN"
|
|
|
|
|
v-model:address="meta.address"
|
|
|
|
|
/>
|
2024-08-29 11:39:09 +07:00
|
|
|
<FormEmployeePassport
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="mode === 'passport' && meta"
|
2024-08-29 11:39:09 +07:00
|
|
|
prefix-id="drawer-info-employee"
|
|
|
|
|
id="form-passport"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
|
|
|
|
ocr
|
|
|
|
|
:title="$t('customerEmployee.form.group.passport')"
|
2024-09-19 11:33:22 +07:00
|
|
|
:readonly="!isEdit"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:passport-type="meta.type"
|
|
|
|
|
v-model:passport-number="meta.number"
|
2024-09-19 10:15:03 +07:00
|
|
|
v-model:passport-issue-date="meta.issueDate"
|
|
|
|
|
v-model:passport-expiry-date="meta.expireDate"
|
|
|
|
|
v-model:passport-issuing-place="meta.issuePlace"
|
|
|
|
|
v-model:passport-issuing-country="meta.issueCountry"
|
2024-08-29 11:39:09 +07:00
|
|
|
/>
|
|
|
|
|
<FormEmployeeVisa
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="mode === 'visa' && meta"
|
2024-08-29 11:39:09 +07:00
|
|
|
prefix-id="drawer-info-employee"
|
|
|
|
|
id="form-visa"
|
|
|
|
|
ocr
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
title="customerEmployee.form.group.visa"
|
2024-09-19 11:33:22 +07:00
|
|
|
:readonly="!isEdit"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:visa-type="meta.type"
|
|
|
|
|
v-model:visa-number="meta.number"
|
|
|
|
|
v-model:visa-issue-date="meta.issueDate"
|
|
|
|
|
v-model:visa-expiry-date="meta.expireDate"
|
|
|
|
|
v-model:visa-issuing-place="meta.issuePlace"
|
2024-08-29 11:39:09 +07:00
|
|
|
/>
|
2024-09-25 10:58:46 +07:00
|
|
|
|
|
|
|
|
<noticeJobEmployment v-if="mode === 'noticeJobEmployment'" />
|
2024-08-29 11:39:09 +07:00
|
|
|
</template>
|
2024-09-18 10:58:08 +07:00
|
|
|
</UploadFileGroup>
|
2024-08-28 15:37:59 +07:00
|
|
|
</div>
|
2024-08-16 17:36:25 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'healthCheck'">
|
|
|
|
|
<FormEmployeeHealthCheck
|
|
|
|
|
v-if="employeeFormState.currentTab === 'healthCheck'"
|
|
|
|
|
id="form-checkup"
|
|
|
|
|
prefix-id="form-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model:current-index="employeeFormState.currentIndex"
|
|
|
|
|
v-model:employeeCheckup="currentFromDataEmployee.employeeCheckup"
|
|
|
|
|
v-model:checkupTypeOption="
|
|
|
|
|
optionStore.globalOption.insurancePlace
|
|
|
|
|
"
|
|
|
|
|
v-model:medicalBenefitOption="
|
|
|
|
|
optionStore.globalOption.typeInsurance
|
|
|
|
|
"
|
|
|
|
|
v-model:insuranceCompanyOption="
|
|
|
|
|
optionStore.globalOption.insurancePlace
|
|
|
|
|
"
|
|
|
|
|
@delete="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
deleteEmployeeById({ type: 'healthCheck' });
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@save="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
2024-09-06 09:58:05 +07:00
|
|
|
notify('create', $t('general.success'));
|
2024-08-16 17:36:25 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@undo="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeCheckup?.[index]
|
|
|
|
|
.statusSave === false
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeCheckup[index].statusSave =
|
|
|
|
|
true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeCheckup?.[index].statusSave
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeCheckup[index].statusSave =
|
|
|
|
|
false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'workHistory'">
|
|
|
|
|
<FormEmployeeWorkHistory
|
|
|
|
|
v-if="employeeFormState.currentTab === 'workHistory'"
|
|
|
|
|
id="form-work-history"
|
|
|
|
|
prefix-id="form-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model:current-index="employeeFormState.currentIndex"
|
|
|
|
|
v-model:employee-work="currentFromDataEmployee.employeeWork"
|
|
|
|
|
v-model:position-name-option="optionStore.globalOption.position"
|
|
|
|
|
v-model:job-type-option="optionStore.globalOption.businessType"
|
|
|
|
|
v-model:workplace-option="optionStore.globalOption.area"
|
|
|
|
|
@delete="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
deleteEmployeeById({ type: 'work' });
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@save="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@undo="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeWork?.[index].statusSave ===
|
|
|
|
|
false
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeWork[index].statusSave =
|
|
|
|
|
true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeWork?.[index].statusSave
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeWork[index].statusSave =
|
|
|
|
|
false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
2024-08-28 15:37:59 +07:00
|
|
|
a
|
2024-08-16 17:36:25 +07:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'other'">
|
|
|
|
|
<FormEmployeeOther
|
|
|
|
|
v-if="employeeFormState.currentTab === 'other'"
|
2024-08-19 17:18:53 +07:00
|
|
|
id="form-employee-other"
|
2024-08-16 17:36:25 +07:00
|
|
|
prefix-id="form-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model:employee-other="currentFromDataEmployee.employeeOtherInfo"
|
|
|
|
|
@undo="
|
|
|
|
|
() => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo?.statusSave ===
|
|
|
|
|
false
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo.statusSave = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
() => {
|
|
|
|
|
if (currentFromDataEmployee.employeeOtherInfo?.statusSave) {
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo.statusSave = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
2024-08-06 03:14:31 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</DialogForm>
|
|
|
|
|
|
2024-08-05 15:09:36 +07:00
|
|
|
<ImageUploadDialog
|
|
|
|
|
ref="dialogCustomerImageUpload"
|
|
|
|
|
v-model:dialog-state="customerFormState.imageDialog"
|
|
|
|
|
v-model:file="customerFormData.image"
|
|
|
|
|
v-model:image-url="customerFormState.customerImageUrl"
|
2024-09-11 16:43:41 +07:00
|
|
|
v-model:data-list="imageList"
|
|
|
|
|
v-model:on-create-data-list="onCreateImageList"
|
|
|
|
|
:on-create="customerFormState.dialogModal"
|
2024-08-15 11:02:01 +07:00
|
|
|
:default-url="customerFormState.defaultCustomerImageUrl"
|
2024-09-11 16:43:41 +07:00
|
|
|
:hiddenFooter="!customerFormState.isImageEdit"
|
|
|
|
|
@add-image="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!v) return;
|
|
|
|
|
if (!customerFormState.editCustomerId) return;
|
|
|
|
|
await customerStore.addImageList(
|
|
|
|
|
v,
|
|
|
|
|
customerFormState.editCustomerId,
|
2024-09-18 10:58:08 +07:00
|
|
|
Date.now().toString(),
|
2024-09-11 16:43:41 +07:00
|
|
|
);
|
|
|
|
|
await fetchImageList(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
customerFormData.selectedImage || '',
|
2024-09-11 16:53:08 +07:00
|
|
|
'customer',
|
2024-09-11 16:43:41 +07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@remove-image="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!v) return;
|
|
|
|
|
if (!customerFormState.editCustomerId) return;
|
|
|
|
|
const name = v.split('/').pop() || '';
|
|
|
|
|
await customerStore.deleteImageByName(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
name,
|
|
|
|
|
);
|
2024-09-11 16:53:08 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
customerFormState.editCustomerId,
|
2024-09-12 16:41:09 +07:00
|
|
|
customerFormData.selectedImage || '',
|
2024-09-11 16:53:08 +07:00
|
|
|
'customer',
|
|
|
|
|
);
|
2024-09-11 16:43:41 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@submit="
|
2024-08-08 09:46:36 +07:00
|
|
|
async (v) => {
|
2024-09-11 16:43:41 +07:00
|
|
|
if (customerFormState.dialogModal) {
|
|
|
|
|
customerFormState.customerImageUrl = v;
|
2024-08-08 09:46:36 +07:00
|
|
|
customerFormState.imageDialog = false;
|
2024-09-11 16:43:41 +07:00
|
|
|
} else {
|
|
|
|
|
refreshImageState = true;
|
|
|
|
|
customerFormData.selectedImage = v;
|
|
|
|
|
imageList ? (imageList.selectedImage = v) : '';
|
|
|
|
|
customerFormState.customerImageUrl = `${baseUrl}/customer/${customerFormState.editCustomerId && customerFormState.editCustomerId}/image/${v}`;
|
|
|
|
|
customerFormStore.resetForm();
|
|
|
|
|
await customerFormStore.submitFormCustomer();
|
|
|
|
|
customerFormState.imageDialog = false;
|
|
|
|
|
refreshImageState = false;
|
2024-08-08 09:46:36 +07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-06 08:11:49 +00:00
|
|
|
>
|
2024-09-11 16:43:41 +07:00
|
|
|
<template #title>
|
|
|
|
|
<span
|
|
|
|
|
v-if="!customerFormState.dialogModal"
|
|
|
|
|
class="justify-center flex text-bold"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('general.image') }}
|
|
|
|
|
{{
|
|
|
|
|
$i18n.locale === 'eng'
|
|
|
|
|
? `${customerFormData.firstNameEN} ${customerFormData.lastNameEN}`
|
|
|
|
|
: `${customerFormData.firstName} ${customerFormData.lastName}`
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2024-08-06 08:11:49 +00:00
|
|
|
<template #error>
|
|
|
|
|
<div class="full-height full-width" style="background: white">
|
|
|
|
|
<div
|
|
|
|
|
class="full-height full-width flex justify-center items-center"
|
2024-09-05 15:57:30 +07:00
|
|
|
:style="`background: ${
|
|
|
|
|
customerFormData.gender
|
|
|
|
|
? customerFormData.customerType === 'CORP'
|
|
|
|
|
? '#5f1775'
|
|
|
|
|
: '#347454'
|
|
|
|
|
: `hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/0.1)`
|
|
|
|
|
}`"
|
2024-08-06 08:11:49 +00:00
|
|
|
>
|
|
|
|
|
<q-img
|
2024-09-17 18:01:13 +07:00
|
|
|
:src="`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.gender : 'male'}.png`"
|
2024-08-06 08:11:49 +00:00
|
|
|
fit="contain"
|
|
|
|
|
style="height: 100%"
|
2024-09-05 15:57:30 +07:00
|
|
|
>
|
|
|
|
|
<template #error>
|
|
|
|
|
<span
|
|
|
|
|
class="full-width full-height column items-center justify-center"
|
|
|
|
|
>
|
|
|
|
|
<q-icon
|
2024-09-11 16:43:41 +07:00
|
|
|
size="3rem"
|
2024-09-05 15:57:30 +07:00
|
|
|
:name="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? 'mdi-account-plus-outline'
|
|
|
|
|
: 'mdi-office-building-outline'
|
|
|
|
|
"
|
|
|
|
|
:style="`color: hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/1)`"
|
|
|
|
|
/>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
|
|
|
|
</q-img>
|
2024-08-06 08:11:49 +00:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</ImageUploadDialog>
|
2024-08-05 16:48:19 +07:00
|
|
|
|
2024-08-06 07:55:05 +00:00
|
|
|
<ImageUploadDialog
|
|
|
|
|
ref="dialogEmployeeImageUpload"
|
|
|
|
|
v-model:dialog-state="employeeFormState.imageDialog"
|
|
|
|
|
v-model:file="currentFromDataEmployee.image"
|
|
|
|
|
v-model:image-url="employeeFormState.profileUrl"
|
2024-09-11 16:53:08 +07:00
|
|
|
v-model:data-list="imageList"
|
|
|
|
|
v-model:on-create-data-list="onCreateImageList"
|
|
|
|
|
:on-create="employeeFormState.dialogModal"
|
|
|
|
|
:hiddenFooter="!employeeFormState.isImageEdit"
|
|
|
|
|
@add-image="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!v) return;
|
|
|
|
|
if (!currentFromDataEmployee.id) return;
|
|
|
|
|
await employeeStore.addImageList(
|
|
|
|
|
v,
|
|
|
|
|
currentFromDataEmployee.id,
|
2024-09-18 10:58:08 +07:00
|
|
|
Date.now().toString(),
|
2024-09-11 16:53:08 +07:00
|
|
|
);
|
|
|
|
|
await fetchImageList(
|
|
|
|
|
currentFromDataEmployee.id,
|
|
|
|
|
currentFromDataEmployee.selectedImage || '',
|
|
|
|
|
'employee',
|
|
|
|
|
);
|
|
|
|
|
}
|
2024-08-06 07:55:05 +00:00
|
|
|
"
|
2024-09-11 16:53:08 +07:00
|
|
|
@remove-image="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!v) return;
|
|
|
|
|
if (!currentFromDataEmployee.id) return;
|
|
|
|
|
const name = v.split('/').pop() || '';
|
|
|
|
|
await employeeStore.deleteImageByName(currentFromDataEmployee.id, name);
|
2024-09-12 16:41:09 +07:00
|
|
|
await fetchImageList(
|
|
|
|
|
currentFromDataEmployee.id,
|
|
|
|
|
currentFromDataEmployee.selectedImage || '',
|
|
|
|
|
'employee',
|
|
|
|
|
);
|
2024-09-11 16:53:08 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@submit="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (employeeFormState.dialogModal) {
|
|
|
|
|
employeeFormState.profileUrl = v;
|
|
|
|
|
employeeFormState.imageDialog = false;
|
|
|
|
|
} else {
|
|
|
|
|
refreshImageState = true;
|
|
|
|
|
employeeFormState.dialogType = 'edit';
|
|
|
|
|
currentFromDataEmployee.selectedImage = v;
|
|
|
|
|
imageList ? (imageList.selectedImage = v) : '';
|
|
|
|
|
employeeFormState.profileUrl = `${baseUrl}/employee/${currentFromDataEmployee.id && currentFromDataEmployee.id}/image/${v}`;
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
|
|
|
|
await employeeFormStore.submitPersonal();
|
|
|
|
|
employeeFormState.imageDialog = false;
|
|
|
|
|
refreshImageState = false;
|
|
|
|
|
employeeFormState.isEmployeeEdit = false;
|
|
|
|
|
employeeFormState.dialogType = 'info';
|
|
|
|
|
await fetchListEmployee();
|
|
|
|
|
}
|
2024-08-13 14:02:00 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-06 07:55:05 +00:00
|
|
|
>
|
2024-09-11 16:53:08 +07:00
|
|
|
<template #title>
|
|
|
|
|
<span
|
|
|
|
|
v-if="!employeeFormState.dialogModal"
|
|
|
|
|
class="justify-center flex text-bold"
|
|
|
|
|
>
|
|
|
|
|
{{ $t('general.image') }}
|
|
|
|
|
{{
|
|
|
|
|
$i18n.locale === 'eng'
|
|
|
|
|
? `${currentFromDataEmployee.firstNameEN} ${currentFromDataEmployee.lastNameEN}`
|
|
|
|
|
: `${currentFromDataEmployee.firstName} ${currentFromDataEmployee.lastName}`
|
|
|
|
|
}}
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2024-08-06 07:55:05 +00:00
|
|
|
<template #error>
|
|
|
|
|
<div class="full-height full-width" style="background: white">
|
|
|
|
|
<div
|
|
|
|
|
class="full-height full-width flex justify-center items-center"
|
|
|
|
|
style="background: #ee4367"
|
|
|
|
|
>
|
|
|
|
|
<q-img
|
|
|
|
|
src="/images/employee-avatar.png"
|
|
|
|
|
fit="contain"
|
|
|
|
|
style="height: 100%"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</ImageUploadDialog>
|
2024-08-27 15:03:56 +07:00
|
|
|
<!-- นายจ้าง edit customer -->
|
2024-08-26 11:04:18 +07:00
|
|
|
<DrawerInfo
|
|
|
|
|
hide-action
|
|
|
|
|
v-model:drawer-open="customerFormState.drawerModal"
|
|
|
|
|
:title="
|
2024-09-17 18:01:13 +07:00
|
|
|
customerFormData.customerType === 'CORP'
|
|
|
|
|
? customerFormData.customerBranch[0]?.registerName
|
|
|
|
|
: customerNameInfo
|
|
|
|
|
"
|
|
|
|
|
:badgeLabel="
|
|
|
|
|
customerFormData.customerType === 'CORP'
|
|
|
|
|
? $t('customer.employerLegalEntity')
|
|
|
|
|
: $t('customer.employerNaturalPerson')
|
2024-08-26 11:04:18 +07:00
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
:badgeStyle="
|
|
|
|
|
customerFormData.customerType === 'CORP'
|
|
|
|
|
? `color: var(--${$q.dark.isActive ? 'violet-10' : 'violet-11'}); background: hsl(var(--${$q.dark.isActive ? 'violet-10-hsl' : 'violet-11-hsl'})/0.15)`
|
|
|
|
|
: `color: var(--${$q.dark.isActive ? 'teal-8' : 'teal-10'}); background: hsl(var(--${$q.dark.isActive ? 'teal-8-hsl' : 'teal-10-hsl'})/0.15)`
|
2024-08-26 11:04:18 +07:00
|
|
|
"
|
2024-08-27 15:03:56 +07:00
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
customerFormState.drawerModal = false;
|
2024-09-05 10:37:14 +07:00
|
|
|
resetScrollBar('customer-form-content');
|
2024-08-27 15:03:56 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-26 11:04:18 +07:00
|
|
|
:submit="
|
|
|
|
|
async () => {
|
|
|
|
|
await customerFormStore.submitFormCustomer();
|
|
|
|
|
customerFormState.readonly = true;
|
2024-09-06 09:58:05 +07:00
|
|
|
notify('create', $t('general.success'));
|
2024-08-26 11:04:18 +07:00
|
|
|
await fetchListCustomer();
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:show="
|
|
|
|
|
async () => {
|
2024-08-27 16:19:59 +07:00
|
|
|
// await fetchListOfOptionBranch();
|
|
|
|
|
// customerFormStore.resetForm(true);
|
2024-08-26 11:04:18 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:before-close="
|
|
|
|
|
() => {
|
|
|
|
|
if (customerFormStore.isFormDataDifferent()) {
|
|
|
|
|
customerConfirmUnsave();
|
2024-09-19 10:15:03 +07:00
|
|
|
return false;
|
2024-08-26 11:04:18 +07:00
|
|
|
} else {
|
|
|
|
|
fetchListCustomer();
|
|
|
|
|
customerFormState.branchIndex = -1;
|
2024-09-17 10:00:35 +07:00
|
|
|
customerFormStore.resetForm(true);
|
2024-08-26 11:04:18 +07:00
|
|
|
}
|
2024-09-19 10:15:03 +07:00
|
|
|
return false;
|
2024-08-26 11:04:18 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<div class="column full-height">
|
|
|
|
|
<div class="q-px-lg q-pt-lg surface-2">
|
|
|
|
|
<ProfileBanner
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="customerFormData.customerBranch !== undefined"
|
2024-09-17 18:01:13 +07:00
|
|
|
:active="customerFormData.status !== 'INACTIVE'"
|
2024-08-26 11:04:18 +07:00
|
|
|
hide-fade
|
2024-09-17 18:01:13 +07:00
|
|
|
useToggle
|
|
|
|
|
v-model:toggle-status="customerFormData.status"
|
|
|
|
|
:menu="formMenuIcon"
|
|
|
|
|
:toggleTitle="$t('status.title')"
|
2024-08-26 11:04:18 +07:00
|
|
|
:fallback-cover="`/images/customer-${customerFormData.customerType}-banner-bg.jpg`"
|
|
|
|
|
:img="
|
2024-09-11 16:43:41 +07:00
|
|
|
`${baseUrl}/customer/${customerFormState.editCustomerId}/image/${customerFormData.selectedImage}`.concat(
|
|
|
|
|
refreshImageState ? `?ts=${Date.now()}` : '',
|
|
|
|
|
) || null
|
2024-09-05 15:57:30 +07:00
|
|
|
"
|
2024-09-17 10:00:35 +07:00
|
|
|
:fallbackImg="`/images/customer-${customerFormData.customerType}-avartar-${customerFormData.customerType === 'PERS' ? customerFormData.customerBranch[0]?.gender : 'male'}.png`"
|
2024-09-05 15:57:30 +07:00
|
|
|
:color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/1)`"
|
|
|
|
|
:bg-color="`hsla(var(--${customerFormData.customerType === 'PERS' ? 'teal-10-hsl' : 'violet-11-hsl'})/0.1)`"
|
|
|
|
|
:icon="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? 'mdi-account-plus-outline'
|
|
|
|
|
: 'mdi-office-building-outline'
|
2024-08-26 11:04:18 +07:00
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
:title="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? `${customerFormData.customerBranch[0]?.firstName} ${customerFormData.customerBranch[0]?.lastName}`
|
|
|
|
|
: customerFormData.customerBranch[0]?.registerName
|
|
|
|
|
"
|
|
|
|
|
:caption="
|
|
|
|
|
customerFormData.customerType === 'PERS'
|
|
|
|
|
? `${customerFormData.customerBranch[0]?.firstNameEN} ${customerFormData.customerBranch[0]?.lastNameEN}`
|
|
|
|
|
: customerFormData.customerBranch[0]?.registerNameEN
|
|
|
|
|
"
|
2024-09-11 16:43:41 +07:00
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
customerFormState.imageDialog = true;
|
|
|
|
|
customerFormState.isImageEdit = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
customerFormState.imageDialog = customerFormState.isImageEdit = true
|
|
|
|
|
"
|
2024-09-17 18:01:13 +07:00
|
|
|
@update:toggle-status="
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!customerFormState.editCustomerId) return;
|
|
|
|
|
await triggerChangeStatus(customerFormState.editCustomerId, v);
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-26 11:04:18 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
style="flex: 1; width: 100%; overflow-y: auto"
|
|
|
|
|
class="surface-2 q-pa-lg column"
|
|
|
|
|
id="customer-form"
|
|
|
|
|
>
|
|
|
|
|
<div class="col bg-red surface-1 rounded bordered row">
|
|
|
|
|
<div class="col full-height scroll" v-if="$q.screen.gt.sm">
|
|
|
|
|
<div class="q-py-md q-pl-md q-pr-sm">
|
|
|
|
|
<SideMenu
|
|
|
|
|
:menu="[
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('form.field.basicInformation'),
|
2024-08-26 11:04:18 +07:00
|
|
|
anchor: 'form-basic-info-customer',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: $t('customer.form.group.branch'),
|
|
|
|
|
anchor: 'form-branch-customer-branch',
|
2024-09-19 13:30:20 +07:00
|
|
|
useBtn: true,
|
2024-08-26 11:04:18 +07:00
|
|
|
},
|
2024-08-27 12:54:07 +07:00
|
|
|
|
2024-08-26 11:04:18 +07:00
|
|
|
...(customerFormData.customerBranch?.map((v, i) => ({
|
|
|
|
|
name:
|
|
|
|
|
i === 0
|
|
|
|
|
? $t('customer.form.headQuarters.title')
|
|
|
|
|
: $t('customer.form.branch.title', {
|
|
|
|
|
name: i,
|
|
|
|
|
}),
|
|
|
|
|
anchor: `form-branch-customer-no-${i}`,
|
|
|
|
|
sub: true,
|
|
|
|
|
})) || []),
|
|
|
|
|
]"
|
|
|
|
|
background="transparent"
|
|
|
|
|
:active="{
|
|
|
|
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
|
|
|
|
foreground: 'var(--blue-6)',
|
|
|
|
|
}"
|
|
|
|
|
scroll-element="#customer-form-content"
|
2024-09-19 13:30:20 +07:00
|
|
|
>
|
|
|
|
|
<template v-slot:btn-form-branch-customer-branch>
|
|
|
|
|
<q-btn
|
|
|
|
|
dense
|
|
|
|
|
flat
|
|
|
|
|
icon="mdi-plus"
|
|
|
|
|
size="sm"
|
|
|
|
|
rounded
|
|
|
|
|
padding="0px 0px"
|
2024-09-25 11:43:10 +07:00
|
|
|
style="color: var(--stone-9)"
|
2024-09-19 13:30:20 +07:00
|
|
|
@click.stop="customerFormStore.addCurrentCustomerBranch()"
|
|
|
|
|
v-if="
|
|
|
|
|
customerFormState.branchIndex === -1 &&
|
|
|
|
|
!!customerFormState.editCustomerId &&
|
|
|
|
|
customerFormState.dialogType !== 'create'
|
|
|
|
|
"
|
|
|
|
|
:disabled="!customerFormState.readonly"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</SideMenu>
|
2024-08-26 11:04:18 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
|
|
|
|
|
id="customer-form-content"
|
|
|
|
|
style="height: 100%; max-height: 100%; overflow-y: auto"
|
|
|
|
|
>
|
|
|
|
|
<EmployerFormBasicInfo
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="
|
|
|
|
|
customerFormData.customerBranch !== undefined &&
|
|
|
|
|
customerFormData.customerBranch.length > 0
|
|
|
|
|
"
|
2024-08-26 11:04:18 +07:00
|
|
|
:readonly="
|
|
|
|
|
(customerFormState.dialogType === 'edit' &&
|
|
|
|
|
customerFormState.readonly === true) ||
|
|
|
|
|
customerFormState.dialogType === 'info'
|
|
|
|
|
"
|
2024-09-05 13:48:45 +07:00
|
|
|
:hide-action="customerFormData.status === 'INACTIVE'"
|
2024-08-26 11:04:18 +07:00
|
|
|
:action-disabled="customerFormState.branchIndex !== -1"
|
|
|
|
|
id="form-basic-info-customer"
|
2024-09-17 10:00:35 +07:00
|
|
|
:onCreate="customerFormState.dialogType === 'create'"
|
2024-08-26 11:04:18 +07:00
|
|
|
@edit="
|
|
|
|
|
(customerFormState.dialogType = 'edit'),
|
|
|
|
|
(customerFormState.readonly = false)
|
|
|
|
|
"
|
|
|
|
|
@cancel="() => customerFormUndo(false)"
|
|
|
|
|
@delete="
|
|
|
|
|
customerFormState.editCustomerId &&
|
|
|
|
|
deleteCustomerById(customerFormState.editCustomerId)
|
|
|
|
|
"
|
|
|
|
|
:customer-type="customerFormData.customerType"
|
|
|
|
|
v-model:registered-branch-id="customerFormData.registeredBranchId"
|
2024-09-17 10:00:35 +07:00
|
|
|
v-model:customerName="customerNameInfo"
|
|
|
|
|
v-model:registerName="
|
|
|
|
|
customerFormData.customerBranch[0].registerName
|
|
|
|
|
"
|
|
|
|
|
v-model:citizenId="customerFormData.customerBranch[0].citizenId"
|
|
|
|
|
v-model:legalPersonNo="
|
|
|
|
|
customerFormData.customerBranch[0].legalPersonNo
|
|
|
|
|
"
|
|
|
|
|
v-model:businessType="
|
|
|
|
|
customerFormData.customerBranch[0].businessType
|
|
|
|
|
"
|
|
|
|
|
v-model:jobPosition="
|
|
|
|
|
customerFormData.customerBranch[0].jobPosition
|
|
|
|
|
"
|
|
|
|
|
v-model:telephoneNo="
|
|
|
|
|
customerFormData.customerBranch[0].telephoneNo
|
|
|
|
|
"
|
2024-08-26 11:04:18 +07:00
|
|
|
v-model:branch-options="registerAbleBranchOption"
|
|
|
|
|
/>
|
|
|
|
|
|
2024-08-27 12:54:07 +07:00
|
|
|
<!-- <div class="row q-col-gutter-sm q-mb-xl">
|
|
|
|
|
<UploadFile
|
|
|
|
|
id="form-upload-file-customer"
|
|
|
|
|
class="q-mb-xl"
|
|
|
|
|
hide-action
|
|
|
|
|
:dropdown-list="uploadFileList"
|
|
|
|
|
v-model:file="customerFormState.file"
|
|
|
|
|
@send-ocr="
|
|
|
|
|
(group: any, file: any) => ocrStore.sendOcr({ file })
|
|
|
|
|
"
|
2024-08-28 14:43:51 +07:00
|
|
|
/>
|
2024-08-27 12:54:07 +07:00
|
|
|
</div> -->
|
|
|
|
|
|
2024-08-26 11:04:18 +07:00
|
|
|
<div class="row q-col-gutter-sm" id="form-branch-customer-branch">
|
|
|
|
|
<div
|
2024-09-17 10:00:35 +07:00
|
|
|
class="col-12 text-weight-bold text-body1 row items-center q-mt-lg"
|
2024-08-26 11:04:18 +07:00
|
|
|
>
|
|
|
|
|
<q-icon
|
|
|
|
|
flat
|
|
|
|
|
size="xs"
|
|
|
|
|
class="q-pa-sm rounded q-mr-xs"
|
|
|
|
|
color="info"
|
|
|
|
|
name="mdi-briefcase-outline"
|
|
|
|
|
style="background-color: var(--surface-3)"
|
|
|
|
|
/>
|
|
|
|
|
<span>{{ $t('customer.form.group.branch') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<template
|
|
|
|
|
v-for="(_, idx) in customerFormData.customerBranch"
|
|
|
|
|
:key="idx"
|
|
|
|
|
>
|
|
|
|
|
<q-form
|
2024-08-26 18:04:04 +07:00
|
|
|
class="full-width q-mb-xl"
|
2024-08-26 11:04:18 +07:00
|
|
|
v-if="customerFormData.customerBranch"
|
|
|
|
|
greedy
|
|
|
|
|
@submit.prevent="
|
|
|
|
|
async () => {
|
|
|
|
|
if (!customerFormData.customerBranch) return;
|
|
|
|
|
if (!customerFormState.editCustomerId) return;
|
|
|
|
|
|
2024-09-17 18:01:13 +07:00
|
|
|
if (customerFormData.customerType === 'PERS') {
|
|
|
|
|
tabFieldRequired.main = [
|
|
|
|
|
'citizenId',
|
|
|
|
|
'namePrefix',
|
|
|
|
|
'firstName',
|
|
|
|
|
'firstNameEN',
|
|
|
|
|
'lastName',
|
|
|
|
|
'lastNameEN',
|
|
|
|
|
'gender',
|
|
|
|
|
'birthDate',
|
|
|
|
|
];
|
|
|
|
|
}
|
2024-08-26 11:04:18 +07:00
|
|
|
if (customerFormData.customerType === 'CORP') {
|
2024-09-16 14:41:59 +07:00
|
|
|
tabFieldRequired.main = [
|
|
|
|
|
'legalPersonNo',
|
|
|
|
|
'registerName',
|
2024-09-17 18:01:13 +07:00
|
|
|
'registerNameEN',
|
|
|
|
|
'customerName',
|
2024-09-16 14:41:59 +07:00
|
|
|
];
|
2024-08-26 11:04:18 +07:00
|
|
|
}
|
|
|
|
|
|
2024-09-16 14:40:41 +07:00
|
|
|
let tapIsUndefined = validateTabField(
|
2024-08-26 11:04:18 +07:00
|
|
|
customerFormData.customerBranch?.[idx],
|
2024-09-16 14:41:59 +07:00
|
|
|
tabFieldRequired,
|
2024-08-26 11:04:18 +07:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (tapIsUndefined.length > 0) {
|
2024-09-17 18:01:13 +07:00
|
|
|
return dialog({
|
2024-08-26 11:04:18 +07:00
|
|
|
color: 'warning',
|
|
|
|
|
icon: 'mdi-alert',
|
|
|
|
|
title: t('dialog.title.incompleteDataEntry'),
|
|
|
|
|
actionText: t('ok'),
|
|
|
|
|
persistent: true,
|
|
|
|
|
message: t('dialog.message.incompleteDataEntry', {
|
|
|
|
|
tap: `${tapIsUndefined.map((v: string) => t(`customerBranch.tab.${v}`)).join(', ')}`,
|
|
|
|
|
}),
|
|
|
|
|
action: async () => {
|
|
|
|
|
return;
|
|
|
|
|
},
|
|
|
|
|
});
|
2024-09-17 18:01:13 +07:00
|
|
|
}
|
|
|
|
|
if (!customerFormData.customerBranch[idx].id) {
|
|
|
|
|
await customerStore.createBranch({
|
|
|
|
|
...customerFormData.customerBranch[idx],
|
|
|
|
|
customerId: customerFormState.editCustomerId,
|
|
|
|
|
id: undefined,
|
|
|
|
|
});
|
2024-08-26 11:04:18 +07:00
|
|
|
} else {
|
2024-09-17 18:01:13 +07:00
|
|
|
await customerStore.editBranchById(
|
|
|
|
|
customerFormData.customerBranch[idx].id || '',
|
|
|
|
|
{
|
2024-08-26 11:04:18 +07:00
|
|
|
...customerFormData.customerBranch[idx],
|
|
|
|
|
id: undefined,
|
2024-08-27 16:19:59 +07:00
|
|
|
},
|
|
|
|
|
);
|
2024-09-17 18:01:13 +07:00
|
|
|
}
|
2024-08-27 16:19:59 +07:00
|
|
|
|
2024-09-17 18:01:13 +07:00
|
|
|
customerFormData.customerBranch[idx].file?.forEach(
|
|
|
|
|
async (v) => {
|
|
|
|
|
if (!v.file) return;
|
2024-08-28 09:51:12 +07:00
|
|
|
|
2024-09-17 18:01:13 +07:00
|
|
|
const ext = v.file.name.split('.').at(-1);
|
|
|
|
|
let filename = v.group + '-' + new Date().getTime();
|
|
|
|
|
if (ext) filename += `.${ext}`;
|
|
|
|
|
|
|
|
|
|
const res = await customerStore.putAttachment({
|
|
|
|
|
branchId:
|
|
|
|
|
customerFormData.customerBranch?.[idx].id || '',
|
|
|
|
|
file: v.file,
|
|
|
|
|
filename,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
customerFormStore.resetForm();
|
2024-08-26 11:04:18 +07:00
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
>
|
|
|
|
|
<EmployerFormBranch
|
|
|
|
|
v-if="!!customerFormState.editCustomerId"
|
|
|
|
|
:index="idx"
|
2024-09-05 13:48:45 +07:00
|
|
|
:hide-action="customerFormData.status === 'INACTIVE'"
|
2024-08-27 19:37:46 +07:00
|
|
|
v-model:customer="customerFormData"
|
2024-08-26 11:04:18 +07:00
|
|
|
v-model:customer-branch="
|
|
|
|
|
customerFormData.customerBranch[idx]
|
|
|
|
|
"
|
|
|
|
|
:customer-type="customerFormData.customerType"
|
|
|
|
|
:customer-name="`${customerFormData.firstName} ${customerFormData.lastName}`"
|
|
|
|
|
:action-disabled="
|
|
|
|
|
!customerFormState.readonly ||
|
|
|
|
|
(customerFormState.branchIndex !== -1 &&
|
|
|
|
|
customerFormState.branchIndex !== idx)
|
|
|
|
|
"
|
|
|
|
|
:readonly="customerFormState.branchIndex !== idx"
|
|
|
|
|
@edit="() => (customerFormState.branchIndex = idx)"
|
|
|
|
|
@cancel="() => customerFormUndo(false)"
|
|
|
|
|
@delete="
|
|
|
|
|
async () => {
|
|
|
|
|
if (!!customerFormData.customerBranch?.[idx].id) {
|
|
|
|
|
const action = await deleteCustomerBranchById(
|
|
|
|
|
customerFormData.customerBranch[idx].id || '',
|
|
|
|
|
);
|
|
|
|
|
if (action) {
|
|
|
|
|
await customerFormStore.assignFormData(
|
|
|
|
|
customerFormState.editCustomerId,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
customerFormStore.resetForm();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@save="() => {}"
|
|
|
|
|
/>
|
|
|
|
|
</q-form>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</DrawerInfo>
|
2024-08-06 07:55:05 +00:00
|
|
|
|
2024-08-20 18:04:42 +07:00
|
|
|
<!-- ลูกจ้าง edit employee -->
|
2024-08-05 16:48:19 +07:00
|
|
|
<DrawerInfo
|
2024-09-05 10:37:14 +07:00
|
|
|
v-if="!!employeeFormState.currentEmployee"
|
2024-08-09 02:10:06 +00:00
|
|
|
hide-action
|
2024-08-05 16:48:19 +07:00
|
|
|
v-model:drawer-open="employeeFormState.drawerModal"
|
2024-08-27 15:03:56 +07:00
|
|
|
:close="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.drawerModal = false;
|
2024-09-05 10:37:14 +07:00
|
|
|
resetScrollBar('drawer-employee-form-content');
|
2024-08-27 15:03:56 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-05 16:48:19 +07:00
|
|
|
:title="
|
|
|
|
|
employeeFormState.currentEmployee
|
2024-08-26 16:24:08 +07:00
|
|
|
? $i18n.locale === 'eng'
|
2024-08-05 16:48:19 +07:00
|
|
|
? `${employeeFormState.currentEmployee.firstNameEN} ${employeeFormState.currentEmployee.lastNameEN}`
|
|
|
|
|
: `${employeeFormState.currentEmployee.firstName} ${employeeFormState.currentEmployee.lastName}`
|
|
|
|
|
: '-'
|
|
|
|
|
"
|
2024-08-05 17:32:07 +07:00
|
|
|
:badgeClass="
|
|
|
|
|
currentFromDataEmployee.gender === 'male'
|
|
|
|
|
? 'app-bg-male text-white'
|
|
|
|
|
: currentFromDataEmployee.gender === 'female'
|
|
|
|
|
? 'app-bg-female text-white'
|
|
|
|
|
: ''
|
|
|
|
|
"
|
2024-08-07 13:30:05 +07:00
|
|
|
:submit="
|
|
|
|
|
async () => {
|
2024-08-07 18:34:50 +07:00
|
|
|
if (employeeFormState.currentTab === 'personalInfo') {
|
|
|
|
|
await employeeFormStore.submitPersonal();
|
2024-08-15 11:53:12 +07:00
|
|
|
employeeFormState.dialogType = 'info';
|
|
|
|
|
employeeFormState.isEmployeeEdit = false;
|
2024-08-07 18:34:50 +07:00
|
|
|
}
|
|
|
|
|
if (employeeFormState.currentTab === 'healthCheck') {
|
|
|
|
|
await employeeFormStore.submitHealthCheck();
|
|
|
|
|
}
|
2024-08-09 17:56:39 +07:00
|
|
|
|
|
|
|
|
if (employeeFormState.currentTab === 'workHistory') {
|
|
|
|
|
await employeeFormStore.submitWorkHistory();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (employeeFormState.currentTab === 'other') {
|
|
|
|
|
await employeeFormStore.submitOther();
|
|
|
|
|
}
|
2024-08-07 18:34:50 +07:00
|
|
|
await fetchListEmployee();
|
|
|
|
|
|
2024-08-07 13:30:05 +07:00
|
|
|
employeeFormState.isEmployeeEdit = false;
|
2024-08-13 13:31:29 +07:00
|
|
|
employeeFormState.currentIndex = -1;
|
2024-08-07 13:30:05 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-09 17:56:39 +07:00
|
|
|
:before-close="
|
|
|
|
|
() => {
|
|
|
|
|
if (employeeFormStore.isFormDataDifferent()) {
|
|
|
|
|
employeeConfirmUnsave();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-05 16:48:19 +07:00
|
|
|
>
|
2024-08-19 17:56:36 +07:00
|
|
|
<div class="column full-height">
|
|
|
|
|
<div class="q-px-lg q-pt-lg surface-2">
|
|
|
|
|
<ProfileBanner
|
2024-08-28 14:13:22 +07:00
|
|
|
hideFade
|
2024-09-11 16:53:08 +07:00
|
|
|
@view="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.imageDialog = true;
|
|
|
|
|
employeeFormState.isImageEdit = false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
@edit="
|
2024-09-11 16:53:08 +07:00
|
|
|
employeeFormState.imageDialog = employeeFormState.isImageEdit = true
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@update:toggle-status="
|
|
|
|
|
(v) => {
|
|
|
|
|
if (currentFromDataEmployee.id !== undefined)
|
|
|
|
|
triggerChangeStatus(currentFromDataEmployee.id, v);
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-08-28 13:49:57 +07:00
|
|
|
:active="currentFromDataEmployee.status !== 'INACTIVE'"
|
2024-09-02 15:26:03 +07:00
|
|
|
:use-toggle="currentTab === 'employee'"
|
2024-08-19 17:56:36 +07:00
|
|
|
color="white"
|
2024-08-20 18:04:42 +07:00
|
|
|
icon="mdi-account-outline"
|
2024-08-28 14:13:22 +07:00
|
|
|
:bg-color="
|
|
|
|
|
employeeFormState.profileUrl
|
|
|
|
|
? 'white'
|
|
|
|
|
: 'linear-gradient(135deg, rgba(43,137,223,1) 0%, rgba(230,51,81,1) 100%)'
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-model:current-tab="employeeFormState.currentTab"
|
|
|
|
|
v-model:toggle-status="currentFromDataEmployee.status"
|
|
|
|
|
fallback-cover="/images/employee-banner.png"
|
2024-08-20 18:04:42 +07:00
|
|
|
:title="
|
|
|
|
|
employeeFormState.currentEmployee
|
2024-08-26 16:24:08 +07:00
|
|
|
? $i18n.locale === 'eng'
|
2024-08-20 18:04:42 +07:00
|
|
|
? `${employeeFormState.currentEmployee.firstNameEN} ${employeeFormState.currentEmployee.lastNameEN}`
|
|
|
|
|
: `${employeeFormState.currentEmployee.firstName} ${employeeFormState.currentEmployee.lastName}`
|
|
|
|
|
: '-'
|
|
|
|
|
"
|
|
|
|
|
:caption="currentFromDataEmployee.code"
|
2024-09-11 16:53:08 +07:00
|
|
|
:img="
|
|
|
|
|
`${baseUrl}/employee/${currentFromDataEmployee.id}/image/${currentFromDataEmployee.selectedImage}`.concat(
|
|
|
|
|
refreshImageState ? `?ts=${Date.now()}` : '',
|
|
|
|
|
) || null
|
|
|
|
|
"
|
2024-08-28 14:13:22 +07:00
|
|
|
:fallbackImg="'/images/employee-avatar.png'"
|
2024-08-19 17:56:36 +07:00
|
|
|
:tabs-list="[
|
2024-08-26 16:24:08 +07:00
|
|
|
{
|
|
|
|
|
name: 'personalInfo',
|
|
|
|
|
label: 'customerEmployee.form.group.personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'healthCheck',
|
|
|
|
|
label: 'customerEmployee.form.group.healthCheck',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'workHistory',
|
|
|
|
|
label: 'customerEmployee.form.group.workHistory',
|
|
|
|
|
},
|
|
|
|
|
{ name: 'other', label: 'customerEmployee.form.group.other' },
|
2024-08-19 17:56:36 +07:00
|
|
|
]"
|
|
|
|
|
:menu="formMenuIconEmployee"
|
2024-08-26 16:24:08 +07:00
|
|
|
:toggle-title="$t('status.title')"
|
2024-08-19 17:56:36 +07:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
style="flex: 1; width: 100%; overflow-y: auto"
|
|
|
|
|
class="surface-2 q-pa-lg column"
|
|
|
|
|
id="drawer-employee-form"
|
|
|
|
|
>
|
|
|
|
|
<div class="col bg-red surface-1 rounded bordered row">
|
|
|
|
|
<div class="col full-height scroll" v-if="$q.screen.gt.sm">
|
|
|
|
|
<div class="q-py-md q-pl-md q-pr-sm">
|
|
|
|
|
<SideMenu
|
|
|
|
|
:menu="
|
|
|
|
|
[
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('form.field.basicInformation'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-form-information',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.personalInfo'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-form-personal',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('form.address'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-form-personal-address',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.passport'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-form-passport',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.visa'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-form-visa',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
2024-08-26 18:04:04 +07:00
|
|
|
|
|
|
|
|
{
|
2024-08-28 15:37:59 +07:00
|
|
|
name: $t('general.uploadFile'),
|
2024-08-26 18:04:04 +07:00
|
|
|
anchor: 'drawer-upload-file',
|
|
|
|
|
tab: 'personalInfo',
|
|
|
|
|
},
|
|
|
|
|
|
2024-08-19 17:56:36 +07:00
|
|
|
...(currentFromDataEmployee.employeeCheckup?.map(
|
|
|
|
|
(v, i) => ({
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('general.times', { number: i + 1 }),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: `drawer-employee-checkup-${i}`,
|
|
|
|
|
tab: 'healthCheck',
|
|
|
|
|
}),
|
|
|
|
|
) || []),
|
|
|
|
|
...(currentFromDataEmployee.employeeWork?.map((v, i) => ({
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('general.times', { number: i + 1 }),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: `drawer-employee-work-history-${i}`,
|
|
|
|
|
tab: 'workHistory',
|
|
|
|
|
})) || []),
|
|
|
|
|
{
|
2024-08-26 16:24:08 +07:00
|
|
|
name: $t('customerEmployee.form.group.family'),
|
2024-08-19 17:56:36 +07:00
|
|
|
anchor: 'drawer-other',
|
|
|
|
|
tab: 'other',
|
|
|
|
|
},
|
|
|
|
|
].filter((v) => v.tab === employeeFormState.currentTab)
|
|
|
|
|
"
|
|
|
|
|
background="transparent"
|
|
|
|
|
:active="{
|
|
|
|
|
background: 'hsla(var(--blue-6-hsl) / .2)',
|
|
|
|
|
foreground: 'var(--blue-6)',
|
|
|
|
|
}"
|
|
|
|
|
scroll-element="#drawer-employee-form-content"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2024-08-05 16:48:19 +07:00
|
|
|
</div>
|
2024-08-19 17:56:36 +07:00
|
|
|
<div
|
|
|
|
|
class="col-12 col-md-10 q-py-md q-pr-md q-pl-sm"
|
|
|
|
|
id="drawer-employee-form-content"
|
|
|
|
|
style="height: 100%; overflow-y: auto"
|
|
|
|
|
>
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'personalInfo'">
|
|
|
|
|
<div
|
|
|
|
|
class="surface-1 rounded q-pt-sm row"
|
|
|
|
|
style="position: absolute; z-index: 999; right: 4%"
|
2024-09-05 13:16:18 +07:00
|
|
|
v-if="
|
|
|
|
|
currentTab === 'employee' &&
|
|
|
|
|
currentFromDataEmployee.status !== 'INACTIVE'
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
>
|
|
|
|
|
<UndoButton
|
|
|
|
|
v-if="employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-undo"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
|
|
|
|
employeeFormState.isEmployeeEdit = false;
|
|
|
|
|
employeeFormState.dialogType = 'info';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
<SaveButton
|
|
|
|
|
v-if="employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-save"
|
|
|
|
|
icon-only
|
|
|
|
|
type="submit"
|
|
|
|
|
/>
|
|
|
|
|
<EditButton
|
|
|
|
|
v-if="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-edit"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => {
|
|
|
|
|
employeeFormState.isEmployeeEdit = true;
|
|
|
|
|
employeeFormState.dialogType = 'edit';
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
<DeleteButton
|
|
|
|
|
v-if="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
id="btn-info-basic-delete"
|
|
|
|
|
icon-only
|
|
|
|
|
@click="
|
|
|
|
|
() => deleteEmployeeById({ id: currentFromDataEmployee.id })
|
|
|
|
|
"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<BasicInformation
|
|
|
|
|
no-action
|
|
|
|
|
id="drawer-form-information"
|
|
|
|
|
prefix-id="drawer-info-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
2024-08-26 16:24:08 +07:00
|
|
|
title="form.field.basicInformation"
|
2024-08-19 17:56:36 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
:employee-owner-option="employeeStore.ownerOption"
|
|
|
|
|
v-model:customer-branch="
|
|
|
|
|
employeeFormState.formDataEmployeeOwner
|
2024-08-16 16:47:13 +07:00
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-model:employee-id="employeeFormState.currentEmployeeCode"
|
|
|
|
|
v-model:nrc-no="currentFromDataEmployee.nrcNo"
|
|
|
|
|
v-model:code="currentFromDataEmployee.code"
|
|
|
|
|
@filter-owner-branch="
|
|
|
|
|
employeeFormStore.employeeFilterOwnerBranch
|
|
|
|
|
"
|
|
|
|
|
class="q-mb-xl"
|
2024-08-16 16:47:13 +07:00
|
|
|
/>
|
2024-08-19 17:56:36 +07:00
|
|
|
<FormPerson
|
|
|
|
|
id="drawer-form-personal"
|
|
|
|
|
prefix-id="drawer-info-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
employee
|
|
|
|
|
separator
|
2024-08-26 16:24:08 +07:00
|
|
|
title="customerEmployee.form.group.personalInfo"
|
2024-08-19 17:56:36 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
2024-08-27 15:03:56 +07:00
|
|
|
v-model:prefixName="currentFromDataEmployee.namePrefix"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-model:firstName="currentFromDataEmployee.firstName"
|
|
|
|
|
v-model:lastName="currentFromDataEmployee.lastName"
|
|
|
|
|
v-model:firstNameEN="currentFromDataEmployee.firstNameEN"
|
|
|
|
|
v-model:lastNameEN="currentFromDataEmployee.lastNameEN"
|
2024-08-27 15:03:56 +07:00
|
|
|
v-model:midName="currentFromDataEmployee.middleName"
|
|
|
|
|
v-model:midNameEN="currentFromDataEmployee.middleNameEN"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-model:gender="currentFromDataEmployee.gender"
|
|
|
|
|
v-model:birthDate="currentFromDataEmployee.dateOfBirth"
|
|
|
|
|
v-model:nationality="currentFromDataEmployee.nationality"
|
|
|
|
|
class="q-mb-xl"
|
2024-08-16 16:47:13 +07:00
|
|
|
/>
|
2024-08-19 17:56:36 +07:00
|
|
|
<AddressForm
|
|
|
|
|
id="drawer-form-personal-address"
|
|
|
|
|
employee
|
|
|
|
|
v-model:address="currentFromDataEmployee.address"
|
|
|
|
|
v-model:addressEN="currentFromDataEmployee.addressEN"
|
|
|
|
|
v-model:provinceId="currentFromDataEmployee.provinceId"
|
|
|
|
|
v-model:districtId="currentFromDataEmployee.districtId"
|
|
|
|
|
v-model:subDistrictId="currentFromDataEmployee.subDistrictId"
|
2024-08-27 15:03:56 +07:00
|
|
|
v-model:sameWithEmployer="
|
|
|
|
|
employeeFormState.formDataEmployeeSameAddr
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
:readonly="!employeeFormState.isEmployeeEdit"
|
|
|
|
|
prefix-id="drawer-info-personnel"
|
|
|
|
|
dense
|
|
|
|
|
class="q-mb-xl"
|
|
|
|
|
/>
|
2024-08-26 18:04:04 +07:00
|
|
|
|
2024-08-28 15:37:59 +07:00
|
|
|
<div class="row" id="drawer-upload-file">
|
|
|
|
|
<div class="col-12 q-pb-sm text-weight-bold text-body1">
|
|
|
|
|
<q-icon
|
|
|
|
|
flat
|
|
|
|
|
size="xs"
|
|
|
|
|
class="q-pa-sm rounded q-mr-xs"
|
|
|
|
|
color="info"
|
|
|
|
|
name="mdi-upload"
|
|
|
|
|
style="background-color: var(--surface-3)"
|
|
|
|
|
/>
|
|
|
|
|
{{ $t(`general.uploadFile`) }}
|
|
|
|
|
</div>
|
2024-09-19 10:15:03 +07:00
|
|
|
<!-- แก้ไขลูกจ้าง -->
|
2024-09-18 10:58:08 +07:00
|
|
|
<UploadFileGroup
|
2024-09-19 10:15:03 +07:00
|
|
|
v-model:current-id="currentFromDataEmployee.id"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model="currentFromDataEmployee.file"
|
2024-08-28 15:37:59 +07:00
|
|
|
hide-action
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:current-selected-menu="currentSelectedMenu"
|
|
|
|
|
:group-list="uploadFileListEmployee"
|
|
|
|
|
:menu="uploadFileListEmployee"
|
|
|
|
|
:columns="columnsAttachment"
|
2024-09-20 13:10:19 +07:00
|
|
|
:ocr="
|
|
|
|
|
async (group, file) => {
|
|
|
|
|
const res = await ocrStore.sendOcr({
|
|
|
|
|
file: file,
|
|
|
|
|
category: group,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
const tempValue = {
|
|
|
|
|
status: true,
|
|
|
|
|
group,
|
|
|
|
|
meta: res.fields,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return tempValue;
|
|
|
|
|
}
|
|
|
|
|
return { status: false, group, meta: [] };
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-19 10:15:03 +07:00
|
|
|
auto-save
|
2024-09-19 11:33:22 +07:00
|
|
|
:download="
|
|
|
|
|
(obj) => {
|
|
|
|
|
employeeStore.getFile({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group: obj.group,
|
|
|
|
|
fileId: obj._meta.id,
|
|
|
|
|
download: true,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-19 10:15:03 +07:00
|
|
|
:delete-item="
|
|
|
|
|
async (obj) => {
|
|
|
|
|
const res = await employeeStore.delMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group: obj.group,
|
|
|
|
|
metaId: obj._meta.id,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
:save="
|
|
|
|
|
async (
|
|
|
|
|
group: 'passport' | 'visa',
|
|
|
|
|
_meta: any,
|
|
|
|
|
file: File | undefined,
|
|
|
|
|
) => {
|
2024-09-20 09:22:18 +07:00
|
|
|
if (
|
|
|
|
|
file !== undefined &&
|
|
|
|
|
currentFromDataEmployee.id &&
|
|
|
|
|
!_meta.hasOwnProperty('id')
|
|
|
|
|
) {
|
2024-09-19 10:15:03 +07:00
|
|
|
const res = await employeeStore.postMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
meta: _meta,
|
|
|
|
|
file,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const {
|
|
|
|
|
id,
|
|
|
|
|
employeeId,
|
|
|
|
|
createdAt,
|
|
|
|
|
updatedAt,
|
|
|
|
|
...payload
|
|
|
|
|
} = _meta;
|
|
|
|
|
const res = await employeeStore.putMeta({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
metaId: _meta.id,
|
|
|
|
|
meta: payload,
|
|
|
|
|
file,
|
|
|
|
|
});
|
|
|
|
|
if (res) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
"
|
2024-09-18 10:58:08 +07:00
|
|
|
:get-file-list="
|
|
|
|
|
async (group: 'passport' | 'visa') => {
|
|
|
|
|
if (!!currentFromDataEmployee.id) {
|
2024-09-19 10:15:03 +07:00
|
|
|
const resMeta = await employeeStore.getMetaList({
|
|
|
|
|
parentId: currentFromDataEmployee.id,
|
|
|
|
|
group,
|
|
|
|
|
});
|
|
|
|
|
|
2024-09-20 09:22:18 +07:00
|
|
|
const tempValue = resMeta.map(async (i: any) => {
|
|
|
|
|
return {
|
|
|
|
|
_meta: { ...i },
|
|
|
|
|
name: i.id || '',
|
|
|
|
|
group: group,
|
|
|
|
|
url: await employeeStore.getFile({
|
|
|
|
|
parentId: currentFromDataEmployee.id || '',
|
|
|
|
|
group,
|
|
|
|
|
fileId: i.id,
|
|
|
|
|
}),
|
|
|
|
|
file: undefined,
|
|
|
|
|
};
|
|
|
|
|
});
|
2024-09-19 10:15:03 +07:00
|
|
|
|
2024-09-20 09:22:18 +07:00
|
|
|
return await waitAll(tempValue);
|
2024-08-29 16:59:58 +07:00
|
|
|
}
|
2024-09-18 10:58:08 +07:00
|
|
|
return [];
|
2024-08-28 15:37:59 +07:00
|
|
|
}
|
|
|
|
|
"
|
2024-08-29 11:39:09 +07:00
|
|
|
>
|
2024-09-19 11:33:22 +07:00
|
|
|
<template #form="{ mode, meta, isEdit }">
|
2024-08-29 11:39:09 +07:00
|
|
|
<FormEmployeePassport
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="mode === 'passport' && meta"
|
2024-08-29 11:39:09 +07:00
|
|
|
prefix-id="drawer-info-employee"
|
2024-09-18 10:58:08 +07:00
|
|
|
id="form-passport"
|
2024-08-29 11:39:09 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
separator
|
|
|
|
|
ocr
|
2024-09-11 16:53:08 +07:00
|
|
|
:title="$t('customerEmployee.form.group.passport')"
|
2024-09-19 11:33:22 +07:00
|
|
|
:readonly="!isEdit"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:passport-type="meta.type"
|
|
|
|
|
v-model:passport-number="meta.number"
|
2024-09-19 10:15:03 +07:00
|
|
|
v-model:passport-issue-date="meta.issueDate"
|
|
|
|
|
v-model:passport-expiry-date="meta.expireDate"
|
|
|
|
|
v-model:passport-issuing-place="meta.issuePlace"
|
|
|
|
|
v-model:passport-issuing-country="meta.issueCountry"
|
2024-08-29 11:39:09 +07:00
|
|
|
/>
|
|
|
|
|
<FormEmployeeVisa
|
2024-09-18 10:58:08 +07:00
|
|
|
v-if="mode === 'visa' && meta"
|
2024-08-29 11:39:09 +07:00
|
|
|
prefix-id="drawer-info-employee"
|
2024-09-18 10:58:08 +07:00
|
|
|
id="form-visa"
|
|
|
|
|
ocr
|
2024-08-29 11:39:09 +07:00
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
title="customerEmployee.form.group.visa"
|
2024-09-19 11:33:22 +07:00
|
|
|
:readonly="!isEdit"
|
2024-09-18 10:58:08 +07:00
|
|
|
v-model:visa-type="meta.type"
|
|
|
|
|
v-model:visa-number="meta.number"
|
|
|
|
|
v-model:visa-issue-date="meta.issueDate"
|
|
|
|
|
v-model:visa-expiry-date="meta.expireDate"
|
|
|
|
|
v-model:visa-issuing-place="meta.issuePlace"
|
2024-08-29 11:39:09 +07:00
|
|
|
/>
|
2024-09-23 12:56:12 +07:00
|
|
|
<FormTm6 v-if="mode === 'tm6' && meta" />
|
2024-08-29 11:39:09 +07:00
|
|
|
</template>
|
2024-09-18 10:58:08 +07:00
|
|
|
</UploadFileGroup>
|
2024-08-28 15:37:59 +07:00
|
|
|
</div>
|
2024-08-19 17:56:36 +07:00
|
|
|
</template>
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'healthCheck'">
|
|
|
|
|
<FormEmployeeHealthCheck
|
|
|
|
|
v-if="employeeFormState.currentTab === 'healthCheck'"
|
|
|
|
|
id="drawer-form-checkup"
|
|
|
|
|
prefix-id="drawer-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
2024-09-05 13:16:18 +07:00
|
|
|
:hide-action="
|
|
|
|
|
currentTab !== 'employee' ||
|
|
|
|
|
currentFromDataEmployee.status === 'INACTIVE'
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-model:current-index="employeeFormState.currentIndex"
|
|
|
|
|
v-model:employee-checkup="
|
|
|
|
|
currentFromDataEmployee.employeeCheckup
|
|
|
|
|
"
|
|
|
|
|
v-model:checkup-type-option="
|
|
|
|
|
optionStore.globalOption.insurancePlace
|
|
|
|
|
"
|
|
|
|
|
v-model:medical-benefit-option="
|
|
|
|
|
optionStore.globalOption.typeInsurance
|
|
|
|
|
"
|
|
|
|
|
v-model:insuranceCompanyOption="
|
|
|
|
|
optionStore.globalOption.insurancePlace
|
|
|
|
|
"
|
|
|
|
|
@save="
|
|
|
|
|
(index) => {
|
2024-08-16 16:47:13 +07:00
|
|
|
employeeFormState.currentIndex = index;
|
2024-09-06 09:58:05 +07:00
|
|
|
notify('create', $t('general.success'));
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeCheckup?.[index]
|
|
|
|
|
.statusSave
|
|
|
|
|
) {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
currentFromDataEmployee.employeeCheckup[
|
|
|
|
|
index
|
|
|
|
|
].statusSave = false;
|
|
|
|
|
}
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@undo="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeCheckup?.[index]
|
|
|
|
|
.statusSave === false
|
|
|
|
|
) {
|
|
|
|
|
employeeFormState.currentIndex = -1;
|
|
|
|
|
currentFromDataEmployee.employeeCheckup[
|
|
|
|
|
index
|
|
|
|
|
].statusSave = true;
|
|
|
|
|
employeeFormStore.resetFormDataEmployee();
|
|
|
|
|
}
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@delete="
|
|
|
|
|
(index) => {
|
2024-08-16 16:47:13 +07:00
|
|
|
employeeFormState.currentIndex = index;
|
2024-08-19 17:56:36 +07:00
|
|
|
deleteEmployeeById({ type: 'healthCheck' });
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'workHistory'">
|
|
|
|
|
<FormEmployeeWorkHistory
|
|
|
|
|
v-if="employeeFormState.currentTab === 'workHistory'"
|
|
|
|
|
id="drawer-work-history"
|
|
|
|
|
prefix-id="drawer-employee"
|
|
|
|
|
dense
|
2024-09-05 13:16:18 +07:00
|
|
|
:hide-action="
|
|
|
|
|
currentTab !== 'employee' ||
|
|
|
|
|
currentFromDataEmployee.status === 'INACTIVE'
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
outlined
|
|
|
|
|
v-model:current-index="employeeFormState.currentIndex"
|
|
|
|
|
v-model:employee-work="currentFromDataEmployee.employeeWork"
|
|
|
|
|
v-model:position-name-option="optionStore.globalOption.position"
|
|
|
|
|
v-model:job-type-option="optionStore.globalOption.businessType"
|
|
|
|
|
v-model:workplace-option="optionStore.globalOption.area"
|
|
|
|
|
@delete="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
deleteEmployeeById({ type: 'work' });
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@save="
|
|
|
|
|
(index) => {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
2024-08-16 16:47:13 +07:00
|
|
|
}
|
2024-08-19 17:56:36 +07:00
|
|
|
"
|
|
|
|
|
@undo="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeWork?.[index]
|
|
|
|
|
.statusSave === false
|
|
|
|
|
) {
|
|
|
|
|
employeeFormState.currentIndex = -1;
|
|
|
|
|
currentFromDataEmployee.employeeWork[index].statusSave =
|
|
|
|
|
true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
(index) => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeWork?.[index].statusSave
|
|
|
|
|
) {
|
|
|
|
|
employeeFormState.currentIndex = index;
|
|
|
|
|
currentFromDataEmployee.employeeWork[index].statusSave =
|
|
|
|
|
false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="employeeFormState.currentTab === 'other'">
|
|
|
|
|
<FormEmployeeOther
|
2024-09-05 13:16:18 +07:00
|
|
|
:hide-action="
|
|
|
|
|
currentTab !== 'employee' ||
|
|
|
|
|
currentFromDataEmployee.status === 'INACTIVE'
|
|
|
|
|
"
|
2024-08-19 17:56:36 +07:00
|
|
|
v-if="employeeFormState.currentTab === 'other'"
|
|
|
|
|
id="drawer-other"
|
|
|
|
|
prefix-id="drawer-employee"
|
|
|
|
|
dense
|
|
|
|
|
outlined
|
|
|
|
|
v-model:employee-other="
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo
|
|
|
|
|
"
|
|
|
|
|
@undo="
|
|
|
|
|
() => {
|
|
|
|
|
if (
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo?.statusSave ===
|
|
|
|
|
false
|
|
|
|
|
) {
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo.statusSave = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
@edit="
|
|
|
|
|
() => {
|
|
|
|
|
if (currentFromDataEmployee.employeeOtherInfo?.statusSave) {
|
|
|
|
|
currentFromDataEmployee.employeeOtherInfo.statusSave = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
2024-08-05 16:48:19 +07:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</DrawerInfo>
|
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 {
|
2024-08-27 15:03:56 +07:00
|
|
|
--_branch-status-color: var(--stone-5-hsl);
|
|
|
|
|
--_branch-badge-bg: var(--stone-5-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-08-19 11:39:10 +07:00
|
|
|
|
|
|
|
|
.btn-arrow-right {
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
transition: transform 0.3s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.btn-arrow-right.active {
|
|
|
|
|
transform: rotate(90deg);
|
|
|
|
|
transition: transform 0.3s ease;
|
|
|
|
|
}
|
2024-04-23 11:15:25 +00:00
|
|
|
</style>
|