feat: เพิ่ม toggleStatusEmployee
This commit is contained in:
parent
686d88c8d4
commit
3ce1e0da44
4 changed files with 31 additions and 4 deletions
|
|
@ -207,6 +207,7 @@ watch(currentStatus, async () => {
|
||||||
class="col-4"
|
class="col-4"
|
||||||
>
|
>
|
||||||
<BranchCardCustomer
|
<BranchCardCustomer
|
||||||
|
:inactive="br.status === 'INACTIVE'"
|
||||||
:color="customerType"
|
:color="customerType"
|
||||||
:badgeField="['status']"
|
:badgeField="['status']"
|
||||||
:data="{
|
:data="{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ defineEmits<{
|
||||||
(e: 'deleteCard', id: string): void;
|
(e: 'deleteCard', id: string): void;
|
||||||
(e: 'updateCard', action: 'FORM' | 'INFO', id: string): void;
|
(e: 'updateCard', action: 'FORM' | 'INFO', id: string): void;
|
||||||
(e: 'enterCard', action: 'FORM' | 'INFO', id: string): void;
|
(e: 'enterCard', action: 'FORM' | 'INFO', id: string): void;
|
||||||
(e: 'toggleStatus', id: string): void;
|
(e: 'toggleStatus', id: string, status: boolean): void;
|
||||||
}>();
|
}>();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
@ -126,8 +126,10 @@ defineEmits<{
|
||||||
<q-toggle
|
<q-toggle
|
||||||
dense
|
dense
|
||||||
size="sm"
|
size="sm"
|
||||||
@click="$emit('toggleStatus', v.id)"
|
@click="
|
||||||
:model-value="!v.disabled"
|
$emit('toggleStatus', v.id, v.disabled === false)
|
||||||
|
"
|
||||||
|
:model-value="v.disabled"
|
||||||
val="xs"
|
val="xs"
|
||||||
padding="none"
|
padding="none"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
async function toggleStatusCustomer(id: string, status: boolean) {
|
||||||
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
await editById(id, { status: !status ? 'ACTIVE' : 'INACTIVE' });
|
||||||
|
|
||||||
|
|
@ -787,6 +791,10 @@ async function submitBranch() {
|
||||||
if (formData.value.customerBranch?.[0]) {
|
if (formData.value.customerBranch?.[0]) {
|
||||||
delete formData.value.customerBranch[0]['id'];
|
delete formData.value.customerBranch[0]['id'];
|
||||||
|
|
||||||
|
formData.value.customerBranch[0].status = statusToggle.value
|
||||||
|
? 'ACTIVE'
|
||||||
|
: 'INACTIVE';
|
||||||
|
|
||||||
await editBranchById(currentBranchId.value, {
|
await editBranchById(currentBranchId.value, {
|
||||||
...formData.value.customerBranch[0],
|
...formData.value.customerBranch[0],
|
||||||
customerId: currentCustomerId.value,
|
customerId: currentCustomerId.value,
|
||||||
|
|
@ -1541,6 +1549,7 @@ watch(selectorLabel, async () => {
|
||||||
:list="
|
:list="
|
||||||
(!!inputSearch ? resultSearchEmployee ?? [] : listEmployee).map(
|
(!!inputSearch ? resultSearchEmployee ?? [] : listEmployee).map(
|
||||||
(v: Employee) => ({
|
(v: Employee) => ({
|
||||||
|
disabled: v.status === 'INACTIVE',
|
||||||
img: v.profileImageUrl,
|
img: v.profileImageUrl,
|
||||||
id: v.id,
|
id: v.id,
|
||||||
name:
|
name:
|
||||||
|
|
@ -1566,6 +1575,7 @@ watch(selectorLabel, async () => {
|
||||||
@update-card="openDialogInputForm"
|
@update-card="openDialogInputForm"
|
||||||
@enter-card="openDialogInputForm"
|
@enter-card="openDialogInputForm"
|
||||||
@delete-card="onDelete"
|
@delete-card="onDelete"
|
||||||
|
@toggle-status="(id, status) => toggleStatusEmployee(id, status)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="row flex-center q-pt-md">
|
<div class="row flex-center q-pt-md">
|
||||||
|
|
@ -1631,6 +1641,8 @@ watch(selectorLabel, async () => {
|
||||||
(v) => {
|
(v) => {
|
||||||
currentBranchId = v[0].id;
|
currentBranchId = v[0].id;
|
||||||
|
|
||||||
|
statusToggle = v[0].status === 'INACTIVE' ? false : true;
|
||||||
|
|
||||||
currentBranch = {
|
currentBranch = {
|
||||||
name: v[0].name,
|
name: v[0].name,
|
||||||
code: v[0].code,
|
code: v[0].code,
|
||||||
|
|
@ -2478,6 +2490,18 @@ watch(selectorLabel, async () => {
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
</AppBox>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template #information>
|
<template #information>
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ const useEmployeeStore = defineStore('api-employee', () => {
|
||||||
|
|
||||||
async function editById(
|
async function editById(
|
||||||
id: string,
|
id: string,
|
||||||
data: EmployeeCreate,
|
data: Partial<EmployeeCreate>,
|
||||||
flow?: {
|
flow?: {
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
refTransactionId: string;
|
refTransactionId: string;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue