feat: Add cart store for catalog quantity sync
- Create Pinia cart store to manage cart state globally - Sync quantity changes between catalog cards and cart sidebar - Improve product card design with borders and hover effects - Fix cart sync when updating quantity via minus button or input field
This commit is contained in:
@@ -186,17 +186,17 @@
|
||||
clients: [],
|
||||
products: [],
|
||||
};
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.fetchClients();
|
||||
this.fetchProducts();
|
||||
this.fetchPaymentMethods();
|
||||
},
|
||||
watch: {
|
||||
group () {
|
||||
this.drawer = false
|
||||
this.fetchClients();
|
||||
this.fetchProducts();
|
||||
this.fetchPaymentMethods();
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
group () {
|
||||
this.drawer = false
|
||||
},
|
||||
},
|
||||
beforeMount() {
|
||||
window.addEventListener('beforeunload', this.confirmLeave);
|
||||
},
|
||||
@@ -228,8 +228,8 @@
|
||||
});
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
methods: {
|
||||
openModal() {
|
||||
this.$refs.customerModal.openModal();
|
||||
},
|
||||
onFormChange() {
|
||||
@@ -307,25 +307,25 @@
|
||||
calculateSubtotal(line) {
|
||||
return line.unit_price * line.quantity;
|
||||
},
|
||||
async submit() {
|
||||
this.$refs.purchase.validate();
|
||||
if (this.valid) {
|
||||
this.api.createPurchase(this.purchase)
|
||||
.then(data => {
|
||||
console.log('Compra enviada:', data);
|
||||
this.$router.push({
|
||||
path: "/summary_purchase",
|
||||
query : {id: parseInt(data.id)}
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error al enviarl la compra:', error));
|
||||
} else {
|
||||
this.show_alert_purchase = true;
|
||||
setTimeout(() => {
|
||||
this.show_alert_purchase = false;
|
||||
}, 4000);
|
||||
}
|
||||
},
|
||||
async submit() {
|
||||
this.$refs.purchase.validate();
|
||||
if (this.valid) {
|
||||
this.api.createPurchase(this.purchase)
|
||||
.then(data => {
|
||||
console.log('Compra enviada:', data);
|
||||
this.$router.push({
|
||||
path: "/summary_purchase",
|
||||
query : {id: parseInt(data.id)}
|
||||
});
|
||||
})
|
||||
.catch(error => console.error('Error al enviarl la compra:', error));
|
||||
} else {
|
||||
this.show_alert_purchase = true;
|
||||
setTimeout(() => {
|
||||
this.show_alert_purchase = false;
|
||||
}, 4000);
|
||||
}
|
||||
},
|
||||
navigate(route) {
|
||||
this.$router.push(route);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user