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
|
export class CartSalesComponent
|
||||||
implements OnInit, AfterViewInit, OnDestroy, OnChanges
|
implements OnInit, AfterViewInit, OnDestroy, OnChanges {
|
||||||
{
|
|
||||||
public containerRef: ViewContainerRef;
|
public containerRef: ViewContainerRef;
|
||||||
public resultQuestion;
|
public resultQuestion;
|
||||||
|
|
||||||
@@ -233,11 +232,11 @@ export class CartSalesComponent
|
|||||||
discountValue: number;
|
discountValue: number;
|
||||||
carrierId: number;
|
carrierId: number;
|
||||||
} = {
|
} = {
|
||||||
taxValue: 0,
|
taxValue: 0,
|
||||||
discountValue: 0,
|
discountValue: 0,
|
||||||
orderValue: 0,
|
orderValue: 0,
|
||||||
carrierId: 0,
|
carrierId: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
public windowState: WindowState = 'maximized';
|
public windowState: WindowState = 'maximized';
|
||||||
public openedPrintPreOrder = false;
|
public openedPrintPreOrder = false;
|
||||||
@@ -275,13 +274,13 @@ export class CartSalesComponent
|
|||||||
private readonly messageService: MessageService,
|
private readonly messageService: MessageService,
|
||||||
private readonly productService: ProductService,
|
private readonly productService: ProductService,
|
||||||
private readonly customerService: CustomerService
|
private readonly customerService: CustomerService
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
ngOnChanges(changes: SimpleChanges): void {
|
ngOnChanges(changes: SimpleChanges): void {
|
||||||
this.loadShopping();
|
this.loadShopping();
|
||||||
}
|
}
|
||||||
|
|
||||||
ngAfterViewInit(): void {}
|
ngAfterViewInit(): void { }
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
if (this.shoppingSubscription) {
|
if (this.shoppingSubscription) {
|
||||||
@@ -536,8 +535,8 @@ export class CartSalesComponent
|
|||||||
address != null
|
address != null
|
||||||
? address.placeId
|
? address.placeId
|
||||||
: customer != null
|
: customer != null
|
||||||
? customer.placeId
|
? customer.placeId
|
||||||
: 0,
|
: 0,
|
||||||
cartId
|
cartId
|
||||||
)
|
)
|
||||||
.subscribe((data) => {
|
.subscribe((data) => {
|
||||||
@@ -561,7 +560,7 @@ export class CartSalesComponent
|
|||||||
this.formNotes.get('shippingDate').value == undefined ||
|
this.formNotes.get('shippingDate').value == undefined ||
|
||||||
this.formNotes.get('shippingDate').value == null ||
|
this.formNotes.get('shippingDate').value == null ||
|
||||||
Date.parse(this.formNotes.get('shippingDate').value) <
|
Date.parse(this.formNotes.get('shippingDate').value) <
|
||||||
Date.parse(deliveryDate.toDateString())
|
Date.parse(deliveryDate.toDateString())
|
||||||
) {
|
) {
|
||||||
const model: JsonModel = {
|
const model: JsonModel = {
|
||||||
shippingDate: deliveryDate != null ? deliveryDate.toString() : null,
|
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() {
|
showDialogSelectAddress() {
|
||||||
if (this.customer == null) {
|
if (this.customer == null) {
|
||||||
this.titleInformation = 'Selecionar endereço de entrega';
|
this.titleInformation = 'Selecionar endereço de entrega';
|
||||||
@@ -1654,9 +1687,8 @@ export class CartSalesComponent
|
|||||||
|
|
||||||
this.informationDelivery = `Pedido com data de entrega para o dia
|
this.informationDelivery = `Pedido com data de entrega para o dia
|
||||||
${dataTexto}
|
${dataTexto}
|
||||||
- Tipo de entrega: ${
|
- Tipo de entrega: ${dataDelivery.scheduleDelivery ? 'PROGRAMADA' : 'NORMAL'
|
||||||
dataDelivery.scheduleDelivery ? 'PROGRAMADA' : 'NORMAL'
|
}`;
|
||||||
}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.titleMessage = 'Gerar pedido de venda';
|
this.titleMessage = 'Gerar pedido de venda';
|
||||||
@@ -1750,7 +1782,7 @@ export class CartSalesComponent
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
Date.parse(this.formNotes.get('shippingDate').value) ==
|
Date.parse(this.formNotes.get('shippingDate').value) ==
|
||||||
Date.parse(deliveryDate.toDateString()) &&
|
Date.parse(deliveryDate.toDateString()) &&
|
||||||
this.formNotes.get('scheduleDelivery').value == true
|
this.formNotes.get('scheduleDelivery').value == true
|
||||||
) {
|
) {
|
||||||
this.titleInformation = 'Pedido de venda';
|
this.titleInformation = 'Pedido de venda';
|
||||||
@@ -2268,8 +2300,8 @@ export class CartSalesComponent
|
|||||||
closeModelPrintPreOrder(action: string) {
|
closeModelPrintPreOrder(action: string) {
|
||||||
console.log(
|
console.log(
|
||||||
`Dialog result: ${action}` +
|
`Dialog result: ${action}` +
|
||||||
' - ' +
|
' - ' +
|
||||||
this.formModelPreOrder.get('model').value
|
this.formModelPreOrder.get('model').value
|
||||||
);
|
);
|
||||||
this.openedModelPrintPreOrder = false;
|
this.openedModelPrintPreOrder = false;
|
||||||
this.modelPrintPreOrder = this.formModelPreOrder.get('model').value;
|
this.modelPrintPreOrder = this.formModelPreOrder.get('model').value;
|
||||||
@@ -2712,8 +2744,8 @@ export class CartSalesComponent
|
|||||||
address != null
|
address != null
|
||||||
? address.placeId
|
? address.placeId
|
||||||
: customer != null
|
: customer != null
|
||||||
? customer.placeId
|
? customer.placeId
|
||||||
: 0,
|
: 0,
|
||||||
cartId
|
cartId
|
||||||
)
|
)
|
||||||
.pipe(map((result) => (deliveryDays = result.deliveryDays)))
|
.pipe(map((result) => (deliveryDays = result.deliveryDays)))
|
||||||
|
|||||||
Reference in New Issue
Block a user