2024-04-17 15:44:13 +07:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import useUserStore from 'src/stores/user';
|
|
|
|
|
import { dateFormat } from 'src/utils/datetime';
|
|
|
|
|
|
|
|
|
|
const userStore = useUserStore();
|
|
|
|
|
|
|
|
|
|
const firstName = defineModel<string>('firstName');
|
|
|
|
|
const lastName = defineModel<string>('lastName');
|
|
|
|
|
const firstNameEN = defineModel<string>('firstNameEN');
|
|
|
|
|
const lastNameEN = defineModel<string>('lastNameEN');
|
|
|
|
|
const telephoneNo = defineModel<string>('telephoneNo');
|
|
|
|
|
const email = defineModel<string>('email');
|
|
|
|
|
const gender = defineModel<string>('gender');
|
|
|
|
|
const birthDate = defineModel<Date | null>('birthDate');
|
|
|
|
|
|
|
|
|
|
defineProps<{
|
|
|
|
|
dense?: boolean;
|
|
|
|
|
outlined?: boolean;
|
|
|
|
|
readonly?: boolean;
|
|
|
|
|
separator?: boolean;
|
|
|
|
|
}>();
|
|
|
|
|
</script>
|
|
|
|
|
<template>
|
2024-04-22 10:53:56 +07:00
|
|
|
<div class="col-3 app-text-muted">• {{ $t('formDialogTitlePersonnel') }}</div>
|
2024-04-17 15:44:13 +07:00
|
|
|
<div class="col-9 row q-col-gutter-md">
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-first-name"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-3"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputFirstName')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="firstName"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[
|
|
|
|
|
(val: string) => !!val || $t('formDialogInputFirstNameValidate'),
|
|
|
|
|
]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-last-name"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-3"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputLastName')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="lastName"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[(val: string) => !!val || $t('formDialogInputLastNameValidate')]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-first-name-en"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-3"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputFirstNameEN')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="firstNameEN"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[
|
|
|
|
|
(val: string) => !!val || $t('formDialogInputFirstNameENValidate'),
|
|
|
|
|
]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-last-name-en"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
hide-bottom-space
|
|
|
|
|
class="col-3"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputLastNameEN')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="lastNameEN"
|
2024-04-22 10:53:56 +07:00
|
|
|
:rules="[
|
|
|
|
|
(val: string) => !!val || $t('formDialogInputLastNameENValidate'),
|
|
|
|
|
]"
|
2024-04-17 15:44:13 +07:00
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-telephone"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
class="col-6"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputTelephone')"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="telephoneNo"
|
|
|
|
|
mask="##########"
|
|
|
|
|
/>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-email"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputEmail')"
|
2024-04-17 15:44:13 +07:00
|
|
|
class="col-6"
|
|
|
|
|
v-model="email"
|
|
|
|
|
/>
|
|
|
|
|
<q-select
|
2024-04-22 10:53:56 +07:00
|
|
|
id="select-gender"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
|
|
|
|
:hide-dropdown-icon="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
emit-value
|
|
|
|
|
map-options
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputGender')"
|
2024-04-17 15:44:13 +07:00
|
|
|
class="col-3"
|
|
|
|
|
option-label="label"
|
|
|
|
|
option-value="value"
|
|
|
|
|
v-model="gender"
|
|
|
|
|
:options="userStore.userOption.genderOpts"
|
|
|
|
|
/>
|
|
|
|
|
<VueDatePicker
|
|
|
|
|
utc
|
|
|
|
|
autoApply
|
2024-04-23 11:13:57 +00:00
|
|
|
:teleport="true"
|
2024-04-17 15:44:13 +07:00
|
|
|
v-model="birthDate"
|
|
|
|
|
:locale="'th'"
|
|
|
|
|
:enableTimePicker="false"
|
|
|
|
|
:disabled="readonly"
|
|
|
|
|
class="col-3"
|
|
|
|
|
>
|
|
|
|
|
<template #year="{ value }">
|
|
|
|
|
{{ value + 543 }}
|
|
|
|
|
</template>
|
|
|
|
|
<template #trigger>
|
|
|
|
|
<q-input
|
2024-04-22 10:53:56 +07:00
|
|
|
id="input-birth-date"
|
|
|
|
|
:label="$t('formDialogInputBirthDate')"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
2024-04-17 15:44:13 +07:00
|
|
|
:readonly="readonly"
|
2024-04-19 09:06:38 +07:00
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
:model-value="birthDate ? dateFormat(birthDate) : ''"
|
|
|
|
|
>
|
|
|
|
|
<template v-slot:prepend>
|
|
|
|
|
<q-icon
|
|
|
|
|
size="xs"
|
|
|
|
|
name="mdi-calendar-blank-outline"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
color="positive"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-slot:append>
|
|
|
|
|
<q-icon
|
|
|
|
|
v-if="birthDate && !readonly"
|
|
|
|
|
name="mdi-close"
|
|
|
|
|
class="cursor-pointer"
|
|
|
|
|
size="xs"
|
|
|
|
|
@click="birthDate = undefined"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|
|
|
|
|
</q-input>
|
|
|
|
|
</template>
|
|
|
|
|
</VueDatePicker>
|
|
|
|
|
<q-input
|
2024-04-25 04:05:48 +00:00
|
|
|
for="input-age"
|
2024-04-17 15:44:13 +07:00
|
|
|
:dense="dense"
|
2024-04-19 09:06:38 +07:00
|
|
|
:outlined="readonly ? false : outlined"
|
|
|
|
|
:borderless="readonly"
|
2024-04-17 15:44:13 +07:00
|
|
|
readonly
|
2024-04-22 10:53:56 +07:00
|
|
|
:label="$t('formDialogInputAge')"
|
2024-04-17 15:44:13 +07:00
|
|
|
class="col-3"
|
|
|
|
|
:model-value="birthDate ? userStore.calculateAge(birthDate) : ''"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<q-separator
|
|
|
|
|
v-if="separator"
|
|
|
|
|
class="col-12 q-mb-md"
|
|
|
|
|
style="padding-block: 0.5px; margin-top: 32px"
|
|
|
|
|
/>
|
|
|
|
|
</template>
|