From c241d70c3c70a5501894227a1ad26463df2b80dc Mon Sep 17 00:00:00 2001 From: puriphatt Date: Thu, 8 Aug 2024 08:07:55 +0000 Subject: [PATCH] fix: validate hq abbreviation --- .../01_branch-management/FormBranchInformation.vue | 5 +++++ src/i18n/en-US/form-dialog.ts | 2 ++ src/i18n/th-th/form-dialog.ts | 2 ++ 3 files changed, 9 insertions(+) diff --git a/src/components/01_branch-management/FormBranchInformation.vue b/src/components/01_branch-management/FormBranchInformation.vue index c36df0b5..33003dce 100644 --- a/src/components/01_branch-management/FormBranchInformation.vue +++ b/src/components/01_branch-management/FormBranchInformation.vue @@ -58,6 +58,11 @@ function formatCode(input: string | undefined, type: 'code' | 'number') { :label="$t('formDialogHqAbbreviation')" for="input-abbreviation" :model-value="view ? formatCode(abbreviation, 'code') : abbreviation" + :rules="[ + (val) => + (val && val.length > 0 && /[a-zA-Z]+/.test(val)) || + $t('formDialogInputHqAbbreviation'), + ]" @update:model-value="(v) => (abbreviation = v as string)" />