refactor(ui): unify selects via SearchableSelect (session form + contracts)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -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() {
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 10, alignItems: 'flex-end', padding: 14, borderRadius: 10, border: '1px solid var(--border)', background: 'var(--surface)', marginBottom: 14 }}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||
<label style={{ fontSize: 11.5, fontWeight: 600 }}>بیمه</label>
|
||||
<select className="input" style={{ minWidth: 160 }} value={insuranceId} disabled={!!editUuid} onChange={(e) => setInsuranceId(e.target.value)}>
|
||||
<option value="">انتخاب...</option>
|
||||
{(editUuid ? allInsurances : available).map((i) => (
|
||||
<option key={i.insurance_id} value={i.insurance_id}>{i.insurance_name} ({KIND_LABEL[i.type] ?? i.type})</option>
|
||||
))}
|
||||
</select>
|
||||
<div style={{ minWidth: 200 }}>
|
||||
<SearchableSelect
|
||||
options={(editUuid ? allInsurances : available).map((i) => ({ 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="انتخاب..."
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
|
||||
<label style={{ fontSize: 11.5, fontWeight: 600 }}>درصد پوشش</label>
|
||||
|
||||
Reference in New Issue
Block a user