From 0bc1b4a2e97bc40dec55dfd06546411293277155 Mon Sep 17 00:00:00 2001 From: hamed <15238-genius.ha@users.noreply.drupalcode.org> Date: Tue, 23 Jun 2026 21:00:19 +0330 Subject: [PATCH] refactor(ui): unify selects via SearchableSelect (session form + contracts) Co-Authored-By: Claude Opus 4.8 --- .../components/TenantInsuranceContracts.tsx | 16 ++++++++++------ assets/admin/pages/NewSessionPage.tsx | 19 ++++++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/assets/admin/components/TenantInsuranceContracts.tsx b/assets/admin/components/TenantInsuranceContracts.tsx index 64c48409..cb7b0989 100644 --- a/assets/admin/components/TenantInsuranceContracts.tsx +++ b/assets/admin/components/TenantInsuranceContracts.tsx @@ -4,6 +4,7 @@ import { TrashIcon, PlusIcon, PencilIcon } from '@heroicons/react/24/outline'; import { toast } from 'sonner'; import { api } from '../lib/api'; import { formatRial } from '../lib/utils'; +import SearchableSelect from './ui/SearchableSelect'; interface Contract { uuid: string; @@ -129,12 +130,15 @@ export default function TenantInsuranceContracts() {
- +
+ ({ value: String(i.insurance_id), label: `${i.insurance_name} (${KIND_LABEL[i.type] ?? i.type})` }))} + value={insuranceId} + onChange={(v) => setInsuranceId(v ? String(v) : '')} + isDisabled={!!editUuid} + placeholder="انتخاب..." + /> +
diff --git a/assets/admin/pages/NewSessionPage.tsx b/assets/admin/pages/NewSessionPage.tsx index 0ee82b62..92f5c219 100644 --- a/assets/admin/pages/NewSessionPage.tsx +++ b/assets/admin/pages/NewSessionPage.tsx @@ -159,17 +159,11 @@ export default function NewSessionPage() {
- + applyBase(v ? String(v) : '')} placeholder="بدون بیمه پایه" isClearable />
- + applySupp(v ? String(v) : '')} placeholder="بدون بیمه تکمیلی" isClearable />
@@ -221,9 +215,12 @@ export default function NewSessionPage() {

پرداخت و یادداشت

- + ({ value: v, label: l }))} + value={form.watch('payment_method')} + onChange={v => form.setValue('payment_method', (v as FormData['payment_method']) || 'cash')} + placeholder="روش پرداخت" + />