diff --git a/src/components/DialogForm.vue b/src/components/DialogForm.vue index c3e7eae3..7295c62b 100644 --- a/src/components/DialogForm.vue +++ b/src/components/DialogForm.vue @@ -140,18 +140,21 @@ const currentTab = defineModel('currentTab'); {{ badgeLabel }} - + +
+ +
diff --git a/src/components/dialog/DialogFormContainer.vue b/src/components/dialog/DialogFormContainer.vue index b28075ad..ccf174d2 100644 --- a/src/components/dialog/DialogFormContainer.vue +++ b/src/components/dialog/DialogFormContainer.vue @@ -57,7 +57,7 @@ const state = defineModel({ default: false });
diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 2cf172b3..6140c8ff 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -130,6 +130,7 @@ export default { visaNo: 'VISA No.', enterToAdd: 'Press enter to add.', forExample: 'eg. {example}', + importFromFile: 'Import From File {suffix}', }, menu: { @@ -710,6 +711,8 @@ export default { }, quotation: { + addWorker: 'Add Worker', + importWorker: 'Search for worker from the data.', templateForm: 'Select a template document form.', title: 'Quotation', caption: 'All Quotation', @@ -843,6 +846,7 @@ export default { confirmChangeStatus: 'Confirm Status Change', confirmDelete: 'Confirm Deletion {msg}', youngWorker: 'Employee under 15', + importWorker: 'Import Worker', confirmLogout: 'Confirm Logout', confirmQuotationAccept: 'Confirm acceptance of the quotation.', }, diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index d25dde27..b52093a8 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -130,6 +130,7 @@ export default { visaNo: 'หมายเลขหนังสือลงตรา', enterToAdd: 'กดปุ่ม Enter เพื่อเพิ่ม', forExample: 'เช่น {example}', + importFromFile: 'นำเข้าจากไฟล์ {suffix}', }, menu: { @@ -702,6 +703,8 @@ export default { }, quotation: { + addWorker: 'เพิ่มแรงงาน', + importWorker: 'ค้นหาแรงงานจากข้อมูล ', templateForm: 'เลือกแบบฟอร์มเอกสารต้นแบบ', title: 'ใบเสนอราคา', caption: 'ใบเสนอราคาทั้งหมด', @@ -836,6 +839,7 @@ export default { confirmChangeStatus: 'ยืนยันการเปลี่ยนสถานะ', confirmDelete: 'ยืนยันการลบ {msg}', youngWorker: 'ลูกจ้างอายุต่ำกว่า 15 ปี', + importWorker: 'นำเข้าคนงาน', confirmLogout: 'ยืนยันการออกจากระบบ', confirmQuotationAccept: 'ยืนยันการตอบรับใบเสนอราคา', }, diff --git a/src/pages/05_quotation/ImportWorker.vue b/src/pages/05_quotation/ImportWorker.vue new file mode 100644 index 00000000..1a9dbbd8 --- /dev/null +++ b/src/pages/05_quotation/ImportWorker.vue @@ -0,0 +1,232 @@ + + + + + diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index e87fee63..6d504738 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -56,6 +56,7 @@ import ToggleButton from 'components/button/ToggleButton.vue'; import FormAbout from 'components/05_quotation/FormAbout.vue'; import SelectZone from 'components/shared/SelectZone.vue'; import PersonCard from 'components/shared/PersonCard.vue'; +import ImportWorker from './ImportWorker.vue'; import { AddButton, SaveButton, @@ -233,6 +234,7 @@ const pageState = reactive({ fieldSelected: [], gridView: false, isLoaded: false, + importWorker: false, currentTab: 'all', addModal: false, @@ -1043,9 +1045,50 @@ async function getInvoiceCodeFullPay() { const ret = await invoiceStore.getInvoiceList(); if (ret) code.value = ret.result.at(0)?.code || ''; } + +const importWorkerCriteria = ref<{ + passport: string[] | null; + visa: string[] | null; +}>({ + passport: [], + visa: [], +}); + +async function getWorkerFromCriteria( + payload: typeof importWorkerCriteria.value, +) { + const ret = await employeeStore.fetchList({ + payload: { + passport: payload.passport || undefined, + }, + pageSize: 99999, // must include all possible worker + page: 1, + passport: true, + customerBranchId: quotationFormData.value.customerBranchId, + }); + + if (!ret) return false; // error, do not close dialog + + // TODO: Merge employee into worker list + const deduplicate = ret.result.filter( + (a) => !selectedWorker.value.find((b) => a.id === b.id), + ); + + preSelectedWorker.value = [...deduplicate, ...selectedWorker.value]; + + convertEmployeeToTable(); + + return true; +}