+
-
+
-
-
-
-
+
+
-
+ }}%)" (resultEvent)="closeInformation($event)">
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
+
-
-
-
+
+
+
Pedido de venda
@@ -1507,105 +974,69 @@
@@ -1618,39 +1049,21 @@
-
+
-
+
Cancelar
-
+
Gravar
-
+
Cancelar
-
+
Imprimir
-
+
-
+
@@ -1806,53 +1158,32 @@
-
+
Fechar
-
+
Valor Frete:
- R$ {{ dataItem.deliveryValue | number : "1.2-2" }}
+ R$ {{ dataItem.deliveryValue | number : "1.2-2" }}
@@ -2004,43 +1295,27 @@
-
+
@@ -2056,15 +1331,8 @@
@@ -2072,12 +1340,8 @@
Confirmar
-
+
Cancelar
-
+
\ No newline at end of file
diff --git a/src/app/sales/cart-sales/cart-sales.component.ts b/src/app/sales/cart-sales/cart-sales.component.ts
index 87ba4aa..9d34c0f 100644
--- a/src/app/sales/cart-sales/cart-sales.component.ts
+++ b/src/app/sales/cart-sales/cart-sales.component.ts
@@ -79,8 +79,7 @@ export interface JsonModel {
],
})
export class CartSalesComponent
- implements OnInit, AfterViewInit, OnDestroy, OnChanges
-{
+ implements OnInit, AfterViewInit, OnDestroy, OnChanges {
public containerRef: ViewContainerRef;
public resultQuestion;
@@ -233,11 +232,11 @@ export class CartSalesComponent
discountValue: number;
carrierId: number;
} = {
- taxValue: 0,
- discountValue: 0,
- orderValue: 0,
- carrierId: 0,
- };
+ taxValue: 0,
+ discountValue: 0,
+ orderValue: 0,
+ carrierId: 0,
+ };
public windowState: WindowState = 'maximized';
public openedPrintPreOrder = false;
@@ -275,13 +274,13 @@ export class CartSalesComponent
private readonly messageService: MessageService,
private readonly productService: ProductService,
private readonly customerService: CustomerService
- ) {}
+ ) { }
ngOnChanges(changes: SimpleChanges): void {
this.loadShopping();
}
- ngAfterViewInit(): void {}
+ ngAfterViewInit(): void { }
ngOnDestroy(): void {
if (this.shoppingSubscription) {
@@ -536,8 +535,8 @@ export class CartSalesComponent
address != null
? address.placeId
: customer != null
- ? customer.placeId
- : 0,
+ ? customer.placeId
+ : 0,
cartId
)
.subscribe((data) => {
@@ -561,7 +560,7 @@ export class CartSalesComponent
this.formNotes.get('shippingDate').value == undefined ||
this.formNotes.get('shippingDate').value == null ||
Date.parse(this.formNotes.get('shippingDate').value) <
- Date.parse(deliveryDate.toDateString())
+ Date.parse(deliveryDate.toDateString())
) {
const model: JsonModel = {
shippingDate: deliveryDate != null ? deliveryDate.toString() : null,
@@ -1579,6 +1578,40 @@ export class CartSalesComponent
}
}
+ public updateCart(
+ cartId: string,
+ customerId: number,
+ addressId: number,
+ saleStoreId: string,
+ paymentPlanId: number,
+ billingId: string
+ ) {
+ this.shoppingService.getShopping(cartId).subscribe((shopping) => {
+ if (shopping) {
+ shopping.codcli = customerId;
+ shopping.codendentcli = addressId;
+ shopping.saleStore = saleStoreId;
+ shopping.codplpag = paymentPlanId;
+ shopping.codcob = billingId;
+
+ this.shoppingService.updateShopping(shopping).subscribe(
+ (response) => {
+ console.log('Cart updated successfully:', response);
+ this.store.dispatch(
+ new LoadShoppingAction(this.shoppingService.getCart())
+ );
+ this.loadFormOrder();
+ },
+ (error) => {
+ console.error('Error updating cart:', error);
+ }
+ );
+ } else {
+ console.error('Shopping cart not found for ID:', cartId);
+ }
+ });
+ }
+
showDialogSelectAddress() {
if (this.customer == null) {
this.titleInformation = 'Selecionar endereço de entrega';
@@ -1654,9 +1687,8 @@ export class CartSalesComponent
this.informationDelivery = `Pedido com data de entrega para o dia
${dataTexto}
- - Tipo de entrega: ${
- dataDelivery.scheduleDelivery ? 'PROGRAMADA' : 'NORMAL'
- }`;
+ - Tipo de entrega: ${dataDelivery.scheduleDelivery ? 'PROGRAMADA' : 'NORMAL'
+ }`;
}
this.titleMessage = 'Gerar pedido de venda';
@@ -1750,7 +1782,7 @@ export class CartSalesComponent
if (
Date.parse(this.formNotes.get('shippingDate').value) ==
- Date.parse(deliveryDate.toDateString()) &&
+ Date.parse(deliveryDate.toDateString()) &&
this.formNotes.get('scheduleDelivery').value == true
) {
this.titleInformation = 'Pedido de venda';
@@ -2268,8 +2300,8 @@ export class CartSalesComponent
closeModelPrintPreOrder(action: string) {
console.log(
`Dialog result: ${action}` +
- ' - ' +
- this.formModelPreOrder.get('model').value
+ ' - ' +
+ this.formModelPreOrder.get('model').value
);
this.openedModelPrintPreOrder = false;
this.modelPrintPreOrder = this.formModelPreOrder.get('model').value;
@@ -2712,8 +2744,8 @@ export class CartSalesComponent
address != null
? address.placeId
: customer != null
- ? customer.placeId
- : 0,
+ ? customer.placeId
+ : 0,
cartId
)
.pipe(map((result) => (deliveryDays = result.deliveryDays)))