feat: Personnel drawer info edit, delete, undo
This commit is contained in:
parent
d1d58d55c1
commit
b6e8078c3c
8 changed files with 220 additions and 625 deletions
|
|
@ -83,8 +83,9 @@ watch(districtId, fetchSubDistrict);
|
||||||
<div class="col-9 row q-col-gutter-md">
|
<div class="col-9 row q-col-gutter-md">
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
id="addr-input"
|
id="addr-input"
|
||||||
:label="$t('address')"
|
:label="$t('address')"
|
||||||
|
|
@ -99,8 +100,9 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -121,8 +123,9 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -143,8 +146,9 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -164,7 +168,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
readonly
|
readonly
|
||||||
id="zip"
|
id="zip"
|
||||||
:label="$t('zipCode')"
|
:label="$t('zipCode')"
|
||||||
|
|
@ -179,7 +184,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
id="addr-en-input"
|
id="addr-en-input"
|
||||||
:label="$t('address')"
|
:label="$t('address')"
|
||||||
|
|
@ -194,7 +200,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -209,7 +216,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -224,7 +232,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -239,7 +248,8 @@ watch(districtId, fetchSubDistrict);
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
readonly
|
readonly
|
||||||
zip="zip-en"
|
zip="zip-en"
|
||||||
:label="$t('zipCode')"
|
:label="$t('zipCode')"
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,9 @@ defineProps<{
|
||||||
>
|
>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="เลขประจำตัว นจ. 16 (เลขที่ขึ้นทะเบียน)"
|
label="เลขประจำตัว นจ. 16 (เลขที่ขึ้นทะเบียน)"
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-model="registrationNo"
|
v-model="registrationNo"
|
||||||
|
|
@ -63,8 +64,9 @@ defineProps<{
|
||||||
<q-input
|
<q-input
|
||||||
label="วันที่เริ่มงาน"
|
label="วันที่เริ่มงาน"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:model-value="startDate ? dateFormat(startDate) : ''"
|
:model-value="startDate ? dateFormat(startDate) : ''"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
|
|
@ -104,8 +106,9 @@ defineProps<{
|
||||||
<q-input
|
<q-input
|
||||||
label="วันที่พ้นสภาพพนักงาน"
|
label="วันที่พ้นสภาพพนักงาน"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:model-value="retireDate ? dateFormat(retireDate) : ''"
|
:model-value="retireDate ? dateFormat(retireDate) : ''"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
|
|
@ -131,9 +134,10 @@ defineProps<{
|
||||||
<q-select
|
<q-select
|
||||||
v-if="userType === 'MESSENGER'"
|
v-if="userType === 'MESSENGER'"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
options-dense
|
||||||
|
|
@ -152,8 +156,9 @@ defineProps<{
|
||||||
>
|
>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="เงื่อนไขส่วนลดบริการต่างๆ ของตัวแทน"
|
label="เงื่อนไขส่วนลดบริการต่างๆ ของตัวแทน"
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-model="discountCondition"
|
v-model="discountCondition"
|
||||||
|
|
@ -167,9 +172,10 @@ defineProps<{
|
||||||
>
|
>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
options-dense
|
||||||
|
|
@ -182,8 +188,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -197,8 +204,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -212,24 +220,27 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="ด่าน"
|
label="ด่าน"
|
||||||
class="col-6"
|
class="col-6"
|
||||||
v-model="checkPoint"
|
v-model="checkPoint"
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="ด่าน ENG"
|
label="ด่าน ENG"
|
||||||
class="col-6"
|
class="col-6"
|
||||||
v-model="checkPointEN"
|
v-model="checkPointEN"
|
||||||
/>
|
/>
|
||||||
<q-file
|
<q-file
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="แบบเอกสารประจำตัว"
|
label="แบบเอกสารประจำตัว"
|
||||||
class="col-12"
|
class="col-12"
|
||||||
v-model="idenDoc"
|
v-model="idenDoc"
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import useUserStore from 'src/stores/user';
|
import useUserStore from 'src/stores/user';
|
||||||
import { watch } from 'vue';
|
|
||||||
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const { userOption } = storeToRefs(userStore);
|
|
||||||
|
|
||||||
const hqId = defineModel<string | null | undefined>('hqId');
|
const hqId = defineModel<string | null | undefined>('hqId');
|
||||||
const brId = defineModel<string | null | undefined>('brId');
|
const brId = defineModel<string | null | undefined>('brId');
|
||||||
|
|
@ -36,8 +34,9 @@ async function selectHq(id: string) {
|
||||||
<div class="col-9 row q-col-gutter-md">
|
<div class="col-9 row q-col-gutter-md">
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -54,8 +53,9 @@ async function selectHq(id: string) {
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -71,8 +71,9 @@ async function selectHq(id: string) {
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -88,8 +89,9 @@ async function selectHq(id: string) {
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -105,7 +107,8 @@ async function selectHq(id: string) {
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
:readonly="usernameReadonly"
|
:readonly="usernameReadonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
|
@ -118,7 +121,8 @@ async function selectHq(id: string) {
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
readonly
|
readonly
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,9 @@ defineProps<{
|
||||||
<div class="col-9 row q-col-gutter-md">
|
<div class="col-9 row q-col-gutter-md">
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
label="ชื่อ ภาษาไทย"
|
label="ชื่อ ภาษาไทย"
|
||||||
|
|
@ -35,8 +36,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
label="นามสกุล ภาษาไทย"
|
label="นามสกุล ภาษาไทย"
|
||||||
|
|
@ -45,8 +47,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
label="ชื่อ ภาษาอังกฤษ"
|
label="ชื่อ ภาษาอังกฤษ"
|
||||||
|
|
@ -55,8 +58,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
hide-bottom-space
|
hide-bottom-space
|
||||||
class="col-3"
|
class="col-3"
|
||||||
label="นามสกุล ภาษาอังกฤษ"
|
label="นามสกุล ภาษาอังกฤษ"
|
||||||
|
|
@ -65,8 +69,9 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
class="col-6"
|
class="col-6"
|
||||||
label="เบอร์โทร"
|
label="เบอร์โทร"
|
||||||
v-model="telephoneNo"
|
v-model="telephoneNo"
|
||||||
|
|
@ -74,17 +79,19 @@ defineProps<{
|
||||||
/>
|
/>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
label="อีเมล"
|
label="อีเมล"
|
||||||
class="col-6"
|
class="col-6"
|
||||||
v-model="email"
|
v-model="email"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
label="เพศ"
|
label="เพศ"
|
||||||
|
|
@ -110,8 +117,9 @@ defineProps<{
|
||||||
<q-input
|
<q-input
|
||||||
label="วันเดือนปีเกิด"
|
label="วันเดือนปีเกิด"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
|
:borderless="readonly"
|
||||||
:model-value="birthDate ? dateFormat(birthDate) : ''"
|
:model-value="birthDate ? dateFormat(birthDate) : ''"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
|
|
@ -136,7 +144,8 @@ defineProps<{
|
||||||
</VueDatePicker>
|
</VueDatePicker>
|
||||||
<q-input
|
<q-input
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:outlined="outlined"
|
:outlined="readonly ? false : outlined"
|
||||||
|
:borderless="readonly"
|
||||||
readonly
|
readonly
|
||||||
label="อายุ"
|
label="อายุ"
|
||||||
class="col-3"
|
class="col-3"
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import AppBox from '../app/AppBox.vue';
|
||||||
import FormAddress from './FormAddress.vue';
|
import FormAddress from './FormAddress.vue';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
readonly?: boolean;
|
||||||
addressTitle?: string;
|
addressTitle?: string;
|
||||||
addressTitleEN?: string;
|
addressTitleEN?: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
@ -33,6 +34,7 @@ const zipCode = defineModel<string>('zipCode', { default: '' });
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
separator
|
separator
|
||||||
|
:readonly="readonly"
|
||||||
v-model:address="address"
|
v-model:address="address"
|
||||||
v-model:addressEN="addressEN"
|
v-model:addressEN="addressEN"
|
||||||
v-model:provinceId="provinceId"
|
v-model:provinceId="provinceId"
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,70 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title: string;
|
title: string;
|
||||||
|
isEdit?: boolean;
|
||||||
editData?: (...args: unknown[]) => void;
|
editData?: (...args: unknown[]) => void;
|
||||||
deleteData?: (...args: unknown[]) => void;
|
deleteData?: (...args: unknown[]) => void;
|
||||||
submit?: (...args: unknown[]) => void;
|
submit?: (...args: unknown[]) => void;
|
||||||
close?: (...args: unknown[]) => void;
|
close?: (...args: unknown[]) => void;
|
||||||
|
undo?: (...args: unknown[]) => void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const drawerOpen = defineModel<boolean>('drawerOpen', {
|
const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
default: false,
|
default: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const myForm = ref();
|
||||||
|
|
||||||
|
function reset() {
|
||||||
|
if (myForm.value) {
|
||||||
|
myForm.value.resetValidation();
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<q-drawer
|
<q-drawer
|
||||||
|
@before-hide="reset"
|
||||||
@hide="close"
|
@hide="close"
|
||||||
:width="1100"
|
:width="1300"
|
||||||
:breakpoint="500"
|
:breakpoint="500"
|
||||||
v-model="drawerOpen"
|
v-model="drawerOpen"
|
||||||
behavior="mobile"
|
behavior="mobile"
|
||||||
side="right"
|
side="right"
|
||||||
show-if-above
|
show-if-above
|
||||||
|
>
|
||||||
|
<q-form
|
||||||
|
ref="myForm"
|
||||||
|
class="full-height"
|
||||||
|
greedy
|
||||||
|
@submit.prevent
|
||||||
|
@validation-success="submit"
|
||||||
>
|
>
|
||||||
<AppBox
|
<AppBox
|
||||||
class="column justify-between full-height"
|
class="column justify-between full-height"
|
||||||
style="padding: 0; border-radius: var(--radius-2)"
|
style="padding: 0; border-radius: var(--radius-2)"
|
||||||
>
|
>
|
||||||
<div class="form-header col q-px-lg row items-center">
|
<div class="form-header col q-px-lg row items-center">
|
||||||
|
<div v-if="isEdit" class="row">
|
||||||
<q-btn
|
<q-btn
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
id="closeDialog"
|
id="closeDialog"
|
||||||
|
icon="mdi-undo"
|
||||||
|
padding="xs"
|
||||||
|
class="q-mr-md"
|
||||||
|
:class="{ dark: $q.dark.isActive }"
|
||||||
|
style="color: var(--brand-1)"
|
||||||
|
@click="undo"
|
||||||
|
/>
|
||||||
|
<div style="width: 31.98px"></div>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<q-btn
|
||||||
|
round
|
||||||
|
flat
|
||||||
|
id="editDialog"
|
||||||
icon="mdi-pencil-outline"
|
icon="mdi-pencil-outline"
|
||||||
padding="xs"
|
padding="xs"
|
||||||
class="q-mr-md"
|
class="q-mr-md"
|
||||||
|
|
@ -40,13 +75,14 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
<q-btn
|
<q-btn
|
||||||
round
|
round
|
||||||
flat
|
flat
|
||||||
id="closeDialog"
|
id="deleteDialog"
|
||||||
icon="mdi-trash-can-outline"
|
icon="mdi-trash-can-outline"
|
||||||
padding="xs"
|
padding="xs"
|
||||||
:class="{ dark: $q.dark.isActive }"
|
:class="{ dark: $q.dark.isActive }"
|
||||||
style="color: hsl(var(--negative-bg))"
|
style="color: hsl(var(--negative-bg))"
|
||||||
@click="deleteData"
|
@click="deleteData"
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="col text-subtitle1 text-weight-bold text-center">
|
<div class="col text-subtitle1 text-weight-bold text-center">
|
||||||
{{ title }}
|
{{ title }}
|
||||||
|
|
@ -61,7 +97,9 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
padding="xs"
|
padding="xs"
|
||||||
class="close-btn"
|
class="close-btn"
|
||||||
:class="{ dark: $q.dark.isActive }"
|
:class="{ dark: $q.dark.isActive }"
|
||||||
|
type="reset"
|
||||||
@click="close"
|
@click="close"
|
||||||
|
resetValidation
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -84,9 +122,11 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
id="cancelBtn"
|
id="cancelBtn"
|
||||||
class="q-px-md app-text-negative"
|
class="q-px-md app-text-negative"
|
||||||
:label="$t('cancel')"
|
:label="$t('cancel')"
|
||||||
|
type="reset"
|
||||||
@click="close"
|
@click="close"
|
||||||
/>
|
/>
|
||||||
<q-btn
|
<q-btn
|
||||||
|
v-if="isEdit"
|
||||||
dense
|
dense
|
||||||
unelevated
|
unelevated
|
||||||
id="submitBtn"
|
id="submitBtn"
|
||||||
|
|
@ -95,8 +135,19 @@ const drawerOpen = defineModel<boolean>('drawerOpen', {
|
||||||
class="q-px-md"
|
class="q-px-md"
|
||||||
:label="$t('save')"
|
:label="$t('save')"
|
||||||
/>
|
/>
|
||||||
|
<q-btn
|
||||||
|
v-else
|
||||||
|
dense
|
||||||
|
unelevated
|
||||||
|
id="okBtn"
|
||||||
|
color="primary"
|
||||||
|
class="q-px-md"
|
||||||
|
label="ตกลง"
|
||||||
|
@click="close"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</AppBox>
|
</AppBox>
|
||||||
|
</q-form>
|
||||||
</q-drawer>
|
</q-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, watch } from 'vue';
|
import { ref, onMounted, watch } from 'vue';
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import useUserStore from 'stores/user';
|
import useUserStore from 'stores/user';
|
||||||
import useBranchStore from 'src/stores/branch';
|
import useBranchStore from 'src/stores/branch';
|
||||||
|
|
@ -26,7 +25,6 @@ import { computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const router = useRouter();
|
|
||||||
const userStore = useUserStore();
|
const userStore = useUserStore();
|
||||||
const branchStore = useBranchStore();
|
const branchStore = useBranchStore();
|
||||||
const adrressStore = useAddressStore();
|
const adrressStore = useAddressStore();
|
||||||
|
|
@ -66,6 +64,8 @@ const defaultFormData = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const currentUser = ref<User>();
|
const currentUser = ref<User>();
|
||||||
|
const infoPersonCardEdit = ref(false);
|
||||||
|
const infoPersonId = ref<string>('');
|
||||||
const infoPersonCard = ref();
|
const infoPersonCard = ref();
|
||||||
const infoDrawer = ref(false);
|
const infoDrawer = ref(false);
|
||||||
const profileSubmit = ref(false);
|
const profileSubmit = ref(false);
|
||||||
|
|
@ -151,6 +151,7 @@ async function openDialog(action?: 'FORM' | 'INFO', idEdit?: string) {
|
||||||
modal.value = true;
|
modal.value = true;
|
||||||
} else if (action === 'INFO') {
|
} else if (action === 'INFO') {
|
||||||
infoDrawer.value = true;
|
infoDrawer.value = true;
|
||||||
|
infoPersonCardEdit.value = false;
|
||||||
if (!userData.value) return;
|
if (!userData.value) return;
|
||||||
const user = userData.value.result.find((x) => x.id === idEdit);
|
const user = userData.value.result.find((x) => x.id === idEdit);
|
||||||
infoPersonCard.value = user
|
infoPersonCard.value = user
|
||||||
|
|
@ -192,6 +193,12 @@ async function openDialog(action?: 'FORM' | 'INFO', idEdit?: string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function undo() {
|
||||||
|
if (!infoPersonId) return;
|
||||||
|
infoPersonCardEdit.value = false;
|
||||||
|
assignFormData(infoPersonId.value);
|
||||||
|
}
|
||||||
|
|
||||||
function onClose() {
|
function onClose() {
|
||||||
code.value = '';
|
code.value = '';
|
||||||
hqId.value = '';
|
hqId.value = '';
|
||||||
|
|
@ -208,6 +215,8 @@ function onClose() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onSubmit() {
|
async function onSubmit() {
|
||||||
|
console.log('hello');
|
||||||
|
|
||||||
formData.value.profileImage = profileFile.value as File;
|
formData.value.profileImage = profileFile.value as File;
|
||||||
if (isEdit.value === true && userId.value) {
|
if (isEdit.value === true && userId.value) {
|
||||||
dialog({
|
dialog({
|
||||||
|
|
@ -326,6 +335,7 @@ async function assignFormData(idEdit: string) {
|
||||||
const foundUser = userData.value.result.find((user) => user.id === idEdit);
|
const foundUser = userData.value.result.find((user) => user.id === idEdit);
|
||||||
if (foundUser) {
|
if (foundUser) {
|
||||||
currentUser.value = foundUser;
|
currentUser.value = foundUser;
|
||||||
|
infoPersonId.value = currentUser.value.id;
|
||||||
|
|
||||||
formData.value = {
|
formData.value = {
|
||||||
provinceId: foundUser.provinceId,
|
provinceId: foundUser.provinceId,
|
||||||
|
|
@ -589,16 +599,23 @@ watch(
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DrawerInfo
|
<DrawerInfo
|
||||||
|
v-if="currentUser"
|
||||||
|
:isEdit="infoPersonCardEdit"
|
||||||
:title="
|
:title="
|
||||||
$i18n.locale === 'en-US'
|
$i18n.locale === 'en-US'
|
||||||
? `${formData.firstNameEN} ${formData.lastNameEN}`
|
? `${currentUser.firstNameEN} ${currentUser.lastNameEN}`
|
||||||
: `${formData.firstName} ${formData.lastName}`
|
: `${currentUser.firstName} ${currentUser.lastName}`
|
||||||
"
|
"
|
||||||
v-model:drawerOpen="infoDrawer"
|
v-model:drawerOpen="infoDrawer"
|
||||||
|
:deleteData="() => onDelete(infoPersonId)"
|
||||||
|
:submit="() => onSubmit()"
|
||||||
:close="() => onClose()"
|
:close="() => onClose()"
|
||||||
|
:undo="() => undo()"
|
||||||
|
:editData="() => (infoPersonCardEdit = true)"
|
||||||
>
|
>
|
||||||
<template #info>
|
<template #info>
|
||||||
<infoForm
|
<infoForm
|
||||||
|
:readonly="!infoPersonCardEdit"
|
||||||
v-model:address="formData.address"
|
v-model:address="formData.address"
|
||||||
v-model:addressEN="formData.addressEN"
|
v-model:addressEN="formData.addressEN"
|
||||||
v-model:provinceId="formData.provinceId"
|
v-model:provinceId="formData.provinceId"
|
||||||
|
|
@ -625,6 +642,7 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
separator
|
separator
|
||||||
|
:readonly="!infoPersonCardEdit"
|
||||||
:usernameReadonly="isEdit"
|
:usernameReadonly="isEdit"
|
||||||
v-model:hqId="hqId"
|
v-model:hqId="hqId"
|
||||||
v-model:brId="brId"
|
v-model:brId="brId"
|
||||||
|
|
@ -639,6 +657,7 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
separator
|
separator
|
||||||
|
:readonly="!infoPersonCardEdit"
|
||||||
v-model:firstName="formData.firstName"
|
v-model:firstName="formData.firstName"
|
||||||
v-model:lastName="formData.lastName"
|
v-model:lastName="formData.lastName"
|
||||||
v-model:firstNameEN="formData.firstNameEN"
|
v-model:firstNameEN="formData.firstNameEN"
|
||||||
|
|
@ -654,6 +673,7 @@ watch(
|
||||||
dense
|
dense
|
||||||
outlined
|
outlined
|
||||||
separator
|
separator
|
||||||
|
:readonly="!infoPersonCardEdit"
|
||||||
v-model:userType="formData.userType"
|
v-model:userType="formData.userType"
|
||||||
v-model:registrationNo="formData.registrationNo"
|
v-model:registrationNo="formData.registrationNo"
|
||||||
v-model:startDate="formData.startDate"
|
v-model:startDate="formData.startDate"
|
||||||
|
|
|
||||||
|
|
@ -1,512 +0,0 @@
|
||||||
<script lang="ts" setup>
|
|
||||||
import { useRoute } from 'vue-router';
|
|
||||||
import { onMounted, ref, watch } from 'vue';
|
|
||||||
import { storeToRefs } from 'pinia';
|
|
||||||
import { useRouter } from 'vue-router';
|
|
||||||
|
|
||||||
import useUserStore from 'stores/user';
|
|
||||||
|
|
||||||
import { User } from 'stores/user/types';
|
|
||||||
import { Branch } from 'stores/branch/types';
|
|
||||||
import { dialog } from 'src/stores/utils';
|
|
||||||
|
|
||||||
import PersonCard from 'components/home/PersonCard.vue';
|
|
||||||
import AppBox from 'components/app/AppBox.vue';
|
|
||||||
import FormTop from 'src/components/02_personnel-management/FormInformation.vue';
|
|
||||||
import FormName from 'src/components/02_personnel-management/FormPerson.vue';
|
|
||||||
import FormByType from 'src/components/02_personnel-management/FormByType.vue';
|
|
||||||
import useAddressStore, {
|
|
||||||
District,
|
|
||||||
Province,
|
|
||||||
SubDistrict,
|
|
||||||
} from 'src/stores/address';
|
|
||||||
import { reactive } from 'vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
|
||||||
|
|
||||||
const router = useRouter();
|
|
||||||
const userStore = useUserStore();
|
|
||||||
const addrStore = useAddressStore();
|
|
||||||
|
|
||||||
const { data: userData } = storeToRefs(userStore);
|
|
||||||
|
|
||||||
const currentUser = ref<User>();
|
|
||||||
const currentUserBranch = ref<Branch[]>([]);
|
|
||||||
const currentHQ = ref<string | null>();
|
|
||||||
const currentBR = ref<string | null>();
|
|
||||||
const isEdit = ref(false);
|
|
||||||
const formRef = ref();
|
|
||||||
|
|
||||||
async function getCurrentUser() {
|
|
||||||
if (typeof route.params.id !== 'string') return;
|
|
||||||
|
|
||||||
const record = userData.value?.result.find((v) => v.id === route.params.id);
|
|
||||||
|
|
||||||
if (record) return (currentUser.value = record);
|
|
||||||
|
|
||||||
const res = await userStore.fetchById(route.params.id);
|
|
||||||
|
|
||||||
if (res) currentUser.value = res;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function getUserBranch() {
|
|
||||||
if (!currentUser.value) return;
|
|
||||||
|
|
||||||
const res = await userStore.getBranch(currentUser.value.id);
|
|
||||||
|
|
||||||
if (!res) return;
|
|
||||||
|
|
||||||
currentUserBranch.value = res.result;
|
|
||||||
|
|
||||||
const mainBranch = currentUserBranch.value[0];
|
|
||||||
|
|
||||||
if (mainBranch && mainBranch.headOfficeId) {
|
|
||||||
currentHQ.value = mainBranch.headOfficeId;
|
|
||||||
currentBR.value = mainBranch.id;
|
|
||||||
} else {
|
|
||||||
currentHQ.value = mainBranch.id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const opts = reactive<{
|
|
||||||
province: Province[];
|
|
||||||
district: District[];
|
|
||||||
subDistrict: SubDistrict[];
|
|
||||||
}>({
|
|
||||||
province: [],
|
|
||||||
district: [],
|
|
||||||
subDistrict: [],
|
|
||||||
});
|
|
||||||
|
|
||||||
async function getProvince() {
|
|
||||||
const result = await addrStore.fetchProvince();
|
|
||||||
if (result) opts.province = result;
|
|
||||||
}
|
|
||||||
async function getDistrict() {
|
|
||||||
if (!currentUser.value?.provinceId) return;
|
|
||||||
const result = await addrStore.fetchDistrictByProvinceId(
|
|
||||||
currentUser.value?.provinceId,
|
|
||||||
);
|
|
||||||
if (result) opts.district = result;
|
|
||||||
}
|
|
||||||
async function getSubDistrict() {
|
|
||||||
if (!currentUser.value?.districtId) return;
|
|
||||||
const result = await addrStore.fetchSubDistrictByProvinceId(
|
|
||||||
currentUser.value?.districtId,
|
|
||||||
);
|
|
||||||
if (result) opts.subDistrict = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
function triggerEdit(id?: string) {
|
|
||||||
if (!id) return;
|
|
||||||
isEdit.value = true;
|
|
||||||
console.log('Edit!');
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit() {
|
|
||||||
dialog({
|
|
||||||
color: 'primary',
|
|
||||||
icon: 'mdi-pencil-outline',
|
|
||||||
title: 'ยืนยันการแก้ไขข้อมูล',
|
|
||||||
actionText: 'ตกลง',
|
|
||||||
persistent: true,
|
|
||||||
message: 'คุณต้องการแก้ไขข้อมูล ใช่หรือไม่',
|
|
||||||
action: async () => {
|
|
||||||
console.log('Submit!');
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDelete(id?: string) {
|
|
||||||
if (!id) return;
|
|
||||||
dialog({
|
|
||||||
color: 'negative',
|
|
||||||
icon: 'mdi-trash-can-outline',
|
|
||||||
title: 'ยืนยันการลบข้อมูล',
|
|
||||||
actionText: 'ตกลง',
|
|
||||||
persistent: true,
|
|
||||||
message: 'คุณต้องการลบข้อมูล ใช่หรือไม่',
|
|
||||||
action: async () => {
|
|
||||||
console.log('Delete!');
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(async () => {
|
|
||||||
await getCurrentUser();
|
|
||||||
await getUserBranch();
|
|
||||||
await userStore.fetchHqOption();
|
|
||||||
if (!currentHQ.value) return;
|
|
||||||
await userStore.fetchBrOption(currentHQ.value);
|
|
||||||
await getProvince();
|
|
||||||
|
|
||||||
if (userStore.userOption.roleOpts.length === 0) {
|
|
||||||
userStore.fetchRoleOption();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(() => route.params.id, getCurrentUser);
|
|
||||||
watch(() => currentUser.value?.provinceId, getDistrict);
|
|
||||||
watch(() => currentUser.value?.districtId, getSubDistrict);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<div class="text-h6 text-weight-bold q-mb-md" v-if="currentUser">
|
|
||||||
<q-btn
|
|
||||||
flat
|
|
||||||
round
|
|
||||||
padding="xs"
|
|
||||||
icon="mdi-arrow-left"
|
|
||||||
style="color: hsl(var(--info-bg))"
|
|
||||||
@click="router.go(-1)"
|
|
||||||
/>
|
|
||||||
{{
|
|
||||||
$i18n.locale === 'en-US'
|
|
||||||
? `${currentUser.firstNameEN} ${currentUser.lastNameEN}`
|
|
||||||
: `${currentUser.firstName} ${currentUser.lastName}`
|
|
||||||
}}
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="q-pa-md info-bg"
|
|
||||||
:style="`background-image: url(/personnel-info-bg-${$q.dark.isActive ? 'dark' : 'light'}.png)`"
|
|
||||||
>
|
|
||||||
<q-form
|
|
||||||
greedy
|
|
||||||
ref="formRef"
|
|
||||||
id="formId"
|
|
||||||
@submit.prevent
|
|
||||||
@validation-success="onSubmit"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="info-container"
|
|
||||||
:class="{ desktop: $q.screen.gt.sm, dark: $q.dark.isActive }"
|
|
||||||
>
|
|
||||||
<div>
|
|
||||||
<PersonCard
|
|
||||||
:list="[
|
|
||||||
{
|
|
||||||
id: currentUser.id,
|
|
||||||
img: `${currentUser.profileImageUrl}`,
|
|
||||||
name:
|
|
||||||
$i18n.locale === 'en-US'
|
|
||||||
? `${currentUser.firstNameEN} ${currentUser.lastNameEN}`
|
|
||||||
: `${currentUser.firstName} ${currentUser.lastName}`,
|
|
||||||
male: currentUser.gender === 'male',
|
|
||||||
female: currentUser.gender === 'female',
|
|
||||||
detail: [
|
|
||||||
{ label: 'ประเภท', value: $t(currentUser.userType) },
|
|
||||||
{
|
|
||||||
label: 'ตำแหน่ง',
|
|
||||||
value: currentUser.userRole
|
|
||||||
? userStore.userOption.roleOpts.find(
|
|
||||||
(r) => r.value === currentUser?.userRole,
|
|
||||||
)?.label || ''
|
|
||||||
: '',
|
|
||||||
},
|
|
||||||
{ label: 'โทรศัพท์', value: currentUser.telephoneNo },
|
|
||||||
{
|
|
||||||
label: 'อายุ',
|
|
||||||
value: userStore.calculateAge(
|
|
||||||
currentUser.birthDate as Date,
|
|
||||||
),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
badge: currentUser.code,
|
|
||||||
disabled: currentUser.status === 'INACTIVE',
|
|
||||||
},
|
|
||||||
]"
|
|
||||||
v-if="currentUser"
|
|
||||||
:grid-columns="1"
|
|
||||||
no-hover
|
|
||||||
no-action
|
|
||||||
style="box-shadow: var(--shadow-2)"
|
|
||||||
/>
|
|
||||||
<div class="col-12 row items-center q-pt-md q-col-gutter-x-md">
|
|
||||||
<div class="col-6">
|
|
||||||
<q-btn
|
|
||||||
v-if="!isEdit"
|
|
||||||
dense
|
|
||||||
class="btn-edit full-width"
|
|
||||||
@click="triggerEdit(currentUser?.id)"
|
|
||||||
>
|
|
||||||
<q-icon size="16px" name="mdi-pencil-outline" class="q-pr-xs" />
|
|
||||||
<span>แก้ไขข้อมูล</span>
|
|
||||||
</q-btn>
|
|
||||||
<q-btn
|
|
||||||
v-else
|
|
||||||
dense
|
|
||||||
class="btn-edit full-width"
|
|
||||||
label="บันทึกข้อมูล"
|
|
||||||
type="submit"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="col-6">
|
|
||||||
<q-btn
|
|
||||||
v-if="!isEdit"
|
|
||||||
dense
|
|
||||||
class="btn-delete full-width"
|
|
||||||
@click="onDelete(currentUser?.id)"
|
|
||||||
>
|
|
||||||
<q-icon
|
|
||||||
size="16px"
|
|
||||||
name="mdi-trash-can-outline"
|
|
||||||
class="q-pr-xs"
|
|
||||||
/>
|
|
||||||
<span>ลบข้อมูล</span>
|
|
||||||
</q-btn>
|
|
||||||
<q-btn
|
|
||||||
v-else
|
|
||||||
dense
|
|
||||||
class="btn-delete full-width"
|
|
||||||
label="ยกเลิก"
|
|
||||||
type="reset"
|
|
||||||
@click="isEdit = false"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<AppBox
|
|
||||||
class="surface-1"
|
|
||||||
rounded
|
|
||||||
bordered
|
|
||||||
v-if="currentUser"
|
|
||||||
style="
|
|
||||||
box-shadow: var(--shadow-2);
|
|
||||||
overflow-y: auto;
|
|
||||||
max-height: 50vw;
|
|
||||||
"
|
|
||||||
>
|
|
||||||
<div class="row q-col-gutter-md">
|
|
||||||
<FormTop
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
v-model:hqId="currentHQ"
|
|
||||||
v-model:brId="currentBR"
|
|
||||||
v-model:userType="currentUser.userType"
|
|
||||||
v-model:userRole="currentUser.userRole"
|
|
||||||
v-model:userCode="currentUser.code"
|
|
||||||
/>
|
|
||||||
<FormName
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
v-model:firstName="currentUser.firstName"
|
|
||||||
v-model:lastName="currentUser.lastName"
|
|
||||||
v-model:firstNameEN="currentUser.firstNameEN"
|
|
||||||
v-model:lastNameEN="currentUser.lastNameEN"
|
|
||||||
/>
|
|
||||||
<div class="col-12 group-label">{{ $t('address') }}</div>
|
|
||||||
|
|
||||||
<q-input
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
id="address"
|
|
||||||
label="ที่อยู่"
|
|
||||||
class="col-12"
|
|
||||||
v-model="currentUser.address"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="selectProvince"
|
|
||||||
v-model="currentUser.provinceId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:label="$t('province')"
|
|
||||||
class="col-3"
|
|
||||||
@update:model-value="
|
|
||||||
currentUser
|
|
||||||
? { ...currentUser, districtId: null, subDistrictId: null }
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
:options="opts.province"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="selectDistrict"
|
|
||||||
v-model="currentUser.districtId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:label="$t('district')"
|
|
||||||
class="col-3"
|
|
||||||
@update:model-value="
|
|
||||||
currentUser ? (currentUser.subDistrictId = null) : ''
|
|
||||||
"
|
|
||||||
:options="opts.district"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="SelectSubDistrict"
|
|
||||||
v-model="currentUser.subDistrictId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="name"
|
|
||||||
:label="$t('subDistrict')"
|
|
||||||
class="col-3"
|
|
||||||
:options="opts.subDistrict"
|
|
||||||
/>
|
|
||||||
<q-input
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
:label="$t('zipCode')"
|
|
||||||
class="col-3"
|
|
||||||
v-model="currentUser.zipCode"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div class="col-12 group-label">{{ $t('address') }} EN</div>
|
|
||||||
|
|
||||||
<q-input
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="addressEN"
|
|
||||||
label="ที่อยู่"
|
|
||||||
class="col-12"
|
|
||||||
v-model="currentUser.addressEN"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="selectProvinceEN"
|
|
||||||
v-model="currentUser.provinceId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nameEN"
|
|
||||||
:label="$t('province')"
|
|
||||||
class="col-3"
|
|
||||||
@update:model-value="
|
|
||||||
currentUser
|
|
||||||
? { ...currentUser, districtId: null, subDistrictId: null }
|
|
||||||
: ''
|
|
||||||
"
|
|
||||||
:options="opts.province"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-dropdown-icon
|
|
||||||
id="selectDistrictEN"
|
|
||||||
v-model="currentUser.districtId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nameEN"
|
|
||||||
:label="$t('district')"
|
|
||||||
class="col-3"
|
|
||||||
@update:model-value="
|
|
||||||
currentUser ? (currentUser.subDistrictId = null) : ''
|
|
||||||
"
|
|
||||||
:options="opts.district"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
hide-dropdown-icon
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
id="SelectSubDistrictEN"
|
|
||||||
v-model="currentUser.subDistrictId"
|
|
||||||
option-value="id"
|
|
||||||
option-label="nameEN"
|
|
||||||
:label="$t('subDistrict')"
|
|
||||||
class="col-3"
|
|
||||||
:options="opts.subDistrict"
|
|
||||||
/>
|
|
||||||
<q-input
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
zip="zipEN"
|
|
||||||
:label="$t('zipCode')"
|
|
||||||
class="col-3"
|
|
||||||
v-model="currentUser.zipCode"
|
|
||||||
/>
|
|
||||||
<FormByType
|
|
||||||
dense
|
|
||||||
outlined
|
|
||||||
:readonly="!isEdit"
|
|
||||||
v-model:userType="currentUser.userType"
|
|
||||||
v-model:telephoneNo="currentUser.telephoneNo"
|
|
||||||
v-model:gender="currentUser.gender"
|
|
||||||
v-model:email="currentUser.email"
|
|
||||||
v-model:registrationNo="currentUser.registrationNo"
|
|
||||||
v-model:startDate="currentUser.startDate"
|
|
||||||
v-model:retireDate="currentUser.retireDate"
|
|
||||||
v-model:birthDate="currentUser.birthDate"
|
|
||||||
v-model:responsibleArea="currentUser.responsibleArea"
|
|
||||||
v-model:discountCondition="currentUser.discountCondition"
|
|
||||||
v-model:sourceNationality="currentUser.sourceNationality"
|
|
||||||
v-model:importNationality="currentUser.importNationality"
|
|
||||||
v-model:trainingPlace="currentUser.trainingPlace"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</AppBox>
|
|
||||||
</div>
|
|
||||||
</q-form>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<style scoped lang="scss">
|
|
||||||
.info-container {
|
|
||||||
--_group-label-color: currentColor;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(1, 1fr);
|
|
||||||
gap: var(--size-4);
|
|
||||||
|
|
||||||
.group-label {
|
|
||||||
color: var(--_group-label-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
&.dark {
|
|
||||||
--_group-label-color: hsl(var(--info-bg));
|
|
||||||
}
|
|
||||||
|
|
||||||
&.desktop {
|
|
||||||
grid-template-columns: 1fr 4fr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.info-bg {
|
|
||||||
background-color: var(--surface-1);
|
|
||||||
height: 100%;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-edit {
|
|
||||||
color: white;
|
|
||||||
background-color: hsl(var(--info-bg));
|
|
||||||
border-radius: var(--radius-2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-delete {
|
|
||||||
color: hsl(var(--negative-bg));
|
|
||||||
background-color: var(--surface-1);
|
|
||||||
border-radius: var(--radius-2);
|
|
||||||
border: 1px solid hsl(var(--negative-bg));
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue