From 1cb849a299403c5c936208761cd5e5c36ab0f588 Mon Sep 17 00:00:00 2001 From: Luis Eduardo Estevao Date: Thu, 19 Feb 2026 10:02:15 -0300 Subject: [PATCH] feat: add cart sales component and lookup service for managing sales orders. Add parameter customerId find payment plans. --- src/app/sales/cart-sales/cart-sales.component.ts | 7 +++++-- src/app/services/lookup.service.ts | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/app/sales/cart-sales/cart-sales.component.ts b/src/app/sales/cart-sales/cart-sales.component.ts index 17250a5..ab7042d 100644 --- a/src/app/sales/cart-sales/cart-sales.component.ts +++ b/src/app/sales/cart-sales/cart-sales.component.ts @@ -632,7 +632,7 @@ export class CartSalesComponent if (billing !== null) { const savePayment = localStorage.getItem('paymentPlan'); - this.paymentPlan$ = this.lookupService.getPaymentPlan(billing.codcob); + this.paymentPlan$ = this.lookupService.getPaymentPlan(billing.codcob, customer !== null ? customer.customerId : 1); this.subscritpionPaymentPlan = this.paymentPlan$.subscribe((data) => { this.paymentPlans = data; if ( @@ -798,13 +798,16 @@ export class CartSalesComponent setBilling(billing: any) { localStorage.setItem('billing', JSON.stringify(billing)); + const customer = JSON.parse(localStorage.getItem('customer')) as Customer; this.idBilling = billing.codcob; console.log(JSON.stringify(billing)); localStorage.removeItem('paymentPlan'); this.formPayment.patchValue({ paymentPlan: null, }); - this.paymentPlan$ = this.lookupService.getPaymentPlan(billing.codcob); + this.paymentPlan$ = this.lookupService.getPaymentPlan(billing.codcob, + customer !== null ? customer.customerId : 1 + ); this.subscritpionPaymentPlan = this.paymentPlan$ .pipe( tap((data) => (this.paymentPlans = data)), diff --git a/src/app/services/lookup.service.ts b/src/app/services/lookup.service.ts index 63267ff..e5180af 100644 --- a/src/app/services/lookup.service.ts +++ b/src/app/services/lookup.service.ts @@ -25,7 +25,7 @@ export class LookupService { constructor( private http: HttpClient, private authService: AuthService, - ) { } + ) { } getStore(): Observable { const url = environment.url + `lists/store/user/${this.authService.getUser()}`; @@ -60,8 +60,8 @@ export class LookupService { } } - getPaymentPlan(billingId: string = '9999'): Observable { - const url = environment.url + `lists/paymentplan/${billingId}`; + getPaymentPlan(billingId: string = '9999', customerId: number = 1): Observable { + const url = environment.url + `lists/paymentplan/${billingId}/${customerId}`; try { const response = this.http.get(url); return response;