diff --git a/src/components/03_customer-management/FormEmployeePassport.vue b/src/components/03_customer-management/FormEmployeePassport.vue index 735e6624..0afe325d 100644 --- a/src/components/03_customer-management/FormEmployeePassport.vue +++ b/src/components/03_customer-management/FormEmployeePassport.vue @@ -4,7 +4,11 @@ import { selectFilterOptionRefMod } from 'src/stores/utils'; import { dateFormat, parseAndFormatDate } from 'src/utils/datetime'; import { ref } from 'vue'; import { useI18n } from 'vue-i18n'; +import useOptionStore from 'src/stores/options'; +import { watch } from 'vue'; +import { onMounted } from 'vue'; +const optionStore = useOptionStore(); const { locale } = useI18n(); const passportType = defineModel('passportType'); @@ -20,13 +24,6 @@ const passportIssuingPlace = defineModel('passportIssuingPlace'); const previousPassportReference = defineModel( 'previousPassportReference', ); -const passportTypeOption = defineModel<{ label: string; value: string }[]>( - 'passportTypeOption', - { required: true }, -); -const passportIssuingCountryOption = defineModel< - { label: string; value: string }[] ->('passportIssuingCountryOption', { required: true }); defineProps<{ title?: string; @@ -34,263 +31,297 @@ defineProps<{ outlined?: boolean; readonly?: boolean; separator?: boolean; + prefixId: string; }>(); const passportTypeOptions = ref[]>([]); -const passportTypeFilter = selectFilterOptionRefMod( - passportTypeOption, - passportTypeOptions, - 'label', -); +let passportTypeFilter: ( + value: string, + update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void, +) => void; const passportIssuingCountryOptions = ref[]>([]); -const passportIssuingCountryFilter = selectFilterOptionRefMod( - passportIssuingCountryOption, - passportIssuingCountryOptions, - 'label', +let passportIssuingCountryFilter: ( + value: string, + update: (callbackFn: () => void, afterFn?: (ref: QSelect) => void) => void, +) => void; + +onMounted(() => { + passportTypeFilter = selectFilterOptionRefMod( + ref(optionStore.globalOption.nationality), + passportTypeOptions, + 'label', + ); + passportIssuingCountryFilter = selectFilterOptionRefMod( + ref(optionStore.globalOption.nationality), + passportIssuingCountryOptions, + 'label', + ); +}); + +watch( + () => optionStore.globalOption, + () => { + passportTypeFilter = selectFilterOptionRefMod( + ref(optionStore.globalOption.nationality), + passportTypeOptions, + 'label', + ); + passportIssuingCountryFilter = selectFilterOptionRefMod( + ref(optionStore.globalOption.nationality), + passportIssuingCountryOptions, + 'label', + ); + }, ); diff --git a/src/components/03_customer-management/FormEmployeeVisa.vue b/src/components/03_customer-management/FormEmployeeVisa.vue index 79452163..525c3db9 100644 --- a/src/components/03_customer-management/FormEmployeeVisa.vue +++ b/src/components/03_customer-management/FormEmployeeVisa.vue @@ -1,4 +1,5 @@