feat(admin): finish the screens that were stopping one step short
Five places where the data existed and the screen did not use it. Booking a whole course had no button because it needs a doctor and the course does not carry one — each session can be with a different doctor. The page now asks for the doctor the same way the resource booking page does, and the button explains that it is all-or-nothing before it is pressed. A course whose package does not cover the remaining sessions is still valid — the rest is simply charged normally — but nobody was told. The course response carries package_balance and the shortfall, and the page warns. Before session six, not during it. The credit ledger already returned who recorded a row and which appointment it belonged to, and showed neither. An adjustable ledger without the name of the person who adjusted it is half an audit trail. Version history printed a JSON blob of each version's effects, which does not answer the question anyone actually has: what changed? It now diffs each version against the previous one, field by field, and says so plainly when a version changed nothing meaningful. A resource with no calendar showed "—" for utilization. Null means undefined, not zero, and the next step is always the same: set up the calendar. It is a link now. The report range also accepts a custom from/to, kept in the URL like the rest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { BeakerIcon } from '@heroicons/react/24/outline';
|
||||
import PageHeader from '../components/ui/PageHeader';
|
||||
import ConfirmDialog from '../components/ui/ConfirmDialog';
|
||||
import DataTable, { type Column } from '../components/ui/DataTable';
|
||||
import PolicyVersionDiff from '../components/PolicyVersionDiff';
|
||||
import { formatDate } from '../lib/utils';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
import { usePolicies, usePolicy, usePolicySimulation } from '../hooks/usePolicies';
|
||||
@@ -163,20 +164,7 @@ export default function PolicySimulationPage() {
|
||||
/>
|
||||
|
||||
{policy?.versions && policy.versions.length > 1 && (
|
||||
<div className="card" style={{ marginBottom: 16 }}>
|
||||
<h3 style={{ fontSize: 14, margin: '0 0 10px' }}>تاریخچهٔ نسخهها</h3>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: 6 }}>
|
||||
{policy.versions.map((v) => (
|
||||
<div key={v.version} style={{ display: 'flex', gap: 10, fontSize: 12 }}>
|
||||
<span style={{ fontWeight: 600, minWidth: 60 }}>نسخهٔ {v.version}</span>
|
||||
<span style={{ color: 'var(--text-3)' }}>{formatDate(v.created_at)}</span>
|
||||
<span style={{ color: 'var(--text-2)' }}>
|
||||
{JSON.stringify((v.snapshot as { effects?: unknown }).effects)}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<PolicyVersionDiff versions={policy.versions as never} />
|
||||
)}
|
||||
|
||||
<div style={{ overflowX: 'auto' }}>
|
||||
|
||||
Reference in New Issue
Block a user