feat: implement product configuration and order management with service refactoring and UI updates

This commit is contained in:
Elyes
2025-11-27 09:49:13 +01:00
parent a740a5b319
commit 0a03f9be60
14 changed files with 281 additions and 56 deletions

View File

@@ -0,0 +1,31 @@
import { Injectable } from '@angular/core';
import { IOrder } from '../models/order.interface';
@Injectable({
providedIn: 'root',
})
export class OrderService {
private currentOrder: IOrder = {};
public getOrder(): IOrder {
return this.currentOrder;
}
public updateOrder(partialOrder: Partial<IOrder>): void {
this.currentOrder = { ...this.currentOrder, ...partialOrder };
}
public placeOrder(): string {
// Logic to send order
const finalOrder = this.getOrder();
const shippingID = "SC-" + Math.floor(Math.random() * 1000000).toString().padStart(6, '0');
this.updateOrder({ shippingNumber: shippingID });
console.log('Order placed:', this.getOrder());
return shippingID;
}
}