improvement: all confirmed suggestions implemented

This commit is contained in:
2026-09-04 17:04:48 +03:30
parent 7f92e735fb
commit 72f885d9dd
23 changed files with 1070 additions and 679 deletions

View File

@@ -53,6 +53,9 @@ interface TreatmentDetailsEditorProps {
onTreatmentTypeChange?: (nextType: string) => void;
/** Arch-level jobs count as work for the missing-teeth lab banner. */
hasArchJobs?: boolean;
showLabDispatchToggle?: boolean;
labWorkspaceView?: 'chart' | 'dispatch';
onLabWorkspaceViewChange?: (view: 'chart' | 'dispatch') => void;
}
export function TreatmentDetailsEditor({
@@ -79,6 +82,9 @@ export function TreatmentDetailsEditor({
chartLockMessage,
onTreatmentTypeChange,
hasArchJobs = false,
showLabDispatchToggle = false,
labWorkspaceView = 'chart',
onLabWorkspaceViewChange,
}: TreatmentDetailsEditorProps) {
const t = useTranslations('treatment');
const tCommon = useTranslations('common');
@@ -229,7 +235,7 @@ export function TreatmentDetailsEditor({
{showFields && activeDetail ? (
<div className="space-y-3">
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 sm:items-end">
<div className="grid grid-cols-1 gap-3 sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_auto] sm:items-end">
<Dropdown
label={t('treatmentType')}
value={activeDetail.treatmentType}
@@ -253,6 +259,32 @@ export function TreatmentDetailsEditor({
onUploadFiles={onUploadFiles}
onRemoveAttachment={readOnly ? undefined : onRemoveAttachment}
/>
{showLabDispatchToggle ? (
<Button
type="button"
variant={labWorkspaceView === 'dispatch' ? 'outline' : 'primary'}
className={`h-[2.875rem] sm:h-9 shrink-0 px-3 text-sm ${
labWorkspaceView === 'dispatch' ? 'bg-background-secondary' : ''
}`}
onClick={() =>
onLabWorkspaceViewChange?.(
labWorkspaceView === 'dispatch' ? 'chart' : 'dispatch',
)
}
>
<span className="inline-grid justify-items-center">
<span className="invisible col-start-1 row-start-1 whitespace-nowrap" aria-hidden>
{t('showLabDispatch')}
</span>
<span className="invisible col-start-1 row-start-1 whitespace-nowrap" aria-hidden>
{t('showChart')}
</span>
<span className="col-start-1 row-start-1 whitespace-nowrap">
{labWorkspaceView === 'dispatch' ? t('showChart') : t('showLabDispatch')}
</span>
</span>
</Button>
) : null}
</div>
{chart ? (