diff --git a/public/images/customer-CORP-avartar-female.png b/public/images/customer-CORP-avartar-female.png index 446ef866..4cbb894f 100644 Binary files a/public/images/customer-CORP-avartar-female.png and b/public/images/customer-CORP-avartar-female.png differ diff --git a/public/images/customer-CORP-avartar-male.png b/public/images/customer-CORP-avartar-male.png index 6ad95d7d..ae177f60 100644 Binary files a/public/images/customer-CORP-avartar-male.png and b/public/images/customer-CORP-avartar-male.png differ diff --git a/public/images/customer-PERS-avartar-female.png b/public/images/customer-PERS-avartar-female.png index ca0a2bf1..c3ba574e 100644 Binary files a/public/images/customer-PERS-avartar-female.png and b/public/images/customer-PERS-avartar-female.png differ diff --git a/public/images/customer-PERS-avartar-male.png b/public/images/customer-PERS-avartar-male.png index e9fd15fe..ce0ab20c 100644 Binary files a/public/images/customer-PERS-avartar-male.png and b/public/images/customer-PERS-avartar-male.png differ diff --git a/public/images/employee-avatar-female.png b/public/images/employee-avatar-female.png index 66ace3a0..ce9370f1 100644 Binary files a/public/images/employee-avatar-female.png and b/public/images/employee-avatar-female.png differ diff --git a/public/images/employee-avatar-male.png b/public/images/employee-avatar-male.png index a8daa8ff..aaf5fb1f 100644 Binary files a/public/images/employee-avatar-male.png and b/public/images/employee-avatar-male.png differ diff --git a/public/no-img-female.png b/public/no-img-female.png index 4e177dca..95f959ff 100644 Binary files a/public/no-img-female.png and b/public/no-img-female.png differ diff --git a/public/no-img-man.png b/public/no-img-man.png index 861f356a..f0ccba15 100644 Binary files a/public/no-img-man.png and b/public/no-img-man.png differ diff --git a/public/option/option.json b/public/option/option.json index c5ea33cd..963c4ad2 100644 --- a/public/option/option.json +++ b/public/option/option.json @@ -183,15 +183,15 @@ "prefix": [ { - "label": "Mr", + "label": "MR", "value": "mr" }, { - "label": "Mrs", + "label": "MRS", "value": "mrs" }, { - "label": "Miss", + "label": "MISS", "value": "miss" } ], diff --git a/src/components/01_branch-management/BranchCard.vue b/src/components/01_branch-management/BranchCard.vue index 83c268ba..c10d63fc 100644 --- a/src/components/01_branch-management/BranchCard.vue +++ b/src/components/01_branch-management/BranchCard.vue @@ -89,15 +89,7 @@ defineProps<{ -
+ + + {
+
{{ $t('general.advanceSearch') }}
diff --git a/src/components/shared/PersonCard.vue b/src/components/shared/PersonCard.vue index 3abc14b0..d53a0b5c 100644 --- a/src/components/shared/PersonCard.vue +++ b/src/components/shared/PersonCard.vue @@ -23,6 +23,8 @@ defineProps<{ history?: boolean; prefixId?: string; separateEnter?: boolean; + hideAction?: boolean; + hideDelete?: boolean; }>(); defineEmits<{ @@ -76,8 +78,10 @@ defineEmits<{ /> + + diff --git a/src/components/shared/select/SelectQuotation.vue b/src/components/shared/select/SelectQuotation.vue index ae9f7863..344e500b 100644 --- a/src/components/shared/select/SelectQuotation.vue +++ b/src/components/shared/select/SelectQuotation.vue @@ -25,6 +25,7 @@ const { getQuotationList: getList, getQuotation: getById } = useStore(); defineEmits<{ (e: 'create'): void; + (e: 'selected', value: SelectOption): void; }>(); type ExclusiveProps = { @@ -117,6 +118,14 @@ function setDefaultValue() { (v: string) => !props.required || !!v || $t('form.error.required'), ]" @filter="filter" + @update:model-value=" + (v) => { + $emit( + 'selected', + selectOptions.find((opt) => opt.id === v), + ); + } + " > - { const customerStore = useCustomerStore(); + const onCreateImageList = ref<{ + selectedImage: string; + list: { url: string; imgFile: File | null; name: string }[]; + }>({ selectedImage: '', list: [] }); const { t } = useI18n(); const flowStore = useFlowStore(); @@ -30,11 +34,13 @@ export const useCustomerForm = defineStore('form-customer', () => { const registerAbleBranchOption = ref<{ id: string; name: string }[]>(); + const currentBranchRootId = ref(''); + const tabFieldRequired = ref<{ [key: string]: (keyof CustomerBranchCreate)[]; }>({ main: [], - business: ['businessType', 'jobPosition'], + business: ['businessTypeId', 'jobPosition'], address: [ 'address', 'addressEN', @@ -82,6 +88,7 @@ export const useCustomerForm = defineStore('form-customer', () => { formDataOcr: Record; isImageEdit: boolean; currentCustomerId?: string; + imageList: { list: string[]; selectedImage: string }; }>({ dialogType: 'info', dialogOpen: false, @@ -98,6 +105,7 @@ export const useCustomerForm = defineStore('form-customer', () => { treeFile: [], formDataOcr: {}, isImageEdit: false, + imageList: { list: [], selectedImage: '' }, }); watch( @@ -160,6 +168,7 @@ export const useCustomerForm = defineStore('form-customer', () => { state.value.editCustomerCode = data.code; state.value.customerImageUrl = `${baseUrl}/customer/${id}/image/${data.selectedImage}`; state.value.defaultCustomerImageUrl = `${baseUrl}/customer/${id}/image/${data.selectedImage}`; + currentBranchRootId.value = data.branch[0].id || ''; resetFormData.registeredBranchId = data.registeredBranchId; resetFormData.status = data.status; @@ -181,7 +190,7 @@ export const useCustomerForm = defineStore('form-customer', () => { payDate: v.payDate, jobDescription: v.jobDescription, jobPosition: v.jobPosition, - businessType: v.businessType, + businessTypeId: v.businessTypeId, employmentOffice: v.employmentOffice, employmentOfficeEN: v.employmentOfficeEN, telephoneNo: v.telephoneNo, @@ -218,7 +227,6 @@ export const useCustomerForm = defineStore('form-customer', () => { contactTel: v.contactTel, officeTel: v.officeTel, agentUserId: v.agentUserId || undefined, - customerName: v.customerName, authorizedName: v.authorizedName, authorizedNameEN: v.authorizedNameEN, @@ -256,7 +264,6 @@ export const useCustomerForm = defineStore('form-customer', () => { async function addCurrentCustomerBranch() { if (currentFormData.value.customerBranch?.some((v) => !v.id)) return; currentFormData.value.customerBranch?.push({ - id: '', customerId: '', branchCode: currentFormData.value.customerBranch.length !== 0 @@ -290,8 +297,8 @@ export const useCustomerForm = defineStore('form-customer', () => { birthDate: currentFormData.value.customerBranch?.at(0)?.birthDate || undefined, - businessType: - currentFormData.value.customerBranch?.at(0)?.businessType || '', + businessTypeId: + currentFormData.value.customerBranch?.at(0)?.businessTypeId || '', jobPosition: currentFormData.value.customerBranch?.at(0)?.jobPosition || '', jobDescription: @@ -328,8 +335,6 @@ export const useCustomerForm = defineStore('form-customer', () => { currentFormData.value.customerBranch?.at(0)?.agentUserId || undefined, status: 'CREATED', - customerName: - currentFormData.value.customerBranch?.at(0)?.customerName || '', registerName: currentFormData.value.customerBranch?.at(0)?.registerName || '', registerNameEN: @@ -498,11 +503,14 @@ export const useCustomerForm = defineStore('form-customer', () => { } return { + onCreateImageList, tabFieldRequired, registerAbleBranchOption, state, resetFormData, currentFormData, + currentBranchRootId, + isFormDataDifferent, resetForm, assignFormData, @@ -541,7 +549,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { gender: '', birthDate: undefined, - businessType: '', + businessTypeId: '', jobPosition: '', jobDescription: '', payDate: '', @@ -571,7 +579,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { agentUserId: undefined, status: 'CREATED', - customerName: '', registerName: '', registerNameEN: '', registerDate: undefined, @@ -623,7 +630,7 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { payDateEN: _data.payDateEN, jobDescription: _data.jobDescription, jobPosition: _data.jobPosition, - businessType: _data.businessType, + businessTypeId: _data.businessTypeId, employmentOffice: _data.employmentOffice, employmentOfficeEN: _data.employmentOfficeEN, telephoneNo: _data.telephoneNo, @@ -657,7 +664,6 @@ export const useCustomerBranchForm = defineStore('form-customer-branch', () => { officeTel: _data.officeTel, agentUserId: _data.agentUserId || undefined, codeCustomer: _data.codeCustomer, - customerName: _data.customerName, homeCode: _data.homeCode, authorizedName: _data.authorizedName, authorizedNameEN: _data.authorizedNameEN, @@ -784,6 +790,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { } | undefined; ocr: boolean; + imageList: { list: string[]; selectedImage: string }; }>({ currentBranchId: '', isImageEdit: false, @@ -808,9 +815,10 @@ export const useEmployeeForm = defineStore('form-employee', () => { infoEmployeePersonCard: [], formDataEmployeeOwner: undefined, ocr: false, + imageList: { list: [], selectedImage: '' }, }); - const defaultFormData: EmployeeCreate = { + const defaultFormData: EmployeeCreate & { image?: File } = { id: '', code: '', customerBranchId: '', @@ -892,6 +900,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { expireDate: new Date(), remark: undefined, workerType: '', + reportDate: null, number: '', }, ], @@ -937,7 +946,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { }; let resetEmployeeData = structuredClone(defaultFormData); - const currentFromDataEmployee = ref( + const currentFromDataEmployee = ref( structuredClone(defaultFormData), ); @@ -959,7 +968,8 @@ export const useEmployeeForm = defineStore('form-employee', () => { state.value.currentIndexVisa = -1; state.value.currentIndexCheckup = -1; state.value.currentIndexWorkHistory = -1; - state.value.currentTab = 'personalInfo'; + state.value.imageList = { list: [], selectedImage: '' }; + // state.value.currentTab = 'personalInfo'; if (clean) { state.value.formDataEmployeeOwner = undefined; resetEmployeeData = structuredClone(defaultFormData); @@ -986,12 +996,16 @@ export const useEmployeeForm = defineStore('form-employee', () => { state.value.currentIndexPassport ].id === undefined ) { + const { id, employeeId, updatedAt, createdAt, file, ...payload } = + currentFromDataEmployee.value.employeePassport?.[ + state.value.currentIndexPassport + ]; + const res = await employeeStore.postMeta({ parentId: currentFromDataEmployee.value.id || '', group: 'passport', - meta: currentFromDataEmployee.value.employeePassport?.[ - state.value.currentIndexPassport - ], + meta: payload, + file: file, }); if (res) { @@ -1005,7 +1019,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { state.value.currentIndexPassport ].id !== undefined ) { - const { id, employeeId, updatedAt, createdAt, ...payload } = + const { id, employeeId, updatedAt, createdAt, file, ...payload } = currentFromDataEmployee.value.employeePassport?.[ state.value.currentIndexPassport ]; @@ -1018,6 +1032,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { state.value.currentIndexPassport ].id || '', meta: payload, + file: file || undefined, }); } @@ -1245,7 +1260,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { await assignFormDataEmployee(currentFromDataEmployee.value.id); } - async function submitPersonal(imgList: { + async function submitPersonal(imgList?: { selectedImage: string; list: { url: string; imgFile: File | null; name: string }[]; }) { @@ -1266,6 +1281,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { currentFromDataEmployee.value.lastNameEN.trim(); if (state.value.dialogType === 'create') { + delete currentFromDataEmployee.value.image; const res = await employeeStore.create( { ...currentFromDataEmployee.value, @@ -1294,7 +1310,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { state.value.currentEmployee?.status === 'CREATED' ? 'ACTIVE' : state.value.currentEmployee?.status, - customerBranchId: state.value.formDataEmployeeOwner?.id || '', + customerBranchId: state.value.currentBranchId || '', employeeWork: [], employeeCheckup: [], employeeOtherInfo: undefined, @@ -1382,12 +1398,10 @@ export const useEmployeeForm = defineStore('form-employee', () => { statusSave: true, })), ), - employeeOtherInfo: structuredClone( - { - ...payload.employeeOtherInfo, - statusSave: !!payload.employeeOtherInfo?.id ? true : false, - } || {}, - ), + employeeOtherInfo: structuredClone({ + ...(payload.employeeOtherInfo ?? {}), + statusSave: true, + }), employeeWork: structuredClone( payload.employeeWork?.length === 0 ? state.value.dialogModal @@ -1536,6 +1550,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { expireDate: new Date(), remark: undefined, workerType: '', + reportDate: null, number: '', }); @@ -1660,6 +1675,7 @@ export const useEmployeeForm = defineStore('form-employee', () => { state, currentFromDataEmployee, resetEmployeeData, + addPassport, addVisa, addCheckup, diff --git a/src/pages/04_flow-managment/FlowDialog.vue b/src/pages/04_flow-managment/FlowDialog.vue index e3958ac8..42c429ba 100644 --- a/src/pages/04_flow-managment/FlowDialog.vue +++ b/src/pages/04_flow-managment/FlowDialog.vue @@ -43,6 +43,7 @@ withDefaults( defineProps<{ readonly?: boolean; isEdit?: boolean; + hideAction?: boolean; }>(), { readonly: false, isEdit: false }, ); @@ -207,7 +208,7 @@ function triggerPropertiesDialog(step: WorkFlowPayloadStep) { style="position: absolute; z-index: 999; top: 0; right: 0" >
-
@@ -1745,7 +1812,9 @@ function covertToNode() { :readonly=" { quotation: quotationFormState.mode !== 'edit', - invoice: false, + invoice: + isRoleInclude(['sale', 'head_of_sale']) || + !canAccess('quotation', 'edit'), accepted: true, }[view] " @@ -1856,10 +1925,10 @@ function covertToNode() { installments: quotationFormData.paySplit, }, 'quotation-labor': { - name: selectedWorker.map( + name: selectedWorkerItem.map( (v, i) => `${i + 1}. ` + - `${v.employeePassport.length !== 0 ? v.employeePassport[0].number + '_' : ''} ${v.namePrefix}.${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(), + `${v.employeePassport.length !== 0 ? v.employeePassport[0].number + '_' : ''}${v.namePrefix}.${v.firstNameEN ? `${v.firstNameEN} ${v.lastNameEN}` : `${v.firstName} ${v.lastName}`} `.toUpperCase(), ), }, }) @@ -1949,6 +2018,11 @@ function covertToNode() { view !== View.Receipt && view !== View.Complete " + :branch-id="quotationFull.registeredBranchId" + :readonly=" + isRoleInclude(['sale', 'head_of_sale']) || + !canAccess('quotation', 'edit') + " :data="quotationFormState.source" v-model:first-code-payment="firstCodePayment" @fetch-status=" @@ -2087,7 +2161,14 @@ function covertToNode() { :style="`background-color:hsla(var(--info-bg) / 0.07)`" > - + @@ -2298,9 +2378,15 @@ function covertToNode() {
-