bugfix: no-detail treatment ui made some confusion. it is improved. at least to a degree.

This commit is contained in:
2026-08-22 19:36:37 +03:30
parent f52ad6b84a
commit 50725b7b3f
9 changed files with 27 additions and 43 deletions

View File

@@ -28,7 +28,7 @@ interface TreatmentDetailsEditorProps {
canEdit: boolean;
saveStatus: 'idle' | 'dirty' | 'saving' | 'saved' | 'error';
uploadBusy: boolean;
onAddDetail: (initialType?: string) => void;
onAddDetail: () => void;
onRemoveDetail?: (detailClientId: string) => void;
onUploadFiles: (files: File[], onProgress: (percent: number) => void) => Promise<void>;
onRemoveAttachment?: (attachmentId: string) => void;
@@ -113,7 +113,7 @@ export function TreatmentDetailsEditor({
type="button"
variant="primary"
disabled={!canEdit || disabled}
onClick={() => onAddDetail()}
onClick={onAddDetail}
fullWidth
className="sm:w-auto shrink-0"
>
@@ -269,34 +269,7 @@ export function TreatmentDetailsEditor({
{footer ? <div className="pt-1">{footer}</div> : null}
</div>
) : showFields && !activeDetail ? (
<div className="space-y-3">
<Dropdown
label={t('treatmentType')}
value=""
onChange={(e) => {
const nextType = e.target.value;
if (nextType) onAddDetail(nextType);
}}
disabled={!canEdit || disabled}
>
<option value="">{t('treatmentTypePlaceholder')}</option>
{treatmentCatalog.map((entry, index) => (
<option key={entry.code} value={entry.code} style={treatmentTypeOptionStyle(entry.code, index)}>
{entry.label}
</option>
))}
</Dropdown>
{chart ? (
<div className="relative min-w-0 w-full">
<div className="absolute inset-0 z-10 flex items-center justify-center rounded-[var(--radius-md)] bg-background-card/70 px-4">
<p className="text-sm text-text-secondary text-center">{chartLockMessage}</p>
</div>
<div className="pointer-events-none opacity-40">{chart}</div>
</div>
) : chartLockMessage ? (
<p className="text-sm text-text-secondary">{chartLockMessage}</p>
) : null}
</div>
<p className="text-sm text-text-muted">{t('noDetails')}</p>
) : null}
</div>
);