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

View file

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

View file

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

View file

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

View file

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

View file

@ -1209,19 +1209,12 @@ function confirmDeleteWork(id: string) {
}
function triggerConfirmCloseWork() {
const isWorkNameEdit =
workNameRef.value && workNameRef.value.isWorkNameEdit
? workNameRef.value.isWorkNameEdit()
: false;
if (isWorkNameEdit) {
dialogWarningClose(t, {
action: () => {
manageWorkNameDialog.value = false;
},
});
} else {
manageWorkNameDialog.value = false;
}
dialogWarningClose(t, {
action: () => {
manageWorkNameDialog.value = false;
},
cancel: () => {},
});
}
const tempValueProperties = ref<Attributes>({
@ -4066,7 +4059,19 @@ watch([currentStatusList, productMode], () => {
width="65%"
v-model:modal="manageWorkNameDialog"
: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">
<WorkNameManagement

View file

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