🖨️
Print Studio
NutriMaavu Label & Barcode Generator
`); w.document.close(); } async function printAllHubBarcodes() { const r = await api('GET', '/hub/orders'); const orders = Array.isArray(r.data) ? r.data : []; if (!orders.length) return toast('No orders found', 'error'); let html = ''; orders.forEach(o => { const qtys = []; if(o.qty_250g>0) for(let i=0;i0) for(let i=0;i0) for(let i=0;i0) for(let i=0;i { const pkg = o.pkg_uid||o.package_uid||'NM-PKG'; const bat = o.batter_uid||'NM-BAT'; const bars = generateBarcodeBars(pkg+'|'+bat+'|'+qty); html += `
🌿 NUTRIMAAVU
${o.customer_name||''} · ${qty}
${bars.map(h=>`
`).join('')}
${pkg}|${bat}|${qty}
`; }); }); const w = window.open('', '_blank'); w.document.write(`${html}`); w.document.close(); } // ── POUCH DESIGNER PAGE ────────────────────────────────────── async function loadPouchDesigner() { const el = document.getElementById('page-content'); el.innerHTML = '
'; const [pkgsR, battersR] = await Promise.all([ api('GET', '/packages'), api('GET', '/admin/batters'), ]); const pkgs = Array.isArray(pkgsR.data) ? pkgsR.data : []; const batters = Array.isArray(battersR.data) ? battersR.data : []; el.innerHTML = `
🎨 Pouch Label Designer
📏 Pouch Size Guide
250g → 100×150mm (Small)
500g → 140×200mm (Medium)
750g → 160×230mm (Large)
1kg → 180×260mm (XL)
🎨
Select package, batter & quantity to preview
`; } function updatePouchDesign() { const pkgSel = document.getElementById('pd-pkg'); const batSel = document.getElementById('pd-bat'); const qty = document.getElementById('pd-qty')?.value || '500g'; if (!pkgSel?.value || !batSel?.value) return; const pkgOpt = pkgSel.options[pkgSel.selectedIndex]; const batOpt = batSel.options[batSel.selectedIndex]; const pkg = { id:pkgSel.value, name:pkgOpt.dataset.name, color:pkgOpt.dataset.color||'#16a34a', emoji:pkgOpt.dataset.emoji||'🥘', uid:pkgOpt.dataset.uid }; const bat = { id:batSel.value, name:batOpt.dataset.name, name_ta:batOpt.dataset.nameTa||'', uid:batOpt.dataset.uid }; const sizes = {'250g':{w:'100mm',h:'150mm',wPx:200,hPx:300},'500g':{w:'140mm',h:'200mm',wPx:280,hPx:400},'750g':{w:'160mm',h:'230mm',wPx:320,hPx:460},'1000g':{w:'180mm',h:'260mm',wPx:360,hPx:520}}; const size = sizes[qty] || sizes['500g']; const mfg = new Date().toLocaleString('en-IN',{timeZone:'Asia/Kolkata',day:'2-digit',month:'short',year:'numeric'}); const bb = new Date(); bb.setHours(bb.getHours()+30); const bbStr = bb.toLocaleString('en-IN',{timeZone:'Asia/Kolkata',day:'2-digit',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'}); const barcode_uid = pkg.uid+'|'+bat.uid+'|'+qty; const bars = generateBarcodeBars(barcode_uid); const preview = document.getElementById('pouch-preview'); if (!preview) return; preview.innerHTML = `
FRONT PANEL
🌿 NUTRIMAAVU
SARA-DHANSIK FOOD PROCESSOR
${pkg.emoji}
${pkg.name}
Health Batter Mix
${bat.name}
${bat.name_ta??`
${bat.name_ta}
`:''}
${qty}
📌 Sticker area
❄️ Refrigerate 4°C · Use within 24hrs
nutrimaavu.com · Theni, Tamil Nadu
BACK PANEL
PRODUCT DETAILS
Product${bat.name}
Package${pkg.name}
Net Weight${qty}
MFG Date${mfg}
Best Before${bbStr}
Storage: Refrigerate below 4°C. Use within 24 hours of opening. 6 hours at room temperature.
Manufacturer: Sara-Dhansik Food Processor, Theni, Tamil Nadu - 625531
${bars.map(h=>`
`).join('')}
${barcode_uid}
📌 Delivery sticker area
`; } function printPouchLabel(panel) { const pkgSel = document.getElementById('pd-pkg'); const batSel = document.getElementById('pd-bat'); const qty = document.getElementById('pd-qty')?.value || '500g'; if (!pkgSel?.value || !batSel?.value) { alert('Please select Package and Batter first'); return; } const pkgOpt = pkgSel.options[pkgSel.selectedIndex]; const batOpt = batSel.options[batSel.selectedIndex]; const pkg = { name:pkgOpt.dataset.name, color:pkgOpt.dataset.color||'#16a34a', emoji:pkgOpt.dataset.emoji||'🥘', uid:pkgOpt.dataset.uid }; const bat = { name:batOpt.dataset.name, name_ta:batOpt.dataset.nameTa||'', uid:batOpt.dataset.uid }; const sizes = {'250g':'100mm 150mm','500g':'140mm 200mm','750g':'160mm 230mm','1000g':'180mm 260mm'}; const pageSize = sizes[qty] || '140mm 200mm'; const mfg = new Date().toLocaleString('en-IN',{timeZone:'Asia/Kolkata',day:'2-digit',month:'short',year:'numeric'}); const bb = new Date(); bb.setHours(bb.getHours()+30); const bbStr = bb.toLocaleString('en-IN',{timeZone:'Asia/Kolkata',day:'2-digit',month:'short',year:'numeric',hour:'2-digit',minute:'2-digit'}); const barcode_uid = pkg.uid+'|'+bat.uid+'|'+qty; const bars = generateBarcodeBars(barcode_uid); const barsHtml = bars.map(h=>`
`).join(''); const frontHtml = `
🌿 NUTRIMAAVU
SARA-DHANSIK FOOD PROCESSOR
${pkg.emoji}
${pkg.name}
${bat.name}
${bat.name_ta??`
${bat.name_ta}
`:''}
${qty}
[ Delivery Sticker Area ]
❄️ Refrigerate 4°C · Use within 24hrs · nutrimaavu.com
`; const backHtml = `
PRODUCT DETAILS
Product${bat.name}
Package${pkg.name}
Net Weight${qty}
MFG Date${mfg}
Best Before${bbStr}
Refrigerate below 4°C. Use within 24 hours. 6 hours at room temperature.
Mfr: Sara-Dhansik Food Processor, Theni, TN - 625531
${barsHtml}
${barcode_uid}
[ Delivery Sticker Area ]
`; const printContent = panel==='front'?frontHtml:panel==='back'?backHtml:frontHtml+backHtml; const w = window.open('', '_blank'); w.document.write(`Pouch Label ${printContent}`); w.document.close(); } // ── LOGO & DESIGN PAGE ─────────────────────────────────────── function loadLogoDesign() { const el = document.getElementById('page-content'); el.innerHTML = `
🌿
NutriMaavu Brand Assets
Logo, brand colors, and design files will be uploaded here.
Coming soon — contact admin to upload brand assets.
🏷️
Company Logo
Coming Soon
🎨
Package Designs
Coming Soon
🖨️
Print Templates
Coming Soon
Current Brand Colors
#16a34a
Primary
#0f6b35
Dark
#dcfce7
Light
#fbbf24
Gold
#18181b
Text
`; } // ── INIT ─────────────────────────────────────────────────────── if (TOKEN && USER) initApp(); else document.getElementById('auth-page').style.display = 'flex';