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"
/>

View file

@ -291,6 +291,9 @@ export default {
letterAndNumOnly: 'Only _ letters and number are allowed',
numOnly: 'Only number are allowed',
requireLength: 'Please enter {msg} character',
branchNameField: "Only letters, numbers, or the characters . , - ' &.",
branchNameENField:
"Only English letters, numbers, or the characters . , - ' &.",
},
warning: {
title: 'Warning {msg}',

View file

@ -290,6 +290,9 @@ export default {
letterAndNumOnly: 'โปรดใช้เฉพาะ _ ตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น',
numOnly: 'โปรดใช้เฉพาะตัวเลขเท่านั้น',
requireLength: 'กรุณากรอกให้ครบ {msg} หลัก',
branchNameField: "โปรดใช้ตัวอักษร ตัวเลข หรือ . , - ' & เท่านั้น",
branchNameENField:
"โปรดใช้ตัวอักษรภาษาอังกฤษ ตัวเลข หรือ . , - ' & เท่านั้น",
},
warning: {
title: 'แจ้งเตือน {msg}',
@ -865,7 +868,7 @@ export default {
work: {
Pending: 'รอสั่งงาน',
Ready: 'พร้อมสั่งงาน',
Waiting: 'สั่งงานเเล้วรอดำเนินการ',
Waiting: 'สั่งFเล้วรอดำเนินการ',
InProgress: 'กำลังดำเนินการ',
Validate: 'รอตรวจสอบ',
Ended: 'เสร็จสิ้น',