This commit is contained in:
seb
2026-10-18 19:32:31 +02:00
parent 199bf869a6
commit 587170ce9b
9 changed files with 184 additions and 29 deletions

View File

@@ -272,6 +272,11 @@ class ManifestHeader extends PureComponent {
} = this.props;
const hasArticles = this.hasArticles();
const isEdit = docId != null;
const hasAttachments = Array.isArray(attachments) && attachments.length > 0;
const canSave = isEdit
? Boolean(isDirty)
: Boolean(hasArticles || hasAttachments);
// Delivery: number is server-allocated/read-only; the caller reference
// lives in the editable externalNumber field.
@@ -447,20 +452,33 @@ class ManifestHeader extends PureComponent {
<Stack spacing={1.5} sx={{ pt: 0.5 }}>
<Button
variant="contained"
color={isDirty ? 'warning' : 'primary'}
disabled={saving || orderCreating}
color={canSave ? 'success' : 'inherit'}
disabled={Boolean(saving || orderCreating || !canSave)}
onClick={onSave}
sx={{
height: 40,
fontWeight: 700,
fontSize: '0.875rem',
whiteSpace: 'nowrap',
...(isDirty && {
boxShadow: (theme) => `0 0 0 2px ${theme.palette.warning.main}`,
...(canSave && {
bgcolor: 'success.main',
color: '#fff',
'&:hover': {
bgcolor: 'success.dark',
},
}),
...(!canSave && {
bgcolor: 'action.disabledBackground',
color: 'text.disabled',
boxShadow: 'none',
'&.Mui-disabled': {
bgcolor: 'action.disabledBackground',
color: 'text.disabled',
},
}),
}}
>
{saving ? 'Speichern…' : isDirty ? 'Speichern *' : 'Speichern'}
{saving ? 'Speichern…' : 'Speichern'}
</Button>
{isDirty && onRestore && (
<Button

View File

@@ -362,9 +362,15 @@ export class TextEditorPanel extends PureComponent {
<Button
size="small"
variant="contained"
color={isDirty ? 'success' : 'inherit'}
startIcon={<SaveOutlinedIcon />}
onClick={this.handleSave}
disabled={loading || !isDirty}
sx={
isDirty
? { bgcolor: 'success.main', color: '#fff', '&:hover': { bgcolor: 'success.dark' } }
: undefined
}
>
Speichern
</Button>