diff --git a/src/boot/axios.ts b/src/boot/axios.ts index 250928ca..0813e004 100644 --- a/src/boot/axios.ts +++ b/src/boot/axios.ts @@ -57,7 +57,9 @@ api.interceptors.response.use( persistent: true, enablei18n: true, message: `dialog.backend.${parseError(err.response.status, err.response.data)}`, - action: () => {}, + action: () => { + if (err.response.status === 401) window.location.reload(); + }, }); }, ); diff --git a/src/components/03_customer-management/FormEmployeePassport.vue b/src/components/03_customer-management/FormEmployeePassport.vue index b7a3e6e5..80ea8775 100644 --- a/src/components/03_customer-management/FormEmployeePassport.vue +++ b/src/components/03_customer-management/FormEmployeePassport.vue @@ -32,6 +32,8 @@ const firstName = defineModel('firstName'); const namePrefix = defineModel('namePrefix'); const passportNumber = defineModel('passportNumber'); +const passportValidator = /[a-zA-Z]{1}[a-zA-Z0-9]{1}[0-9]{5,7}$/; + const genderOptions = ref[]>([]); let genderFilter: ( value: string, @@ -275,7 +277,6 @@ watch( - @@ -484,7 +486,9 @@ watch( :label="$t('customerEmployee.form.passportNo')" v-model="passportNumber" :rules="[ - (val) => (val && val.length > 0) || $t('form.error.required'), + (val) => !!val || $t('form.error.required'), + (val) => + passportValidator.test(val) || $t('form.error.passportFormat'), ]" /> diff --git a/src/components/shared/select/SelectAgent.vue b/src/components/shared/select/SelectAgent.vue new file mode 100644 index 00000000..d3addfe2 --- /dev/null +++ b/src/components/shared/select/SelectAgent.vue @@ -0,0 +1,127 @@ + + diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 22487124..fcf4bfa1 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -139,6 +139,7 @@ export default { import: 'Import', numberOfDay: 'Number of days', other: 'Other', + agencyAddress: 'Agency Address', }, menu: { @@ -299,6 +300,7 @@ export default { branchNameField: "Only letters, numbers, or the characters . , - ' &.", branchNameENField: "Only English letters, numbers, or the characters . , - ' &.", + passportFormat: 'Please enter the passport number in the correct format.', }, warning: { title: 'Warning {msg}', @@ -958,6 +960,10 @@ export default { Validate: 'Validate', Complete: 'Complete', Canceled: 'Canceled', + Restart: 'go proceed again', + receive: { + Canceled: 'Canceled', + }, }, receiveTask: 'Receive Task', @@ -977,7 +983,7 @@ export default { noRequestAvailable: 'There is no request list available for processing', validate: 'Validate', done: 'Done', - confirmValidate: 'Confirm Validate', + confirmEndWork: 'Confirm end of work', }, dialog: { @@ -1012,6 +1018,10 @@ export default { confirmValidate: 'Do you confirm the validation?', warningSelectDeliveryStaff: 'You have not yet selected a document delivery staff.', + + confirmEndWorkWarning: + "Do you want to end the work now? The current statuses 'Pending', 'In Progress', 'To Be Reprocessed' will be changed to 'Redo All'.", + confirmEndWork: 'Do you want to end the work?', }, action: { ok: 'OK', diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index 3fdcc190..e5a962f7 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -139,6 +139,7 @@ export default { next: 'ถัดไป', numberOfDay: 'จำนวนวัน', other: 'อื่นๆ', + agencyAddress: 'ที่อยู่หน่วยงาน ', }, menu: { @@ -298,6 +299,7 @@ export default { branchNameField: "โปรดใช้ตัวอักษร ตัวเลข หรือ . , - ' & เท่านั้น", branchNameENField: "โปรดใช้ตัวอักษรภาษาอังกฤษ ตัวเลข หรือ . , - ' & เท่านั้น", + passportFormat: 'กรุณากรอกหมายเลขพาสปอร์ตให้ถูกต้องตามรูปแบบ', }, warning: { title: 'แจ้งเตือน {msg}', @@ -941,12 +943,15 @@ export default { InProgress: 'กำลังดำเนินการ ', Success: 'ดำเนินการสำเร็จ', Failed: 'ดำเนินการไม่สำเร็จ', - Redo: 'ทำใหม่', + Redo: 'ยกเลิกรอดำเนินการใหม่', Validate: 'ตรวจสอบความถูกต้อง', Complete: 'ดำเนินการเสร็จสิ้น', - Canceled: ' รายการคำขอถูกยกเลิก', + Canceled: 'รายการคำขอถูกยกเลิก', + Restart: 'ไปดำเนินการใหม่', + receive: { + Canceled: 'ยกเลิก', + }, }, - receiveTask: 'รับงาน', receiveScan: 'รับงานแบบสแกน', receiveCustom: 'รับงานแบบเลือกเอง', @@ -964,7 +969,7 @@ export default { noRequestAvailable: 'ไม่มีใบรายการคำขอที่สามารถดำเนินการได้', validate: 'ตรวจสอบสินค้า', done: 'ดำเนินการแล้ว', - confirmValidate: 'ยืนยันการตรวจสอบ', + confirmEndWork: 'ยืนยันการจบงาน', }, dialog: { @@ -996,7 +1001,8 @@ export default { confirmSavingStatus: 'คุณต้องการยืนยันการบันทึกข้อมูลการเปลี่ยนสถานะใช่หรือไม่', confirmSending: 'ยืนยันการส่งงานใช่หรือไม่', - confirmValidate: 'ยืนยันการตรวจสอบใช่หรือไม่', + confirmEndWorkWarning: `ท่านต้องการให้ดำเนินการจบงานในขณะนี้หรือไม่? สถานะปัจจุบันที่แสดงว่า 'รอดำเนินการ' 'กำลังดำเนินการ' 'ไปดำเนินการใหม่' จะถูกเปลี่ยนเป็น 'ทำใหม่ทั้งหมด'`, + confirmEndWork: 'ท่านต้องการจบงานใช่หรือไม่', }, action: { ok: 'ยืนยัน', diff --git a/src/pages/03_customer-management/MainPage.vue b/src/pages/03_customer-management/MainPage.vue index cdfd28cd..e8d88d02 100644 --- a/src/pages/03_customer-management/MainPage.vue +++ b/src/pages/03_customer-management/MainPage.vue @@ -4630,7 +4630,7 @@ const emptyCreateDialog = ref(false); " class="q-mb-xl" /> - -import useUserStore from 'stores/user'; -import { ref } from 'vue'; -import { useI18n } from 'vue-i18n'; - -import SelectInput from 'src/components/shared/SelectInput.vue'; -import { QSelect } from 'quasar'; - -const userStore = useUserStore(); -const { locale } = useI18n({ useScope: 'global' }); +import SelectAgent from 'src/components/shared/select/SelectAgent.vue'; defineProps<{ readonly?: boolean; @@ -20,41 +12,6 @@ const officeTel = defineModel('officeTel'); const agent = defineModel('agent'); const agentUserId = defineModel('agentUserId'); - -const agentOptions = ref<{ id: string; label: string; labelEN: string }[]>([]); - -async function fetchAgentOptions(query: string) { - const res = await userStore.fetchList({ - includeBranch: true, - query: query, - pageSize: 99999, - userType: 'DELEGATE', - status: 'ACTIVE', - }); - - if (res) { - agentOptions.value = res.result.map((v) => ({ - id: v.id, - label: v.firstName + ' ' + v.lastName, - labelEN: v.firstNameEN + ' ' + v.lastNameEN, - })); - } -} - -async function filter(val: string, update: (...args: unknown[]) => void) { - update( - async () => { - await fetchAgentOptions(val); - }, - - (ref: QSelect) => { - if (val !== '' && ref.options && ref.options?.length > 0) { - ref.setOptionIndex(-1); - ref.moveOptionSelection(1, true); - } - }, - ); -} - diff --git a/src/pages/05_quotation/MainPage.vue b/src/pages/05_quotation/MainPage.vue index db693382..8c09854f 100644 --- a/src/pages/05_quotation/MainPage.vue +++ b/src/pages/05_quotation/MainPage.vue @@ -59,10 +59,12 @@ const { state: customerFormState, currentFormData: customerFormData } = const { currentMyBranch } = storeToRefs(userBranch); const fieldSelectedOption = computed(() => { - return columnQuotation.map((v) => ({ - label: v.label, - value: v.name, - })); + return columnQuotation + .filter((v) => v.name !== 'action') + .map((v) => ({ + label: v.label, + value: v.name, + })); }); const special = ref(false); const branchId = ref(''); diff --git a/src/pages/06_edm/MainPage.vue b/src/pages/06_edm/MainPage.vue index 922637f6..add6ea2d 100644 --- a/src/pages/06_edm/MainPage.vue +++ b/src/pages/06_edm/MainPage.vue @@ -4,6 +4,7 @@ import { getInstance } from 'src/services/keycloak'; import { useNavigator } from 'src/stores/navigator'; import { useI18n } from 'vue-i18n'; import { useQuasar } from 'quasar'; +import { initLang } from 'src/utils/ui'; const $q = useQuasar(); const { locale } = useI18n(); @@ -25,6 +26,8 @@ function sendMessage() { } onMounted(() => { + initLang(); + currentLocale.value = locale.value; navigatorStore.current.title = 'menu.dms'; navigatorStore.current.path = [ { @@ -47,12 +50,14 @@ watch( watch([locale, $q.dark], () => { sendMessage(); }); + +const currentLocale = ref(locale.value);