feat: one piece per variant and optional admin rial wage

A customer cart line is a single piece, the home reel opens on tap, and a variant can be saved without a rial wage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
mahmood
2026-11-26 19:11:09 +03:30
co-authored by Cursor
parent 3e9f532c6c
commit 3800d2d50e
13 changed files with 158 additions and 250 deletions
@@ -7,7 +7,7 @@
:aria-label="mode === 'create' ? 'افزودن تنوع جدید' : 'ویرایش تنوع'"
@keydown="onKeydown"
>
<!-- required: what every weight variant needs -->
<!-- weight and percent wage are required; rial wage may be left empty -->
<div class="vre__primary">
<a-form-item
class="vre__item"
@@ -51,7 +51,6 @@
<a-form-item
class="vre__item"
label="اجرت ریالی"
required
:validate-status="errors.rial_pay ? 'error' : ''"
:help="errors.rial_pay"
>
@@ -61,7 +60,7 @@
:min="0"
:step="50000"
addon-after="ریال"
placeholder="نداشت: صفر"
placeholder="اختیاری"
:formatter="formatThousands"
:parser="parseThousands"
/>
@@ -111,7 +111,7 @@ export function validateVariant(v: VariantRow): VariantErrors {
else if (Number(v.grams) <= 0) e.grams = 'وزن باید بیشتر از صفر باشد';
if (!isBlank(v.qty) && Number(v.qty) < 0) e.qty = 'تعداد منفی نمی‌شود';
if (isBlank(v.percentage_pay)) e.percentage_pay = 'اجرت درصدی را وارد کنید';
if (isBlank(v.rial_pay)) e.rial_pay = 'اجرت ریالی را وارد کنید؛ اگر ندارد صفر بزنید';
if (!isBlank(v.rial_pay) && Number(v.rial_pay) < 0) e.rial_pay = 'اجرت ریالی منفی نمی‌شود';
return e;
}