2024-04-03 18:28:59 +07:00
|
|
|
<script setup lang="ts">
|
2024-04-05 17:26:40 +07:00
|
|
|
import { ref, onMounted } from 'vue';
|
|
|
|
|
import useUserStore from 'stores/user';
|
|
|
|
|
import { storeToRefs } from 'pinia';
|
2024-04-04 15:03:39 +07:00
|
|
|
|
2024-04-05 17:36:54 +07:00
|
|
|
import PersonCard from 'components/home/PersonCard.vue';
|
2024-04-03 18:28:59 +07:00
|
|
|
import AppBox from 'components/app/AppBox.vue';
|
2024-04-05 17:36:54 +07:00
|
|
|
import StatCardComponent from 'components/StatCardComponent.vue';
|
|
|
|
|
import SelectorList from 'components/SelectorList.vue';
|
2024-04-04 16:39:50 +07:00
|
|
|
import BtnAddComponet from 'components/01_branch-management/BtnAddComponet.vue';
|
2024-04-05 17:36:54 +07:00
|
|
|
import TooltipComponet from 'components/TooltipComponet.vue';
|
2024-04-04 15:03:39 +07:00
|
|
|
|
2024-04-05 17:26:40 +07:00
|
|
|
const userStore = useUserStore();
|
|
|
|
|
const { data: userData } = storeToRefs(userStore);
|
2024-04-03 18:28:59 +07:00
|
|
|
|
2024-04-05 17:26:40 +07:00
|
|
|
onMounted(async () => {
|
|
|
|
|
await userStore.fetchList();
|
|
|
|
|
});
|
2024-04-04 15:03:39 +07:00
|
|
|
|
2024-04-05 17:31:29 +07:00
|
|
|
const branchStat = ref([
|
|
|
|
|
{ label: 'Branch A', amount: 1 },
|
|
|
|
|
{ label: 'Branch B', amount: 5 },
|
|
|
|
|
{ label: 'Branch C', amount: 3 },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
const selectorLabel = ref('');
|
2024-04-04 15:03:39 +07:00
|
|
|
const selectorList = [
|
2024-04-05 17:31:29 +07:00
|
|
|
{ label: 'personnelSelector1', count: 0 },
|
|
|
|
|
{ label: 'personnelSelector2', count: 0 },
|
|
|
|
|
{ label: 'personnelSelector3', count: 0 },
|
|
|
|
|
{ label: 'personnelSelector4', count: 0 },
|
2024-04-04 15:03:39 +07:00
|
|
|
] satisfies InstanceType<typeof SelectorList>['$props']['list'];
|
2024-04-03 18:28:59 +07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2024-04-04 15:03:39 +07:00
|
|
|
<div class="column q-pb-lg">
|
2024-04-04 16:39:50 +07:00
|
|
|
<div class="text-h6 text-weight-bold q-mb-md">
|
|
|
|
|
{{ $t('personnelManagement') }}
|
|
|
|
|
</div>
|
2024-04-04 15:03:39 +07:00
|
|
|
|
|
|
|
|
<div class="row full-width q-mb-md no-wrap">
|
|
|
|
|
<!-- selector -->
|
2024-04-04 16:39:50 +07:00
|
|
|
<SelectorList
|
|
|
|
|
:list="selectorList"
|
|
|
|
|
v-model:selector="selectorLabel"
|
|
|
|
|
class="q-mr-md col-4"
|
|
|
|
|
/>
|
2024-04-04 15:03:39 +07:00
|
|
|
|
|
|
|
|
<!-- stat -->
|
2024-04-05 10:37:57 +07:00
|
|
|
<AppBox bordered class="column full-width">
|
|
|
|
|
<span class="q-pb-lg text-weight-bold text-subtitle1">
|
|
|
|
|
{{ $t('personnelStatTitle') + $t(selectorLabel) }}
|
2024-04-04 15:03:39 +07:00
|
|
|
</span>
|
2024-04-05 10:37:57 +07:00
|
|
|
<div class="row col full-width" style="overflow-x: auto">
|
2024-04-05 17:36:54 +07:00
|
|
|
<StatCardComponent :branch="branchStat" class="no-wrap" />
|
2024-04-04 16:39:50 +07:00
|
|
|
</div>
|
2024-04-04 15:03:39 +07:00
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
2024-04-03 18:28:59 +07:00
|
|
|
|
2024-04-04 15:03:39 +07:00
|
|
|
<!-- main -->
|
|
|
|
|
<AppBox bordered style="width: 100%; height: 580px; overflow-y: auto">
|
2024-04-05 17:26:40 +07:00
|
|
|
<PersonCard
|
|
|
|
|
:list="
|
|
|
|
|
userData?.result.map((v) => ({
|
|
|
|
|
img: `${v.profileImageUrl}`,
|
|
|
|
|
name: `${v.firstName} ${v.lastName}`,
|
|
|
|
|
male: v.gender === 'male',
|
|
|
|
|
female: v.gender === 'female',
|
|
|
|
|
detail: [
|
|
|
|
|
{ label: 'Email', value: v.email },
|
|
|
|
|
{ label: 'Telephone No', value: v.telephoneNo },
|
|
|
|
|
],
|
|
|
|
|
badge: v.code.slice(0, 10),
|
|
|
|
|
disabled: v.status === 'INACTIVE',
|
|
|
|
|
})) || []
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
<div
|
|
|
|
|
class="column"
|
|
|
|
|
style="height: 100%"
|
|
|
|
|
v-if="userData && userData.total === 0"
|
|
|
|
|
>
|
2024-04-04 16:39:50 +07:00
|
|
|
<div class="col-1 self-end">
|
|
|
|
|
<div class="row">
|
|
|
|
|
<tooltip-componet
|
|
|
|
|
title="personnelTooltipTitle"
|
|
|
|
|
caption="personnelTooltipCaption"
|
|
|
|
|
imgSrc="personnel-table-"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="col self-center" style="display: flex; align-items: center">
|
|
|
|
|
<btn-add-componet
|
2024-04-04 18:08:37 +07:00
|
|
|
:label="'personnelAdd'"
|
2024-04-05 09:24:10 +07:00
|
|
|
:cyanOn="true"
|
2024-04-04 16:39:50 +07:00
|
|
|
@trigger="
|
|
|
|
|
() => {
|
|
|
|
|
console.log('test');
|
|
|
|
|
}
|
|
|
|
|
"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2024-04-03 18:28:59 +07:00
|
|
|
</AppBox>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|