fix: service => not display workflow when no properties

This commit is contained in:
puriphatt 2024-11-04 12:43:55 +07:00
parent 980bb86574
commit cf809b0b4f
5 changed files with 91 additions and 62 deletions

View file

@ -75,6 +75,7 @@ async function addWork() {
id: '',
name: '',
attributes: {
workflowName: '',
additional: [],
showTotalPrice: false,
stepProperties: [],

View file

@ -580,75 +580,97 @@ watch(
>
{{ $t('flow.noProcessStep') }}
</span>
<span
v-else
<template
v-for="(step, stepIndex) in attributes.stepProperties"
:key="step.id"
>
<q-icon name="mdi-circle-medium" />
{{ $t('flow.stepNo', { msg: stepIndex + 1 }) }}:
{{ mapStepName(step.id) }}
<!-- step att -->
<section
class="col scroll q-pa-sm flex items-center surface-1 rounded"
<span
v-if="
attributes.stepProperties?.length > 0 &&
step.attributes.length > 0
"
>
<div
v-if="
attributes.stepProperties[stepIndex].attributes.length > 0
"
class="row q-gutter-sm"
<q-icon name="mdi-circle-medium" />
{{ $t('flow.stepNo', { msg: stepIndex + 1 }) }}:
{{ mapStepName(step.id) }}
<!-- step att -->
<section
class="col scroll q-pa-sm flex items-center surface-1 rounded"
>
<span
v-for="(att, i) in step.attributes"
:key="i"
class="surface-2 bordered rounded q-px-xs"
<div
v-if="
attributes.stepProperties[stepIndex].attributes.length > 0
"
class="row q-gutter-sm"
>
{{ optionStore.mapOption(att.fieldName ?? '') }}
</span>
</div>
<div v-else class="app-text-muted-2">
{{ $t('productService.service.noProperties') }}
</div>
</section>
<!-- step product -->
<section
class="q-pt-sm q-pl-lg column"
:class="{
'q-pb-sm': stepIndex !== attributes.stepProperties.length - 1,
}"
>
<span class="app-text-muted-2 text-caption">
{{
$t('general.select', {
msg: $t('productService.product.title'),
})
}}
</span>
<div
v-if="productItems.length > 0"
class="surface-1 rounded q-pa-xs"
>
<div v-for="product in productItems" :key="product.id">
<q-checkbox
:disable="readonly"
:model-value="
attributes.stepProperties[
stepIndex
].productsId.includes(product.id)
"
@click="toggleCheckProductInStep(product.id, stepIndex)"
size="xs"
/>
{{ product.name }}
<span
v-for="(att, i) in step.attributes"
:key="i"
class="surface-2 bordered rounded q-px-xs"
>
{{ optionStore.mapOption(att.fieldName ?? '') }}
</span>
</div>
</div>
<span v-else class="app-text-muted-2 surface-1 rounded q-pa-xs">
{{ $t('productService.product.noProduct') }}
</span>
</section>
<div v-else class="app-text-muted-2">
{{ $t('productService.service.noProperties') }}
</div>
</section>
<!-- step product -->
<section
class="q-pt-sm q-pl-lg column"
:class="{
'q-pb-sm':
stepIndex !== attributes.stepProperties.length - 1,
}"
>
<span class="app-text-muted-2 text-caption">
{{
$t('general.select', {
msg: $t('productService.product.title'),
})
}}
</span>
<div
v-if="productItems.length > 0"
class="surface-1 rounded q-pa-xs"
>
<div v-for="product in productItems" :key="product.id">
<q-checkbox
:disable="readonly"
:model-value="
attributes.stepProperties[
stepIndex
].productsId.includes(product.id)
"
@click="toggleCheckProductInStep(product.id, stepIndex)"
size="xs"
/>
{{ product.name }}
</div>
</div>
<span
v-else
class="app-text-muted-2 surface-1 rounded q-pa-xs"
>
{{ $t('productService.product.noProduct') }}
</span>
</section>
</span>
</template>
<span
v-if="
attributes.stepProperties.every(
(s) => s.attributes.length === 0,
)
"
class="app-text-muted"
>
{{ $t('productService.service.noPropertiesYet') }}
</span>
</div>

View file

@ -653,6 +653,7 @@ export default {
addWork: 'Add Work',
workAlreadyExist: 'Work already exist',
splitPay: 'Split Payment',
noPropertiesYet: 'No properties have been selected yet',
},
product: {
title: 'Products and Services',

View file

@ -649,6 +649,7 @@ export default {
addWork: 'เพิ่มงาน',
workAlreadyExist: 'งานนี้มีอยู่แล้ว',
splitPay: 'แบ่งจ่าย',
noPropertiesYet: 'ยังไม่ได้เลือกคุณสมบัติต่องาน',
},
product: {
title: 'สินค้าและบริการ',

View file

@ -273,6 +273,7 @@ const formDataProductService = ref<ServiceCreate>({
showTotalPrice: false,
additional: [],
workflowId: '',
workflowName: '',
stepProperties: [],
},
detail: '',
@ -899,6 +900,7 @@ const prevService = ref<ServiceCreate>({
work: [],
attributes: {
showTotalPrice: false,
workflowName: '',
workflowId: '',
stepProperties: [],
additional: [],
@ -1057,6 +1059,7 @@ function clearFormService() {
name: '',
detail: '',
attributes: {
workflowName: '',
workflowId: '',
stepProperties: [],
additional: [],
@ -1285,6 +1288,7 @@ function triggerConfirmCloseWork() {
const tempValueProperties = ref<Attributes>({
showTotalPrice: false,
workflowName: '',
workflowId: '',
stepProperties: [],
additional: [],