refactor: header can't edit customer is INACTIVE

This commit is contained in:
Net 2024-09-05 13:48:45 +07:00
parent 7bf30ab0a4
commit 850289f23d
3 changed files with 37 additions and 18 deletions

View file

@ -2800,6 +2800,7 @@ const emptyCreateDialog = ref(false);
customerFormState.readonly === true) || customerFormState.readonly === true) ||
customerFormState.dialogType === 'info' customerFormState.dialogType === 'info'
" "
:hide-action="customerFormData.status === 'INACTIVE'"
:action-disabled="customerFormState.branchIndex !== -1" :action-disabled="customerFormState.branchIndex !== -1"
id="form-basic-info-customer" id="form-basic-info-customer"
:create="customerFormState.dialogType === 'create'" :create="customerFormState.dialogType === 'create'"
@ -2862,7 +2863,8 @@ const emptyCreateDialog = ref(false);
@click="customerFormStore.addCurrentCustomerBranch()" @click="customerFormStore.addCurrentCustomerBranch()"
v-if=" v-if="
customerFormState.branchIndex === -1 && customerFormState.branchIndex === -1 &&
!!customerFormState.editCustomerId !!customerFormState.editCustomerId &&
customerFormData.status !== 'INACTIVE'
" "
:disabled="!customerFormState.readonly" :disabled="!customerFormState.readonly"
/> />
@ -2959,6 +2961,7 @@ const emptyCreateDialog = ref(false);
<EmployerFormBranch <EmployerFormBranch
v-if="!!customerFormState.editCustomerId" v-if="!!customerFormState.editCustomerId"
:index="idx" :index="idx"
:hide-action="customerFormData.status === 'INACTIVE'"
v-model:customer="customerFormData" v-model:customer="customerFormData"
v-model:customer-branch=" v-model:customer-branch="
customerFormData.customerBranch[idx] customerFormData.customerBranch[idx]

View file

@ -21,14 +21,20 @@ import {
DeleteButton, DeleteButton,
UndoButton, UndoButton,
} from 'components/button'; } from 'components/button';
defineProps<{ withDefaults(
prefixId?: string; defineProps<{
outlined?: boolean; prefixId?: string;
readonly?: boolean; outlined?: boolean;
create?: boolean; readonly?: boolean;
actionDisabled?: boolean; create?: boolean;
customerType?: 'CORP' | 'PERS'; actionDisabled?: boolean;
}>(); customerType?: 'CORP' | 'PERS';
hideAction?: boolean;
}>(),
{
hideAction: false,
},
);
defineEmits<{ defineEmits<{
(e: 'save'): void; (e: 'save'): void;
(e: 'edit'): void; (e: 'edit'): void;
@ -144,7 +150,10 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
<template> <template>
<div class="row q-col-gutter-sm q-mb-sm"> <div class="row q-col-gutter-sm q-mb-sm">
<div class="col-12 text-weight-bold text-body1 row items-center"> <div
v-if="!hideAction"
class="col-12 text-weight-bold text-body1 row items-center"
>
<q-icon <q-icon
flat flat
size="xs" size="xs"

View file

@ -40,14 +40,20 @@ defineEmits<{
(e: 'delete'): void; (e: 'delete'): void;
}>(); }>();
defineProps<{ withDefaults(
index: number; defineProps<{
customerName: string; index: number;
readonly?: boolean; customerName: string;
prefixId?: string; readonly?: boolean;
actionDisabled?: boolean; prefixId?: string;
customerType?: 'CORP' | 'PERS'; actionDisabled?: boolean;
}>(); customerType?: 'CORP' | 'PERS';
hideAction?: boolean;
}>(),
{
hideAction: false,
},
);
</script> </script>
<template> <template>
@ -55,6 +61,7 @@ defineProps<{
class="col-12 text-weight-bold row items-center q-mb-sm" class="col-12 text-weight-bold row items-center q-mb-sm"
:style="{ opacity: actionDisabled ? '.5' : undefined }" :style="{ opacity: actionDisabled ? '.5' : undefined }"
:id="`form-branch-customer-no-${index}`" :id="`form-branch-customer-no-${index}`"
v-if="!hideAction"
> >
{{ {{
index === 0 index === 0