bugfix: Treatment detail auto-fill bug fixed.

This commit is contained in:
2026-08-22 18:51:57 +03:30
parent de46da216f
commit f52ad6b84a
8 changed files with 109 additions and 213 deletions

View File

@@ -28,7 +28,7 @@ interface TreatmentDetailsEditorProps {
canEdit: boolean;
saveStatus: 'idle' | 'dirty' | 'saving' | 'saved' | 'error';
uploadBusy: boolean;
onAddDetail: () => void;
onAddDetail: (initialType?: string) => 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"
>
@@ -203,12 +203,12 @@ export function TreatmentDetailsEditor({
{stepper && activeDetail ? <div className="pt-1">{stepper}</div> : null}
{activeDetail && showMissingTeethLabBlock ? (
<p className={labBlockedBannerClass}>{t('labShipmentBlockedBody')}</p>
) : null}
{showFields && activeDetail ? (
<div className="space-y-3">
{showMissingTeethLabBlock && (
<p className={labBlockedBannerClass}>{t('labShipmentBlockedBody')}</p>
)}
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 sm:items-end">
<Dropdown
label={t('treatmentType')}
@@ -268,6 +268,35 @@ 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>
) : null}
</div>
);