feat: check if every item is completed

This commit is contained in:
Methapon Metanipat 2024-11-26 17:34:23 +07:00
parent de5d470784
commit e49ab198a0

View file

@ -18,6 +18,7 @@ import {
Attributes,
DocStatus,
Step,
RequestWorkStatus,
} from 'src/stores/request-list/types';
import useOptionStore from 'src/stores/options';
import ProductExpansion from './ProductExpansion.vue';
@ -285,8 +286,24 @@ async function triggerViewFile(opt: {
class="status-color q-pa-sm bordered row items-center cursor-pointer no-wrap"
style="text-wrap: nowrap"
:class="{
[`status-color-${'doing'}`]: true,
'step-status-active': pageState.currentStep === value.order,
['status-color-done']: workList
?.filter((v) => {
return v.productService.work?.attributes.workflowStep?.[
i
]?.productsId.includes(v.productService.productId);
})
.every((v) => {
const status = v.stepStatus.find(
({ step }) => step === i + 1,
)?.workStatus;
return (
status === RequestWorkStatus.Completed ||
status === RequestWorkStatus.Ended
);
}),
['status-color-doing']: true,
['step-status-active']: pageState.currentStep === value.order,
}"
@click="() => (pageState.currentStep = value.order)"
>
@ -542,16 +559,16 @@ async function triggerViewFile(opt: {
color: hsla(var(--_color));
}
&.status-color-done {
--_color: var(--green-5-hsl);
&.status-color-waiting {
--_color: var(--gray-4-hsl);
color: var(--foreground);
}
&.status-color-doing {
--_color: var(--blue-5-hsl);
color: var(--foreground);
}
&.status-color-waiting {
--_color: var(--gray-4-hsl);
&.status-color-done {
--_color: var(--green-5-hsl);
color: var(--foreground);
}
}