diff --git a/src/components/03_customer-management/FormEmployeeVisa.vue b/src/components/03_customer-management/FormEmployeeVisa.vue index bba22dad..876c7a52 100644 --- a/src/components/03_customer-management/FormEmployeeVisa.vue +++ b/src/components/03_customer-management/FormEmployeeVisa.vue @@ -78,12 +78,6 @@ onMounted(async () => { await fetchProvince(); }); -const visaIssueCountryOptions = ref[]>([]); -let visaIssueCountryFilter: ( - value: string, - update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void, -) => void; - const visaTypeOptions = ref[]>([]); let visaTypeFilter: ( value: string, @@ -103,12 +97,6 @@ onMounted(() => { 'label', ); - visaIssueCountryFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.nationality), - visaIssueCountryOptions, - 'label', - ); - workerTypeFilter = selectFilterOptionRefMod( ref(optionStore.globalOption?.workerType), workerTypeOptions, @@ -119,14 +107,8 @@ onMounted(() => { watch( () => optionStore.globalOption, () => { - visaIssueCountryFilter = selectFilterOptionRefMod( - ref(optionStore.globalOption?.nationality), - visaIssueCountryOptions, - 'label', - ); - visaTypeFilter = selectFilterOptionRefMod( - optionStore.globalOption.visaType, + optionStore.globalOption.nationality, visaTypeOptions, 'label', ); @@ -440,11 +422,11 @@ watch( class="col-md-4 col-6" :dense="dense" :readonly="readonly" - :options="visaIssueCountryOptions" + :options="visaTypeOptions" :hide-dropdown-icon="readonly" :for="`${prefixId}-select-issue-country`" :label="$t('customerEmployee.form.issueCountry')" - @filter="visaIssueCountryFilter" + @filter="visaTypeFilter" :model-value="readonly ? issueCountry || '-' : issueCountry" @update:model-value=" (v) => (typeof v === 'string' ? (issueCountry = v) : '') diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index 98146be4..09d4f118 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -104,6 +104,10 @@ const { importProduct, } = productServiceStore; +const currentCopy = ref<{ + id: string | undefined; + type: 'service' | 'product'; +}>(); const { workNameItems } = storeToRefs(productServiceStore); const allStat = ref<{ mode: string; count: number }[]>([]); @@ -1844,49 +1848,65 @@ function handleSubmitSameWorkflow() { ); } -async function copy(id: string) { - { - const res = await fetchListServiceById(id); - if (res) { - formService.value = { - code: res.code, - name: res.name, - detail: res.detail, - attributes: res.attributes, - work: res.work.map((v) => ({ - id: v.id, - name: v.name, - attributes: v.attributes, - product: v.productOnWork.map((productOnWorkItem) => ({ - id: productOnWorkItem.product.id, - installmentNo: productOnWorkItem.installmentNo, - stepCount: productOnWorkItem.stepCount, - })), - })), - status: res.status, - productGroupId: res.productGroupId, - selectedImage: res.selectedImage, - installments: res.installments, - }; +async function paste() { + if ( + !!currentCopy.value && + currentCopy.value.type === 'service' && + !!currentCopy.value.id + ) + dialogWarningClose(t, { + message: t('dialog.message.warningPaste'), + action: async () => { + const res = await fetchListServiceById(currentCopy.value.id); + if (res) { + formService.value = { + code: res.code, + name: res.name, + detail: res.detail, + attributes: res.attributes, + work: res.work.map((v) => ({ + id: v.id, + name: v.name, + attributes: v.attributes, + product: v.productOnWork.map((productOnWorkItem) => ({ + id: productOnWorkItem.product.id, + installmentNo: productOnWorkItem.installmentNo, + stepCount: productOnWorkItem.stepCount, + })), + })), + status: res.status, + productGroupId: res.productGroupId, + selectedImage: res.selectedImage, + installments: res.installments, + }; - workItems.value = res.work.map((item) => { - return { - id: item.id, - name: item.name, - attributes: item.attributes, - product: item.productOnWork.map((productOnWorkItem) => { + workItems.value = res.work.map((item) => { return { - ...productOnWorkItem.product, - nameEn: productOnWorkItem.product.name, - installmentNo: productOnWorkItem.installmentNo, + id: item.id, + name: item.name, + attributes: item.attributes, + product: item.productOnWork.map((productOnWorkItem) => { + return { + ...productOnWorkItem.product, + nameEn: productOnWorkItem.product.name, + installmentNo: productOnWorkItem.installmentNo, + }; + }), }; - }), - }; - }); - } + }); + } + }, + }); + else { + dialog({ + color: 'warning', + icon: 'mdi-alert', + title: t('form.warning.title'), + actionText: t('dialog.action.ok'), + message: t('dialog.message.warningCopyEmpty'), + action: async () => {}, + }); } - - dialogService.value = true; } watch( @@ -3258,7 +3278,11 @@ watch( :id-name="props.row.name" @copy=" () => { - copy(props.row.id); + notify('create', $t('dialog.message.copy')); + currentCopy = { + id: props.row.id, + type: productAndServiceTab, + }; } " @view="