diff --git a/src/components/04_product-service/FormServiceWork.vue b/src/components/04_product-service/FormServiceWork.vue index 7232d137..dcae360a 100644 --- a/src/components/04_product-service/FormServiceWork.vue +++ b/src/components/04_product-service/FormServiceWork.vue @@ -74,7 +74,12 @@ async function addWork() { workItems.value.push({ id: '', name: '', - attributes: { additional: [], showTotalPrice: false }, + attributes: { + additional: [], + showTotalPrice: false, + stepProperties: [], + workflowId: '', + }, product: [], }); await nextTick(); @@ -177,8 +182,16 @@ watch( v-model:product-items="work.product" v-model:attributes="work.attributes" @add-product="$emit('addProduct', index)" - @move-work-up="moveItemUp(workItems, index)" - @move-work-down="moveItemDown(workItems, index)" + @move-work-up=" + () => { + moveItemUp(workItems, index); + } + " + @move-work-down=" + () => { + moveItemDown(workItems, index); + } + " @delete-work="confirmDelete(workItems, index)" @move-product-up="moveItemUp" @move-product-down="moveItemDown" diff --git a/src/components/04_product-service/ServiceProperties.vue b/src/components/04_product-service/ServiceProperties.vue index 235180b1..0fbae5fc 100644 --- a/src/components/04_product-service/ServiceProperties.vue +++ b/src/components/04_product-service/ServiceProperties.vue @@ -1,20 +1,35 @@ - - - - - - - - - {{ $t('general.selectAll') }} - - - - - - - - {{ ops.label }} - - - - - - + + {{ $t('flow.title') }} + filter(val, update)" + /> + + - - + + - - - - - + {{ $t('flow.stepNo', { msg: stepIndex + 1 }) }} + : {{ mapStepName(step.id) }} + - {{ index + 1 }} - - - - - + - {{ scope.opt.label }} + + + + {{ $t('general.selectAll') }} + - - - - - - - { - if (!formServiceProperties) return; - if (t === 'date') { - formServiceProperties.additional[index] = { - type: t, - fieldName: p.fieldName, - }; - } - - if (t === 'array') { - formServiceProperties.additional[index] = { - type: t, - fieldName: p.fieldName, - options: [''], - }; - } - - if (t === 'string') { - formServiceProperties.additional[index] = { - type: t, - fieldName: p.fieldName, - isPhoneNumber: false, - phoneNumberLength: 10, - }; - } - - if (t === 'number') { - formServiceProperties.additional[index] = { - type: t, - fieldName: p.fieldName, - comma: false, - decimal: false, - decimalPlace: 2, - }; - } - } - " - :options="typeOption" - v-model="p.type" - > - + - + - - {{ scope.opt.label }} + + {{ ops.label }} + - + + + - - - - - - {{ scope.opt.label }} - - - + + + + + + - - - - - {{ $t('general.additional') }} - + {{ index + 1 }} + - - - - - {{ $t('general.telephone') }} - - - - - - - - - - {{ $t('form.useComma') }} - - - - {{ $t('form.decimal') }} - - - - - - - + changeType(v, stepIndex)" + > + + - - + + + + + + + { + if ( + !formServiceProperties.stepProperties[stepIndex] + .attributes + ) + return; + if (t === 'date') { + formServiceProperties.stepProperties[ + stepIndex + ].attributes[index] = { + type: t, + fieldName: p.fieldName, + }; + } + + if (t === 'array') { + formServiceProperties.stepProperties[ + stepIndex + ].attributes[index] = { + type: t, + fieldName: p.fieldName, + options: [], + }; + } + + if (t === 'string') { + formServiceProperties.stepProperties[ + stepIndex + ].attributes[index] = { + type: t, + fieldName: p.fieldName, + isPhoneNumber: false, + phoneNumberLength: 10, + }; + } + + if (t === 'number') { + formServiceProperties.stepProperties[ + stepIndex + ].attributes[index] = { + type: t, + fieldName: p.fieldName, + comma: false, + decimal: false, + decimalPlace: 2, + }; + } + } + " + :options="typeOption" + v-model="p.type" + > + + + + - - - { - p.options.splice(i, 1); - } - " - dense - flat - icon="mdi-trash-can-outline" - class="bordered" - text-color="negative" - style="border-radius: 6px" + + {{ scope.opt.label }} + + + + + + + + + {{ scope.opt.label }} + + + + + + + + + {{ $t('general.additional') }} + + + + + + + {{ $t('general.telephone') }} + + + - - - { - p.options.push(''); - } - " - dense - flat - icon="mdi-plus" - class="bordered col-11" - text-color="grey" - style="border-radius: 6px" - /> - - - - + + + + + + {{ $t('form.useComma') }} + + + + {{ $t('form.decimal') }} + + + + + + + + + + + + { + p.options.splice(i, 1); + } + " + dense + flat + icon="mdi-trash-can-outline" + class="bordered" + text-color="negative" + style="border-radius: 6px" + /> + + + + { + p.options.push(''); + } + " + dense + flat + icon="mdi-plus" + class="bordered col-11" + text-color="grey" + style="border-radius: 6px" + /> + + + + + + + + - - - + diff --git a/src/components/04_product-service/WorkManagementComponent.vue b/src/components/04_product-service/WorkManagementComponent.vue index 66085da1..bc2c5d0d 100644 --- a/src/components/04_product-service/WorkManagementComponent.vue +++ b/src/components/04_product-service/WorkManagementComponent.vue @@ -1,21 +1,32 @@ @@ -84,7 +171,7 @@ watch( switch-toggle-side default-opened expand-icon="mdi-chevron-down-circle" - header-class="surface-2 expansion-rounded" + header-class="expansion-rounded" header-style="border-top-left-radius: var(--radius-2); border-top-right-radius: var(--radius-2)" > @@ -115,7 +202,7 @@ watch( style="color: hsl(var(--text-mute-2))" @click.stop="$emit('moveWorkDown')" /> - - + --> + selectFlow(val)" + @filter="(val: string, update) => filter(val, update)" + > + + + {{ + $t('productService.service.workNo', { msg: workIndex + 1 }) + }}: + + + - - - - - - {{ $t('productService.service.propertiesInWork') }} - {{ workIndex + 1 }} - - - - - {{ $t('productService.service.properties') }} - - - - - - - - {{ optionStore.mapOption(p.fieldName ?? '') }} - - - - {{ $t('productService.service.noProperties') }} - - - + + + + - @@ -297,15 +351,17 @@ watch( v-if="productItems.length > 0" class="q-py-md q-px-md full-width q-gutter-y-sm" > - - + @@ -316,6 +372,7 @@ watch( dense flat round + size="sm" :disable="index === 0" style="color: hsl(var(--text-mute-2))" @click.stop="$emit('moveProductUp', productItems, index)" @@ -328,27 +385,27 @@ watch( dense flat round - class="q-mx-sm" + size="sm" :disable="index === productItems.length - 1" style="color: hsl(var(--text-mute-2))" @click.stop="$emit('moveProductDown', productItems, index)" /> {{ index + 1 }} - + @@ -360,35 +417,30 @@ watch( - + {{ product.name }} {{ product.name }} - - {{ product.code }} - - - - + + + {{ product.code }} + - - + + {{ product.process }} {{ $t('general.day') }} + + + + + + + + - + งวดที่จ่าย {{ !readonly ? '' : product.installmentNo }} - + + { + if (Number(v) > splitPay) + product.installmentNo = splitPay; + } + " + /> + - - - {{ $t('productService.product.processingTime') }} - {{ product.process }} {{ $t('general.day') }} - @@ -478,19 +535,149 @@ watch( > {{ $t('general.delete') }} - + - + {{ $t('productService.product.noProduct') }} - + + + + + + {{ $t('flow.processStep') }} + + + + + + + + + {{ $t('flow.noProcessStep') }} + + + + {{ $t('flow.stepNo', { msg: stepIndex + 1 }) }}: + {{ mapStepName(step.id) }} + + + + + + {{ optionStore.mapOption(att.fieldName ?? '') }} + + + + {{ $t('productService.service.noProperties') }} + + + + + + + {{ + $t('general.select', { + msg: $t('productService.product.title'), + }) + }} + + + + + + {{ product.name }} + + + + {{ $t('productService.product.noProduct') }} + + + + + + + + {{ $t('productService.service.totalProductWork') }} - {{ workName }} + {{ mapFlowName(attributes.workflowId) }} @@ -502,8 +689,8 @@ watch( diff --git a/src/pages/04_product-service/MainPage.vue b/src/pages/04_product-service/MainPage.vue index bfbe8d74..b4d3f9e8 100644 --- a/src/pages/04_product-service/MainPage.vue +++ b/src/pages/04_product-service/MainPage.vue @@ -63,6 +63,7 @@ import { Attributes, } from 'stores/product-service/types'; import { computed } from 'vue'; +import { WorkflowTemplate } from 'src/stores/workflow-template/types'; const flowStore = useFlowStore(); const utilsStore = useUtilsStore(); @@ -94,7 +95,7 @@ const { deleteWork, } = productServiceStore; -const { workNameItems } = storeToRefs(productServiceStore); +const { workNameItems, splitPay } = storeToRefs(productServiceStore); const readOnlybranchOption = ref(false); const allStat = ref<{ mode: string; count: number }[]>([]); const stat = ref< @@ -264,10 +265,14 @@ const formDataProduct = ref({ image: undefined, }); +const workflow = ref(); const formDataProductService = ref({ work: [], attributes: { + showTotalPrice: false, additional: [], + workflowId: '', + stepProperties: [], }, detail: '', name: '', @@ -892,6 +897,9 @@ async function assignFormDataGroup(data: ProductGroup) { const prevService = ref({ work: [], attributes: { + showTotalPrice: false, + workflowId: '', + stepProperties: [], additional: [], }, detail: '', @@ -941,6 +949,11 @@ async function assignFormDataProductService(id: string) { formDataProductService.value.work = prevService.value.work; workItems.value = res.work.map((item) => { + splitPay.value = Math.max( + ...item.productOnWork.map( + (productOnWorkItem) => productOnWorkItem.installmentNo, + ), + ); return { id: item.id, name: item.name, @@ -1043,13 +1056,16 @@ function clearFormService() { name: '', detail: '', attributes: { + workflowId: '', + stepProperties: [], additional: [], + showTotalPrice: false, }, work: [], status: undefined, productGroupId: '', }; - + splitPay.value = 0; workItems.value = []; selectProduct.value = []; dialogService.value = false; @@ -1229,6 +1245,9 @@ function triggerConfirmCloseWork() { } const tempValueProperties = ref({ + showTotalPrice: false, + workflowId: '', + stepProperties: [], additional: [], }); const currentPropertiesMode = ref<'service' | 'work'>('service'); @@ -3818,13 +3837,13 @@ watch( @@ -3876,6 +3895,20 @@ watch( " /> + + {{ $t('productService.service.splitPay') }} + + {{ $t('quotation.receiptDialog.installments') }} + - - + --> @@ -4026,12 +4059,12 @@ watch( } " > - + - + @@ -4241,7 +4274,7 @@ watch( /> @@ -4297,13 +4330,28 @@ watch( }" /> + + {{ $t('productService.service.splitPay') }} + + {{ $t('quotation.receiptDialog.installments') }} + @@ -4354,7 +4402,7 @@ watch( /> - - + --> @@ -4751,4 +4799,8 @@ watch( color: hsl(var(--info-bg)); font-weight: 600; } + +:deep(.split-pay .q-field__control) { + height: 23px; +}