mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
Merged PR 363: #1087 Catch Error Creating Lieferschein & Reset Loading State | #1085 Reset Loader on Empty List of Receipts to Print
#1087 Catch Error Creating Lieferschein & Reset Loading State #1085 Reset Loader on Empty List of Receipts to Print Related work items: #1087
This commit is contained in:
@@ -6,12 +6,10 @@ import {
|
||||
ResponseArgsOfValueTupleOfOrderItemSubsetDTOAndOrderItemSubsetDTO,
|
||||
StatusValues,
|
||||
} from '@swagger/oms';
|
||||
import { BehaviorSubject, Observable } from 'rxjs';
|
||||
import { Observable } from 'rxjs';
|
||||
import { filter, map } from 'rxjs/operators';
|
||||
import { PrinterSelectionComponent } from '../../../components/printer-selection/printer-selection.component';
|
||||
import { OrderDetailsCardInput } from '../components/order-details-card';
|
||||
import { ShelfActionHandlerService } from './shelf-action-handler.service';
|
||||
import { ShelfShippingNoteService } from './shelf-shipping-note.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class ShelfOrderDetailsService {
|
||||
@@ -67,7 +65,10 @@ export class ShelfOrderDetailsService {
|
||||
receipts?: ReceiptDTO[];
|
||||
})[]
|
||||
): ReceiptDTO[] {
|
||||
return items.reduce((acc, curr) => [...(acc || []), ...curr.receipts], []);
|
||||
return items.reduce(
|
||||
(acc, curr) => [...(acc || []), ...(curr.receipts ? curr.receipts : [])],
|
||||
[]
|
||||
);
|
||||
}
|
||||
|
||||
public showPickUpAndPrintOption$(
|
||||
|
||||
@@ -33,13 +33,23 @@ export class ShelfShippingNoteService {
|
||||
statusObs$?: BehaviorSubject<boolean>;
|
||||
}
|
||||
): Promise<ReceiptDTO[]> {
|
||||
if (data.statusObs$ && data.statusObs$.next) {
|
||||
data.statusObs$.next(true);
|
||||
}
|
||||
|
||||
let receipts: ReceiptDTO[];
|
||||
try {
|
||||
receipts = await this.createNote(orderItemSubsetIds, {
|
||||
printerComponent: data.printerComponent,
|
||||
statusObs$: data.statusObs$,
|
||||
});
|
||||
} catch (error) {}
|
||||
} catch (error) {
|
||||
console.error('Error creating Lieferschein');
|
||||
} finally {
|
||||
if (data.statusObs$ && data.statusObs$.next) {
|
||||
data.statusObs$.next(false);
|
||||
}
|
||||
}
|
||||
|
||||
return receipts;
|
||||
}
|
||||
@@ -74,6 +84,7 @@ export class ShelfShippingNoteService {
|
||||
}
|
||||
}
|
||||
|
||||
data.statusObs$.next(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user