feat: implement direct purchase functionality and enhance product buy events
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
{{ formattedPrice() }}
|
||||
</span>
|
||||
<div class="product-row-card__btn-wrapper">
|
||||
<app-button variant="primary" (click)="buy.emit()">
|
||||
<app-button variant="primary" (click)="onBuy()">
|
||||
Comprar
|
||||
</app-button>
|
||||
</div>
|
||||
|
||||
@@ -28,7 +28,7 @@ export class ProductRowCardComponent {
|
||||
readonly selectedVariant = model<any>(null);
|
||||
|
||||
// Interactive events
|
||||
readonly buy = output<void>();
|
||||
readonly buy = output<{ quantity: number; variant: any }>();
|
||||
readonly addToCart = output<{ quantity: number; variant: any }>();
|
||||
|
||||
constructor() {
|
||||
@@ -57,6 +57,13 @@ export class ProductRowCardComponent {
|
||||
});
|
||||
}
|
||||
|
||||
protected onBuy(): void {
|
||||
this.buy.emit({
|
||||
quantity: this.quantity(),
|
||||
variant: this.selectedVariant(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to format currency numbers to Argentine Pesos style "$ XX.XXX".
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user