u
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user