feat: filter based on status
This commit is contained in:
parent
004bf00be9
commit
b999802133
1 changed files with 73 additions and 17 deletions
|
|
@ -76,6 +76,8 @@ onMounted(async () => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const statusFilter = ref<'all' | 'statusACTIVE' | 'statusINACTIVE'>('all');
|
||||||
|
|
||||||
const currentHq = ref<{ id: string; code: string }>({
|
const currentHq = ref<{ id: string; code: string }>({
|
||||||
id: '',
|
id: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
@ -530,18 +532,64 @@ watch(locale, () => {
|
||||||
</div>
|
</div>
|
||||||
<div class="branch-wrapper q-pa-md">
|
<div class="branch-wrapper q-pa-md">
|
||||||
<div class="q-mb-md flex" style="gap: var(--size-4)">
|
<div class="q-mb-md flex" style="gap: var(--size-4)">
|
||||||
<div style="flex-grow: 1; display: flex; align-items: center">
|
<div
|
||||||
<q-select
|
style="
|
||||||
v-if="!currentHq.id"
|
flex-grow: 1;
|
||||||
outlined
|
display: flex;
|
||||||
v-model="fieldSelectedBranch"
|
align-items: stretch;
|
||||||
:options="
|
gap: var(--size-2);
|
||||||
fieldBranch.map((v) => ({ label: $t(v), value: v }))
|
"
|
||||||
"
|
>
|
||||||
:label="$t('select')"
|
<template v-if="!currentHq.id">
|
||||||
dense
|
<q-select
|
||||||
/>
|
v-model="fieldSelectedBranch"
|
||||||
|
style="min-width: 120px"
|
||||||
|
outlined
|
||||||
|
:options="
|
||||||
|
fieldBranch.map((v) => ({ label: $t(v), value: v }))
|
||||||
|
"
|
||||||
|
:label="$t('select')"
|
||||||
|
dense
|
||||||
|
/>
|
||||||
|
<q-btn
|
||||||
|
icon="mdi-tune-vertical-variant"
|
||||||
|
class="bordered rounded"
|
||||||
|
unelevated
|
||||||
|
>
|
||||||
|
<q-menu class="bordered">
|
||||||
|
<q-list v-close-popup dense>
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
class="flex items-center"
|
||||||
|
:class="{ 'app-text-info': statusFilter === 'all' }"
|
||||||
|
@click="statusFilter = 'all'"
|
||||||
|
>
|
||||||
|
{{ $t('all') }}
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
class="flex items-center"
|
||||||
|
:class="{
|
||||||
|
'app-text-info': statusFilter === 'statusACTIVE',
|
||||||
|
}"
|
||||||
|
@click="statusFilter = 'statusACTIVE'"
|
||||||
|
>
|
||||||
|
{{ $t('statusACTIVE') }}
|
||||||
|
</q-item>
|
||||||
|
<q-item
|
||||||
|
clickable
|
||||||
|
class="flex items-center"
|
||||||
|
:class="{
|
||||||
|
'app-text-info': statusFilter === 'statusINACTIVE',
|
||||||
|
}"
|
||||||
|
@click="statusFilter = 'statusINACTIVE'"
|
||||||
|
>
|
||||||
|
{{ $t('statusINACTIVE') }}
|
||||||
|
</q-item>
|
||||||
|
</q-list>
|
||||||
|
</q-menu>
|
||||||
|
</q-btn>
|
||||||
|
</template>
|
||||||
<div v-else class="text-weight-bold text">
|
<div v-else class="text-weight-bold text">
|
||||||
{{ $t('branchInHQ') }}
|
{{ $t('branchInHQ') }}
|
||||||
{{ currentHq.code }}
|
{{ currentHq.code }}
|
||||||
|
|
@ -581,6 +629,18 @@ watch(locale, () => {
|
||||||
<BranchCard
|
<BranchCard
|
||||||
v-for="item in branchData.result
|
v-for="item in branchData.result
|
||||||
.filter((v) => {
|
.filter((v) => {
|
||||||
|
if (
|
||||||
|
statusFilter === 'statusACTIVE' &&
|
||||||
|
v.status === 'INACTIVE'
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
statusFilter === 'statusINACTIVE' &&
|
||||||
|
v.status !== 'INACTIVE'
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!!currentHq.id && currentHq.id === v.headOfficeId) {
|
if (!!currentHq.id && currentHq.id === v.headOfficeId) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -618,11 +678,7 @@ watch(locale, () => {
|
||||||
() => {
|
() => {
|
||||||
if (item.hq) {
|
if (item.hq) {
|
||||||
fieldSelectedBranch.value = '';
|
fieldSelectedBranch.value = '';
|
||||||
currentHq = {
|
currentHq = { id: item.id, code: item.branchLabelCode };
|
||||||
id: item.id,
|
|
||||||
code: item.branchLabelCode,
|
|
||||||
};
|
|
||||||
|
|
||||||
beforeBranch = {
|
beforeBranch = {
|
||||||
id: '',
|
id: '',
|
||||||
code: '',
|
code: '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue