fix: i18n & work name before close

This commit is contained in:
puriphatt 2024-08-28 18:05:01 +07:00
parent 17289402fd
commit 185a713ad1
7 changed files with 64 additions and 31 deletions

View file

@ -3,14 +3,13 @@ import useUserStore from 'stores/user';
import useOptionStore from 'stores/options'; import useOptionStore from 'stores/options';
import { UserAttachmentDelete } from 'stores/user/types'; import { UserAttachmentDelete } from 'stores/user/types';
import { dialog, selectFilterOptionRefMod } from 'stores/utils'; import { dialog, selectFilterOptionRefMod } from 'stores/utils';
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
import { onMounted, ref, watch } from 'vue'; import { onMounted, ref, watch } from 'vue';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
import { Icon } from '@iconify/vue'; import { Icon } from '@iconify/vue';
import { QSelect } from 'quasar'; import { QSelect } from 'quasar';
import DatePicker from '../shared/DatePicker.vue'; import DatePicker from '../shared/DatePicker.vue';
const { locale } = useI18n(); const { t } = useI18n();
const userStore = useUserStore(); const userStore = useUserStore();
const optionStore = useOptionStore(); const optionStore = useOptionStore();
@ -54,10 +53,12 @@ function deleteFile(name: string) {
dialog({ dialog({
color: 'negative', color: 'negative',
icon: 'mdi-trash-can-outline', icon: 'mdi-trash-can-outline',
title: 'ยืนยันการลบเอกสารประจำตัว', title: t('dialog.title.confirmDelete', {
actionText: 'ตกลง', msg: t('personnel.form.attachment'),
}),
actionText: t('general.delete'),
persistent: true, persistent: true,
message: 'คุณต้องการลบเอกสารประจำตัว ใช่หรือไม่', message: t('dialog.message.confirmDelete'),
action: async () => { action: async () => {
if (!userId.value) return; if (!userId.value) return;
const payload: UserAttachmentDelete = { const payload: UserAttachmentDelete = {
@ -69,6 +70,7 @@ function deleteFile(name: string) {
agencyFileList.value = result; agencyFileList.value = result;
} }
}, },
cancel: () => {},
}); });
} }

View file

@ -56,6 +56,7 @@ export default {
times: 'No. {number}', times: 'No. {number}',
uploadFile: 'Upload File', uploadFile: 'Upload File',
}, },
menu: { menu: {
dashboard: 'Dashboard', dashboard: 'Dashboard',
dashboardCaption: 'Statistical information.', dashboardCaption: 'Statistical information.',
@ -99,6 +100,7 @@ export default {
addSignature: 'Add Signature', addSignature: 'Add Signature',
}, },
}, },
form: { form: {
title: { title: {
info: '{name}', info: '{name}',
@ -126,6 +128,7 @@ export default {
middleName: 'Middle Name', middleName: 'Middle Name',
middleNameEN: 'Middle Name (EN)', middleNameEN: 'Middle Name (EN)',
error: { error: {
title: 'Error Occurred {msg}',
required: 'This field is required.', required: 'This field is required.',
select: 'Please select.', select: 'Please select.',
selectField: 'Please select {field}.', selectField: 'Please select {field}.',
@ -148,12 +151,14 @@ export default {
decimalPlace: 'Decimal Place', decimalPlace: 'Decimal Place',
selection: 'Selection', selection: 'Selection',
}, },
status: { status: {
title: 'Status', title: 'Status',
CREATED: 'Active', // NOTE: Treated as active CREATED: 'Active', // NOTE: Treated as active
ACTIVE: 'Active', ACTIVE: 'Active',
INACTIVE: 'Inactive', INACTIVE: 'Inactive',
}, },
branch: { branch: {
office: 'Office', office: 'Office',
card: { card: {
@ -199,6 +204,7 @@ export default {
bankAccountType: 'Bank Account Type', bankAccountType: 'Bank Account Type',
}, },
}, },
personnel: { personnel: {
title: 'Personnel Management', title: 'Personnel Management',
caption: 'Manage All Personnel', caption: 'Manage All Personnel',
@ -308,7 +314,6 @@ export default {
headQuarters: { headQuarters: {
title: 'Headoffice', title: 'Headoffice',
}, },
businessType: 'Business Type', businessType: 'Business Type',
businessTypeEN: 'Business Type (EN)', businessTypeEN: 'Business Type (EN)',
jobPosition: 'Job Position', jobPosition: 'Job Position',
@ -329,6 +334,7 @@ export default {
contactPhone: 'Contact Phone', contactPhone: 'Contact Phone',
}, },
}, },
customerEmployee: { customerEmployee: {
branch: 'Branch', branch: 'Branch',
form: { form: {
@ -417,6 +423,7 @@ export default {
other: 'Other', other: 'Other',
}, },
}, },
customerBranch: { customerBranch: {
tab: { tab: {
main: 'About', main: 'About',
@ -439,6 +446,7 @@ export default {
attachment: 'Attachment', attachment: 'Attachment',
}, },
}, },
productService: { productService: {
title: 'Products and Services', title: 'Products and Services',
caption: 'Manage All Products and Services', caption: 'Manage All Products and Services',
@ -499,8 +507,9 @@ export default {
title: { title: {
incompleteDataEntry: 'Incomplete Data Entry', incompleteDataEntry: 'Incomplete Data Entry',
confirmChangeStatus: 'Confirm Status Change', confirmChangeStatus: 'Confirm Status Change',
confirmDelete: 'Confirm Deletion', confirmDelete: 'Confirm Deletion {msg}',
youngWorker: 'Employee under 18', youngWorker: 'Employee under 18',
confirmLogout: 'Confirm Logout',
}, },
message: { message: {
incompleteDataEntry: 'Incomplete data entry on {tap} page', incompleteDataEntry: 'Incomplete data entry on {tap} page',
@ -508,6 +517,9 @@ export default {
confirmChangeStatusOff: 'Do you want to close?', confirmChangeStatusOff: 'Do you want to close?',
confirmDelete: 'Do you want to delete this item?', confirmDelete: 'Do you want to delete this item?',
youngWorker: 'Employee is under 18 years old, do you want to confirm?', youngWorker: 'Employee is under 18 years old, do you want to confirm?',
confirmLogout: 'Do you want to Logout?',
headquartersNotEstablished: 'Headoffice not established',
warningClose: 'Incomplte edit data, Do you want to close?',
}, },
action: { action: {
ok: 'OK', ok: 'OK',

View file

@ -56,6 +56,7 @@ export default {
times: 'ครั้งที่ {number}', times: 'ครั้งที่ {number}',
uploadFile: 'อัปโหลดไฟล์', uploadFile: 'อัปโหลดไฟล์',
}, },
menu: { menu: {
dashboard: 'แดชบอร์ด', dashboard: 'แดชบอร์ด',
dashboardCaption: 'แสดงข้อมูลสถิติ', dashboardCaption: 'แสดงข้อมูลสถิติ',
@ -99,6 +100,7 @@ export default {
addSignature: 'เพิ่มลายเซ็น', addSignature: 'เพิ่มลายเซ็น',
}, },
}, },
form: { form: {
title: { title: {
info: '{name}', info: '{name}',
@ -149,12 +151,14 @@ export default {
decimalPlace: 'ตำแหน่ง', decimalPlace: 'ตำแหน่ง',
selection: 'ตัวเลือก', selection: 'ตัวเลือก',
}, },
status: { status: {
title: 'สถานะการใช้งาน', title: 'สถานะการใช้งาน',
CREATED: 'ใช้งานอยู่', // NOTE: Treated as active CREATED: 'ใช้งานอยู่', // NOTE: Treated as active
ACTIVE: 'ใช้งานอยู่', ACTIVE: 'ใช้งานอยู่',
INACTIVE: 'ไม่ใช้งาน', INACTIVE: 'ไม่ใช้งาน',
}, },
branch: { branch: {
office: 'สำนักงาน', office: 'สำนักงาน',
card: { card: {
@ -200,6 +204,7 @@ export default {
bankAccountType: 'ประเภทบัญชี', bankAccountType: 'ประเภทบัญชี',
}, },
}, },
personnel: { personnel: {
title: 'จัดการบุคลากร', title: 'จัดการบุคลากร',
caption: 'จัดการบุคลากรทั้งหมด', caption: 'จัดการบุคลากรทั้งหมด',
@ -236,7 +241,7 @@ export default {
trainingPlace: 'สถานที่อบรม', trainingPlace: 'สถานที่อบรม',
checkpoint: 'ด่าน', checkpoint: 'ด่าน',
checkpointEN: 'ด่าน ภาษาอังกฤษ', checkpointEN: 'ด่าน ภาษาอังกฤษ',
attachment: 'แบบเอกสารประจำตัว', attachment: 'เอกสารประจำตัว',
}, },
}, },
customer: { customer: {
@ -250,6 +255,7 @@ export default {
powerOfAttorney: 'หนังสือมอบอำนาจ', powerOfAttorney: 'หนังสือมอบอำนาจ',
others: 'อื่นๆ', others: 'อื่นๆ',
}, },
employer: 'นายจ้าง', employer: 'นายจ้าง',
employee: 'ลูกจ้าง', employee: 'ลูกจ้าง',
employerLegalEntity: 'นิติบุคคล', employerLegalEntity: 'นิติบุคคล',
@ -328,6 +334,7 @@ export default {
contactPhone: 'โทรศัพท์ผู้ติดต่อ', contactPhone: 'โทรศัพท์ผู้ติดต่อ',
}, },
}, },
customerEmployee: { customerEmployee: {
branch: 'สาขา', branch: 'สาขา',
form: { form: {
@ -414,6 +421,7 @@ export default {
other: 'อื่นๆ', other: 'อื่นๆ',
}, },
}, },
customerBranch: { customerBranch: {
tab: { tab: {
main: 'เกี่ยวกับ', main: 'เกี่ยวกับ',
@ -436,6 +444,7 @@ export default {
attachment: 'เอกสารเพิ่มเติม', attachment: 'เอกสารเพิ่มเติม',
}, },
}, },
productService: { productService: {
title: 'สินค้าและบริการ', title: 'สินค้าและบริการ',
caption: 'จัดการสินค้าและบริการทั้งหมด', caption: 'จัดการสินค้าและบริการทั้งหมด',
@ -496,8 +505,9 @@ export default {
title: { title: {
incompleteDataEntry: 'กรอกข้อมูลไม่ครบ', incompleteDataEntry: 'กรอกข้อมูลไม่ครบ',
confirmChangeStatus: 'ยืนยันการเปลี่ยนสถานะ', confirmChangeStatus: 'ยืนยันการเปลี่ยนสถานะ',
confirmDelete: 'ยืนยันการลบ', confirmDelete: 'ยืนยันการลบ {msg}',
youngWorker: 'ลูกจ้างอายุต่ำกว่า 18 ปี', youngWorker: 'ลูกจ้างอายุต่ำกว่า 18 ปี',
confirmLogout: 'ยืนยันการออกจากระบบ',
}, },
message: { message: {
incompleteDataEntry: 'กรอกข้อมูลไม่ครบในหน้า {tap}', incompleteDataEntry: 'กรอกข้อมูลไม่ครบในหน้า {tap}',
@ -505,6 +515,9 @@ export default {
confirmChangeStatusOff: 'คุณต้องการปิดใช่หรือไม่', confirmChangeStatusOff: 'คุณต้องการปิดใช่หรือไม่',
confirmDelete: 'คุณต้องการลบรายการนี้ใช่หรือไม่', confirmDelete: 'คุณต้องการลบรายการนี้ใช่หรือไม่',
youngWorker: 'ลูกจ้างอายุต่ำกว่า 18 ปี ต้องการยืนยันหรือไม่', youngWorker: 'ลูกจ้างอายุต่ำกว่า 18 ปี ต้องการยืนยันหรือไม่',
confirmLogout: 'คุณต้องการออกจากระบบใช่หรือไม่',
headquartersNotEstablished: 'ยังไม่ได้สร้างสำนักงานใหญ่',
warningClose: 'มีการแก้ไขที่ยังไม่ได้บันทึก คุณต้องการปิดใช่หรือไม่',
}, },
action: { action: {
ok: 'ยืนยัน', ok: 'ยืนยัน',

View file

@ -118,10 +118,11 @@ function setActive(button: NotificationButton) {
function doLogout() { function doLogout() {
dialog({ dialog({
icon: 'mdi-logout-variant', icon: 'mdi-logout-variant',
title: t('confirmLogoutTitle'), title: t('dialog.title.confirmLogout'),
persistent: true, persistent: true,
color: 'negative', color: 'negative',
message: t('confirmLogoutMessage'), message: t('dialog.message.confirmLogout'),
actionText: t('general.logout'),
action: async () => { action: async () => {
logout(); logout();
}, },

View file

@ -325,10 +325,10 @@ async function openDialog(
dialog({ dialog({
color: 'warning', color: 'warning',
icon: 'mdi-alert', icon: 'mdi-alert',
title: t('warning'), title: t('form.warning.title'),
actionText: t('agree'), actionText: t('ok'),
persistent: true, persistent: true,
message: t('headquartersNotEstablished'), message: t('dialog.message.headquartersNotEstablished'),
action: async () => {}, action: async () => {},
}); });

View file

@ -1209,19 +1209,12 @@ function confirmDeleteWork(id: string) {
} }
function triggerConfirmCloseWork() { function triggerConfirmCloseWork() {
const isWorkNameEdit = dialogWarningClose(t, {
workNameRef.value && workNameRef.value.isWorkNameEdit action: () => {
? workNameRef.value.isWorkNameEdit() manageWorkNameDialog.value = false;
: false; },
if (isWorkNameEdit) { cancel: () => {},
dialogWarningClose(t, { });
action: () => {
manageWorkNameDialog.value = false;
},
});
} else {
manageWorkNameDialog.value = false;
}
} }
const tempValueProperties = ref<Attributes>({ const tempValueProperties = ref<Attributes>({
@ -4066,7 +4059,19 @@ watch([currentStatusList, productMode], () => {
width="65%" width="65%"
v-model:modal="manageWorkNameDialog" v-model:modal="manageWorkNameDialog"
:title="$t('general.manage')" :title="$t('general.manage')"
:close="triggerConfirmCloseWork" :before-close="
() => {
const isWorkNameEdit =
workNameRef && workNameRef.isWorkNameEdit
? workNameRef.isWorkNameEdit()
: false;
if (isWorkNameEdit) {
triggerConfirmCloseWork();
return true;
}
return false;
}
"
> >
<div class="q-pa-lg full-height"> <div class="q-pa-lg full-height">
<WorkNameManagement <WorkNameManagement

View file

@ -35,9 +35,9 @@ export function dialogWarningClose(
dialog({ dialog({
color: 'warning', color: 'warning',
icon: 'mdi-alert', icon: 'mdi-alert',
title: t('warning'), title: t('form.warning.title'),
actionText: t('ok'), actionText: t('dialog.action.ok'),
message: t('warningClose'), message: t('dialog.message.warningClose'),
action: async () => { action: async () => {
if (opts.action) opts.action(); if (opts.action) opts.action();
}, },