diff --git a/manager_dashboard/src/pages/Management/ProductFormModal.jsx b/manager_dashboard/src/pages/Management/ProductFormModal.jsx index 25981ee..a7b447c 100644 --- a/manager_dashboard/src/pages/Management/ProductFormModal.jsx +++ b/manager_dashboard/src/pages/Management/ProductFormModal.jsx @@ -139,6 +139,13 @@ function buildFormFromProduct(product) { } : null, is_favorite: ps.is_favorite ?? false, favorite_sort_order: ps.favorite_sort_order ?? 0, })) ?? [], + digital_visible: product.digital_visible ?? true, + digital_available: product.digital_available ?? true, + digital_name: product.digital_name ?? '', + digital_description: product.digital_description ?? '', + digital_image_url: product.digital_image_url ?? '', + digital_price: product.digital_price ?? '', + digital_discount: product.digital_discount ?? '', } } @@ -425,6 +432,13 @@ export default function ProductFormModal({ product, categories, printers, onSave })), is_favorite: ps.is_favorite ?? false, favorite_sort_order: ps.favorite_sort_order ?? 0, })), + digital_visible: form.digital_visible, + digital_available: form.digital_available, + digital_name: form.digital_name || null, + digital_description: form.digital_description || null, + digital_image_url: form.digital_image_url || null, + digital_price: form.digital_price !== '' ? parseFloat(form.digital_price) : null, + digital_discount: form.digital_discount !== '' ? parseFloat(form.digital_discount) : null, } } @@ -463,6 +477,7 @@ export default function ProductFormModal({ product, categories, printers, onSave { key: 'options', label: 'Έξτρα', count: form.options.length }, ...form.preference_sets.map((ps, i) => ({ key: i, label: ps.name || `Προτ. ${i + 1}`, count: ps.choices.length })), { key: '__add_pref__', label: '+ Προτίμηση', isAdd: true }, + { key: 'digital_menu', label: 'Digital Menu' }, ] const favList = buildFavoritesList(form) @@ -699,6 +714,94 @@ export default function ProductFormModal({ product, categories, printers, onSave )} + {/* Digital Menu tab */} + {activeTab === 'digital_menu' && (() => { + const basePrice = parseFloat(form.base_price) || 0 + const dp = form.digital_price !== '' ? parseFloat(form.digital_price) : null + const disc = form.digital_discount !== '' ? parseFloat(form.digital_discount) : null + let customerPrice = basePrice + if (dp !== null && !isNaN(dp)) customerPrice = dp + else if (disc !== null && !isNaN(disc) && disc > 0) customerPrice = Math.round(basePrice * (1 - disc / 100) * 100) / 100 + + return ( +
+ {/* Section 1 — Visibility */} +
+

Ορατότητα

+
+ +
+ +

Uncheck to show as ‘Out of stock’

+
+
+
+ + {/* Section 2 — Display overrides */} +
+

Display overrides

+

Leave blank to use the standard product value

+
+
+ + setField('digital_name', e.target.value)} + placeholder={form.name || 'Leave blank to use product name'} /> +
+
+ +