mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
feat: update entity container schema to allow optional fields; enhance return details component with dynamic product data and improved layout
This commit is contained in:
@@ -2,14 +2,14 @@ import { z } from 'zod';
|
||||
|
||||
const EntityContainerSchema = z.object({
|
||||
id: z.number(),
|
||||
uId: z.string(),
|
||||
displayLabel: z.string(),
|
||||
enabled: z.boolean(),
|
||||
selected: z.boolean(),
|
||||
uId: z.string().optional(),
|
||||
displayLabel: z.string().optional(),
|
||||
enabled: z.boolean().optional(),
|
||||
selected: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export function EntityContainer<T>(data: z.ZodType<T>) {
|
||||
return EntityContainerSchema.extend({
|
||||
data: data,
|
||||
data: data.optional(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<ui-item-row>
|
||||
<div>
|
||||
<a href="#">
|
||||
<img sharedProductImage ean="9783742327529" [imageWidth]="100" [imageHeight]="100" alt="" />
|
||||
<img
|
||||
sharedProductImage
|
||||
[ean]="item().product.ean"
|
||||
[imageWidth]="100"
|
||||
[imageHeight]="100"
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-isa-neutral-900 flex flex-col gap-2">
|
||||
<h4 class="isa-text-body-2-bold">Hefter, Martina</h4>
|
||||
<h3 class="isa-text-subtitle-1-bold">Hey guten Morgen, wie geht es dir?</h3>
|
||||
<h4 class="isa-text-body-2-bold">{{ item().product.contributors }}</h4>
|
||||
<h3 class="isa-text-subtitle-1-bold">{{ item().product.name }}</h3>
|
||||
<div class="flex flex-row justify-start items-center gap-2">
|
||||
<span class="isa-text-body-2-bold text-isa-secondary-900">12,99 €</span>
|
||||
<span class="isa-text-body-2-regular text-isa-neutral-600">inkl. 7% MwSt</span>
|
||||
@@ -19,11 +25,11 @@
|
||||
>Taschenbuch (Kartoniert, Paper lorem ipsum sum)</span
|
||||
>
|
||||
</div>
|
||||
<div>Droemer/Knaur; lorem dolor sum et ent ... | 987654345678</div>
|
||||
<div>27. März 2024</div>
|
||||
<div>{{ item().product.manufacturer }} | item().product.ean</div>
|
||||
<div>{{ item().product.publicationDate | date: 'dd. MMM yyyy' }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<ui-checkbox>
|
||||
<ui-checkbox appearance="bullet">
|
||||
<input type="checkbox" />
|
||||
</ui-checkbox>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { ChangeDetectionStrategy, Component, input } from '@angular/core';
|
||||
import { ReceiptItem } from '@feature/return/services';
|
||||
import { isaArtikelTaschenbuch } from '@isa/icons';
|
||||
@@ -12,7 +13,7 @@ import { NgIconComponent, provideIcons } from '@ng-icons/core';
|
||||
styleUrls: ['./return-details-order-group-item.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
standalone: true,
|
||||
imports: [ItemRowComponent, ProductImageDirective, CheckboxComponent, NgIconComponent],
|
||||
imports: [ItemRowComponent, ProductImageDirective, CheckboxComponent, NgIconComponent, DatePipe],
|
||||
providers: [provideIcons({ isaArtikelTaschenbuch })],
|
||||
})
|
||||
export class ReturnDetailsOrderGroupItemComponent {
|
||||
|
||||
@@ -5,6 +5,6 @@
|
||||
<lib-return-details-data [receipt]="receipt"></lib-return-details-data>
|
||||
<lib-return-details-order-group [items]="receipt.items"></lib-return-details-order-group>
|
||||
@for (item of receipt.items; track item.id) {
|
||||
<lib-return-details-order-group-item [item]="item"></lib-return-details-order-group-item>
|
||||
<lib-return-details-order-group-item [item]="item.data"></lib-return-details-order-group-item>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,18 +49,6 @@ export class DetailsPageComponent {
|
||||
return this.#returnDetailsStore.entityMap()[itemId];
|
||||
});
|
||||
|
||||
itemsGroupedByOrder = computed<Dictionary<ReceiptItem[]>>(() => {
|
||||
const receipt = this.receiptResult().data;
|
||||
if (!receipt) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return groupBy(
|
||||
receipt.items.flatMap((i) => i.data),
|
||||
'orderNumber',
|
||||
);
|
||||
});
|
||||
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const itemId = this.itemId();
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const BranchSchema = z.object({});
|
||||
@@ -0,0 +1,17 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum OrderItemType {
|
||||
NotSet = 0,
|
||||
SignleItem = 1,
|
||||
VATBundle = 2,
|
||||
ItemPrice = 4,
|
||||
ComponentPrice = 8,
|
||||
SubItem = 16,
|
||||
Accessory = 32,
|
||||
Set = 64,
|
||||
Postage = 128,
|
||||
HandlingFee = 256,
|
||||
Voucher = 512,
|
||||
}
|
||||
|
||||
export const OrderItemTypeSchema = z.nativeEnum(OrderItemType);
|
||||
@@ -0,0 +1,18 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum PaymentStatus {
|
||||
NotSet = 0,
|
||||
ProformaInvoicePrinted = 1,
|
||||
InvoicePrinted = 2,
|
||||
Paid = 4,
|
||||
OnApproval = 8,
|
||||
Free = 16,
|
||||
Dunning1 = 32,
|
||||
ProformaInvoicePaid = 64,
|
||||
Canceled = 128,
|
||||
Dunning2 = 256,
|
||||
PartiallyPaid = 512,
|
||||
Outstanding = 1024,
|
||||
}
|
||||
|
||||
export const PaymentStatusSchema = z.nativeEnum(PaymentStatus);
|
||||
@@ -0,0 +1,11 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const ProductSchema = z.object({
|
||||
name: z.string(),
|
||||
contributors: z.string(),
|
||||
ean: z.string(),
|
||||
manufacturer: z.string(),
|
||||
publicationDate: z.coerce.date(),
|
||||
});
|
||||
|
||||
export type Product = z.infer<typeof ProductSchema>;
|
||||
@@ -1,7 +1,17 @@
|
||||
import { EntityContainer } from '@isa/common/result';
|
||||
import { z } from 'zod';
|
||||
import { BranchSchema } from './branch.schema';
|
||||
import { OrderItemTypeSchema } from './order-item-type.schema';
|
||||
import { PaymentStatusSchema } from './payment-status.schema';
|
||||
import { ProductSchema } from './product.schema';
|
||||
|
||||
export const ReceiptItemSchema = z.object({
|
||||
id: z.number(),
|
||||
lineNumber: z.number(),
|
||||
orderBranch: EntityContainer(BranchSchema),
|
||||
orderItemType: OrderItemTypeSchema,
|
||||
paymentStatus: PaymentStatusSchema,
|
||||
product: ProductSchema,
|
||||
});
|
||||
|
||||
export type ReceiptItem = z.infer<typeof ReceiptItemSchema>;
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum ShippingType {
|
||||
NotSet = 0,
|
||||
PostCard = 1,
|
||||
Letter = 2,
|
||||
LargeLetter = 4,
|
||||
BookRate = 8,
|
||||
MerchandiseShipment = 16,
|
||||
Parcel = 32,
|
||||
Palette = 64,
|
||||
MerchandiseShipmentSmall = 128,
|
||||
}
|
||||
|
||||
export const ShippingTypeSchema = z.nativeEnum(ShippingType);
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum TypeOfDelivery {
|
||||
NotSet = 0,
|
||||
Standard = 1,
|
||||
Express = 2,
|
||||
AirMail = 4,
|
||||
SeeOrOverland = 8,
|
||||
Courier = 16,
|
||||
CashOnDelivery = 32,
|
||||
DeliveryVehicle = 64,
|
||||
}
|
||||
|
||||
export const TypeOfDeliverySchema = z.nativeEnum(TypeOfDelivery);
|
||||
@@ -0,0 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export enum ValidationStatus {
|
||||
NotSet = 0,
|
||||
Validate = 1,
|
||||
ValidateManually = 2,
|
||||
ValidateAutomatically = 4,
|
||||
}
|
||||
|
||||
export const ValidationStatusSchema = z.nativeEnum(ValidationStatus);
|
||||
Reference in New Issue
Block a user