diff --git a/src/components/01_branch-management/FormBranchInformation.vue b/src/components/01_branch-management/FormBranchInformation.vue index 5a90d3f7..a4041333 100644 --- a/src/components/01_branch-management/FormBranchInformation.vue +++ b/src/components/01_branch-management/FormBranchInformation.vue @@ -159,42 +159,6 @@ function formatCode(input: string | undefined, type: 'code' | 'number') { ]" for="input-name-en" /> - - - -
diff --git a/src/components/shared/select/select.ts b/src/components/shared/select/select.ts index 08fd88b2..cf1555cb 100644 --- a/src/components/shared/select/select.ts +++ b/src/components/shared/select/select.ts @@ -35,7 +35,13 @@ export const createSelect = >( let previousSearch = ''; watch(value, (v) => { - if (!v || (cache && cache.find((opt) => opt[valueField] === v))) return; + if (!v) return; + + if (cache && cache.find((opt) => opt[valueField] === v)) { + valueOption.value = cache.find((opt) => opt[valueField] === v); + return; + } + getSelectedOption(); }); @@ -63,7 +69,15 @@ export const createSelect = >( const currentValue = value.value; if (!currentValue) return; - if (selectOptions.value.find((v) => v[valueField] === currentValue)) return; + + const option = selectOptions.value.find( + (v) => v[valueField] === currentValue, + ); + + if (option) { + valueOption.value = option; + return; + } if (valueOption.value && valueOption.value[valueField] === currentValue) { return selectOptions.value.unshift(valueOption.value); } diff --git a/src/i18n/tha.ts b/src/i18n/tha.ts index cfc68f19..0558bd78 100644 --- a/src/i18n/tha.ts +++ b/src/i18n/tha.ts @@ -799,7 +799,7 @@ export default { branch: 'สาขาที่ออกใบเสนอราคา', branchVirtual: 'จุดรับบริการที่ออกใบเสนอราคา', customer: 'ลูกค้า', - newCustomer: 'ลูกค้าใหม่', + newCustomer: 'แรงงานใหม่', employeeList: 'รายชื่อแรงงาน', employee: 'แรงงาน', employeeName: 'ชื่อ-นามสกุล แรงงาน', diff --git a/src/pages/05_quotation/QuotationFormProductSelect.vue b/src/pages/05_quotation/QuotationFormProductSelect.vue index 39be19e7..b2e92761 100644 --- a/src/pages/05_quotation/QuotationFormProductSelect.vue +++ b/src/pages/05_quotation/QuotationFormProductSelect.vue @@ -51,6 +51,8 @@ const emit = defineEmits<{ const selectedProductGroup = defineModel('selectedProductGroup', { default: '', }); + +const selectedProductGroupOption = ref(); const model = defineModel(); const inputSearch = defineModel('inputSearch'); const productGroup = defineModel('productGroup', { @@ -569,14 +571,18 @@ watch( {{ productGroup.find( (g) => g.id === selectedProductGroup, - )?.name || '-' + )?.name || + selectedProductGroupOption?.name || + '-' }} {{ productGroup.find( (g) => g.id === selectedProductGroup, - )?.code || '-' + )?.code || + selectedProductGroupOption?.code || + '-' }}
@@ -862,13 +868,13 @@ watch( {{ $t('productService.group.title') }} - ({ + ...(responsiblePerson(props.row.quotation)?.user.map((v) => ({ name: $i18n.locale === 'eng' ? `${v.firstNameEN} ${v.lastNameEN}` @@ -324,11 +324,11 @@ function handleCheckAll() { ? `/no-img-man.png` : `/no-img-female.png` : `${baseUrl}/user/${v.id}/profile-image/${v.selectedImage}`, - })), - ...responsiblePerson(props.row.quotation).group.map((g) => ({ + })) || []), + ...(responsiblePerson(props.row.quotation)?.group.map((g) => ({ name: `${$t('general.group')} ${g.group}`, imgUrl: '/img-group.png', - })), + })) || []), ]" > diff --git a/src/pages/12_debit-note/FormPage.vue b/src/pages/12_debit-note/FormPage.vue index 0b6b1870..143d9f9b 100644 --- a/src/pages/12_debit-note/FormPage.vue +++ b/src/pages/12_debit-note/FormPage.vue @@ -386,7 +386,7 @@ async function assignFormData(id: string) { selectedProductGroup.value = data.productServiceList[0]?.product.productGroup?.id || ''; - ((previousValue = { + (previousValue = { id: data.id || undefined, debitNoteQuotationId: data.debitNoteQuotationId || undefined, productServiceList: structuredClone( @@ -412,7 +412,7 @@ async function assignFormData(id: string) { quotationId: data.debitNoteQuotationId, remark: data.remark || undefined, }), - (currentFormData.value = structuredClone(previousValue))); + (currentFormData.value = structuredClone(previousValue)); assignProductServiceList(); assignSelectedWorker(); @@ -1046,7 +1046,11 @@ async function submitAccepted() { :status-active="i.active?.()" :status-done="i.status === 'done'" :status-waiting="i.status === 'waiting'" - @click="i.handler()" + @click=" + () => { + if (pageState.mode !== 'create') i.handler(); + } + " />