u
This commit is contained in:
@@ -8,6 +8,8 @@ import TextField from '@mui/material/TextField';
|
||||
import Chip from '@mui/material/Chip';
|
||||
import UploadFileIcon from '@mui/icons-material/UploadFile';
|
||||
import PictureAsPdfIcon from '@mui/icons-material/PictureAsPdf';
|
||||
import ShoppingCartIcon from '@mui/icons-material/ShoppingCart';
|
||||
import LocalShippingOutlinedIcon from '@mui/icons-material/LocalShippingOutlined';
|
||||
import Inventory2OutlinedIcon from '@mui/icons-material/Inventory2Outlined';
|
||||
import CheckCircleOutlineOutlinedIcon from '@mui/icons-material/CheckCircleOutlineOutlined';
|
||||
import SingleLineTextEdit from 'dashgui/SingleLineTextEdit';
|
||||
@@ -36,6 +38,8 @@ class ManifestHeader extends PureComponent {
|
||||
createdParty: null,
|
||||
};
|
||||
this.fileInputRef = createRef();
|
||||
this.partyInputRef = createRef();
|
||||
this.focusPartyInput = this.focusPartyInput.bind(this);
|
||||
this.handlePartyChange = this.handlePartyChange.bind(this);
|
||||
this.handlePartyInputChange = this.handlePartyInputChange.bind(this);
|
||||
this.handlePartyKeyDown = this.handlePartyKeyDown.bind(this);
|
||||
@@ -56,6 +60,13 @@ class ManifestHeader extends PureComponent {
|
||||
this.setState({ partyInput: '', createdParty: null });
|
||||
}
|
||||
}
|
||||
if (!prevProps.partyError && this.props.partyError) {
|
||||
this.partyInputRef.current?.focus();
|
||||
}
|
||||
}
|
||||
|
||||
focusPartyInput() {
|
||||
this.partyInputRef.current?.focus();
|
||||
}
|
||||
|
||||
handlePartyChange(_event, option) {
|
||||
@@ -237,7 +248,12 @@ class ManifestHeader extends PureComponent {
|
||||
onExternalNumberChange,
|
||||
onSave,
|
||||
onRestore,
|
||||
orderCreating,
|
||||
onCreateOrder,
|
||||
onOpenCreateShipment,
|
||||
deliverDisabled,
|
||||
actionsColor,
|
||||
partyError,
|
||||
docId,
|
||||
ledgerSummary,
|
||||
onOpenBookDialog,
|
||||
@@ -258,7 +274,8 @@ class ManifestHeader extends PureComponent {
|
||||
(this.state.createdParty?.id === partyId ? this.state.createdParty : null);
|
||||
|
||||
const isDateEmpty = !date || String(date).trim() === '';
|
||||
const isPartyEmpty = kind !== 'quote' && (partyId == null || partyId === '');
|
||||
const isPartyEmpty =
|
||||
(kind !== 'quote' || Boolean(partyError)) && (partyId == null || partyId === '');
|
||||
|
||||
return (
|
||||
<>
|
||||
@@ -342,8 +359,10 @@ class ManifestHeader extends PureComponent {
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
inputRef={this.partyInputRef}
|
||||
label={dirtyFields?.partyId ? `${partyLabel} *` : partyLabel}
|
||||
error={isPartyEmpty}
|
||||
helperText={Boolean(partyError) && isPartyEmpty ? 'Kunde für Bestellung erforderlich' : undefined}
|
||||
onKeyDown={this.handlePartyKeyDown}
|
||||
slotProps={{
|
||||
...params.slotProps,
|
||||
@@ -455,7 +474,7 @@ class ManifestHeader extends PureComponent {
|
||||
<Button
|
||||
variant="contained"
|
||||
color={isDirty ? 'warning' : 'primary'}
|
||||
disabled={saving}
|
||||
disabled={saving || orderCreating}
|
||||
onClick={onSave}
|
||||
sx={{
|
||||
height: 40,
|
||||
@@ -475,7 +494,7 @@ class ManifestHeader extends PureComponent {
|
||||
color="warning"
|
||||
size="small"
|
||||
startIcon={<RestoreIcon />}
|
||||
disabled={saving}
|
||||
disabled={saving || orderCreating}
|
||||
onClick={onRestore}
|
||||
sx={{
|
||||
height: 34,
|
||||
@@ -523,12 +542,56 @@ class ManifestHeader extends PureComponent {
|
||||
: 'Ins Lager buchen'}
|
||||
</Button>
|
||||
)}
|
||||
{kind === 'quote' && docId != null && onCreateOrder && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
color={partyError && !partyId ? 'warning' : 'primary'}
|
||||
startIcon={orderCreating ? <CircularProgress size={16} color="inherit" /> : <ShoppingCartIcon />}
|
||||
disabled={saving || orderCreating || pdfCreating}
|
||||
onClick={onCreateOrder}
|
||||
title={!partyId ? 'Kunde für Bestellung erforderlich' : 'Bestellung aus diesem Angebot erstellen'}
|
||||
sx={{
|
||||
whiteSpace: 'nowrap',
|
||||
height: 40,
|
||||
width: '100%',
|
||||
px: 1.5,
|
||||
boxSizing: 'border-box',
|
||||
fontWeight: 600,
|
||||
fontSize: '0.875rem',
|
||||
}}
|
||||
>
|
||||
{orderCreating ? 'Wird erstellt…' : 'Bestellung erstellen'}
|
||||
</Button>
|
||||
)}
|
||||
{kind === 'order' && docId != null && onOpenCreateShipment && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
color="primary"
|
||||
startIcon={<LocalShippingOutlinedIcon />}
|
||||
disabled={saving || pdfCreating || orderCreating || deliverDisabled}
|
||||
onClick={onOpenCreateShipment}
|
||||
title={deliverDisabled ? 'Alle Positionen bereits ausgeliefert' : 'Lieferschein erstellen'}
|
||||
sx={{
|
||||
whiteSpace: 'nowrap',
|
||||
height: 40,
|
||||
width: '100%',
|
||||
px: 1.5,
|
||||
boxSizing: 'border-box',
|
||||
fontWeight: 600,
|
||||
fontSize: '0.875rem',
|
||||
}}
|
||||
>
|
||||
Liefern
|
||||
</Button>
|
||||
)}
|
||||
{(kind === 'quote' || kind === 'order') && onPdfCreate && docId != null && Boolean(number) && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outlined"
|
||||
startIcon={pdfCreating ? <CircularProgress size={16} color="inherit" /> : <PictureAsPdfIcon />}
|
||||
disabled={saving || pdfCreating}
|
||||
disabled={saving || pdfCreating || orderCreating}
|
||||
onClick={onPdfCreate}
|
||||
title="PDF erstellen"
|
||||
sx={{
|
||||
|
||||
Reference in New Issue
Block a user