fix(discount): correct edit-form data + calendar clipping + input styling

- List endpoint returned camelCase keys (getArrayResult) so the edit modal
  read empty discount_type/target_*; return toArray() (snake_case) instead.
- Portal the Persian date-picker calendar to body (fixed) so it no longer
  renders under the modal's overflow-scroll body.
- Style the PriceInput/number fields with cp-input in the rule modal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
hamed
2026-07-17 12:37:43 +03:30
co-authored by Claude Fable 5
parent 809ad11680
commit 204c7debe1
4 changed files with 35 additions and 17 deletions
+3 -3
View File
@@ -239,8 +239,8 @@ function RuleModal({ initial, onClose, onSaved }: { initial: DiscountRule | null
<div>
<label style={labelStyle()}>{f.discount_type === 'percent' ? 'درصد تخفیف (۰ تا ۱۰۰)' : 'مبلغ تخفیف (تومان)'}</label>
{f.discount_type === 'percent'
? <input className="cp-input" type="number" inputMode="numeric" min={0} max={100} value={f.value} onChange={(e) => set('value', Number(e.target.value) || 0)} />
: <PriceInput value={f.value} onChange={(v) => set('value', v)} />}
? <input className="cp-input" style={{ width: '100%' }} type="number" inputMode="numeric" min={0} max={100} value={f.value} onChange={(e) => set('value', Number(e.target.value) || 0)} />
: <PriceInput className="cp-input" style={{ width: '100%' }} value={f.value} onChange={(v) => set('value', v)} />}
</div>
<div>
<label style={labelStyle()}>اولویت (بزرگتر = مهمتر)</label>
@@ -262,7 +262,7 @@ function RuleModal({ initial, onClose, onSaved }: { initial: DiscountRule | null
{f.type === 'invoice_amount' && (
<div>
<label style={labelStyle()}>حداقل مبلغ فاکتور (تومان)</label>
<PriceInput value={f.min_amount_toman} onChange={(v) => set('min_amount_toman', v)} />
<PriceInput className="cp-input" style={{ width: '100%' }} value={f.min_amount_toman} onChange={(v) => set('min_amount_toman', v)} />
</div>
)}
{f.type === 'specific_patient' && (