mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#3682 AHF // Reservierungsliste - Radion-Button ein- und ausblenden bei Bezahlt vs Nicht Bezahlt Related work items: #3682
24 lines
899 B
TypeScript
24 lines
899 B
TypeScript
import { Pipe, PipeTransform } from '@angular/core';
|
|
import { KeyValueDTOOfStringAndString, OrderItemListItemDTO } from '@swagger/oms';
|
|
|
|
@Pipe({
|
|
name: 'goodsInReservationSelectable',
|
|
})
|
|
export class GoodsInReservationSelectablePipe implements PipeTransform {
|
|
transform(
|
|
item: OrderItemListItemDTO,
|
|
selectionRules: (action: KeyValueDTOOfStringAndString) => boolean,
|
|
selectedItems: OrderItemListItemDTO[]
|
|
): boolean {
|
|
if (selectedItems.length > 0) {
|
|
const firstSelectedItem = selectedItems[0];
|
|
const selectedLabel = firstSelectedItem.actions.find((action) => selectionRules(action)).label;
|
|
return item?.actions?.some(
|
|
(action) => selectionRules(action) && action.label === selectedLabel && item?.features?.paid === firstSelectedItem?.features?.paid
|
|
);
|
|
} else {
|
|
return item?.actions?.some((action) => selectionRules(action));
|
|
}
|
|
}
|
|
}
|