This commit is contained in:
seb
2026-10-18 20:21:27 +02:00
parent 328ba164ec
commit ac9034685f
4 changed files with 151 additions and 63 deletions

View File

@@ -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}
/>