mirror of
https://github.com/marcogll/ap_pos.git
synced 2026-01-13 13:15:16 +00:00
fix: Fix product import display and add payment methods
- Fix category mapping from 'Vanity Lashes'/'PMU Services' to 'Pestañas'/'Microblading' - Update global products array when loading from API - Add debug logging for categories and products count - Add new payment methods: Otros, Interno, GiftCard 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
17
app.js
17
app.js
@@ -2315,6 +2315,10 @@ async function loadProductsByCategories() {
|
|||||||
|
|
||||||
const allProducts = await response.json();
|
const allProducts = await response.json();
|
||||||
|
|
||||||
|
// Update global products array
|
||||||
|
products = allProducts;
|
||||||
|
console.log('Products loaded:', products.length);
|
||||||
|
|
||||||
// Group products by category
|
// Group products by category
|
||||||
const productsByCategory = {};
|
const productsByCategory = {};
|
||||||
allProducts.forEach(product => {
|
allProducts.forEach(product => {
|
||||||
@@ -2325,9 +2329,12 @@ async function loadProductsByCategories() {
|
|||||||
productsByCategory[category].push(product);
|
productsByCategory[category].push(product);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Populate each category
|
// Log categories found
|
||||||
renderProductsInCategory('Vanity Lashes', productsByCategory['Vanity Lashes'] || []);
|
console.log('Categories found:', Object.keys(productsByCategory));
|
||||||
renderProductsInCategory('PMU Services', productsByCategory['PMU Services'] || []);
|
|
||||||
|
// Populate each category - map to correct category names
|
||||||
|
renderProductsInCategory('Pestañas', productsByCategory['Pestañas'] || []);
|
||||||
|
renderProductsInCategory('Microblading', productsByCategory['Microblading'] || []);
|
||||||
renderProductsInCategory('Uñas', productsByCategory['Uñas'] || []);
|
renderProductsInCategory('Uñas', productsByCategory['Uñas'] || []);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -2338,10 +2345,10 @@ async function loadProductsByCategories() {
|
|||||||
function renderProductsInCategory(categoryName, products) {
|
function renderProductsInCategory(categoryName, products) {
|
||||||
let containerId;
|
let containerId;
|
||||||
switch(categoryName) {
|
switch(categoryName) {
|
||||||
case 'Vanity Lashes':
|
case 'Pestañas':
|
||||||
containerId = 'pestanas-products';
|
containerId = 'pestanas-products';
|
||||||
break;
|
break;
|
||||||
case 'PMU Services':
|
case 'Microblading':
|
||||||
containerId = 'microblading-products';
|
containerId = 'microblading-products';
|
||||||
break;
|
break;
|
||||||
case 'Uñas':
|
case 'Uñas':
|
||||||
|
|||||||
21
index.html
21
index.html
@@ -297,6 +297,27 @@
|
|||||||
<span>Transferencia</span>
|
<span>Transferencia</span>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
<label class="payment-option">
|
||||||
|
<input type="radio" name="m-metodo" value="Otros" />
|
||||||
|
<div class="payment-card">
|
||||||
|
<span class="payment-icon">💼</span>
|
||||||
|
<span>Otros</span>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<label class="payment-option">
|
||||||
|
<input type="radio" name="m-metodo" value="Interno" />
|
||||||
|
<div class="payment-card">
|
||||||
|
<span class="payment-icon">🏢</span>
|
||||||
|
<span>Interno</span>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<label class="payment-option">
|
||||||
|
<input type="radio" name="m-metodo" value="GiftCard" />
|
||||||
|
<div class="payment-card">
|
||||||
|
<span class="payment-icon">🎁</span>
|
||||||
|
<span>GiftCard</span>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user