Compare commits

..

No commits in common. "1d38dbc6cfcd6f78ff223bee6faeb5edd5050a0f" and "2a2bfa3180fe140f61ff5ee0ce0d37e631c7d85b" have entirely different histories.

2 changed files with 67 additions and 61 deletions

View file

@ -78,12 +78,6 @@ onMounted(async () => {
await fetchProvince(); await fetchProvince();
}); });
const visaIssueCountryOptions = ref<Record<string, unknown>[]>([]);
let visaIssueCountryFilter: (
value: string,
update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void,
) => void;
const visaTypeOptions = ref<Record<string, unknown>[]>([]); const visaTypeOptions = ref<Record<string, unknown>[]>([]);
let visaTypeFilter: ( let visaTypeFilter: (
value: string, value: string,
@ -103,12 +97,6 @@ onMounted(() => {
'label', 'label',
); );
visaIssueCountryFilter = selectFilterOptionRefMod(
ref(optionStore.globalOption?.nationality),
visaIssueCountryOptions,
'label',
);
workerTypeFilter = selectFilterOptionRefMod( workerTypeFilter = selectFilterOptionRefMod(
ref(optionStore.globalOption?.workerType), ref(optionStore.globalOption?.workerType),
workerTypeOptions, workerTypeOptions,
@ -119,14 +107,8 @@ onMounted(() => {
watch( watch(
() => optionStore.globalOption, () => optionStore.globalOption,
() => { () => {
visaIssueCountryFilter = selectFilterOptionRefMod(
ref(optionStore.globalOption?.nationality),
visaIssueCountryOptions,
'label',
);
visaTypeFilter = selectFilterOptionRefMod( visaTypeFilter = selectFilterOptionRefMod(
optionStore.globalOption.visaType, optionStore.globalOption.nationality,
visaTypeOptions, visaTypeOptions,
'label', 'label',
); );
@ -440,11 +422,11 @@ watch(
class="col-md-4 col-6" class="col-md-4 col-6"
:dense="dense" :dense="dense"
:readonly="readonly" :readonly="readonly"
:options="visaIssueCountryOptions" :options="visaTypeOptions"
:hide-dropdown-icon="readonly" :hide-dropdown-icon="readonly"
:for="`${prefixId}-select-issue-country`" :for="`${prefixId}-select-issue-country`"
:label="$t('customerEmployee.form.issueCountry')" :label="$t('customerEmployee.form.issueCountry')"
@filter="visaIssueCountryFilter" @filter="visaTypeFilter"
:model-value="readonly ? issueCountry || '-' : issueCountry" :model-value="readonly ? issueCountry || '-' : issueCountry"
@update:model-value=" @update:model-value="
(v) => (typeof v === 'string' ? (issueCountry = v) : '') (v) => (typeof v === 'string' ? (issueCountry = v) : '')

View file

@ -104,6 +104,10 @@ const {
importProduct, importProduct,
} = productServiceStore; } = productServiceStore;
const currentCopy = ref<{
id: string | undefined;
type: 'service' | 'product';
}>();
const { workNameItems } = storeToRefs(productServiceStore); const { workNameItems } = storeToRefs(productServiceStore);
const allStat = ref<{ mode: string; count: number }[]>([]); const allStat = ref<{ mode: string; count: number }[]>([]);
@ -1844,49 +1848,65 @@ function handleSubmitSameWorkflow() {
); );
} }
async function copy(id: string) { async function paste() {
{ if (
const res = await fetchListServiceById(id); !!currentCopy.value &&
if (res) { currentCopy.value.type === 'service' &&
formService.value = { !!currentCopy.value.id
code: res.code, )
name: res.name, dialogWarningClose(t, {
detail: res.detail, message: t('dialog.message.warningPaste'),
attributes: res.attributes, action: async () => {
work: res.work.map((v) => ({ const res = await fetchListServiceById(currentCopy.value.id);
id: v.id, if (res) {
name: v.name, formService.value = {
attributes: v.attributes, code: res.code,
product: v.productOnWork.map((productOnWorkItem) => ({ name: res.name,
id: productOnWorkItem.product.id, detail: res.detail,
installmentNo: productOnWorkItem.installmentNo, attributes: res.attributes,
stepCount: productOnWorkItem.stepCount, work: res.work.map((v) => ({
})), id: v.id,
})), name: v.name,
status: res.status, attributes: v.attributes,
productGroupId: res.productGroupId, product: v.productOnWork.map((productOnWorkItem) => ({
selectedImage: res.selectedImage, id: productOnWorkItem.product.id,
installments: res.installments, installmentNo: productOnWorkItem.installmentNo,
}; stepCount: productOnWorkItem.stepCount,
})),
})),
status: res.status,
productGroupId: res.productGroupId,
selectedImage: res.selectedImage,
installments: res.installments,
};
workItems.value = res.work.map((item) => { workItems.value = res.work.map((item) => {
return {
id: item.id,
name: item.name,
attributes: item.attributes,
product: item.productOnWork.map((productOnWorkItem) => {
return { return {
...productOnWorkItem.product, id: item.id,
nameEn: productOnWorkItem.product.name, name: item.name,
installmentNo: productOnWorkItem.installmentNo, 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( watch(
@ -3258,7 +3278,11 @@ watch(
:id-name="props.row.name" :id-name="props.row.name"
@copy=" @copy="
() => { () => {
copy(props.row.id); notify('create', $t('dialog.message.copy'));
currentCopy = {
id: props.row.id,
type: productAndServiceTab,
};
} }
" "
@view=" @view="