Merge branch 'feat/connect-api-fn' into develop

This commit is contained in:
Methapon2001 2024-04-05 17:31:48 +07:00
commit d5b88adfa7
5 changed files with 62 additions and 115 deletions

View file

@ -1,9 +1,16 @@
<script lang="ts" setup> <script lang="ts" setup>
defineProps<{ dark?: boolean; bordered?: boolean }>(); defineProps<{ dark?: boolean; bordered?: boolean; shadowed?: boolean }>();
</script> </script>
<template> <template>
<div class="app-box" :class="{ dark, 'app-box__bordered': bordered }"> <div
class="app-box"
:class="{
dark,
'app-box__bordered': bordered,
'app-box__shadowed': shadowed,
}"
>
<slot /> <slot />
</div> </div>
</template> </template>
@ -14,6 +21,9 @@ defineProps<{ dark?: boolean; bordered?: boolean }>();
background-color: var(--surface-1); background-color: var(--surface-1);
border-radius: var(--radius-3); border-radius: var(--radius-3);
padding: var(--size-4); padding: var(--size-4);
}
.app-box__shadowed {
box-shadow: var(--shadow-1); box-shadow: var(--shadow-1);
} }

View file

@ -14,6 +14,7 @@ defineProps<{
disabled?: boolean; disabled?: boolean;
img?: string; img?: string;
}[]; }[];
detailColumnCount?: number;
}>(); }>();
const status = ref(false); const status = ref(false);
@ -131,7 +132,7 @@ const status = ref(false);
<!-- detail --> <!-- detail -->
<q-separator /> <q-separator />
<div <div
class="q-pt-sm q-pb-md q-px-lg q-gutter-x-xl person-detail rounded-b" class="q-pt-sm q-px-sm q-pb-md person-detail rounded-b full-width"
:class="{ :class="{
'bg-gender': v.male || v.female, 'bg-gender': v.male || v.female,
'bg-gender__light': 'bg-gender__light':
@ -140,6 +141,11 @@ const status = ref(false);
'bg-gender__female': !v.disabled && v.female, 'bg-gender__female': !v.disabled && v.female,
'bg-gender__disable': v.disabled, 'bg-gender__disable': v.disabled,
}" }"
:style="
(detailColumnCount &&
`grid-template-columns: repeat(${detailColumnCount}, 1fr);`) ||
''
"
> >
<div v-for="(d, j) in v.detail" :key="j"> <div v-for="(d, j) in v.detail" :key="j">
<span <span
@ -219,6 +225,7 @@ const status = ref(false);
flex-grow: 1; flex-grow: 1;
grid-template-columns: repeat(2, 1fr); grid-template-columns: repeat(2, 1fr);
gap: var(--size-2); gap: var(--size-2);
overflow-x: scroll;
& > * { & > * {
display: flex; display: flex;

View file

@ -1,5 +1,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { ref, onMounted } from 'vue';
import useUserStore from 'stores/user';
import { storeToRefs } from 'pinia';
import PersonCard from 'src/components/home/PersonCard.vue'; import PersonCard from 'src/components/home/PersonCard.vue';
import AppBox from 'components/app/AppBox.vue'; import AppBox from 'components/app/AppBox.vue';
@ -8,115 +10,25 @@ import SelectorList from 'src/components/SelectorList.vue';
import BtnAddComponet from 'components/01_branch-management/BtnAddComponet.vue'; import BtnAddComponet from 'components/01_branch-management/BtnAddComponet.vue';
import TooltipComponet from 'src/components/TooltipComponet.vue'; import TooltipComponet from 'src/components/TooltipComponet.vue';
const selectorLabel = ref(''); const userStore = useUserStore();
const { data: userData } = storeToRefs(userStore);
const person = [ onMounted(async () => {
{ await userStore.fetchList();
name: 'นายสันติ เมติกาญจ์', });
badge: 'CORP000001-01-240002',
detail: [
{ label: 'สัญชาติ', value: 'ไทย' },
{ label: 'ตำแหน่ง', value: 'นักบริหาร' },
{ label: 'โทรศัพท์', value: '0621249602' },
{ label: 'ตำแหน่ง', value: '32 ปี' },
],
male: true,
img: 'profile.png',
},
{
name: 'นางสาวสุขใจ แสนดี',
badge: 'CORP000001-01-240001',
detail: [
{ label: 'สัญชาติ', value: 'ไทย' },
{ label: 'ตำแหน่ง', value: 'นักบริหาร' },
{ label: 'โทรศัพท์', value: '0621249602' },
{ label: 'ตำแหน่ง', value: '32 ปี' },
],
female: true,
},
{
name: 'นายสันติ เมติกาญจ์',
badge: 'CORP000001-01-240002',
detail: [
{ label: 'สัญชาติ', value: 'ไทย' },
{ label: 'ตำแหน่ง', value: 'นักบริหาร' },
{ label: 'โทรศัพท์', value: '0621249602' },
{ label: 'ตำแหน่ง', value: '32 ปี' },
],
male: true,
disabled: true,
img: 'profile.png',
},
{
name: 'นางสาวสุขใจ แสนดี',
badge: 'CORP000001-01-240001',
detail: [
{ label: 'สัญชาติ', value: 'ไทย' },
{ label: 'ตำแหน่ง', value: 'นักบริหาร' },
{ label: 'โทรศัพท์', value: '0621249602' },
{ label: 'ตำแหน่ง', value: '32 ปี' },
],
female: true,
disabled: true,
},
{
name: 'นางสาวสุขใจ แสนดี',
badge: 'CORP000001-01-240001',
detail: [
{ label: 'สัญชาติ', value: 'ไทย' },
{ label: 'ตำแหน่ง', value: 'นักบริหาร' },
{ label: 'โทรศัพท์', value: '0621249602' },
{ label: 'ตำแหน่ง', value: '32 ปี' },
],
female: true,
},
] satisfies InstanceType<typeof PersonCard>['$props']['list'];
const branchStat = ref< const branchStat = ref([
{ { label: 'Branch A', amount: 1 },
amount: string; { label: 'Branch B', amount: 5 },
label: string; { label: 'Branch C', amount: 3 },
}[]
>([
{
amount: '0',
label: '-',
},
{
amount: '0',
label: '-',
},
{
amount: '0',
label: '-',
},
{
amount: '0',
label: '-',
},
{
amount: '0',
label: '-',
},
]); ]);
const selectorLabel = ref('');
const selectorList = [ const selectorList = [
{ { label: 'personnelSelector1', count: 0 },
label: 'personnelSelector1', { label: 'personnelSelector2', count: 0 },
count: 0, { label: 'personnelSelector3', count: 0 },
}, { label: 'personnelSelector4', count: 0 },
{
label: 'personnelSelector2',
count: 0,
},
{
label: 'personnelSelector3',
count: 0,
},
{
label: 'personnelSelector4',
count: 0,
},
] satisfies InstanceType<typeof SelectorList>['$props']['list']; ] satisfies InstanceType<typeof SelectorList>['$props']['list'];
</script> </script>
@ -147,8 +59,27 @@ const selectorList = [
<!-- main --> <!-- main -->
<AppBox bordered style="width: 100%; height: 580px; overflow-y: auto"> <AppBox bordered style="width: 100%; height: 580px; overflow-y: auto">
<!-- <PersonCard :list="person" class="q-mb-md" /> --> <PersonCard
<div class="column" style="height: 100%"> :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"
>
<div class="col-1 self-end"> <div class="col-1 self-end">
<div class="row"> <div class="row">
<tooltip-componet <tooltip-componet

View file

@ -5,7 +5,4 @@ export type Pagination<T> = {
total: number; total: number;
}; };
export enum Status { export type Status = 'CREATED' | 'ACTIVE' | 'INACTIVE';
CREATED,
USED,
}

View file

@ -17,6 +17,7 @@ export type User = {
licenseIssueDate: string | null; licenseIssueDate: string | null;
licenseNo: string | null; licenseNo: string | null;
discountCondition: string | null; discountCondition: string | null;
gender: string;
userRole: string; userRole: string;
userType: string; userType: string;
retireDate: string | null; retireDate: string | null;
@ -34,7 +35,7 @@ export type User = {
lastName: string; lastName: string;
firstNameEN: string; firstNameEN: string;
firstName: string; firstName: string;
code: string | null; code: string;
keycloakId: string; keycloakId: string;
id: string; id: string;
profileImageUrl: string; profileImageUrl: string;
@ -47,6 +48,7 @@ export type UserCreate = {
telephoneNo: string; telephoneNo: string;
email: string; email: string;
zipCode: string; zipCode: string;
gender: string;
addressEN: string; addressEN: string;
address: string; address: string;
trainingPlace?: string; trainingPlace?: string;