From b617acfc38e99a63c37144f34abfb88a7b33a73b Mon Sep 17 00:00:00 2001 From: puriphatt Date: Wed, 4 Sep 2024 14:44:41 +0700 Subject: [PATCH] refactor: hq abbrev rule --- .../01_branch-management/FormBranchInformation.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/components/01_branch-management/FormBranchInformation.vue b/src/components/01_branch-management/FormBranchInformation.vue index b0eaa08c..f13cf051 100644 --- a/src/components/01_branch-management/FormBranchInformation.vue +++ b/src/components/01_branch-management/FormBranchInformation.vue @@ -55,9 +55,12 @@ function formatCode(input: string | undefined, type: 'code' | 'number') { for="input-abbreviation" :model-value="view ? formatCode(abbreviation, 'code') : abbreviation" :rules="[ + (val) => (val && val.length > 0) || $t('form.error.required'), (val) => (val && val.length > 0 && /^[a-zA-Z]+$/.test(val)) || - $t('form.error.invalid'), + $t('form.error.invalidCustomeMessage', { + msg: $t('form.error.letterOnly'), + }), ]" @update:model-value="(v) => (abbreviation = v as string)" /> @@ -86,7 +89,7 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {