diff --git a/src/pages/05_quotation/QuotationForm.vue b/src/pages/05_quotation/QuotationForm.vue index 52488d11..eabd16b0 100644 --- a/src/pages/05_quotation/QuotationForm.vue +++ b/src/pages/05_quotation/QuotationForm.vue @@ -3,7 +3,7 @@ import { useI18n } from 'vue-i18n'; import { storeToRefs } from 'pinia'; import { useQuasar } from 'quasar'; import { computed, nextTick, onMounted, reactive, ref, watch } from 'vue'; -import { dialogCheckData } from 'stores/utils'; +import { dialogCheckData, dialogWarningClose } from 'stores/utils'; import { ProductTree, quotationProductTree } from './utils'; // NOTE: Import stores @@ -82,7 +82,7 @@ const employeeFormStore = useEmployeeForm(); const customerStore = useCustomerStore(); const quotationForm = useQuotationForm(); const optionStore = useOptionStore(); -const { locale } = useI18n(); +const { t, locale } = useI18n(); const ocrStore = useOcrStore(); const $q = useQuasar(); @@ -216,7 +216,13 @@ function closeTab() { if (quotationFormState.value.mode === 'edit') { quotationForm.resetForm(); } else { - window.close(); + dialogWarningClose(t, { + message: t('dialog.message.close'), + action: () => { + window.close(); + }, + cancel: () => {}, + }); } } diff --git a/src/stores/utils/index.ts b/src/stores/utils/index.ts index 64cb57a6..c28e8887 100644 --- a/src/stores/utils/index.ts +++ b/src/stores/utils/index.ts @@ -44,6 +44,7 @@ export function dialogCheckData(opts: { export function dialogWarningClose( t: ComposerTranslation, opts: { + message?: string; action?: (...args: unknown[]) => unknown; cancel?: (...args: unknown[]) => unknown; }, @@ -53,7 +54,7 @@ export function dialogWarningClose( icon: 'mdi-alert', title: t('form.warning.title'), actionText: t('dialog.action.ok'), - message: t('dialog.message.warningClose'), + message: opts.message || t('dialog.message.warningClose'), action: async () => { if (opts.action) opts.action(); },