feat: add cart sales component with Kendo UI grid for displaying shopping items.
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 7m25s
All checks were successful
Build (develop) / Promote (main) / build-and-push-deploy (push) Successful in 7m25s
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -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)))
|
||||
|
||||
Reference in New Issue
Block a user