diff --git a/src/i18n/eng.ts b/src/i18n/eng.ts index 24f19ee9..d35ab235 100644 --- a/src/i18n/eng.ts +++ b/src/i18n/eng.ts @@ -4,7 +4,7 @@ export default { save: 'Save', open: 'Open', close: 'Close', - edit: 'Edit', + edit: 'Edit{text}', cancel: 'Cancel', back: 'Back', undo: 'Undo', @@ -31,6 +31,7 @@ export default { displayField: 'Display Fields', order: 'Order', name: '{msg} Name', + nameEN: 'Name (English)', fullName: 'Full Name', detail: '{msg} Detail', remark: '{msg} Remark', @@ -209,6 +210,7 @@ export default { customer: 'Customer', mainData: 'Main Data', agencies: 'Agencies', + businessType: 'Business Type', }, sales: { @@ -1510,4 +1512,11 @@ export default { last90Days: 'Last 90 Days', customDateRange: 'Custom Date Range', }, + + businessType: { + title: 'Business Type', + caption: 'Manage Business Type', + name: 'Business Type Name', + nameEn: 'Business Type Name (English)', + }, }; diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index e8109479..57337ad1 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -4,7 +4,7 @@ export default { save: 'บันทึก', open: 'เปิด', close: 'ปิด', - edit: 'แก้ไข', + edit: 'แก้ไข{text}', cancel: 'ยกเลิก', back: 'ย้อนกลับ', undo: 'ย้อนกลับ', @@ -31,6 +31,7 @@ export default { displayField: 'ฟิลด์แสดงผล', order: 'ลำดับ', name: 'ชื่อ{msg}', + nameEN: 'ชื่อ (ภาษาอังกฤษ)', fullName: 'ชื่อ-สกุล', detail: 'รายละเอียด{msg}', remark: 'หมายเหตุ{msg}', @@ -209,6 +210,7 @@ export default { customer: 'ลูกค้า', mainData: 'ข้อมูลหลัก', agencies: 'หน่วยงาน', + businessType: 'ประเภทกิจการ', }, sales: { @@ -1498,4 +1500,11 @@ export default { last90Days: '90 วันที่ผ่านมา', customDateRange: 'กำหนดช่วงวันที่เอง', }, + + businessType: { + title: 'ประเภทกิจการ', + caption: 'จัดการประเภทกิจการ', + name: 'ชื่อประเภทกิจการ', + nameEn: 'ชื่อประเภทกิจการ (ภาษาอังกฤษ)', + }, }; diff --git a/src/layouts/DrawerComponent.vue b/src/layouts/DrawerComponent.vue index 4d7ea910..3de9b21a 100644 --- a/src/layouts/DrawerComponent.vue +++ b/src/layouts/DrawerComponent.vue @@ -106,6 +106,10 @@ function initMenu() { label: 'agencies', route: '/agencies-management', }, + { + label: 'businessType', + route: '/business-type', + }, ], }, { diff --git a/src/pages/16_ิbusiness-type-management/AgenciesDialog.vue b/src/pages/16_ิbusiness-type-management/AgenciesDialog.vue deleted file mode 100644 index e1597b03..00000000 --- a/src/pages/16_ิbusiness-type-management/AgenciesDialog.vue +++ /dev/null @@ -1,658 +0,0 @@ - - - diff --git a/src/pages/16_ิbusiness-type-management/BusinessTypeDialog.vue b/src/pages/16_ิbusiness-type-management/BusinessTypeDialog.vue new file mode 100644 index 00000000..f0a6f0ff --- /dev/null +++ b/src/pages/16_ิbusiness-type-management/BusinessTypeDialog.vue @@ -0,0 +1,84 @@ + + + diff --git a/src/pages/16_ิbusiness-type-management/MainPage.vue b/src/pages/16_ิbusiness-type-management/MainPage.vue index 6b97e47f..486164c8 100644 --- a/src/pages/16_ิbusiness-type-management/MainPage.vue +++ b/src/pages/16_ิbusiness-type-management/MainPage.vue @@ -26,7 +26,7 @@ import StatCardComponent from 'src/components/StatCardComponent.vue'; import FloatingActionButton from 'src/components/FloatingActionButton.vue'; import CreateButton from 'src/components/AddButton.vue'; import NoData from 'src/components/NoData.vue'; -import AgenciesDialog from './AgenciesDialog.vue'; +import BusinessTypeDialog from './BusinessTypeDialog.vue'; import AdvanceSearch from 'src/components/shared/AdvanceSearch.vue'; const { t } = useI18n(); @@ -34,14 +34,13 @@ const $q = useQuasar(); const useBusinessType = useBusinessTypeStore(); const navigatorStore = useNavigator(); -const institutionStore = useInstitution(); -const { data, page, pageMax, pageSize } = storeToRefs(institutionStore); +const { data, page, pageMax, pageSize } = storeToRefs(useBusinessType); -const fieldSelected = ref<('no' | 'name' | 'nameEn')[]>([ +const fieldSelected = ref<('no' | 'name' | 'nameEN')[]>([ 'no', 'name', - 'nameEn', + 'nameEN', ]); const fieldSelectedOption = ref<{ label: string; value: string }[]>([ { @@ -53,9 +52,10 @@ const fieldSelectedOption = ref<{ label: string; value: string }[]>([ label: 'general.name', value: 'name', }, + { - label: 'general.nameEn', - value: 'nameEn', + label: 'general.nameEN', + value: 'nameEN', }, ]); const columns = [ @@ -65,6 +65,7 @@ const columns = [ label: 'general.order', field: 'no', }, + , { name: 'name', align: 'left', @@ -72,10 +73,10 @@ const columns = [ field: 'name', }, { - name: 'nameEn', - align: 'center', - label: 'general.nameEn', - field: 'nameEn', + name: 'nameEN', + align: 'left', + label: 'general.nameEN', + field: 'nameEN', }, ] satisfies QTableProps['columns']; const pageState = reactive({ @@ -84,12 +85,11 @@ const pageState = reactive({ gridView: false, total: 0, - addModal: false, + businessTypeDialog: false, viewDrawer: false, isDrawerEdit: true, searchDate: [], }); -const deletesStatusQrCodeBankImag = ref([]); const blankFormData: BusinessTypePayLoad = { name: '', @@ -97,71 +97,51 @@ const blankFormData: BusinessTypePayLoad = { }; const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all'); -const refAgenciesDialog = ref(); const formData = ref( structuredClone(blankFormData), ); const currBusinessType = ref(); -const imageListOnCreate = ref<{ - selectedImage: string; - list: { url: string; imgFile: File | null; name: string }[]; -}>({ selectedImage: '', list: [] }); - -function triggerDialog(type: 'add' | 'edit' | 'view') { +function triggerDialog(type: 'add' | 'edit') { if (type === 'add') { formData.value = structuredClone(blankFormData); - pageState.addModal = true; - pageState.isDrawerEdit = true; - } - if (type === 'view') { - pageState.viewDrawer = true; - pageState.isDrawerEdit = false; + pageState.businessTypeDialog = true; } + if (type === 'edit') { - pageState.viewDrawer = true; - pageState.isDrawerEdit = true; + pageState.businessTypeDialog = true; } } function resetForm() { - pageState.isDrawerEdit = true; - pageState.addModal = false; - pageState.viewDrawer = false; + pageState.businessTypeDialog = false; currBusinessType.value = undefined; formData.value = structuredClone(blankFormData); } -function undo() { - if (!currBusinessType.value) return; - assignFormData(currBusinessType.value); - pageState.isDrawerEdit = false; -} - function assignFormData(data: BusinessType) { currBusinessType.value = data; formData.value = { id: data.id, name: data.name, nameEN: data.nameEN }; } -async function submit(opt?: { selectedImage: string }) { +async function submit() { const payload = { id: formData.value.id, name: formData.value.name, nameEN: formData.value.nameEN, }; - if (pageState.isDrawerEdit && currBusinessType.value?.id) { + if (currBusinessType.value?.id) { const ret = await useBusinessType.editById(payload); if (ret) { - pageState.isDrawerEdit = false; await fetchData($q.screen.xs); + pageState.businessTypeDialog = false; return; } } else { await useBusinessType.create(payload); - await fetchData($q.screen.xs); - pageState.addModal = false; + pageState.businessTypeDialog = false; return; } } @@ -204,8 +184,8 @@ async function fetchData(mobileFetch?: boolean) { } onMounted(async () => { - navigatorStore.current.title = 'agencies.title'; - navigatorStore.current.path = [{ text: 'agencies.caption', i18n: true }]; + navigatorStore.current.title = 'businessType.title'; + navigatorStore.current.path = [{ text: 'businessType.caption', i18n: true }]; pageState.gridView = $q.screen.lt.md ? true : false; await fetchData(); @@ -265,7 +245,7 @@ watch( { icon: 'ph-building-office', count: pageState.total, - label: 'agencies.title', + label: 'businessType.title', color: 'light-green', }, ]" @@ -498,10 +478,7 @@ watch( : '' " > - + {{ $q.screen.xs ? props.rowIndex + 1 @@ -555,67 +532,22 @@ watch( - - {{ - formatAddress({ - address: props.row.address, - addressEN: props.row.addressEN, - moo: props.row.moo, - mooEN: props.row.mooEN, - soi: props.row.soi, - soiEN: props.row.soiEN, - street: props.row.street, - streetEN: props.row.streetEN, - province: props.row.province, - district: props.row.district, - subDistrict: props.row.subDistrict, - en: $i18n.locale === 'eng', - }) - }} - - {{ - formatAddress({ - address: props.row.address, - addressEN: props.row.addressEN, - moo: props.row.moo, - mooEN: props.row.mooEN, - soi: props.row.soi, - soiEN: props.row.soiEN, - street: props.row.street, - streetEN: props.row.streetEN, - province: props.row.province, - district: props.row.district, - subDistrict: props.row.subDistrict, - en: $i18n.locale === 'eng', - }) - }} - + + + +
+ {{ props.row.nameEN }} +
+
+ - @@ -665,41 +596,21 @@ watch( > - {{ - $i18n.locale === 'eng' - ? props.row.nameEN - : props.row.name - }} + {{ props.row.name }} + - {{ props.row.code }} + {{ props.row.nameEN }} - -
- - {{ $t('general.address') }} - - - {{ - formatAddress({ - address: props.row.address, - addressEN: props.row.addressEN, - moo: props.row.moo, - mooEN: props.row.mooEN, - soi: props.row.soi, - soiEN: props.row.soiEN, - street: props.row.street, - streetEN: props.row.streetEN, - province: props.row.province, - district: props.row.district, - subDistrict: props.row.subDistrict, - en: $i18n.locale === 'eng', - }) - }} - - {{ - formatAddress({ - address: props.row.address, - addressEN: props.row.addressEN, - moo: props.row.moo, - mooEN: props.row.mooEN, - soi: props.row.soi, - soiEN: props.row.soiEN, - street: props.row.street, - streetEN: props.row.streetEN, - province: props.row.province, - district: props.row.district, - subDistrict: props.row.subDistrict, - en: $i18n.locale === 'eng', - }) - }} - - -
@@ -812,33 +680,13 @@ watch( -