From 7930d59359c684c65fb42a345135678d4b6afd4b Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 17 Jul 2026 17:24:19 +0700 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E7=90=86=E6=89=8B=E5=B7=A5=E5=BC=80?= =?UTF-8?q?=E7=A5=A8=E9=A1=B5=E9=9D=A2=E5=86=97=E4=BD=99=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/i18n/locales/en-US.ts | 1 + client/src/i18n/locales/th-TH.ts | 1 + client/src/i18n/locales/zh-CN.ts | 1 + client/src/tests/manualInvoiceView.spec.ts | 26 ++++-- .../ReservationManualInvoiceView.vue | 84 +++---------------- 5 files changed, 31 insertions(+), 82 deletions(-) diff --git a/client/src/i18n/locales/en-US.ts b/client/src/i18n/locales/en-US.ts index 6676f0c..fad1f80 100644 --- a/client/src/i18n/locales/en-US.ts +++ b/client/src/i18n/locales/en-US.ts @@ -295,6 +295,7 @@ export default { total: 'Total', addCharge: 'Add row', removeCharge: 'Remove', + chargeLineLabel: 'Row {index}', removeChargeLineAria: 'Remove row {index}', maxChargesReached: 'V1 supports up to 10 charge lines.', previewDisclaimer: 'The frontend only previews amounts. Backend totals are authoritative.', diff --git a/client/src/i18n/locales/th-TH.ts b/client/src/i18n/locales/th-TH.ts index 6bc048b..24bebef 100644 --- a/client/src/i18n/locales/th-TH.ts +++ b/client/src/i18n/locales/th-TH.ts @@ -295,6 +295,7 @@ export default { total: 'Total', addCharge: 'เพิ่มแถว', removeCharge: 'ลบ', + chargeLineLabel: 'แถวที่ {index}', removeChargeLineAria: 'ลบแถวที่ {index}', maxChargesReached: 'V1 รองรับได้สูงสุด 10 รายการค่าใช้จ่าย', previewDisclaimer: 'ยอดนี้เป็นเพียงตัวอย่าง ยอดสุดท้ายให้ยึด totals จากหลังบ้าน', diff --git a/client/src/i18n/locales/zh-CN.ts b/client/src/i18n/locales/zh-CN.ts index a0fc2f7..cb15082 100644 --- a/client/src/i18n/locales/zh-CN.ts +++ b/client/src/i18n/locales/zh-CN.ts @@ -295,6 +295,7 @@ export default { total: 'Total', addCharge: '新增一行', removeCharge: '删除', + chargeLineLabel: '第 {index} 行', removeChargeLineAria: '删除第 {index} 行', maxChargesReached: '第一版最多支持 10 条费用明细。', previewDisclaimer: '前端仅做金额预览,最终金额以后端返回 totals 为准。', diff --git a/client/src/tests/manualInvoiceView.spec.ts b/client/src/tests/manualInvoiceView.spec.ts index 68160ce..3def374 100644 --- a/client/src/tests/manualInvoiceView.spec.ts +++ b/client/src/tests/manualInvoiceView.spec.ts @@ -258,16 +258,31 @@ describe('ReservationManualInvoiceView', () => { expect((wrapper.find('[data-testid="booking-room-rate-note"]').element as HTMLInputElement).placeholder).toBe( 'e.g. including BF', ) + expect(wrapper.find('.control-caption').exists()).toBe(false) expect(wrapper.find('[data-testid="manual-invoice-add-charge"]').text()).toContain('Add row') expect(wrapper.find('[data-testid="manual-invoice-submit"]').text()).toContain('Confirm and generate PDF') + expect(wrapper.text()).toContain('Row 1') + expect(wrapper.text()).not.toContain('第 1 行') await wrapper.find('[data-testid="manual-invoice-add-charge"]').trigger('click') expect(wrapper.findAll('.remove-button')[1]?.text()).toContain('Remove') expect(wrapper.findAll('.remove-button')[1]?.attributes('aria-label')).toBe('Remove row 2') + expect(wrapper.text()).toContain('Row 2') expect(wrapper.text()).not.toContain('新增一行') expect(wrapper.text()).not.toContain('确认并生成 PDF') expect(wrapper.text()).not.toContain('例如 includingBF') + expect(wrapper.text()).not.toContain('金额') + expect(wrapper.text()).not.toContain('说明') + }) + + it('passes current locale to native date inputs', () => { + const wrapper = mountView({ locale: 'th-TH' }) + + expect(wrapper.find('[data-testid="document-booking-date"]').attributes('lang')).toBe('th-TH') + expect(wrapper.find('[data-testid="booking-arrival-date"]').attributes('lang')).toBe('th-TH') + expect(wrapper.find('[data-testid="booking-departure-date"]').attributes('lang')).toBe('th-TH') + expect(wrapper.find('[data-testid="document-due-date"]').attributes('lang')).toBe('th-TH') }) it('marks required fields and highlights empty inputs after submit', async () => { @@ -326,16 +341,11 @@ describe('ReservationManualInvoiceView', () => { ) }) - it('shows final-format date previews like the invoice prototype', async () => { + it('does not render final-format date preview blocks', () => { const wrapper = mountView() - await wrapper.find('[data-testid="booking-arrival-date"]').setValue('2026-08-02') - await wrapper.find('[data-testid="booking-departure-date"]').setValue('2026-08-05') - await wrapper.find('[data-testid="document-due-date"]').setValue('2026-07-22') - - expect(wrapper.find('[data-testid="arrival-date-preview"]').text()).toContain('02/08/2026') - expect(wrapper.find('[data-testid="departure-date-preview"]').text()).toContain('05/08/2026') - expect(wrapper.find('[data-testid="due-date-preview"]').text()).toContain('22/07/2026') + expect(wrapper.find('.date-preview').exists()).toBe(false) + expect(wrapper.text()).not.toContain('最终格式') }) it('keeps primary reservation controls bound to the first charge line', async () => { diff --git a/client/src/views/reservation/ReservationManualInvoiceView.vue b/client/src/views/reservation/ReservationManualInvoiceView.vue index 36db2bd..593568d 100644 --- a/client/src/views/reservation/ReservationManualInvoiceView.vue +++ b/client/src/views/reservation/ReservationManualInvoiceView.vue @@ -206,18 +206,12 @@ v-model="form.document.booking_date" data-testid="document-booking-date" type="date" + :lang="locale" :class="validationClass('booking-date')" v-bind="validationAria('booking-date')" required @input="markDocumentDatesEdited" > - - 最终格式 - {{ formatDatePreview(form.document.booking_date) }} -

- - 最终格式 - {{ formatDatePreview(form.booking.arrival_date) }} -

- - 最终格式 - {{ formatDatePreview(form.booking.departure_date) }} -

- - 最终格式 - {{ formatDatePreview(form.document.due_date) }} -