add password in admin
This commit is contained in:
@@ -130,9 +130,18 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
function parsePrice(value: string | number): number | null {
|
||||
if (value === '' || value == null) return null;
|
||||
if (typeof value === 'number') {
|
||||
return Number.isFinite(value) && value >= 0 ? value : null;
|
||||
}
|
||||
const n = Number.parseFloat(String(value).replace(/,/g, '').trim());
|
||||
return Number.isFinite(n) && n >= 0 ? n : null;
|
||||
}
|
||||
|
||||
async function onAdd() {
|
||||
const price = Number.parseFloat(form.value.price.replace(/,/g, ''));
|
||||
if (!form.value.serviceTemplateId || !Number.isFinite(price) || price < 0) {
|
||||
const price = parsePrice(form.value.price);
|
||||
if (!form.value.serviceTemplateId || price === null) {
|
||||
error.value = 'نوع خدمت و قیمت معتبر را وارد کنید.';
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user