fix: branch => branch name rules

This commit is contained in:
puriphatt 2024-12-04 11:35:40 +07:00 committed by Methapon2001
parent c4bdd18deb
commit 24a41868dd
3 changed files with 15 additions and 4 deletions

View file

@ -126,8 +126,12 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
: $t('branch.form.branchName')
"
v-model="name"
:rules="[(val) => val && val.length > 0]"
:error-message="$t('form.error.required')"
:rules="[
(val) => !!val || $t('form.error.required'),
(val) =>
/^[A-Za-z0-9ก-๙\s&.,'-]+$/.test(val) ||
$t('form.error.branchNameField'),
]"
for="input-name"
/>
<q-input
@ -145,7 +149,8 @@ function formatCode(input: string | undefined, type: 'code' | 'number') {
:rules="[
(val) => !!val || $t('form.error.required'),
(val) =>
/^[A-Za-z0-9\s.,]+$/.test(val) || $t('form.error.letterOnly'),
/^[A-Za-z0-9\s&.,'-]+$/.test(val) ||
$t('form.error.branchNameENField'),
]"
for="input-name-en"
/>