refactor: add tab passport
This commit is contained in:
parent
6879d0868c
commit
e969db16e0
3 changed files with 505 additions and 147 deletions
|
|
@ -32,7 +32,9 @@ defineProps<{
|
||||||
outlined?: boolean;
|
outlined?: boolean;
|
||||||
readonly?: boolean;
|
readonly?: boolean;
|
||||||
separator?: boolean;
|
separator?: boolean;
|
||||||
|
img?: string;
|
||||||
ocr?: boolean;
|
ocr?: boolean;
|
||||||
|
hideTitle?: boolean;
|
||||||
|
|
||||||
prefixId: string;
|
prefixId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
@ -86,7 +88,10 @@ watch(
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="row col-12">
|
<div class="row col-12">
|
||||||
<div v-if="!ocr" class="col-12 q-pb-sm text-weight-bold text-body1">
|
<div
|
||||||
|
v-if="!ocr && !hideTitle"
|
||||||
|
class="col-12 q-pb-sm text-weight-bold text-body1"
|
||||||
|
>
|
||||||
<q-icon
|
<q-icon
|
||||||
flat
|
flat
|
||||||
size="xs"
|
size="xs"
|
||||||
|
|
@ -98,151 +103,189 @@ watch(
|
||||||
{{ title }}
|
{{ title }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 row q-col-gutter-sm">
|
<div
|
||||||
<q-select
|
v-if="!ocr"
|
||||||
outlined
|
class="col-12 row justify-between q-pb-sm text-weight-bold"
|
||||||
clearable
|
>
|
||||||
use-input
|
<div class="app-text-muted">
|
||||||
fill-input
|
<slot name="expiryDate" />
|
||||||
emit-value
|
</div>
|
||||||
map-options
|
|
||||||
hide-selected
|
<div>
|
||||||
hide-bottom-space
|
<slot name="button"></slot>
|
||||||
input-debounce="0"
|
</div>
|
||||||
option-value="value"
|
</div>
|
||||||
option-label="label"
|
|
||||||
v-model="passportType"
|
<div class="row q-col-gutter-sm">
|
||||||
class="col-12"
|
<div
|
||||||
:class="{ 'col-md-3': !ocr }"
|
v-if="!ocr"
|
||||||
:dense="dense"
|
class="col row justify-center q-col-gutter-sml"
|
||||||
:readonly="readonly"
|
style="max-height: 50%"
|
||||||
:hide-dropdown-icon="readonly"
|
|
||||||
:options="passportTypeOptions"
|
|
||||||
:for="`${prefixId}-select-passport-type`"
|
|
||||||
:label="$t('customerEmployee.form.passportType')"
|
|
||||||
:rules="[
|
|
||||||
(val) =>
|
|
||||||
(val && val.length > 0) ||
|
|
||||||
$t('form.error.selectField', {
|
|
||||||
field: $t('customerEmployee.form.passportType'),
|
|
||||||
}),
|
|
||||||
]"
|
|
||||||
@filter="passportTypeFilter"
|
|
||||||
>
|
>
|
||||||
<template v-slot:no-option>
|
<div style="border: 1px dashed">
|
||||||
<q-item>
|
<q-avatar
|
||||||
<q-item-section class="text-grey">
|
square
|
||||||
{{ $t('general.noData') }}
|
size="100px"
|
||||||
</q-item-section>
|
font-size="50px"
|
||||||
</q-item>
|
color="grey-4"
|
||||||
</template>
|
text-color="grey"
|
||||||
</q-select>
|
icon="mdi-image-outline"
|
||||||
<q-input
|
/>
|
||||||
:for="`${prefixId}-input-passport-no`"
|
</div>
|
||||||
:dense="dense"
|
</div>
|
||||||
outlined
|
<div
|
||||||
:readonly="readonly"
|
class="row q-col-gutter-sm"
|
||||||
hide-bottom-space
|
:class="{ 'col-10': !ocr, 'col-12': ocr }"
|
||||||
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
|
||||||
:label="$t('customerEmployee.form.passportNo')"
|
|
||||||
v-model="passportNumber"
|
|
||||||
:rules="[(val) => (val && val.length > 0) || $t('form.error.required')]"
|
|
||||||
/>
|
|
||||||
<q-input
|
|
||||||
:for="`${prefixId}-input-passport-ref`"
|
|
||||||
:dense="dense"
|
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
|
||||||
hide-bottom-space
|
|
||||||
:class="{ 'col-12': ocr, 'col-6': !ocr }"
|
|
||||||
:label="$t('customerEmployee.form.passportRef')"
|
|
||||||
:model-value="
|
|
||||||
readonly
|
|
||||||
? previousPassportReference || '-'
|
|
||||||
: previousPassportReference
|
|
||||||
"
|
|
||||||
@update:model-value="
|
|
||||||
(v) => (typeof v === 'string' ? (previousPassportReference = v) : '')
|
|
||||||
"
|
|
||||||
/>
|
|
||||||
<q-input
|
|
||||||
:for="`${prefixId}-input-passport-place`"
|
|
||||||
:dense="dense"
|
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
|
||||||
hide-bottom-space
|
|
||||||
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
|
||||||
:label="$t('customerEmployee.form.passportPlace')"
|
|
||||||
v-model="passportIssuingPlace"
|
|
||||||
:rules="[(val) => (val && val.length > 0) || $t('form.error.required')]"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
outlined
|
|
||||||
clearable
|
|
||||||
use-input
|
|
||||||
fill-input
|
|
||||||
emit-value
|
|
||||||
map-options
|
|
||||||
hide-selected
|
|
||||||
hide-bottom-space
|
|
||||||
input-debounce="0"
|
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
|
||||||
v-model="passportIssuingCountry"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
:hide-dropdown-icon="readonly"
|
|
||||||
:options="passportIssuingCountryOptions"
|
|
||||||
:for="`${prefixId}-select-passport-country`"
|
|
||||||
:label="$t('customerEmployee.form.passportIssuer')"
|
|
||||||
:rules="[
|
|
||||||
(val) =>
|
|
||||||
(val && val.length > 0) ||
|
|
||||||
$t('form.error.selectField', {
|
|
||||||
field: $t('customerEmployee.form.passportIssuer'),
|
|
||||||
}),
|
|
||||||
]"
|
|
||||||
@filter="passportIssuingCountryFilter"
|
|
||||||
>
|
>
|
||||||
<template v-slot:no-option>
|
<q-select
|
||||||
<q-item>
|
outlined
|
||||||
<q-item-section class="text-grey">
|
clearable
|
||||||
{{ $t('general.noData') }}
|
use-input
|
||||||
</q-item-section>
|
fill-input
|
||||||
</q-item>
|
emit-value
|
||||||
</template>
|
map-options
|
||||||
</q-select>
|
hide-selected
|
||||||
<DatePicker
|
hide-bottom-space
|
||||||
:id="`${prefixId}-date-picker-passport-issueance`"
|
input-debounce="0"
|
||||||
:label="$t('customerEmployee.form.passportIssueDate')"
|
option-value="value"
|
||||||
v-model="passportIssueDate"
|
option-label="label"
|
||||||
class="col-6"
|
v-model="passportType"
|
||||||
:class="{ 'col-md-3': !ocr }"
|
:class="{ 'col-12': ocr, 'col-md-3': !ocr }"
|
||||||
:readonly="readonly"
|
:dense="dense"
|
||||||
:rules="[
|
:readonly="readonly"
|
||||||
(val) =>
|
:hide-dropdown-icon="readonly"
|
||||||
(val && val.length > 0) ||
|
:options="passportTypeOptions"
|
||||||
$t('form.error.selectField', {
|
:for="`${prefixId}-select-passport-type`"
|
||||||
field: $t('customerEmployee.form.passportIssueDate'),
|
:label="$t('customerEmployee.form.passportType')"
|
||||||
}),
|
:rules="[
|
||||||
]"
|
(val) =>
|
||||||
/>
|
(val && val.length > 0) ||
|
||||||
<DatePicker
|
$t('form.error.selectField', {
|
||||||
:id="`${prefixId}-date-picker-passport-expire`"
|
field: $t('customerEmployee.form.passportType'),
|
||||||
:label="$t('customerEmployee.form.passportExpireDate')"
|
}),
|
||||||
v-model="passportExpiryDate"
|
]"
|
||||||
class="col-6"
|
@filter="passportTypeFilter"
|
||||||
:class="{ 'col-md-3': !ocr }"
|
>
|
||||||
:readonly="readonly"
|
<template v-slot:no-option>
|
||||||
:rules="[
|
<q-item>
|
||||||
(val) =>
|
<q-item-section class="text-grey">
|
||||||
(val && val.length > 0) ||
|
{{ $t('general.noData') }}
|
||||||
$t('form.error.selectField', {
|
</q-item-section>
|
||||||
field: $t('customerEmployee.form.passportExpireDate'),
|
</q-item>
|
||||||
}),
|
</template>
|
||||||
]"
|
</q-select>
|
||||||
/>
|
<q-input
|
||||||
|
:for="`${prefixId}-input-passport-no`"
|
||||||
|
:dense="dense"
|
||||||
|
outlined
|
||||||
|
:readonly="readonly"
|
||||||
|
hide-bottom-space
|
||||||
|
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
||||||
|
:label="$t('customerEmployee.form.passportNo')"
|
||||||
|
v-model="passportNumber"
|
||||||
|
:rules="[
|
||||||
|
(val) => (val && val.length > 0) || $t('form.error.required'),
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
:for="`${prefixId}-input-passport-ref`"
|
||||||
|
:dense="dense"
|
||||||
|
outlined
|
||||||
|
:readonly="readonly"
|
||||||
|
hide-bottom-space
|
||||||
|
:class="{ 'col-12': ocr, 'col-6': !ocr }"
|
||||||
|
:label="$t('customerEmployee.form.passportRef')"
|
||||||
|
:model-value="
|
||||||
|
readonly
|
||||||
|
? previousPassportReference || '-'
|
||||||
|
: previousPassportReference
|
||||||
|
"
|
||||||
|
@update:model-value="
|
||||||
|
(v) =>
|
||||||
|
typeof v === 'string' ? (previousPassportReference = v) : ''
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
<q-input
|
||||||
|
:for="`${prefixId}-input-passport-place`"
|
||||||
|
:dense="dense"
|
||||||
|
outlined
|
||||||
|
:readonly="readonly"
|
||||||
|
hide-bottom-space
|
||||||
|
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
||||||
|
:label="$t('customerEmployee.form.passportPlace')"
|
||||||
|
v-model="passportIssuingPlace"
|
||||||
|
:rules="[
|
||||||
|
(val) => (val && val.length > 0) || $t('form.error.required'),
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
|
option-value="value"
|
||||||
|
option-label="label"
|
||||||
|
:class="{ 'col-12': ocr, 'col-6': !ocr, 'col-md-3': !ocr }"
|
||||||
|
v-model="passportIssuingCountry"
|
||||||
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:options="passportIssuingCountryOptions"
|
||||||
|
:for="`${prefixId}-select-passport-country`"
|
||||||
|
:label="$t('customerEmployee.form.passportIssuer')"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
(val && val.length > 0) ||
|
||||||
|
$t('form.error.selectField', {
|
||||||
|
field: $t('customerEmployee.form.passportIssuer'),
|
||||||
|
}),
|
||||||
|
]"
|
||||||
|
@filter="passportIssuingCountryFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('general.noData') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<DatePicker
|
||||||
|
:id="`${prefixId}-date-picker-passport-issueance`"
|
||||||
|
:label="$t('customerEmployee.form.passportIssueDate')"
|
||||||
|
v-model="passportIssueDate"
|
||||||
|
class="col-6"
|
||||||
|
:class="{ 'col-md-3': !ocr }"
|
||||||
|
:readonly="readonly"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
(val && val.length > 0) ||
|
||||||
|
$t('form.error.selectField', {
|
||||||
|
field: $t('customerEmployee.form.passportIssueDate'),
|
||||||
|
}),
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
<DatePicker
|
||||||
|
:id="`${prefixId}-date-picker-passport-expire`"
|
||||||
|
:label="$t('customerEmployee.form.passportExpireDate')"
|
||||||
|
v-model="passportExpiryDate"
|
||||||
|
class="col-6"
|
||||||
|
:class="{ 'col-md-3': !ocr }"
|
||||||
|
:readonly="readonly"
|
||||||
|
:rules="[
|
||||||
|
(val) =>
|
||||||
|
(val && val.length > 0) ||
|
||||||
|
$t('form.error.selectField', {
|
||||||
|
field: $t('customerEmployee.form.passportExpireDate'),
|
||||||
|
}),
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { useQuasar } from 'quasar';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { getUserId, getRole } from 'src/services/keycloak';
|
import { getUserId, getRole } from 'src/services/keycloak';
|
||||||
import { baseUrl, waitAll } from 'src/stores/utils';
|
import { baseUrl, waitAll } from 'src/stores/utils';
|
||||||
|
import { dateFormat } from 'src/utils/datetime';
|
||||||
|
|
||||||
import useOcrStore from 'stores/ocr';
|
import useOcrStore from 'stores/ocr';
|
||||||
import useCustomerStore from 'stores/customer';
|
import useCustomerStore from 'stores/customer';
|
||||||
|
|
@ -473,7 +474,7 @@ async function toggleStatusCustomer(id: string, status: boolean) {
|
||||||
|
|
||||||
async function deleteEmployeeById(opts: {
|
async function deleteEmployeeById(opts: {
|
||||||
id?: string;
|
id?: string;
|
||||||
type?: 'healthCheck' | 'work';
|
type?: 'passport' | 'healthCheck' | 'work';
|
||||||
}) {
|
}) {
|
||||||
dialog({
|
dialog({
|
||||||
color: 'negative',
|
color: 'negative',
|
||||||
|
|
@ -483,6 +484,10 @@ async function deleteEmployeeById(opts: {
|
||||||
persistent: true,
|
persistent: true,
|
||||||
message: t('dialog.message.confirmDelete'),
|
message: t('dialog.message.confirmDelete'),
|
||||||
action: async () => {
|
action: async () => {
|
||||||
|
if (opts.type === 'passport') {
|
||||||
|
await employeeFormStore.deletePassport();
|
||||||
|
}
|
||||||
|
|
||||||
if (opts.type === 'healthCheck') {
|
if (opts.type === 'healthCheck') {
|
||||||
await employeeFormStore.deleteHealthCheck();
|
await employeeFormStore.deleteHealthCheck();
|
||||||
}
|
}
|
||||||
|
|
@ -1286,6 +1291,25 @@ const emptyCreateDialog = ref(false);
|
||||||
</q-tooltip>
|
</q-tooltip>
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
||||||
|
<q-td v-if="fieldSelected.includes('address')">
|
||||||
|
{{
|
||||||
|
locale === 'eng'
|
||||||
|
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
|
||||||
|
'-'
|
||||||
|
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
|
||||||
|
'-'
|
||||||
|
}}
|
||||||
|
<q-tooltip>
|
||||||
|
{{
|
||||||
|
locale === 'eng'
|
||||||
|
? `${props.row.branch[0].addressEN}, ${props.row.branch[0].mooEN && `${$t('form.moo')} ${props.row.branch[0].mooEN},`} ${props.row.branch[0].soiEN && `${$t('form.soi')} ${props.row.branch[0].soiEN},`} ${props.row.branch[0].moo && `${props.row.branch[0].streetEN} Rd,`} ${props.row.branch[0].subDistrict.nameEN}, ${props.row.branch[0].district.nameEN}, ${props.row.branch[0].province.nameEN} ${props.row.branch[0].subDistrict.zipCode}` ||
|
||||||
|
'-'
|
||||||
|
: `${props.row.branch[0].address}, ${props.row.branch[0].moo && `${$t('form.moo')} ${props.row.branch[0].moo},`} ${props.row.branch[0].soi && `${$t('form.soi')} ${props.row.branch[0].soi},`} ${props.row.branch[0].street && `${$t('form.road')} ${props.row.branch[0].street},`} ${props.row.branch[0].subDistrict.name}, ${props.row.branch[0].district.name}, ${props.row.branch[0].province.name} ${props.row.branch[0].subDistrict.zipCode}` ||
|
||||||
|
'-'
|
||||||
|
}}
|
||||||
|
</q-tooltip>
|
||||||
|
</q-td>
|
||||||
|
|
||||||
<q-td v-if="fieldSelected.includes('contactName')">
|
<q-td v-if="fieldSelected.includes('contactName')">
|
||||||
{{ props.row.branch[0]?.contactName || '-' }}
|
{{ props.row.branch[0]?.contactName || '-' }}
|
||||||
</q-td>
|
</q-td>
|
||||||
|
|
@ -3537,6 +3561,11 @@ const emptyCreateDialog = ref(false);
|
||||||
employeeFormState.dialogType = 'info';
|
employeeFormState.dialogType = 'info';
|
||||||
employeeFormState.isEmployeeEdit = false;
|
employeeFormState.isEmployeeEdit = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (employeeFormState.currentTab === 'passport') {
|
||||||
|
await employeeFormStore.submitPassport();
|
||||||
|
}
|
||||||
|
|
||||||
if (employeeFormState.currentTab === 'healthCheck') {
|
if (employeeFormState.currentTab === 'healthCheck') {
|
||||||
await employeeFormStore.submitHealthCheck();
|
await employeeFormStore.submitHealthCheck();
|
||||||
}
|
}
|
||||||
|
|
@ -3619,6 +3648,10 @@ const emptyCreateDialog = ref(false);
|
||||||
name: 'personalInfo',
|
name: 'personalInfo',
|
||||||
label: 'customerEmployee.form.group.personalInfo',
|
label: 'customerEmployee.form.group.personalInfo',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'passport',
|
||||||
|
label: 'customerEmployee.fileType.passport',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'healthCheck',
|
name: 'healthCheck',
|
||||||
label: 'customerEmployee.form.group.healthCheck',
|
label: 'customerEmployee.form.group.healthCheck',
|
||||||
|
|
@ -3669,6 +3702,31 @@ const emptyCreateDialog = ref(false);
|
||||||
anchor: 'drawer-upload-file',
|
anchor: 'drawer-upload-file',
|
||||||
tab: 'personalInfo',
|
tab: 'personalInfo',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: $t('customerEmployee.form.group.passport'),
|
||||||
|
anchor: 'drawer-passport',
|
||||||
|
tab: 'passport',
|
||||||
|
useBtn:
|
||||||
|
currentFromDataEmployee.employeePassport?.filter(
|
||||||
|
(item) => {
|
||||||
|
if (item.id === undefined) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
).length === 0 &&
|
||||||
|
employeeFormState.currentIndexPassport === -1
|
||||||
|
? true
|
||||||
|
: false,
|
||||||
|
},
|
||||||
|
...(currentFromDataEmployee.employeePassport?.map(
|
||||||
|
(v, i) => ({
|
||||||
|
name: dateFormat(v.expireDate),
|
||||||
|
anchor: `drawer-employee-employeePassport-${i}`,
|
||||||
|
tab: 'passport',
|
||||||
|
sub: true,
|
||||||
|
}),
|
||||||
|
) || []),
|
||||||
|
|
||||||
...(currentFromDataEmployee.employeeCheckup?.map(
|
...(currentFromDataEmployee.employeeCheckup?.map(
|
||||||
(v, i) => ({
|
(v, i) => ({
|
||||||
|
|
@ -3695,7 +3753,20 @@ const emptyCreateDialog = ref(false);
|
||||||
foreground: 'var(--blue-6)',
|
foreground: 'var(--blue-6)',
|
||||||
}"
|
}"
|
||||||
scroll-element="#drawer-employee-form-content"
|
scroll-element="#drawer-employee-form-content"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:btn-drawer-passport>
|
||||||
|
<q-btn
|
||||||
|
dense
|
||||||
|
flat
|
||||||
|
icon="mdi-plus"
|
||||||
|
size="sm"
|
||||||
|
rounded
|
||||||
|
padding="0px 0px"
|
||||||
|
style="color: var(--stone-9)"
|
||||||
|
@click.stop="employeeFormStore.addPassport()"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</SideMenu>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
|
@ -4010,7 +4081,7 @@ const emptyCreateDialog = ref(false);
|
||||||
v-model:passport-expiry-date="meta.expireDate"
|
v-model:passport-expiry-date="meta.expireDate"
|
||||||
v-model:passport-issuing-place="meta.issuePlace"
|
v-model:passport-issuing-place="meta.issuePlace"
|
||||||
v-model:passport-issuing-country="meta.issueCountry"
|
v-model:passport-issuing-country="meta.issueCountry"
|
||||||
/>
|
></FormEmployeePassport>
|
||||||
<FormEmployeeVisa
|
<FormEmployeeVisa
|
||||||
v-if="mode === 'visa' && meta"
|
v-if="mode === 'visa' && meta"
|
||||||
prefix-id="drawer-info-employee"
|
prefix-id="drawer-info-employee"
|
||||||
|
|
@ -4031,6 +4102,128 @@ const emptyCreateDialog = ref(false);
|
||||||
</template>
|
</template>
|
||||||
</UploadFileGroup>
|
</UploadFileGroup>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<template v-if="employeeFormState.currentTab === 'passport'">
|
||||||
|
<div class="q-gutter-sm">
|
||||||
|
<div class="col-12 q-pb-sm text-weight-bold text-body1">
|
||||||
|
<q-icon
|
||||||
|
flat
|
||||||
|
size="xs"
|
||||||
|
class="q-pa-sm rounded q-mr-xs"
|
||||||
|
color="info"
|
||||||
|
name="mdi-passport"
|
||||||
|
style="background-color: var(--surface-3)"
|
||||||
|
/>
|
||||||
|
{{ $t('customerEmployee.form.group.passport') }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<FormEmployeePassport
|
||||||
|
v-for="(
|
||||||
|
value, index
|
||||||
|
) in currentFromDataEmployee.employeePassport"
|
||||||
|
prefix-id="drawer-info-employee"
|
||||||
|
:key="index"
|
||||||
|
id="form-passport"
|
||||||
|
hide-title
|
||||||
|
dense
|
||||||
|
outlined
|
||||||
|
separator
|
||||||
|
:title="$t('customerEmployee.form.group.passport')"
|
||||||
|
:readonly="employeeFormState.currentIndexPassport !== index"
|
||||||
|
v-model:passport-type="value.type"
|
||||||
|
v-model:passport-number="value.number"
|
||||||
|
v-model:passport-issue-date="value.issueDate"
|
||||||
|
v-model:passport-expiry-date="value.expireDate"
|
||||||
|
v-model:passport-issuing-place="value.issuePlace"
|
||||||
|
v-model:passport-issuing-country="value.issueCountry"
|
||||||
|
>
|
||||||
|
<template v-slot:expiryDate>
|
||||||
|
{{ $t('general.expirationDate') }} :
|
||||||
|
{{ dateFormat(value.expireDate) }}
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-slot:button>
|
||||||
|
<div class="surface-1 row rounded" style="min-height: 35px">
|
||||||
|
<UndoButton
|
||||||
|
v-if="
|
||||||
|
employeeFormState.isEmployeeEdit &&
|
||||||
|
!(employeeFormState.currentIndexPassport === -1) &&
|
||||||
|
employeeFormState.currentIndexPassport === index
|
||||||
|
"
|
||||||
|
id="btn-info-basic-undo"
|
||||||
|
icon-only
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
employeeFormStore.resetFormDataEmployee();
|
||||||
|
employeeFormState.isEmployeeEdit = false;
|
||||||
|
employeeFormState.dialogType = 'info';
|
||||||
|
employeeFormState.currentIndexPassport = -1;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
type="button"
|
||||||
|
/>
|
||||||
|
<SaveButton
|
||||||
|
v-if="
|
||||||
|
(employeeFormState.isEmployeeEdit ||
|
||||||
|
value.id === undefined) &&
|
||||||
|
!(employeeFormState.currentIndexPassport === -1) &&
|
||||||
|
employeeFormState.currentIndexPassport === index
|
||||||
|
"
|
||||||
|
id="btn-info-basic-save"
|
||||||
|
icon-only
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
employeeFormState.currentIndexPassport = index;
|
||||||
|
}
|
||||||
|
"
|
||||||
|
type="submit"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<EditButton
|
||||||
|
v-if="
|
||||||
|
employeeFormState.currentIndexPassport === -1 ||
|
||||||
|
(!employeeFormState.isEmployeeEdit &&
|
||||||
|
value.id !== undefined &&
|
||||||
|
employeeFormState.currentIndexPassport === index)
|
||||||
|
"
|
||||||
|
id="btn-info-basic-edit"
|
||||||
|
icon-only
|
||||||
|
@click="
|
||||||
|
() => {
|
||||||
|
employeeFormState.currentIndexPassport = index;
|
||||||
|
employeeFormState.isEmployeeEdit = true;
|
||||||
|
employeeFormState.dialogType = 'edit';
|
||||||
|
}
|
||||||
|
"
|
||||||
|
type="button"
|
||||||
|
/>
|
||||||
|
<DeleteButton
|
||||||
|
v-if="
|
||||||
|
employeeFormState.currentIndexPassport === -1 ||
|
||||||
|
(!employeeFormState.isEmployeeEdit &&
|
||||||
|
value.id !== undefined &&
|
||||||
|
!(employeeFormState.currentIndexPassport === -1) &&
|
||||||
|
employeeFormState.currentIndexPassport === index)
|
||||||
|
"
|
||||||
|
id="btn-info-basic-delete"
|
||||||
|
icon-only
|
||||||
|
@click.stop="
|
||||||
|
() => {
|
||||||
|
employeeFormState.currentIndexPassport = index;
|
||||||
|
deleteEmployeeById({ type: 'passport' });
|
||||||
|
}
|
||||||
|
"
|
||||||
|
type="button"
|
||||||
|
:disabled="
|
||||||
|
!(employeeFormState.currentIndex === -1) &&
|
||||||
|
!(employeeFormState.currentIndex === index)
|
||||||
|
"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</FormEmployeePassport>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
<template v-if="employeeFormState.currentTab === 'healthCheck'">
|
<template v-if="employeeFormState.currentTab === 'healthCheck'">
|
||||||
<FormEmployeeHealthCheck
|
<FormEmployeeHealthCheck
|
||||||
v-if="employeeFormState.currentTab === 'healthCheck'"
|
v-if="employeeFormState.currentTab === 'healthCheck'"
|
||||||
|
|
|
||||||
|
|
@ -588,6 +588,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
currentEmployeeCode: string;
|
currentEmployeeCode: string;
|
||||||
currentEmployee: Employee | null;
|
currentEmployee: Employee | null;
|
||||||
currentIndex: number;
|
currentIndex: number;
|
||||||
|
currentIndexPassport: number;
|
||||||
profileUrl: string;
|
profileUrl: string;
|
||||||
isEmployeeEdit: boolean;
|
isEmployeeEdit: boolean;
|
||||||
profileSubmit: boolean;
|
profileSubmit: boolean;
|
||||||
|
|
@ -617,6 +618,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
ocr: boolean;
|
ocr: boolean;
|
||||||
}>({
|
}>({
|
||||||
isImageEdit: false,
|
isImageEdit: false,
|
||||||
|
currentIndexPassport: -1,
|
||||||
currentIndex: -1,
|
currentIndex: -1,
|
||||||
statusSavePersonal: false,
|
statusSavePersonal: false,
|
||||||
drawerModal: false,
|
drawerModal: false,
|
||||||
|
|
@ -718,6 +720,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
|
|
||||||
employeePassport: [
|
employeePassport: [
|
||||||
{
|
{
|
||||||
|
id: undefined,
|
||||||
number: '',
|
number: '',
|
||||||
type: '',
|
type: '',
|
||||||
issueDate: new Date(),
|
issueDate: new Date(),
|
||||||
|
|
@ -763,6 +766,7 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
function resetFormDataEmployee(clean = false) {
|
function resetFormDataEmployee(clean = false) {
|
||||||
|
state.value.currentIndexPassport = -1;
|
||||||
if (clean) {
|
if (clean) {
|
||||||
state.value.currentTab = 'personalInfo';
|
state.value.currentTab = 'personalInfo';
|
||||||
state.value.formDataEmployeeOwner = undefined;
|
state.value.formDataEmployeeOwner = undefined;
|
||||||
|
|
@ -776,6 +780,58 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
currentFromDataEmployee.value = structuredClone(resetEmployeeData);
|
currentFromDataEmployee.value = structuredClone(resetEmployeeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function submitPassport() {
|
||||||
|
if (
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
] === undefined
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id === undefined
|
||||||
|
) {
|
||||||
|
const res = await employeeStore.postMeta({
|
||||||
|
parentId: currentFromDataEmployee.value.id || '',
|
||||||
|
group: 'passport',
|
||||||
|
meta: currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
],
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
currentFromDataEmployee.value.employeePassport[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id = res.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id !== undefined
|
||||||
|
) {
|
||||||
|
const { id, ...payload } =
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
];
|
||||||
|
|
||||||
|
await employeeStore.putMeta({
|
||||||
|
parentId: currentFromDataEmployee.value.id || '',
|
||||||
|
group: 'passport',
|
||||||
|
metaId:
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id || '',
|
||||||
|
meta: payload,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
||||||
|
state.value.currentIndexPassport = -1;
|
||||||
|
}
|
||||||
|
|
||||||
async function submitOther() {
|
async function submitOther() {
|
||||||
if (!currentFromDataEmployee.value.employeeOtherInfo) return;
|
if (!currentFromDataEmployee.value.employeeOtherInfo) return;
|
||||||
|
|
||||||
|
|
@ -802,6 +858,25 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function deletePassport() {
|
||||||
|
const res = await employeeStore.delMeta({
|
||||||
|
parentId: currentFromDataEmployee.value.id || '',
|
||||||
|
group: 'passport',
|
||||||
|
metaId:
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id || '',
|
||||||
|
});
|
||||||
|
|
||||||
|
if (res) {
|
||||||
|
currentFromDataEmployee.value.employeePassport?.splice(
|
||||||
|
state.value.currentIndexPassport,
|
||||||
|
1,
|
||||||
|
);
|
||||||
|
await assignFormDataEmployee(currentFromDataEmployee.value.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function deleteWorkHistory() {
|
async function deleteWorkHistory() {
|
||||||
if (!currentFromDataEmployee.value.employeeWork) return;
|
if (!currentFromDataEmployee.value.employeeWork) return;
|
||||||
|
|
||||||
|
|
@ -990,6 +1065,22 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
provinceId: province?.id || '',
|
provinceId: province?.id || '',
|
||||||
districtId: district?.id || '',
|
districtId: district?.id || '',
|
||||||
subDistrictId: subDistrict?.id || '',
|
subDistrictId: subDistrict?.id || '',
|
||||||
|
|
||||||
|
employeePassport: structuredClone(
|
||||||
|
payload.employeePassport?.length === 0
|
||||||
|
? defaultFormData.employeePassport
|
||||||
|
: payload.employeePassport?.map((item) => ({
|
||||||
|
id: item.id,
|
||||||
|
number: item.number,
|
||||||
|
type: item.type,
|
||||||
|
issueDate: item.issueDate,
|
||||||
|
expireDate: item.expireDate,
|
||||||
|
issueCountry: item.issueCountry,
|
||||||
|
issuePlace: item.issuePlace,
|
||||||
|
previousPassportRef: item.previousPassportRef,
|
||||||
|
})),
|
||||||
|
),
|
||||||
|
|
||||||
employeeCheckup: structuredClone(
|
employeeCheckup: structuredClone(
|
||||||
payload.employeeCheckup?.length === 0
|
payload.employeeCheckup?.length === 0
|
||||||
? defaultFormData.employeeCheckup
|
? defaultFormData.employeeCheckup
|
||||||
|
|
@ -1029,6 +1120,17 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
currentFromDataEmployee.value = structuredClone(resetEmployeeData);
|
currentFromDataEmployee.value = structuredClone(resetEmployeeData);
|
||||||
|
|
||||||
|
state.value.currentIndexPassport =
|
||||||
|
(currentFromDataEmployee.value.employeePassport?.length || 0) - 1;
|
||||||
|
|
||||||
|
if (
|
||||||
|
currentFromDataEmployee.value.employeePassport?.[
|
||||||
|
state.value.currentIndexPassport
|
||||||
|
].id !== undefined
|
||||||
|
) {
|
||||||
|
state.value.currentIndexPassport = -1;
|
||||||
|
}
|
||||||
const foundBranch = await customerStore.fetchListCustomeBranchById(
|
const foundBranch = await customerStore.fetchListCustomeBranchById(
|
||||||
payload.customerBranchId,
|
payload.customerBranchId,
|
||||||
);
|
);
|
||||||
|
|
@ -1075,16 +1177,36 @@ export const useEmployeeForm = defineStore('form-employee', () => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addPassport() {
|
||||||
|
currentFromDataEmployee.value.employeePassport?.push({
|
||||||
|
id: undefined,
|
||||||
|
number: '',
|
||||||
|
type: '',
|
||||||
|
issueDate: new Date(),
|
||||||
|
expireDate: new Date(),
|
||||||
|
issueCountry: '',
|
||||||
|
issuePlace: '',
|
||||||
|
previousPassportRef: '',
|
||||||
|
});
|
||||||
|
|
||||||
|
state.value.currentIndexPassport =
|
||||||
|
(currentFromDataEmployee.value.employeePassport?.length || 0) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
state,
|
state,
|
||||||
currentFromDataEmployee,
|
currentFromDataEmployee,
|
||||||
resetEmployeeData,
|
resetEmployeeData,
|
||||||
|
|
||||||
|
addPassport,
|
||||||
|
|
||||||
|
submitPassport,
|
||||||
submitOther,
|
submitOther,
|
||||||
submitWorkHistory,
|
submitWorkHistory,
|
||||||
submitPersonal,
|
submitPersonal,
|
||||||
submitHealthCheck,
|
submitHealthCheck,
|
||||||
|
|
||||||
|
deletePassport,
|
||||||
deleteWorkHistory,
|
deleteWorkHistory,
|
||||||
deleteHealthCheck,
|
deleteHealthCheck,
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue