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: '', id: '',
name: '', name: '',
attributes: { attributes: {
workflowName: '',
additional: [], additional: [],
showTotalPrice: false, showTotalPrice: false,
stepProperties: [], stepProperties: [],

View file

@ -580,10 +580,16 @@ watch(
> >
{{ $t('flow.noProcessStep') }} {{ $t('flow.noProcessStep') }}
</span> </span>
<span
v-else <template
v-for="(step, stepIndex) in attributes.stepProperties" v-for="(step, stepIndex) in attributes.stepProperties"
:key="step.id" :key="step.id"
>
<span
v-if="
attributes.stepProperties?.length > 0 &&
step.attributes.length > 0
"
> >
<q-icon name="mdi-circle-medium" /> <q-icon name="mdi-circle-medium" />
{{ $t('flow.stepNo', { msg: stepIndex + 1 }) }}: {{ $t('flow.stepNo', { msg: stepIndex + 1 }) }}:
@ -616,7 +622,8 @@ watch(
<section <section
class="q-pt-sm q-pl-lg column" class="q-pt-sm q-pl-lg column"
:class="{ :class="{
'q-pb-sm': stepIndex !== attributes.stepProperties.length - 1, 'q-pb-sm':
stepIndex !== attributes.stepProperties.length - 1,
}" }"
> >
<span class="app-text-muted-2 text-caption"> <span class="app-text-muted-2 text-caption">
@ -645,11 +652,26 @@ watch(
{{ product.name }} {{ product.name }}
</div> </div>
</div> </div>
<span v-else class="app-text-muted-2 surface-1 rounded q-pa-xs"> <span
v-else
class="app-text-muted-2 surface-1 rounded q-pa-xs"
>
{{ $t('productService.product.noProduct') }} {{ $t('productService.product.noProduct') }}
</span> </span>
</section> </section>
</span> </span>
</template>
<span
v-if="
attributes.stepProperties.every(
(s) => s.attributes.length === 0,
)
"
class="app-text-muted"
>
{{ $t('productService.service.noPropertiesYet') }}
</span>
</div> </div>
<!-- <div class="q-py-md q-px-md full-width"> <!-- <div class="q-py-md q-px-md full-width">

View file

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

View file

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

View file

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