diff --git a/src/components/upload-file/UploadFileGroup.vue b/src/components/upload-file/UploadFileGroup.vue new file mode 100644 index 00000000..7bb2d84f --- /dev/null +++ b/src/components/upload-file/UploadFileGroup.vue @@ -0,0 +1,227 @@ + + + + + diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index 37a2ff2b..367125a8 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -32,7 +32,6 @@ import BranchCard from 'src/components/01_branch-management/BranchCard.vue'; import ItemCard from 'src/components/ItemCard.vue'; import DrawerInfo from 'components/DrawerInfo.vue'; import ButtonAddComponent from 'components/ButtonAddCompoent.vue'; -import PersonCard from 'components/shared/PersonCard.vue'; import StatCardComponent from 'components/StatCardComponent.vue'; import TooltipComponent from 'components/TooltipComponent.vue'; import EmptyAddButton from 'components/AddButton.vue'; @@ -49,15 +48,14 @@ import SideMenu from 'components/SideMenu.vue'; import { AddButton } from 'components/button'; import TableEmpoloyee from 'src/components/03_customer-management/TableEmpoloyee.vue'; import { calculateAge, toISOStringWithTimezone } from 'src/utils/datetime'; -import { UploadFile } from 'components/upload-file'; +import { UploadFileGroup } from 'components/upload-file'; import { columnsCustomer, columnsEmployee, formMenuIconEmployee, uploadFileListEmployee, - uploadFileListCustomer, - countryCode, + columnsAttachment, } from './constant'; import { useCustomerForm, useEmployeeForm } from './form'; import { storeToRefs } from 'pinia'; @@ -69,7 +67,11 @@ import FormEmployeeOther from 'components/03_customer-management/FormEmployeeOth import useOptionStore from 'stores/options'; import { DialogContainer, DialogHeader } from 'components/dialog'; import KebabAction from 'src/components/shared/KebabAction.vue'; -import { roundElectricalServices } from '@quasar/extras/material-icons-round'; + +const currentSelectedMenu = ref<{ label: string; value: string }>({ + label: '', + value: '', +}); const { t, locale } = useI18n(); const $q = useQuasar(); @@ -182,6 +184,8 @@ const customerTypeSelected = ref<{ }); const customerNameInfo = computed(() => { + if (customerFormData.value.customerBranch === undefined) return; + const name = locale.value === 'eng' ? `${customerFormData.value.customerBranch[0]?.firstNameEN} ${customerFormData.value.customerBranch[0]?.lastNameEN}` @@ -192,6 +196,7 @@ const currentBtnOpen = ref([]); const employeeStats = ref(0); const gridView = ref(false); const splitPercent = ref(15); // Customer only + const currentPageCustomer = ref(1); const maxPageCustomer = ref(1); const currentPageEmployee = ref(1); @@ -618,12 +623,6 @@ function createEmployeeForm() { employeeFormState.value.isEmployeeEdit = true; } -function returnCountryCode(country: string) { - const tempValue = countryCode?.find((v) => v.label.includes(country)); - - return tempValue?.value; -} - async function fetchImageList( id: string, selectedName: string, @@ -682,56 +681,6 @@ watch( }, ); -function assignOcrEmployeeData(data: { - document: string; - fields: { name: string; value: string }[]; - result: string; -}) { - const map = data.fields.reduce>((a, c) => { - a[c.name] = c.value; - return a; - }, {}); - - const temp = data.document.split('_').at(0) || ''; - - if (data.document.includes('passport')) { - if (!currentFromDataEmployee.value.passportNumber) - currentFromDataEmployee.value.passportNumber = map['passport_no'] || ''; - if (!currentFromDataEmployee.value.passportIssueDate) - currentFromDataEmployee.value.passportIssueDate = - new Date(map['issue_date']) || ''; - if (!currentFromDataEmployee.value.passportExpiryDate) - currentFromDataEmployee.value.passportExpiryDate = - new Date(map['expire_date']) || ''; - - if (currentFromDataEmployee.value.passportIssuingPlace) - currentFromDataEmployee.value.passportIssuingPlace = temp; - - if (currentFromDataEmployee.value.passportIssuingCountry) - currentFromDataEmployee.value.passportIssuingCountry = - returnCountryCode(temp) || ''; - } - - if (data.document.includes('visa')) { - if (!currentFromDataEmployee.value.visaType) - currentFromDataEmployee.value.visaType = map['visa_type'] || ''; - - if (!currentFromDataEmployee.value.visaIssueDate) - currentFromDataEmployee.value.visaIssueDate = - new Date(map['issue_date']) || ''; - - if (!currentFromDataEmployee.value.visaIssuingPlace) - currentFromDataEmployee.value.visaIssuingPlace = map['issue_place'] || ''; - - if (!currentFromDataEmployee.value.visaExpiryDate) - currentFromDataEmployee.value.visaExpiryDate = - new Date(map['valid_until']) || ''; - - if (!currentFromDataEmployee.value.visaNumber) - currentFromDataEmployee.value.visaNumber = map['visa_no'] || ''; - } -} - watch( () => employeeFormState.value.currentTab, () => { @@ -1920,6 +1869,7 @@ const emptyCreateDialog = ref(false);
- - - -
{{ $t(`general.uploadFile`) }}
- - @@ -2872,7 +2710,7 @@ const emptyCreateDialog = ref(false); await customerStore.addImageList( v, customerFormState.editCustomerId, - Date.now(), + Date.now().toString(), ); await fetchImageList( customerFormState.editCustomerId, @@ -2982,7 +2820,7 @@ const emptyCreateDialog = ref(false); await employeeStore.addImageList( v, currentFromDataEmployee.id, - Date.now(), + Date.now().toString(), ); await fetchImageList( currentFromDataEmployee.id, @@ -3110,6 +2948,7 @@ const emptyCreateDialog = ref(false);
- -
@@ -3808,140 +3600,73 @@ const emptyCreateDialog = ref(false); /> {{ $t(`general.uploadFile`) }}
- -