refactor(03): input select
This commit is contained in:
parent
48c1bd9987
commit
57e61cf663
7 changed files with 458 additions and 160 deletions
|
|
@ -1,12 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { getRole } from 'src/services/keycloak';
|
import { getRole } from 'src/services/keycloak';
|
||||||
import { CustomerBranch } from 'src/stores/customer/types';
|
import { CustomerBranch } from 'src/stores/customer/types';
|
||||||
import { onMounted, ref } from 'vue';
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
|
import { ref } from 'vue';
|
||||||
|
|
||||||
const personName = defineModel<string>('personName');
|
const personName = defineModel<string>('personName');
|
||||||
const customerName = defineModel<string>('customerName');
|
const customerName = defineModel<string>('customerName');
|
||||||
const customerNameEn = defineModel<string>('customerNameEn');
|
const customerNameEn = defineModel<string>('customerNameEn');
|
||||||
const registeredBranchId = defineModel<string>('registeredBranchId');
|
const registeredBranchId = defineModel<string>('registeredBranchId');
|
||||||
|
const optionsBranch = defineModel<{ id: string; name: string }[]>(
|
||||||
|
'optionsBranch',
|
||||||
|
{ default: [] },
|
||||||
|
);
|
||||||
const taxNo = defineModel<string | null | undefined>('taxNo');
|
const taxNo = defineModel<string | null | undefined>('taxNo');
|
||||||
|
|
||||||
const employerID = defineModel<string>('employerID');
|
const employerID = defineModel<string>('employerID');
|
||||||
|
|
@ -31,7 +36,6 @@ const props = defineProps<{
|
||||||
separator?: boolean;
|
separator?: boolean;
|
||||||
typeCustomer?: string;
|
typeCustomer?: string;
|
||||||
employee?: boolean;
|
employee?: boolean;
|
||||||
optionsBranch?: { id: string; name: string }[];
|
|
||||||
employeeOwnerOption?: CustomerBranch[];
|
employeeOwnerOption?: CustomerBranch[];
|
||||||
prefixId: string;
|
prefixId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
@ -39,6 +43,13 @@ const props = defineProps<{
|
||||||
defineEmits<{
|
defineEmits<{
|
||||||
(e: 'filterOwnerBranch', val: string, update: void): void;
|
(e: 'filterOwnerBranch', val: string, update: void): void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const branchOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const branchFilter = selectFilterOptionRefMod(
|
||||||
|
optionsBranch,
|
||||||
|
branchOptions,
|
||||||
|
'name',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -47,22 +58,26 @@ defineEmits<{
|
||||||
</div>
|
</div>
|
||||||
<div v-if="!employee" class="col-md-9 col-12 row q-col-gutter-md">
|
<div v-if="!employee" class="col-md-9 col-12 row q-col-gutter-md">
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-input-source-nationality`"
|
|
||||||
:dense="dense"
|
|
||||||
outlined
|
outlined
|
||||||
:readonly="readonly"
|
clearable
|
||||||
:hide-dropdown-icon="readonly"
|
use-input
|
||||||
hide-bottom-space
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
options-dense
|
hide-selected
|
||||||
:label="$t('registeredBranch')"
|
hide-bottom-space
|
||||||
class="col-12"
|
class="col-12"
|
||||||
option-label="name"
|
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
input-debounce="0"
|
||||||
|
option-label="name"
|
||||||
|
lazy-rules="ondemand"
|
||||||
v-model="registeredBranchId"
|
v-model="registeredBranchId"
|
||||||
:options="optionsBranch"
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:options="branchOptions"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:label="$t('registeredBranch')"
|
||||||
|
:id="`${prefixId}-input-source-nationality`"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val) => {
|
(val) => {
|
||||||
const roles = getRole() || [];
|
const roles = getRole() || [];
|
||||||
|
|
@ -72,8 +87,16 @@ defineEmits<{
|
||||||
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
|
return isSpecialRole || !!val || 'กรุณากรอกข้อมูล';
|
||||||
},
|
},
|
||||||
]"
|
]"
|
||||||
clearable
|
@filter="branchFilter"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
||||||
import { onMounted } from 'vue';
|
import { onMounted } from 'vue';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
|
|
@ -21,8 +22,8 @@ const saleEmployee = defineModel<string>('saleEmployee');
|
||||||
|
|
||||||
const rawOption = ref();
|
const rawOption = ref();
|
||||||
|
|
||||||
const typeBusinessOptions = ref([]);
|
const typeBusinessOption = ref([]);
|
||||||
const jobPositionOptions = ref([]);
|
const jobPositionOption = ref([]);
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|
@ -38,14 +39,28 @@ onMounted(async () => {
|
||||||
rawOption.value = await resultOption.json();
|
rawOption.value = await resultOption.json();
|
||||||
|
|
||||||
if (locale.value === 'en-US') {
|
if (locale.value === 'en-US') {
|
||||||
typeBusinessOptions.value = rawOption.value.eng.businessType;
|
typeBusinessOption.value = rawOption.value.eng.businessType;
|
||||||
jobPositionOptions.value = rawOption.value.eng.position;
|
jobPositionOption.value = rawOption.value.eng.position;
|
||||||
}
|
}
|
||||||
if (locale.value === 'th-th') {
|
if (locale.value === 'th-th') {
|
||||||
typeBusinessOptions.value = rawOption.value.tha.businessType;
|
typeBusinessOption.value = rawOption.value.tha.businessType;
|
||||||
jobPositionOptions.value = rawOption.value.tha.position;
|
jobPositionOption.value = rawOption.value.tha.position;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const typeBusinessOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const typeBusinessFilter = selectFilterOptionRefMod(
|
||||||
|
typeBusinessOption,
|
||||||
|
typeBusinessOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const jobPositionOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const jobPositionFilter = selectFilterOptionRefMod(
|
||||||
|
jobPositionOption,
|
||||||
|
jobPositionOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div class="col-12 row q-col-gutter-y-md">
|
<div class="col-12 row q-col-gutter-y-md">
|
||||||
|
|
@ -67,20 +82,35 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
outlined
|
||||||
:id="`${prefixId}-select-business-type`"
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
map-options
|
lazy-rules="ondemand"
|
||||||
:dense="dense"
|
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
|
||||||
v-model="bussinessType"
|
v-model="bussinessType"
|
||||||
:options="typeBusinessOptions"
|
|
||||||
:label="$t('businessType')"
|
|
||||||
class="col-md-6 col-12"
|
class="col-md-6 col-12"
|
||||||
/>
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:label="$t('businessType')"
|
||||||
|
:options="typeBusinessOptions"
|
||||||
|
:id="`${prefixId}-select-business-type`"
|
||||||
|
@filter="typeBusinessFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
|
@ -96,21 +126,36 @@ onMounted(async () => {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
outlined
|
||||||
:for="`${prefixId}-select-job-position`"
|
clearable
|
||||||
:id="`${prefixId}-select-job-position`"
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
map-options
|
lazy-rules="ondemand"
|
||||||
:dense="dense"
|
|
||||||
outlined
|
|
||||||
:readonly="readonly"
|
|
||||||
v-model="jobPosition"
|
v-model="jobPosition"
|
||||||
:options="jobPositionOptions"
|
|
||||||
:label="$t('jobPosition')"
|
|
||||||
class="col-md-6 col-12"
|
class="col-md-6 col-12"
|
||||||
/>
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:label="$t('jobPosition')"
|
||||||
|
:options="jobPositionOptions"
|
||||||
|
:id="`${prefixId}-select-job-position`"
|
||||||
|
:for="`${prefixId}-select-job-position`"
|
||||||
|
@filter="jobPositionFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import useAddressStore, {
|
||||||
} from 'src/stores/address';
|
} from 'src/stores/address';
|
||||||
import { EmployeeCheckupCreate } from 'src/stores/employee/types';
|
import { EmployeeCheckupCreate } from 'src/stores/employee/types';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const adrressStore = useAddressStore();
|
const adrressStore = useAddressStore();
|
||||||
|
|
@ -23,13 +24,17 @@ const addrOptions = reactive<{
|
||||||
});
|
});
|
||||||
|
|
||||||
const employeeCheckup = defineModel<EmployeeCheckupCreate[]>('employeeCheckup');
|
const employeeCheckup = defineModel<EmployeeCheckupCreate[]>('employeeCheckup');
|
||||||
const checkupTypeOption =
|
const checkupTypeOption = defineModel<{ label: string; value: string }[]>(
|
||||||
defineModel<{ label: string; value: string }[]>('checkupTypeOption');
|
'checkupTypeOption',
|
||||||
|
{ required: true },
|
||||||
|
);
|
||||||
const medicalBenefitOption = defineModel<{ label: string; value: string }[]>(
|
const medicalBenefitOption = defineModel<{ label: string; value: string }[]>(
|
||||||
'medicalBenefitOption',
|
'medicalBenefitOption',
|
||||||
|
{ required: true },
|
||||||
);
|
);
|
||||||
const insuranceCompanyOption = defineModel<{ label: string; value: string }[]>(
|
const insuranceCompanyOption = defineModel<{ label: string; value: string }[]>(
|
||||||
'insuranceCompanyOption',
|
'insuranceCompanyOption',
|
||||||
|
{ required: true },
|
||||||
);
|
);
|
||||||
|
|
||||||
const tab = ref();
|
const tab = ref();
|
||||||
|
|
@ -81,6 +86,34 @@ onMounted(async () => {
|
||||||
await fetchProvince();
|
await fetchProvince();
|
||||||
tab.value = 'tab0';
|
tab.value = 'tab0';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// const provinceOps = ref<Record<string, unknown>[]>([]);
|
||||||
|
// const provinceFilter = selectFilterOptionRefMod(
|
||||||
|
// addrOptions.provinceOps,
|
||||||
|
// provinceOps,
|
||||||
|
// 'label',
|
||||||
|
// );
|
||||||
|
|
||||||
|
const checkupTypeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const checkupTypeFilter = selectFilterOptionRefMod(
|
||||||
|
checkupTypeOption,
|
||||||
|
checkupTypeOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const medicalBenefitOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const medicalBenefitFilter = selectFilterOptionRefMod(
|
||||||
|
medicalBenefitOption,
|
||||||
|
medicalBenefitOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const insuranceCompanyOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const insuranceCompanyFilter = selectFilterOptionRefMod(
|
||||||
|
insuranceCompanyOption,
|
||||||
|
insuranceCompanyOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -156,39 +189,67 @@ onMounted(async () => {
|
||||||
v-model="checkup.checkupResult"
|
v-model="checkup.checkupResult"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-province`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="checkup.checkupType"
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-6"
|
||||||
|
input-debounce="0"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
:label="$t('formDialogInputCheckupType')"
|
|
||||||
class="col-6"
|
|
||||||
:options="checkupTypeOption"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
:id="`${prefixId}-select-province`"
|
v-model="checkup.checkupType"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
outlined
|
:options="checkupTypeOptions"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
hide-bottom-space
|
:id="`${prefixId}-select-province`"
|
||||||
|
:label="$t('formDialogInputCheckupType')"
|
||||||
|
@filter="checkupTypeFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="checkup.provinceId"
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
option-value="id"
|
option-value="id"
|
||||||
|
input-debounce="0"
|
||||||
option-label="name"
|
option-label="name"
|
||||||
:label="$t('province')"
|
lazy-rules="ondemand"
|
||||||
class="col-md-3 col-6"
|
class="col-md-3 col-6"
|
||||||
|
v-model="checkup.provinceId"
|
||||||
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:label="$t('province')"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:id="`${prefixId}-select-province`"
|
||||||
:options="addrOptions.provinceOps"
|
:options="addrOptions.provinceOps"
|
||||||
/>
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<!-- @filter="provinceFilter" -->
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
|
|
@ -211,39 +272,67 @@ onMounted(async () => {
|
||||||
type="textarea"
|
type="textarea"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-province`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-6"
|
||||||
|
input-debounce="0"
|
||||||
|
option-value="value"
|
||||||
|
option-label="label"
|
||||||
|
lazy-rules="ondemand"
|
||||||
v-model="checkup.medicalBenefitScheme"
|
v-model="checkup.medicalBenefitScheme"
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
:label="$t('formDialogInputMedicalBenefit')"
|
|
||||||
class="col-6"
|
|
||||||
:options="medicalBenefitOption"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-province`"
|
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
outlined
|
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
hide-bottom-space
|
:options="medicalBenefitOptions"
|
||||||
|
:id="`${prefixId}-select-province`"
|
||||||
|
:label="$t('formDialogInputMedicalBenefit')"
|
||||||
|
@filter="medicalBenefitFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="checkup.insuranceCompany"
|
hide-selected
|
||||||
option-value="value"
|
hide-bottom-space
|
||||||
option-label="label"
|
|
||||||
:label="$t('formDialogInputInsuranceCompany')"
|
|
||||||
class="col-6"
|
class="col-6"
|
||||||
:options="insuranceCompanyOption"
|
input-debounce="0"
|
||||||
/>
|
option-label="label"
|
||||||
|
option-value="value"
|
||||||
|
lazy-rules="ondemand"
|
||||||
|
v-model="checkup.insuranceCompany"
|
||||||
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:options="insuranceCompanyOptions"
|
||||||
|
:id="`${prefixId}-select-province`"
|
||||||
|
:label="$t('formDialogInputInsuranceCompany')"
|
||||||
|
@filter="insuranceCompanyFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<VueDatePicker
|
<VueDatePicker
|
||||||
utc
|
utc
|
||||||
autoApply
|
autoApply
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { QSelect } from 'quasar';
|
||||||
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
||||||
|
import { ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
@ -17,11 +20,13 @@ const passportIssuingPlace = defineModel<string>('passportIssuingPlace');
|
||||||
const previousPassportReference = defineModel<string>(
|
const previousPassportReference = defineModel<string>(
|
||||||
'previousPassportReference',
|
'previousPassportReference',
|
||||||
);
|
);
|
||||||
const passportTypeOption =
|
const passportTypeOption = defineModel<{ label: string; value: string }[]>(
|
||||||
defineModel<{ label: string; value: string }[]>('passportTypeOption');
|
'passportTypeOption',
|
||||||
|
{ required: true },
|
||||||
|
);
|
||||||
const passportIssuingCountryOption = defineModel<
|
const passportIssuingCountryOption = defineModel<
|
||||||
{ label: string; value: string }[]
|
{ label: string; value: string }[]
|
||||||
>('passportIssuingCountryOption');
|
>('passportIssuingCountryOption', { required: true });
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|
@ -31,6 +36,20 @@ defineProps<{
|
||||||
separator?: boolean;
|
separator?: boolean;
|
||||||
prefixId: string;
|
prefixId: string;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
|
const passportTypeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const passportTypeFilter = selectFilterOptionRefMod(
|
||||||
|
passportTypeOption,
|
||||||
|
passportTypeOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const passportIssuingCountryOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const passportIssuingCountryFilter = selectFilterOptionRefMod(
|
||||||
|
passportIssuingCountryOption,
|
||||||
|
passportIssuingCountryOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -39,26 +58,40 @@ defineProps<{
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9 col-12 row q-col-gutter-md">
|
<div class="col-md-9 col-12 row q-col-gutter-md">
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-passport-type`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="passportType"
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
:label="$t('formDialogInputPassportType')"
|
lazy-rules="ondemand"
|
||||||
|
v-model="passportType"
|
||||||
class="col-md-3 col-12"
|
class="col-md-3 col-12"
|
||||||
:options="passportTypeOption"
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:options="passportTypeOptions"
|
||||||
|
:id="`${prefixId}-select-passport-type`"
|
||||||
|
:label="$t('formDialogInputPassportType')"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val: string) =>
|
(val: string) =>
|
||||||
!!val || $t('selectValidate') + $t('formDialogInputPassportType'),
|
!!val || $t('selectValidate') + $t('formDialogInputPassportType'),
|
||||||
]"
|
]"
|
||||||
/>
|
@filter="passportTypeFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
:for="`${prefixId}-input-passport-no`"
|
:for="`${prefixId}-input-passport-no`"
|
||||||
|
|
@ -101,26 +134,40 @@ defineProps<{
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-passport-country`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="passportIssuingCountry"
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
:label="$t('formDialogInputPassportCountry')"
|
lazy-rules="ondemand"
|
||||||
class="col-md-3 col-6"
|
class="col-md-3 col-6"
|
||||||
:options="passportIssuingCountryOption"
|
v-model="passportIssuingCountry"
|
||||||
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:options="passportIssuingCountryOptions"
|
||||||
|
:id="`${prefixId}-select-passport-country`"
|
||||||
|
:label="$t('formDialogInputPassportCountry')"
|
||||||
:rules="[
|
:rules="[
|
||||||
(val: string) =>
|
(val: string) =>
|
||||||
!!val || $t('selectValidate') + $t('formDialogInputPassportCountry'),
|
!!val || $t('selectValidate') + $t('formDialogInputPassportCountry'),
|
||||||
]"
|
]"
|
||||||
/>
|
@filter="passportIssuingCountryFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<VueDatePicker
|
<VueDatePicker
|
||||||
:id="`${prefixId}-date-picker-passport-issueance`"
|
:id="`${prefixId}-date-picker-passport-issueance`"
|
||||||
utc
|
utc
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { onMounted, reactive } from 'vue';
|
import { onMounted, reactive, ref } from 'vue';
|
||||||
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
||||||
import useAddressStore, {
|
import useAddressStore, {
|
||||||
District,
|
District,
|
||||||
|
|
@ -7,6 +7,7 @@ import useAddressStore, {
|
||||||
SubDistrict,
|
SubDistrict,
|
||||||
} from 'src/stores/address';
|
} from 'src/stores/address';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
const adrressStore = useAddressStore();
|
const adrressStore = useAddressStore();
|
||||||
|
|
@ -32,8 +33,10 @@ const visaStayUntilDate = defineModel<Date | null | string>(
|
||||||
const tm6Number = defineModel<string>('tm6Number');
|
const tm6Number = defineModel<string>('tm6Number');
|
||||||
const entryDate = defineModel<Date | null | string>('entryDate');
|
const entryDate = defineModel<Date | null | string>('entryDate');
|
||||||
|
|
||||||
const visaTypeOption =
|
const visaTypeOption = defineModel<{ label: string; value: string }[]>(
|
||||||
defineModel<{ label: string; value: string }[]>('visaTypeOption');
|
'visaTypeOption',
|
||||||
|
{ required: true },
|
||||||
|
);
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
title?: string;
|
title?: string;
|
||||||
|
|
@ -54,6 +57,13 @@ async function fetchProvince() {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
await fetchProvince();
|
await fetchProvince();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const visaTypeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const visaTypeFilter = selectFilterOptionRefMod(
|
||||||
|
visaTypeOption,
|
||||||
|
visaTypeOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -62,22 +72,36 @@ onMounted(async () => {
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-9 col-12 row q-col-gutter-md">
|
<div class="col-md-9 col-12 row q-col-gutter-md">
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-visa-type`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
input-debounce="0"
|
||||||
v-model="visaType"
|
v-model="visaType"
|
||||||
option-value="value"
|
option-value="value"
|
||||||
option-label="label"
|
option-label="label"
|
||||||
:label="$t('formDialogInputVisaType')"
|
lazy-rules="ondemand"
|
||||||
class="col-md-3 col-6"
|
class="col-md-3 col-6"
|
||||||
:options="visaTypeOption"
|
:dense="dense"
|
||||||
/>
|
:readonly="readonly"
|
||||||
|
:options="visaTypeOptions"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:id="`${prefixId}-select-visa-type`"
|
||||||
|
:label="$t('formDialogInputVisaType')"
|
||||||
|
@filter="visaTypeFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<!-- :rules="[
|
<!-- :rules="[
|
||||||
(val: string) =>
|
(val: string) =>
|
||||||
!!val || $t('selectValidate') + $t('formDialogInputVisaType'),
|
!!val || $t('selectValidate') + $t('formDialogInputVisaType'),
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,23 @@ import { onMounted, ref } from 'vue';
|
||||||
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
import { dateFormat, parseAndFormatDate } from 'src/utils/datetime';
|
||||||
import { EmployeeWorkCreate } from 'src/stores/employee/types';
|
import { EmployeeWorkCreate } from 'src/stores/employee/types';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
|
import { selectFilterOptionRefMod } from 'src/stores/utils';
|
||||||
|
|
||||||
const { locale } = useI18n();
|
const { locale } = useI18n();
|
||||||
|
|
||||||
const employeeWork = defineModel<EmployeeWorkCreate[]>('employeeWork');
|
const employeeWork = defineModel<EmployeeWorkCreate[]>('employeeWork');
|
||||||
const positionNameOption =
|
const positionNameOption = defineModel<{ label: string; value: string }[]>(
|
||||||
defineModel<{ label: string; value: string }[]>('positionNameOption');
|
'positionNameOption',
|
||||||
const jobTypeOption =
|
{ required: true },
|
||||||
defineModel<{ label: string; value: string }[]>('jobTypeOption');
|
);
|
||||||
const workplaceOption =
|
const jobTypeOption = defineModel<{ label: string; value: string }[]>(
|
||||||
defineModel<{ label: string; value: string }[]>('workplaceOption');
|
'jobTypeOption',
|
||||||
|
{ required: true },
|
||||||
|
);
|
||||||
|
const workplaceOption = defineModel<{ label: string; value: string }[]>(
|
||||||
|
'workplaceOption',
|
||||||
|
{ required: true },
|
||||||
|
);
|
||||||
|
|
||||||
const tab = ref();
|
const tab = ref();
|
||||||
|
|
||||||
|
|
@ -54,6 +61,27 @@ function removeData(index: number) {
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
tab.value = 'tab0';
|
tab.value = 'tab0';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const positionNameOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const positionNameFilter = selectFilterOptionRefMod(
|
||||||
|
positionNameOption,
|
||||||
|
positionNameOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const jobTypeOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const jobTypeFilter = selectFilterOptionRefMod(
|
||||||
|
jobTypeOption,
|
||||||
|
jobTypeOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
|
|
||||||
|
const workplaceOptions = ref<Record<string, unknown>[]>([]);
|
||||||
|
const workplaceFilter = selectFilterOptionRefMod(
|
||||||
|
workplaceOption,
|
||||||
|
workplaceOptions,
|
||||||
|
'label',
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
@ -130,56 +158,98 @@ onMounted(async () => {
|
||||||
v-model="work.ownerName"
|
v-model="work.ownerName"
|
||||||
/>
|
/>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-position-name`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-6"
|
||||||
|
input-debounce="0"
|
||||||
|
option-value="value"
|
||||||
|
option-label="label"
|
||||||
|
lazy-rules="ondemand"
|
||||||
v-model="work.positionName"
|
v-model="work.positionName"
|
||||||
option-value="value"
|
:dense="dense"
|
||||||
option-label="label"
|
:readonly="readonly"
|
||||||
|
:options="positionNameOptions"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:id="`${prefixId}-select-position-name`"
|
||||||
:label="$t('formDialogInputJobPosition')"
|
:label="$t('formDialogInputJobPosition')"
|
||||||
class="col-6"
|
@filter="positionNameFilter"
|
||||||
:options="positionNameOption"
|
>
|
||||||
/>
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<q-select
|
<q-select
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-job-type`"
|
|
||||||
:dense="dense"
|
|
||||||
:readonly="readonly"
|
|
||||||
outlined
|
outlined
|
||||||
:hide-dropdown-icon="readonly"
|
clearable
|
||||||
hide-bottom-space
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
|
hide-selected
|
||||||
|
hide-bottom-space
|
||||||
|
class="col-6"
|
||||||
|
input-debounce="0"
|
||||||
|
option-label="label"
|
||||||
|
option-value="value"
|
||||||
|
lazy-rules="ondemand"
|
||||||
v-model="work.jobType"
|
v-model="work.jobType"
|
||||||
option-value="value"
|
|
||||||
option-label="label"
|
|
||||||
:label="$t('formDialogInputJobType')"
|
|
||||||
class="col-6"
|
|
||||||
:options="jobTypeOption"
|
|
||||||
/>
|
|
||||||
<q-select
|
|
||||||
lazy-rules="ondemand"
|
|
||||||
:id="`${prefixId}-select-province`"
|
|
||||||
:dense="dense"
|
:dense="dense"
|
||||||
:readonly="readonly"
|
:readonly="readonly"
|
||||||
outlined
|
:options="jobTypeOptions"
|
||||||
:hide-dropdown-icon="readonly"
|
:hide-dropdown-icon="readonly"
|
||||||
hide-bottom-space
|
:id="`${prefixId}-select-job-type`"
|
||||||
|
:label="$t('formDialogInputJobType')"
|
||||||
|
@filter="jobTypeFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
<q-select
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
use-input
|
||||||
|
fill-input
|
||||||
emit-value
|
emit-value
|
||||||
map-options
|
map-options
|
||||||
v-model="work.workplace"
|
hide-selected
|
||||||
option-value="value"
|
hide-bottom-space
|
||||||
option-label="label"
|
|
||||||
:label="$t('formDialogInputWorkPlace')"
|
|
||||||
class="col-6"
|
class="col-6"
|
||||||
:options="workplaceOption"
|
input-debounce="0"
|
||||||
/>
|
lazy-rules="ondemand"
|
||||||
|
option-label="label"
|
||||||
|
option-value="value"
|
||||||
|
v-model="work.workplace"
|
||||||
|
:dense="dense"
|
||||||
|
:readonly="readonly"
|
||||||
|
:options="workplaceOptions"
|
||||||
|
:hide-dropdown-icon="readonly"
|
||||||
|
:id="`${prefixId}-select-province`"
|
||||||
|
:label="$t('formDialogInputWorkPlace')"
|
||||||
|
@filter="workplaceFilter"
|
||||||
|
>
|
||||||
|
<template v-slot:no-option>
|
||||||
|
<q-item>
|
||||||
|
<q-item-section class="text-grey">
|
||||||
|
{{ $t('noResults') }}
|
||||||
|
</q-item-section>
|
||||||
|
</q-item>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
<q-input
|
<q-input
|
||||||
lazy-rules="ondemand"
|
lazy-rules="ondemand"
|
||||||
:for="`${prefixId}-input-work-end-date`"
|
:for="`${prefixId}-input-work-end-date`"
|
||||||
|
|
|
||||||
|
|
@ -3006,7 +3006,7 @@ watch(isMainPage, () => {
|
||||||
separator
|
separator
|
||||||
prefix-id="form-dialog"
|
prefix-id="form-dialog"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
:options-branch="branchOption"
|
v-model:options-branch="branchOption"
|
||||||
v-model:registered-branch-id="formData.registeredBranchId"
|
v-model:registered-branch-id="formData.registeredBranchId"
|
||||||
v-model:customer-name="formData.customerName"
|
v-model:customer-name="formData.customerName"
|
||||||
v-model:customer-name-en="formData.customerNameEN"
|
v-model:customer-name-en="formData.customerNameEN"
|
||||||
|
|
@ -3635,7 +3635,7 @@ watch(isMainPage, () => {
|
||||||
separator
|
separator
|
||||||
:readonly="!infoDrawerEdit"
|
:readonly="!infoDrawerEdit"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
:options-branch="branchOption"
|
v-model:options-branch="branchOption"
|
||||||
v-model:registered-branch-id="formData.registeredBranchId"
|
v-model:registered-branch-id="formData.registeredBranchId"
|
||||||
v-model:customer-name="formData.customerName"
|
v-model:customer-name="formData.customerName"
|
||||||
v-model:customer-name-en="formData.customerNameEN"
|
v-model:customer-name-en="formData.customerNameEN"
|
||||||
|
|
@ -3866,7 +3866,7 @@ watch(isMainPage, () => {
|
||||||
separator
|
separator
|
||||||
:readonly="true"
|
:readonly="true"
|
||||||
:type-customer="customerType"
|
:type-customer="customerType"
|
||||||
:options-branch="branchOption"
|
v-model:options-branch="branchOption"
|
||||||
v-model:registered-branch-id="formData.registeredBranchId"
|
v-model:registered-branch-id="formData.registeredBranchId"
|
||||||
v-model:customer-name="formData.customerName"
|
v-model:customer-name="formData.customerName"
|
||||||
v-model:customer-name-en="formData.customerNameEN"
|
v-model:customer-name-en="formData.customerNameEN"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue