feat(claims): replace PersianDateInput with PersianDatePicker and add quick date range buttons
This commit is contained in:
@@ -7,9 +7,16 @@ import { formatRial, formatNumber, formatDate } from '../lib/utils';
|
||||
import PageHeader from '../components/ui/PageHeader';
|
||||
import Modal from '../components/ui/Modal';
|
||||
import SearchableSelect from '../components/ui/SearchableSelect';
|
||||
import PersianDateInput from '../components/ui/PersianDateInput';
|
||||
import PersianDatePicker from '../components/ui/PersianDatePicker';
|
||||
import FeatureGate from '../components/ui/FeatureGate';
|
||||
|
||||
const isoNDaysAgo = (days: number): string => {
|
||||
const d = new Date();
|
||||
d.setDate(d.getDate() - days);
|
||||
return d.toISOString().slice(0, 10);
|
||||
};
|
||||
const todayIso = (): string => new Date().toISOString().slice(0, 10);
|
||||
|
||||
const toUnix = (iso: string): number | null => {
|
||||
if (!iso) return null;
|
||||
const t = new Date(iso + 'T00:00:00').getTime();
|
||||
@@ -188,11 +195,29 @@ export default function ClaimsPage() {
|
||||
</div>
|
||||
<div>
|
||||
<label className="field-label">از تاریخ</label>
|
||||
<PersianDateInput value={fromDate} onChange={setFromDate} placeholder="از تاریخ" />
|
||||
<PersianDatePicker value={fromDate} onChange={setFromDate} placeholder="از تاریخ" />
|
||||
</div>
|
||||
<div>
|
||||
<label className="field-label">تا تاریخ</label>
|
||||
<PersianDateInput value={toDate} onChange={setToDate} placeholder="تا تاریخ" />
|
||||
<PersianDatePicker value={toDate} onChange={setToDate} placeholder="تا تاریخ" />
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: 6, alignItems: 'flex-end', paddingBottom: 1 }}>
|
||||
<button
|
||||
type="button"
|
||||
className="btn sm"
|
||||
onClick={() => { setFromDate(isoNDaysAgo(365)); setToDate(todayIso()); }}
|
||||
title="از یک سال پیش تا امروز"
|
||||
>
|
||||
یک سال اخیر
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn sm"
|
||||
onClick={() => { setFromDate(isoNDaysAgo(30)); setToDate(todayIso()); }}
|
||||
title="از یک ماه پیش تا امروز"
|
||||
>
|
||||
یک ماه اخیر
|
||||
</button>
|
||||
</div>
|
||||
<div style={{ flex: 1, minWidth: 200 }}>
|
||||
<label className="field-label">جستجوی بیمار (نام / موبایل / کدملی)</label>
|
||||
|
||||
Reference in New Issue
Block a user