Spaces:
Running
Running
I want you to create a complete, mobile-friendly **Stock & Production Management Web Application** for my factory that must run inside **Blogger (HTML/JS/CSS only, no PHP or backend)**. The system name will be **"Ittefaq Builder's Stock Management"** and footer must show **Designed By Usman**.
c70c429 verified Download script.js from star786/ittefaq-stockflow-pro: direct link, hf CLI and curl.
- Browser
- Download file 2.74 kB
-
https://huggingface.co/spaces/star786/ittefaq-stockflow-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/star786/ittefaq-stockflow-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/star786/ittefaq-stockflow-pro/resolve/main/script.js
2.74 kB
| // Shared utility functions | |
| function formatDate(date) { | |
| const d = new Date(date); | |
| return d.toLocaleDateString('en-US', { | |
| year: 'numeric', | |
| month: 'short', | |
| day: 'numeric' | |
| }); | |
| } | |
| function generateUniqueId() { | |
| return Date.now().toString(36) + Math.random().toString(36).substr(2); | |
| } | |
| function exportToExcel(data, fileName) { | |
| const ws = XLSX.utils.json_to_sheet(data); | |
| const wb = XLSX.utils.book_new(); | |
| XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); | |
| XLSX.writeFile(wb, `${fileName}.xlsx`); | |
| } | |
| function shareToWhatsApp(data) { | |
| let message = "Stock Report:\n\n"; | |
| data.forEach(item => { | |
| message += `${item.department}: ${item.quantity} ${item.size || ''}\n`; | |
| }); | |
| const url = `https://wa.me/?text=${encodeURIComponent(message)}`; | |
| window.open(url, '_blank'); | |
| } | |
| // Initialize tooltips | |
| function initTooltips() { | |
| const tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')); | |
| tooltipTriggerList.map(function (tooltipTriggerEl) { | |
| return new bootstrap.Tooltip(tooltipTriggerEl); | |
| }); | |
| } | |
| // Data validation | |
| function validateNumberInput(input) { | |
| return !isNaN(parseFloat(input)) && isFinite(input) && parseFloat(input) > 0; | |
| } | |
| // LocalStorage operations | |
| function backupToJSON() { | |
| const data = { | |
| production: JSON.parse(localStorage.getItem('productionData') || '[]'), | |
| stockOut: JSON.parse(localStorage.getItem('stockOutData') || '[]'), | |
| materials: JSON.parse(localStorage.getItem('materials') || '{}') | |
| }; | |
| return JSON.stringify(data); | |
| } | |
| function restoreFromJSON(json) { | |
| try { | |
| const data = JSON.parse(json); | |
| if (data.production) localStorage.setItem('productionData', JSON.stringify(data.production)); | |
| if (data.stockOut) localStorage.setItem('stockOutData', JSON.stringify(data.stockOut)); | |
| if (data.materials) localStorage.setItem('materials', JSON.stringify(data.materials)); | |
| return true; | |
| } catch (e) { | |
| console.error("Restore failed:", e); | |
| return false; | |
| } | |
| } | |
| // Initialize app when DOM is loaded | |
| document.addEventListener('DOMContentLoaded', function() { | |
| initTooltips(); | |
| // Toggle dark mode | |
| const darkModeToggle = document.getElementById('darkModeToggle'); | |
| if (darkModeToggle) { | |
| darkModeToggle.addEventListener('click', function() { | |
| document.documentElement.classList.toggle('dark'); | |
| localStorage.setItem('darkMode', document.documentElement.classList.contains('dark')); | |
| }); | |
| } | |
| // Check for saved dark mode preference | |
| if (localStorage.getItem('darkMode') === 'true') { | |
| document.documentElement.classList.add('dark'); | |
| } | |
| }); |