fix: 02-personnel management layout
This commit is contained in:
parent
bcd81d0f41
commit
de18933332
4 changed files with 155 additions and 129 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
export default {
|
export default {
|
||||||
personnelTitle: 'Personnel',
|
personnelTitle: 'Personnel',
|
||||||
personnelManagement: 'Personnel Management',
|
personnelManagement: 'Personnel Management',
|
||||||
|
personnelManagementCaption: 'Manage All Personnel',
|
||||||
|
|
||||||
personnelTooltipTitle: 'No personnel yet?',
|
personnelTooltipTitle: 'No personnel yet?',
|
||||||
personnelTooltipCaption: 'Click + to add a personnel',
|
personnelTooltipCaption: 'Click + to add a personnel',
|
||||||
personnelAdd: 'Add personnel',
|
personnelAdd: 'Add personnel',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
export default {
|
export default {
|
||||||
personnelTitle: 'บุคลากร',
|
personnelTitle: 'บุคลากร',
|
||||||
personnelManagement: 'จัดการบุคลากร',
|
personnelManagement: 'จัดการบุคลากร',
|
||||||
|
personnelManagementCaption: 'จัดการบุคลากรทั้งหมด',
|
||||||
|
|
||||||
personnelTooltipTitle: 'ยังไม่มีข้อมูลบุคลากร',
|
personnelTooltipTitle: 'ยังไม่มีข้อมูลบุคลากร',
|
||||||
personnelTooltipCaption: 'คลิก + เพื่อเพิ่มบุคลากร',
|
personnelTooltipCaption: 'คลิก + เพื่อเพิ่มบุคลากร',
|
||||||
personnelAdd: 'เพิ่มบุคลากร',
|
personnelAdd: 'เพิ่มบุคลากร',
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch, computed } from 'vue';
|
import { ref, onMounted, watch, computed } from 'vue';
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import { dialog } from 'src/stores/utils';
|
import useUtilsStore, { dialog } from 'src/stores/utils';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import useFlowStore from 'src/stores/flow';
|
import useFlowStore from 'src/stores/flow';
|
||||||
import useUserStore from 'stores/user';
|
import useUserStore from 'stores/user';
|
||||||
|
|
@ -34,6 +34,7 @@ import PaginationComponent from 'src/components/PaginationComponent.vue';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
||||||
|
const utilsStore = useUtilsStore();
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const branchStore = useBranchStore();
|
const branchStore = useBranchStore();
|
||||||
|
|
@ -466,6 +467,9 @@ async function assignFormData(idEdit: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
utilsStore.currentTitle.title = 'personnelManagement';
|
||||||
|
utilsStore.currentTitle.caption = 'personnelManagementCaption';
|
||||||
|
|
||||||
await fetchUserList();
|
await fetchUserList();
|
||||||
|
|
||||||
userStore.userOption.roleOpts.length === 0
|
userStore.userOption.roleOpts.length === 0
|
||||||
|
|
@ -548,12 +552,12 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
></q-fab-action>
|
></q-fab-action>
|
||||||
</ButtonAddComponent>
|
</ButtonAddComponent>
|
||||||
|
|
||||||
<div class="column q-pb-lg">
|
<div class="column full-height">
|
||||||
<div class="text-h6 text-weight-bold q-mb-md">
|
<!-- <div class="text-h6 text-weight-bold q-mb-md">
|
||||||
{{ $t('personnelManagement') }}
|
{{ $t('personnelManagement') }}
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="row full-width q-mb-md no-wrap">
|
<div class="row full-width no-wrap q-pb-md">
|
||||||
<!-- selector -->
|
<!-- selector -->
|
||||||
<SelectorList
|
<SelectorList
|
||||||
:list="selectorList"
|
:list="selectorList"
|
||||||
|
|
@ -587,132 +591,140 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- main -->
|
<!-- main -->
|
||||||
<AppBox bordered class="column" style="width: 100%; min-height: 70vh">
|
<div
|
||||||
<div class="row q-mb-md justify-between">
|
class="col scroll bordered surface-1 rounded q-pa-md justify-between column no-wrap"
|
||||||
<q-btn
|
>
|
||||||
id="btn-filter"
|
<div>
|
||||||
icon="mdi-tune-vertical-variant"
|
<div class="row q-mb-md justify-between">
|
||||||
size="sm"
|
<q-btn
|
||||||
class="bordered rounded"
|
id="btn-filter"
|
||||||
:class="{ 'app-text-info': statusFilter !== 'all' }"
|
icon="mdi-tune-vertical-variant"
|
||||||
unelevated
|
size="sm"
|
||||||
>
|
class="bordered rounded"
|
||||||
<q-menu class="bordered">
|
:class="{ 'app-text-info': statusFilter !== 'all' }"
|
||||||
<q-list v-close-popup dense>
|
unelevated
|
||||||
<q-item
|
>
|
||||||
id="btn-filter-all"
|
<q-menu class="bordered">
|
||||||
clickable
|
<q-list v-close-popup dense>
|
||||||
class="flex items-center"
|
<q-item
|
||||||
:class="{ 'app-text-info': statusFilter === 'all' }"
|
id="btn-filter-all"
|
||||||
@click="statusFilter = 'all'"
|
clickable
|
||||||
>
|
class="flex items-center"
|
||||||
{{ $t('all') }}
|
:class="{ 'app-text-info': statusFilter === 'all' }"
|
||||||
</q-item>
|
@click="statusFilter = 'all'"
|
||||||
<q-item
|
>
|
||||||
id="btn-filter-active"
|
{{ $t('all') }}
|
||||||
clickable
|
</q-item>
|
||||||
class="flex items-center"
|
<q-item
|
||||||
:class="{
|
id="btn-filter-active"
|
||||||
'app-text-info': statusFilter === 'statusACTIVE',
|
clickable
|
||||||
}"
|
class="flex items-center"
|
||||||
@click="statusFilter = 'statusACTIVE'"
|
:class="{
|
||||||
>
|
'app-text-info': statusFilter === 'statusACTIVE',
|
||||||
{{ $t('statusACTIVE') }}
|
}"
|
||||||
</q-item>
|
@click="statusFilter = 'statusACTIVE'"
|
||||||
<q-item
|
>
|
||||||
id="btn-filter-inactive"
|
{{ $t('statusACTIVE') }}
|
||||||
clickable
|
</q-item>
|
||||||
class="flex items-center"
|
<q-item
|
||||||
:class="{
|
id="btn-filter-inactive"
|
||||||
'app-text-info': statusFilter === 'statusINACTIVE',
|
clickable
|
||||||
}"
|
class="flex items-center"
|
||||||
@click="statusFilter = 'statusINACTIVE'"
|
:class="{
|
||||||
>
|
'app-text-info': statusFilter === 'statusINACTIVE',
|
||||||
{{ $t('statusINACTIVE') }}
|
}"
|
||||||
</q-item>
|
@click="statusFilter = 'statusINACTIVE'"
|
||||||
</q-list>
|
>
|
||||||
</q-menu>
|
{{ $t('statusINACTIVE') }}
|
||||||
</q-btn>
|
</q-item>
|
||||||
<q-input
|
</q-list>
|
||||||
for="input-search"
|
</q-menu>
|
||||||
style="width: 250px"
|
</q-btn>
|
||||||
outlined
|
<q-input
|
||||||
dense
|
for="input-search"
|
||||||
:label="$t('search')"
|
style="width: 250px"
|
||||||
debounce="500"
|
outlined
|
||||||
v-model="inputSearch"
|
dense
|
||||||
></q-input>
|
:label="$t('search')"
|
||||||
</div>
|
debounce="500"
|
||||||
<PersonCard
|
v-model="inputSearch"
|
||||||
:list="
|
></q-input>
|
||||||
userData?.result
|
</div>
|
||||||
.filter((v) => {
|
<PersonCard
|
||||||
if (statusFilter === 'statusACTIVE' && v.status === 'INACTIVE') {
|
:list="
|
||||||
return false;
|
userData?.result
|
||||||
}
|
.filter((v) => {
|
||||||
if (
|
if (
|
||||||
statusFilter === 'statusINACTIVE' &&
|
statusFilter === 'statusACTIVE' &&
|
||||||
v.status !== 'INACTIVE'
|
v.status === 'INACTIVE'
|
||||||
) {
|
) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
if (
|
||||||
})
|
statusFilter === 'statusINACTIVE' &&
|
||||||
.map((v) => ({
|
v.status !== 'INACTIVE'
|
||||||
id: v.id,
|
) {
|
||||||
img: `${v.profileImageUrl}`,
|
return false;
|
||||||
name:
|
}
|
||||||
$i18n.locale === 'en-US'
|
return true;
|
||||||
? `${v.firstNameEN} ${v.lastNameEN}`
|
})
|
||||||
: `${v.firstName} ${v.lastName}`,
|
.map((v) => ({
|
||||||
male: v.gender === 'male',
|
id: v.id,
|
||||||
female: v.gender === 'female',
|
img: `${v.profileImageUrl}`,
|
||||||
detail: [
|
name:
|
||||||
{ label: $t('personnelCardUserType'), value: $t(v.userType) },
|
$i18n.locale === 'en-US'
|
||||||
{ label: $t('personnelCardTelephone'), value: v.telephoneNo },
|
? `${v.firstNameEN} ${v.lastNameEN}`
|
||||||
{
|
: `${v.firstName} ${v.lastName}`,
|
||||||
label: $t('personnelCardAge'),
|
male: v.gender === 'male',
|
||||||
value: userStore.calculateAge(v.birthDate as Date) || '',
|
female: v.gender === 'female',
|
||||||
},
|
detail: [
|
||||||
],
|
{ label: $t('personnelCardUserType'), value: $t(v.userType) },
|
||||||
badge: v.code,
|
{ label: $t('personnelCardTelephone'), value: v.telephoneNo },
|
||||||
disabled: v.status === 'INACTIVE',
|
{
|
||||||
})) || []
|
label: $t('personnelCardAge'),
|
||||||
"
|
value: userStore.calculateAge(v.birthDate as Date) || '',
|
||||||
@update-card="openDialog"
|
},
|
||||||
@delete-card="onDelete"
|
],
|
||||||
@enter-card="openDialog"
|
badge: v.code,
|
||||||
@toggle-status="toggleStatus"
|
disabled: v.status === 'INACTIVE',
|
||||||
/>
|
})) || []
|
||||||
<template v-if="userData && userData.total === 0 && !inputSearch">
|
"
|
||||||
<div class="col-1 self-end">
|
@update-card="openDialog"
|
||||||
<div class="row">
|
@delete-card="onDelete"
|
||||||
<TooltipComponent
|
@enter-card="openDialog"
|
||||||
title="personnelTooltipTitle"
|
@toggle-status="toggleStatus"
|
||||||
caption="personnelTooltipCaption"
|
/>
|
||||||
imgSrc="personnel-table-"
|
<template v-if="userData && userData.total === 0 && !inputSearch">
|
||||||
|
<div class="col-1 self-end">
|
||||||
|
<div class="row">
|
||||||
|
<TooltipComponent
|
||||||
|
title="personnelTooltipTitle"
|
||||||
|
caption="personnelTooltipCaption"
|
||||||
|
imgSrc="personnel-table-"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="col self-center"
|
||||||
|
style="display: flex; flex-grow: 1; align-items: center"
|
||||||
|
>
|
||||||
|
<AddButton
|
||||||
|
:label="'personnelAdd'"
|
||||||
|
:cyanOn="true"
|
||||||
|
@trigger="openDialog('FORM')"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</template>
|
||||||
<div
|
|
||||||
class="col self-center"
|
|
||||||
style="display: flex; flex-grow: 1; align-items: center"
|
|
||||||
>
|
|
||||||
<AddButton
|
|
||||||
:label="'personnelAdd'"
|
|
||||||
:cyanOn="true"
|
|
||||||
@trigger="openDialog('FORM')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="userData?.total === 0 && !!inputSearch"
|
v-if="userData?.total === 0 && !!inputSearch"
|
||||||
class="row full-width items-center justify-center"
|
class="row full-width items-center justify-center"
|
||||||
style="min-height: 250px"
|
style="min-height: 250px"
|
||||||
>
|
>
|
||||||
<NoData :not-found="!!inputSearch" />
|
<NoData :not-found="!!inputSearch" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row justify-between q-pt-md" v-if="currentMaxPage > 0">
|
<div class="row justify-between q-pt-md" v-if="currentMaxPage > 0">
|
||||||
<div class="app-text-muted">
|
<div class="app-text-muted">
|
||||||
{{
|
{{
|
||||||
|
|
@ -728,7 +740,7 @@ watch(inputSearch, async () => await fetchUserList());
|
||||||
:fetch-data="async () => await fetchUserList()"
|
:fetch-data="async () => await fetchUserList()"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AppBox>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DrawerInfo
|
<DrawerInfo
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import MenuItem from 'components/home/MenuItem.vue';
|
import MenuItem from 'components/home/MenuItem.vue';
|
||||||
|
import useUtilsStore from 'src/stores/utils';
|
||||||
|
import { onMounted } from 'vue';
|
||||||
|
|
||||||
|
const utilsStore = useUtilsStore();
|
||||||
const menu = [
|
const menu = [
|
||||||
{
|
{
|
||||||
value: 'branch-management',
|
value: 'branch-management',
|
||||||
|
|
@ -93,10 +96,17 @@ const menu = [
|
||||||
disabled: true,
|
disabled: true,
|
||||||
},
|
},
|
||||||
] satisfies InstanceType<typeof MenuItem>['$props']['list'];
|
] satisfies InstanceType<typeof MenuItem>['$props']['list'];
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
utilsStore.currentTitle.title = '';
|
||||||
|
utilsStore.currentTitle.caption = '';
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<MenuItem :list="menu" />
|
<div>
|
||||||
|
<MenuItem :list="menu" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue