feat: เพิ่ม toggleStatusEmployee
This commit is contained in:
parent
686d88c8d4
commit
3ce1e0da44
4 changed files with 31 additions and 4 deletions
|
|
@ -720,6 +720,10 @@ async function fetchListEmployee(param?: {
|
|||
}
|
||||
}
|
||||
|
||||
async function toggleStatusEmployee(id: string, status: boolean) {
|
||||
await employeeStore.editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
||||
}
|
||||
|
||||
async function toggleStatusCustomer(id: string, status: boolean) {
|
||||
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
||||
|
||||
|
|
@ -787,6 +791,10 @@ async function submitBranch() {
|
|||
if (formData.value.customerBranch?.[0]) {
|
||||
delete formData.value.customerBranch[0]['id'];
|
||||
|
||||
formData.value.customerBranch[0].status = statusToggle.value
|
||||
? 'ACTIVE'
|
||||
: 'INACTIVE';
|
||||
|
||||
await editBranchById(currentBranchId.value, {
|
||||
...formData.value.customerBranch[0],
|
||||
customerId: currentCustomerId.value,
|
||||
|
|
@ -1541,6 +1549,7 @@ watch(selectorLabel, async () => {
|
|||
:list="
|
||||
(!!inputSearch ? resultSearchEmployee ?? [] : listEmployee).map(
|
||||
(v: Employee) => ({
|
||||
disabled: v.status === 'INACTIVE',
|
||||
img: v.profileImageUrl,
|
||||
id: v.id,
|
||||
name:
|
||||
|
|
@ -1566,6 +1575,7 @@ watch(selectorLabel, async () => {
|
|||
@update-card="openDialogInputForm"
|
||||
@enter-card="openDialogInputForm"
|
||||
@delete-card="onDelete"
|
||||
@toggle-status="(id, status) => toggleStatusEmployee(id, status)"
|
||||
/>
|
||||
|
||||
<div class="row flex-center q-pt-md">
|
||||
|
|
@ -1631,6 +1641,8 @@ watch(selectorLabel, async () => {
|
|||
(v) => {
|
||||
currentBranchId = v[0].id;
|
||||
|
||||
statusToggle = v[0].status === 'INACTIVE' ? false : true;
|
||||
|
||||
currentBranch = {
|
||||
name: v[0].name,
|
||||
code: v[0].code,
|
||||
|
|
@ -2478,6 +2490,18 @@ watch(selectorLabel, async () => {
|
|||
}"
|
||||
/>
|
||||
</AppBox>
|
||||
|
||||
<div class="text-left q-pt-md" v-if="infoDrawerEdit">
|
||||
<q-toggle
|
||||
id="toggle-status"
|
||||
dense
|
||||
size="md"
|
||||
v-model="statusToggle"
|
||||
padding="none"
|
||||
class="q-pr-md"
|
||||
/>
|
||||
<span>สถานะสาขา</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<template #information>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue