feat: แก้ สถานะ ของCustomer

This commit is contained in:
Net 2024-06-19 14:54:03 +07:00
parent 5a0087b649
commit 0a10ac94fd
3 changed files with 84 additions and 6 deletions

View file

@ -720,6 +720,12 @@ async function fetchListEmployee(param?: {
}
}
async function toggleStatusCustomer(id: string, status: boolean) {
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
await fetchListCustomer();
}
async function onSubmitEdit(id: string) {
if (selectorLabel.value === 'EMPLOYER') {
if (!formData.value) return;
@ -1429,7 +1435,10 @@ watch(selectorLabel, async () => {
:key="i.id"
class="hover-card"
:color="i.customerType === 'CORP' ? 'purple' : 'green'"
:metadata="{ id: '1', disabled: false }"
:metadata="{
id: i.id,
disabled: i.status === 'ACTIVE' || i.status === 'CREATED',
}"
:badge="i.branch"
:list="{
id: i.id,
@ -1437,6 +1446,7 @@ watch(selectorLabel, async () => {
type: i.customerType,
name: i.customerName === '' ? '-' : i.customerName,
code: i.code,
status: i.status,
detail: [
{
@ -1488,6 +1498,14 @@ watch(selectorLabel, async () => {
}
"
@delete-card="deleteCustomerById(i.id)"
@toggle-status="
() => {
toggleStatusCustomer(
i.id,
i.status === 'ACTIVE' ? true : false,
);
}
"
/>
</div>
@ -2250,12 +2268,16 @@ watch(selectorLabel, async () => {
:color="
currentCustomer.customerType === 'CORP' ? 'purple' : 'green'
"
:metadata="{ id: '1', disabled: false }"
:metadata="{
id: '1',
disabled: currentCustomer.status === 'ACTIVE',
}"
:list="{
id: '1',
type: currentCustomer.customerType,
name: currentCustomer.customerName,
imageUrl: currentCustomer.imageUrl,
status: currentCustomer.status,
code: 'HQ006',
}"
/>
@ -2442,12 +2464,16 @@ watch(selectorLabel, async () => {
:color="
currentCustomer.customerType === 'CORP' ? 'purple' : 'green'
"
:metadata="{ id: '1', disabled: false }"
:metadata="{
id: '1',
disabled: currentCustomer.status === 'ACTIVE',
}"
:list="{
id: '1',
type: currentCustomer.customerType,
name: currentCustomer.customerName,
imageUrl: currentCustomer.imageUrl,
status: currentCustomer.status,
code: 'HQ006',
}"
/>