diff --git a/src/components/01_branch-management/FormBranchInformation.vue b/src/components/01_branch-management/FormBranchInformation.vue index a4041333..5a90d3f7 100644 --- a/src/components/01_branch-management/FormBranchInformation.vue +++ b/src/components/01_branch-management/FormBranchInformation.vue @@ -159,6 +159,42 @@ function formatCode(input: string | undefined, type: 'code' | 'number') { ]" for="input-name-en" /> + + + +
diff --git a/src/components/02_personnel-management/FormByType.vue b/src/components/02_personnel-management/FormByType.vue index d1709858..ec3619a1 100644 --- a/src/components/02_personnel-management/FormByType.vue +++ b/src/components/02_personnel-management/FormByType.vue @@ -262,7 +262,7 @@ function deleteFile(name: string) {
(); defineEmits<{ @@ -118,16 +117,12 @@ defineEmits<{
-import { ref } from 'vue'; -import { useI18n } from 'vue-i18n'; import SelectInput from '../shared/SelectInput.vue'; import useOptionStore from 'src/stores/options'; -import { Icon } from '@iconify/vue/dist/iconify.js'; -import { useInstitution } from 'src/stores/institution'; const optionStore = useOptionStore(); @@ -14,11 +10,6 @@ defineProps<{ readonly?: boolean; onDrawer?: boolean; }>(); -const emit = defineEmits<{ - (e: 'deleteAttachment', name: string): void; -}>(); - -const attachmentRef = ref(); const group = defineModel('group', { default: '' }); const name = defineModel('name', { default: '' }); @@ -26,19 +17,8 @@ const nameEn = defineModel('nameEn', { default: '' }); const contactName = defineModel('contactName', { default: '' }); const email = defineModel('email', { default: '' }); const contactTel = defineModel('contactTel', { default: '' }); -const attachment = defineModel('attachment'); -const attachmentList = - defineModel<{ name: string; url: string }[]>('attachmentList'); type Options = { label: string; value: string }; - -function openNewTab(url: string) { - window.open(url, '_blank'); -} - -function deleteAttachment(name: string) { - emit('deleteAttachment', name); -} - - - - - - -
- - - -
-
- {{ item.name }} -
- -
-
-
-
-
diff --git a/src/components/form/AddressForm.vue b/src/components/form/AddressForm.vue index 83440005..cbdb0819 100644 --- a/src/components/form/AddressForm.vue +++ b/src/components/form/AddressForm.vue @@ -12,7 +12,7 @@ import { formatAddress } from 'src/utils/address'; import useOptionStore from 'stores/options'; const optionStore = useOptionStore(); -const props = defineProps<{ +defineProps<{ title?: string; addressTitle?: string; addressTitleEN?: string; @@ -30,7 +30,6 @@ const props = defineProps<{ useEmployment?: boolean; useWorkPlace?: boolean; - useForeignAddress?: boolean; }>(); const addressStore = useAddressStore(); @@ -58,25 +57,6 @@ const subDistrictId = defineModel('subDistrictId'); const zipCode = defineModel('zipCode'); const sameWithEmployer = defineModel('sameWithEmployer'); -const provinceTextEN = defineModel( - 'provinceTextEn', - { - default: '', - }, -); -const districtTextEN = defineModel( - 'districtTextEn', - { - default: '', - }, -); -const subDistrictTextEN = defineModel( - 'subDistrictTextEn', - { - default: '', - }, -); - const homeCode = defineModel('homeCode'); const employmentOffice = defineModel( 'employmentOffice', @@ -84,7 +64,6 @@ const employmentOffice = defineModel( const employmentOfficeEN = defineModel( 'employmentOfficeEn', ); -const addressForeign = defineModel('addressForeign'); const addrOptions = reactive<{ provinceOps: Province[]; @@ -99,18 +78,14 @@ const addrOptions = reactive<{ const area = ref([]); const fullAddress = computed(() => { - const province = addressForeign.value - ? { id: '1', name: provinceId.value } - : provinceOptions.value.find((v) => v.id === provinceId.value); - const district = addressForeign.value - ? { id: '1', name: districtId.value } - : districtOptions.value.find((v) => v.id === districtId.value); - const sDistrict = addressForeign.value - ? { id: '1', name: subDistrictId.value } - : subDistrictOptions.value.find((v) => v.id === subDistrictId.value); + const province = provinceOptions.value.find((v) => v.id === provinceId.value); + const district = districtOptions.value.find((v) => v.id === districtId.value); + const sDistrict = subDistrictOptions.value.find( + (v) => v.id === subDistrictId.value, + ); - if (province?.name && district?.name && sDistrict?.name) { - const fullAddressText = formatAddress({ + if (province && district && sDistrict) { + const fullAddress = formatAddress({ address: address.value, addressEN: addressEN.value, moo: moo.value ? moo.value : '', @@ -122,26 +97,21 @@ const fullAddress = computed(() => { province: province as unknown as Province, district: district as unknown as District, subDistrict: sDistrict as unknown as SubDistrict, - zipCode: addressForeign.value ? zipCode.value || ' ' : undefined, }); - return fullAddressText; + return fullAddress; } return '-'; }); const fullAddressEN = computed(() => { - const province = addressForeign.value - ? { nameEN: provinceTextEN.value } - : provinceOptions.value.find((v) => v.id === provinceId.value); - const district = addressForeign.value - ? { nameEN: districtTextEN.value } - : districtOptions.value.find((v) => v.id === districtId.value); - const sDistrict = addressForeign.value - ? { nameEN: subDistrictTextEN.value } - : subDistrictOptions.value.find((v) => v.id === subDistrictId.value); + const province = provinceOptions.value.find((v) => v.id === provinceId.value); + const district = districtOptions.value.find((v) => v.id === districtId.value); + const sDistrict = subDistrictOptions.value.find( + (v) => v.id === subDistrictId.value, + ); - if (province?.nameEN && district?.nameEN && sDistrict?.nameEN) { - const fullAddressText = formatAddress({ + if (province && district && sDistrict) { + const fullAddress = formatAddress({ address: address.value, addressEN: addressEN.value, moo: moo.value ? moo.value : '', @@ -154,9 +124,8 @@ const fullAddressEN = computed(() => { district: district as unknown as District, subDistrict: sDistrict as unknown as SubDistrict, en: true, - zipCode: addressForeign.value ? zipCode.value || ' ' : undefined, }); - return fullAddressText; + return fullAddress; } return '-'; }); @@ -180,7 +149,7 @@ async function fetchProvince() { } async function fetchDistrict() { - if (!provinceId.value || addressForeign.value) return; + if (!provinceId.value) return; const result = await addressStore.fetchDistrictByProvinceId(provinceId.value); if (result) addrOptions.districtOps = result; @@ -199,7 +168,7 @@ async function fetchDistrict() { } async function fetchSubDistrict() { - if (!districtId.value || addressForeign.value) return; + if (!districtId.value) return; const result = await addressStore.fetchSubDistrictByProvinceId( districtId.value, ); @@ -286,16 +255,6 @@ onMounted(async () => { await fetchSubDistrict(); }); -function clearAddress() { - provinceId.value = null; - districtId.value = null; - subDistrictId.value = null; - provinceTextEN.value = null; - districtTextEN.value = null; - subDistrictTextEN.value = null; - zipCode.value = null; -} - watch(provinceId, fetchDistrict); watch(districtId, fetchSubDistrict); @@ -354,15 +313,6 @@ watchEffect(async () => { {{ $t('customerEmployee.form.addressCustom') }} - -
- - {{ $t('personnel.form.addressForeign') }} -
@@ -499,24 +449,7 @@ watchEffect(async () => { (v) => (typeof v === 'string' ? (street = v) : '') " /> - { - { - - { { (v) => (typeof v === 'string' ? (streetEN = v) : '') " /> - { - - { - - {