u
This commit is contained in:
@@ -160,6 +160,7 @@ class LieferungNeuPage extends PureComponent {
|
||||
this.handleRemoveLine = this.handleRemoveLine.bind(this);
|
||||
this.handleMoveLine = this.handleMoveLine.bind(this);
|
||||
this.handleRemoveAllLines = this.handleRemoveAllLines.bind(this);
|
||||
this.handleRestore = this.handleRestore.bind(this);
|
||||
this.handleSave = this.handleSave.bind(this);
|
||||
this.handlePdfUpload = this.handlePdfUpload.bind(this);
|
||||
this.handlePdfRescan = this.handlePdfRescan.bind(this);
|
||||
@@ -686,6 +687,24 @@ class LieferungNeuPage extends PureComponent {
|
||||
|
||||
handleRemoveAllLines() {
|
||||
this.automat.actions.clearLineitems();
|
||||
this.setState({ lines: [] });
|
||||
}
|
||||
|
||||
handleRestore() {
|
||||
if (!this._initialDoc) return;
|
||||
const base = this._initialDoc;
|
||||
this.automat.actions.setDate(base.date);
|
||||
if (base.partyId != null) {
|
||||
this.automat.actions.setDeliveryEntity(base.partyId);
|
||||
}
|
||||
this.automat.actions.setExternalNumber(base.externalNumber || '');
|
||||
const restoredLines = (base.lines || []).map((l) => ({ ...l }));
|
||||
this.automat.actions.setLineitems(restoredLines);
|
||||
this.automat.actions.setAttachments([...(base.attachments || [])]);
|
||||
this.setState({
|
||||
lines: restoredLines,
|
||||
});
|
||||
enqueueSnackbar('Änderungen verworfen und ursprünglicher Stand wiederhergestellt.', { variant: 'info' });
|
||||
}
|
||||
|
||||
async handlePdfUpload(file) {
|
||||
@@ -1331,6 +1350,7 @@ class LieferungNeuPage extends PureComponent {
|
||||
onNumberChange={this.handleNumberChange}
|
||||
onExternalNumberChange={this.handleExternalNumberChange}
|
||||
docId={this.props.docId}
|
||||
onRestore={isEdit ? this.handleRestore : undefined}
|
||||
ledgerSummary={this.state.ledgerSummary}
|
||||
onOpenBookDialog={this.handleOpenBookDialog}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user