u
This commit is contained in:
@@ -481,27 +481,45 @@ class ManifestHeader extends PureComponent {
|
||||
>
|
||||
{saving ? 'Speichern…' : 'Speichern'}
|
||||
</Button>
|
||||
{isDirty && onRestore && (
|
||||
<Button
|
||||
variant="outlined"
|
||||
color="warning"
|
||||
size="small"
|
||||
startIcon={<RestoreIcon />}
|
||||
disabled={saving || orderCreating}
|
||||
onClick={onRestore}
|
||||
sx={{
|
||||
height: 34,
|
||||
fontWeight: 700,
|
||||
fontSize: '0.8rem',
|
||||
whiteSpace: 'nowrap',
|
||||
textTransform: 'none',
|
||||
borderWidth: 1.5,
|
||||
'&:hover': { borderWidth: 1.5 },
|
||||
}}
|
||||
>
|
||||
Wiederherstellen
|
||||
</Button>
|
||||
)}
|
||||
{(() => {
|
||||
const canRestore = Boolean(onRestore && isDirty && !saving && !orderCreating);
|
||||
return (
|
||||
<Button
|
||||
variant="outlined"
|
||||
color={canRestore ? 'warning' : 'inherit'}
|
||||
size="small"
|
||||
startIcon={<RestoreIcon />}
|
||||
disabled={!canRestore}
|
||||
onClick={canRestore ? onRestore : undefined}
|
||||
title={
|
||||
canRestore
|
||||
? 'Änderungen verwerfen und ursprünglichen Stand wiederherstellen'
|
||||
: 'Keine Änderungen zum Wiederherstellen'
|
||||
}
|
||||
sx={{
|
||||
height: 34,
|
||||
width: '100%',
|
||||
fontWeight: 700,
|
||||
fontSize: '0.8rem',
|
||||
whiteSpace: 'nowrap',
|
||||
textTransform: 'none',
|
||||
borderWidth: 1.5,
|
||||
'&:hover': { borderWidth: 1.5 },
|
||||
...(!canRestore && {
|
||||
borderColor: 'action.disabled',
|
||||
color: 'text.disabled',
|
||||
'&.Mui-disabled': {
|
||||
borderColor: 'action.disabled',
|
||||
color: 'text.disabled',
|
||||
borderWidth: 1.5,
|
||||
},
|
||||
}),
|
||||
}}
|
||||
>
|
||||
Wiederherstellen
|
||||
</Button>
|
||||
);
|
||||
})()}
|
||||
{docId != null && kind === 'delivery' && onOpenBookDialog && Boolean(ledgerSummary && (ledgerSummary.totalPositions > 0 || ledgerSummary.lines?.length > 0 || ledgerSummary.hasTrackStock)) && (
|
||||
<Button
|
||||
variant={ledgerSummary?.status === 'booked' ? 'outlined' : 'contained'}
|
||||
@@ -561,27 +579,56 @@ class ManifestHeader extends PureComponent {
|
||||
{orderCreating ? 'Wird erstellt…' : 'Bestellung erstellen'}
|
||||
</Button>
|
||||
)}
|
||||
{(kind === 'quote' || kind === 'order' || kind === 'delivery') && onPdfCreate && docId != null && Boolean(number) && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
startIcon={pdfCreating ? <CircularProgress size={16} color="inherit" /> : <PictureAsPdfIcon />}
|
||||
disabled={saving || pdfCreating || orderCreating}
|
||||
onClick={onPdfCreate}
|
||||
title="PDF erstellen"
|
||||
sx={{
|
||||
whiteSpace: 'nowrap',
|
||||
height: 40,
|
||||
width: '100%',
|
||||
px: 1.5,
|
||||
boxSizing: 'border-box',
|
||||
fontWeight: 600,
|
||||
fontSize: '0.875rem',
|
||||
}}
|
||||
>
|
||||
{pdfCreating ? 'Wird erstellt…' : 'PDF erstellen'}
|
||||
</Button>
|
||||
)}
|
||||
{(kind === 'quote' || kind === 'order' || kind === 'delivery') && (() => {
|
||||
const canCreatePdf = Boolean(
|
||||
onPdfCreate &&
|
||||
docId != null &&
|
||||
Boolean(number) &&
|
||||
!saving &&
|
||||
!pdfCreating &&
|
||||
!orderCreating
|
||||
);
|
||||
return (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
color={canCreatePdf ? 'primary' : 'inherit'}
|
||||
startIcon={pdfCreating ? <CircularProgress size={16} color="inherit" /> : <PictureAsPdfIcon />}
|
||||
disabled={!canCreatePdf}
|
||||
onClick={canCreatePdf ? onPdfCreate : undefined}
|
||||
title={
|
||||
pdfCreating
|
||||
? 'PDF wird erstellt…'
|
||||
: canCreatePdf
|
||||
? 'PDF erstellen'
|
||||
: docId == null
|
||||
? 'PDF kann erst nach dem Speichern erstellt werden'
|
||||
: !number
|
||||
? 'Dokumentnummer erforderlich für PDF'
|
||||
: 'PDF erstellen'
|
||||
}
|
||||
sx={{
|
||||
whiteSpace: 'nowrap',
|
||||
height: 40,
|
||||
width: '100%',
|
||||
px: 1.5,
|
||||
boxSizing: 'border-box',
|
||||
fontWeight: 600,
|
||||
fontSize: '0.875rem',
|
||||
...(!canCreatePdf && {
|
||||
borderColor: 'action.disabled',
|
||||
color: 'text.disabled',
|
||||
'&.Mui-disabled': {
|
||||
borderColor: 'action.disabled',
|
||||
color: 'text.disabled',
|
||||
},
|
||||
}),
|
||||
}}
|
||||
>
|
||||
{pdfCreating ? 'Wird erstellt…' : 'PDF erstellen'}
|
||||
</Button>
|
||||
);
|
||||
})()}
|
||||
{onPdfUpload ? (
|
||||
<FileDropzone
|
||||
accept="application/pdf,.pdf,text/plain,.txt,text/csv,.csv"
|
||||
|
||||
Reference in New Issue
Block a user