productos, equivalencias, cross-sell y cantidades

This commit is contained in:
Lucas Tettamanti
2026-01-18 18:28:28 -03:00
parent 8cc4744c49
commit c7c56ddbfc
32 changed files with 4083 additions and 2073 deletions

View File

@@ -137,6 +137,11 @@ export const api = {
return fetch(u).then(r => r.json());
},
async getRecommendation(id) {
if (!id) return null;
return fetch(`/recommendations/${encodeURIComponent(id)}`).then(r => r.json());
},
async createRecommendation(data) {
return fetch("/recommendations", {
method: "POST",
@@ -156,4 +161,22 @@ export const api = {
async deleteRecommendation(id) {
return fetch(`/recommendations/${encodeURIComponent(id)}`, { method: "DELETE" }).then(r => r.json());
},
// Quantities (cantidades por producto/evento/persona)
async listQuantities() {
return fetch("/quantities").then(r => r.json());
},
async getProductQuantities(wooProductId) {
if (!wooProductId) return { rules: [] };
return fetch(`/quantities/${encodeURIComponent(wooProductId)}`).then(r => r.json());
},
async saveProductQuantities(wooProductId, rules) {
return fetch(`/quantities/${encodeURIComponent(wooProductId)}`, {
method: "PUT",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ rules }),
}).then(r => r.json());
},
};