Spaces:
Running
Running
Download script.js from Finitech/uv-print-wizard-pro: direct link, hf CLI and curl.
- Browser
- Download file 17.7 kB
-
https://huggingface.co/spaces/Finitech/uv-print-wizard-pro/resolve/main/script.js
- Command line
-
hf download hf://spaces/Finitech/uv-print-wizard-pro/script.js
-
curl -L -o script.js https://huggingface.co/spaces/Finitech/uv-print-wizard-pro/resolve/main/script.js
17.7 kB
| // Printer data | |
| const printers = [ | |
| { | |
| id: 'H7-35', | |
| name: 'H7-35', | |
| price: 6600, | |
| description: 'Compact UV printer ideal for small productions and rapid prototyping. The Bravo Jet H7-35 is the perfect solution for those seeking professional quality in a compact format.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/02/H7-35-img-prodotto-1024x808-1.png', | |
| specs: [ | |
| 'Print area: 300x500mm', | |
| 'Print height: Up to 18cm', | |
| 'Number of colors: 5 (CMYK + W)', | |
| 'Resolution: Up to 2880 dpi', | |
| 'Dimensions: 70x55x77cm', | |
| 'Weight: 60Kg' | |
| ], | |
| hasSpeedOptions: false | |
| }, | |
| { | |
| id: 'Cubic64', | |
| name: 'Cubic64', | |
| price: 13300, | |
| description: 'Advanced version with larger print area and improved precision. The Cubic64 offers superior performance with a compact and functional design.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/12/Cubic64new-scaled.png', | |
| specs: [ | |
| 'Print area: 400x600mm', | |
| 'Print height: Up to 15cm', | |
| 'Number of colors: 6 (CMYK + W + V)', | |
| 'Resolution: Up to 2880 dpi', | |
| 'Dimensions: 80x50x55cm', | |
| 'Weight: 90Kg' | |
| ], | |
| hasSpeedOptions: false | |
| }, | |
| { | |
| id: 'Cubic-UV-DTF', | |
| name: 'Cubic UV-DTF', | |
| price: 18300, | |
| description: 'Specialized for Direct to Film technology with professional results. Ideal for transfers on complex materials, prototyping or quick samples.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/12/Cubic64new-scaled.png', | |
| specs: [ | |
| 'Print area: 400x600mm', | |
| 'Print height: Up to 15cm', | |
| 'Number of colors: 6 (CMYK + W + V)', | |
| 'Resolution: Up to 2880 dpi', | |
| 'Dimensions: 80x50x55cm', | |
| 'Weight: 90Kg' | |
| ], | |
| hasSpeedOptions: false | |
| }, | |
| { | |
| id: '6090-UV', | |
| name: '6090 UV', | |
| price: 27000, | |
| description: 'Medium-large format for industrial production with high productivity. The Bravo Jet 6090 UV is the ideal choice for large-scale professional productions.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/02/6090.png', | |
| specs: [ | |
| 'Print area: 600x900mm', | |
| 'Print height: Up to 20cm', | |
| 'Number of colors: 6 (CMYK + W + V)', | |
| 'Resolution: Up to 5760 dpi', | |
| 'Dimensions: 130x158x75 cm', | |
| 'Weight: 140Kg' | |
| ], | |
| hasSpeedOptions: true | |
| }, | |
| { | |
| id: '1612', | |
| name: '1612', | |
| price: 35000, | |
| description: 'Large format for large-scale industrial production. The Bravo Jet 1612 offers exceptional performance for advanced industrial applications.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/02/1612finitechcdr.png', | |
| specs: [ | |
| 'Print area: 1200x1600mm', | |
| 'Print height: Up to 15cm', | |
| 'Number of colors: 6 (CMYK + W + V)', | |
| 'Resolution: Up to 5760 dpi', | |
| 'Dimensions: 305x185x143 cm', | |
| 'Weight: 550Kg' | |
| ], | |
| hasSpeedOptions: true | |
| }, | |
| { | |
| id: '2513', | |
| name: '2513', | |
| price: 50000, | |
| description: 'Extra-large format for industrial applications on large surfaces. The Bravo Jet 2513 is the ultimate solution for large-scale industrial printing.', | |
| image: 'https://www.finitechitalia.com/wp-content/uploads/2025/02/1612finitechcdr.png', | |
| specs: [ | |
| 'Print area: 1300x2500mm', | |
| 'Print height: Up to 15cm', | |
| 'Number of colors: 6 (CMYK + W + V)', | |
| 'Resolution: Up to 5760 dpi', | |
| 'Dimensions: 405x195x135cm', | |
| 'Weight: 850Kg' | |
| ], | |
| hasSpeedOptions: true | |
| } | |
| ]; | |
| // Speed options | |
| const speedOptions = [ | |
| { | |
| id: 'V1', | |
| name: 'V1 - Up to 8sqm/h', | |
| description: 'Standard speed with optimal print quality', | |
| price: 0 | |
| }, | |
| { | |
| id: 'V2', | |
| name: 'V2 - Up to 10sqm/h', | |
| description: 'Medium speed for extended productions', | |
| price: 7000 | |
| }, | |
| { | |
| id: 'V3', | |
| name: 'V3 - Up to 12sqm/h', | |
| description: 'Maximum speed indicated for numerous daily runs', | |
| price: 16000 | |
| } | |
| ]; | |
| // Additional options | |
| const additionalOptions = [ | |
| { | |
| id: 'preconfigured-computer', | |
| name: 'Preconfigured computer', | |
| description: 'Along with the printer, we provide the PC pre-installed and configured for immediate use. Essential if you want to request the Industry 4.0 or 5.0 bonus and avoid the stress of having to look for a computer.', | |
| price: 500, | |
| disabledFor: [] | |
| }, | |
| { | |
| id: 'on-site-installation', | |
| name: 'Transport, on-site installation, training', | |
| description: 'Complete service: transport, installation and training on site with a dedicated technician. This service becomes particularly useful for those who want to have a technician available for half a day at their premises.', | |
| price: 1200, | |
| disabledFor: [] | |
| }, | |
| { | |
| id: 'remote-installation', | |
| name: 'Transport, remote installation, training', | |
| description: 'The printer arrives directly to you and then you will be followed for half a day of online training. This service fits perfectly with small printers, given the simple and immediate use.', | |
| price: 800, | |
| disabledFor: ['6090-UV', '1612', '2513'] | |
| }, | |
| { | |
| id: 'color-kit', | |
| name: 'Color kit', | |
| description: 'Our inks are specifically designed to work with our heads guaranteeing the best print yield and preventing any hiccups on our printers.', | |
| price: 600, | |
| disabledFor: [] | |
| } | |
| ]; | |
| // Optional accessories | |
| const optionalAccessories = [ | |
| { | |
| id: 'rotary', | |
| name: 'Rotary for cylindrical surfaces', | |
| description: 'Allows printing on cylindrical objects such as bottles and flasks. It is possible to add this accessory at a later time to implement the printer functions.', | |
| price: 1500, | |
| disabledFor: ['1612', '2513'] | |
| }, | |
| { | |
| id: 'queen-module', | |
| name: 'Queen module', | |
| description: 'Camera module for real recognition of shapes and silhouettes, allows specific centering on the pieces in order to also print complex and/or different silhouettes.', | |
| price: 0, // Will be calculated based on printer | |
| disabledFor: ['H7-35', 'Cubic64', 'Cubic-UV-DTF'], | |
| dynamicPricing: { | |
| '6090-UV': 7000, | |
| '1612': 15000, | |
| '2513': 25000 | |
| } | |
| }, | |
| { | |
| id: 'maintenance', | |
| name: 'Ordinary maintenance', | |
| description: 'A service that includes a technical visit for a complete checkup of the printer, tuning and, if necessary, replacement of parts under warranty.', | |
| price: 800, | |
| disabledFor: [] | |
| } | |
| ]; | |
| // Initialize the configurator | |
| document.addEventListener('DOMContentLoaded', function() { | |
| loadPrinters(); | |
| loadSpeedOptions(); | |
| loadAdditionalOptions(); | |
| loadOptionalAccessories(); | |
| // Add event listeners to form fields | |
| document.querySelectorAll('input, select').forEach(element => { | |
| element.addEventListener('input', calculateTotal); | |
| }); | |
| }); | |
| // Load printers into the UI | |
| function loadPrinters() { | |
| const printerContainer = document.querySelector('.grid.grid-cols-1.md\\:grid-cols-2'); | |
| printers.forEach(printer => { | |
| const printerCard = document.createElement('div'); | |
| printerCard.className = 'border-2 border-gray-200 cursor-pointer p-4 printer-card rounded-lg'; | |
| printerCard.id = `printer-${printer.id}`; | |
| printerCard.innerHTML = ` | |
| <img src="${printer.image}" alt="${printer.name}" class="mb-3 printer-image"> | |
| <div class="flex items-start justify-between"> | |
| <h4 class="font-bold text-lg">${printer.name}</h4> | |
| </div> | |
| <p class="mt-2 text-gray-600 text-sm">${printer.description}</p> | |
| <div class="tech-specs"> | |
| <h4>Technical specifications:</h4> | |
| <ul> | |
| ${printer.specs.map(spec => `<li>${spec}</li>`).join('')} | |
| </ul> | |
| </div> | |
| `; | |
| printerCard.addEventListener('click', () => selectPrinter(printer.id, printer.price)); | |
| printerContainer.appendChild(printerCard); | |
| }); | |
| } | |
| // Load speed options into the UI | |
| function loadSpeedOptions() { | |
| const speedContainer = document.querySelector('#speed-selection-container .space-y-4'); | |
| speedOptions.forEach(speed => { | |
| const speedOption = document.createElement('label'); | |
| speedOption.className = 'checkbox-option cursor-pointer flex items-start'; | |
| speedOption.innerHTML = ` | |
| <input type="radio" name="speed" value="${speed.id}" data-prezzo="${speed.price}" class="hidden" onchange="calculateTotal()"> | |
| <span class="border border-gray-300 checkmark flex-shrink-0 h-5 mr-3 mt-1 rounded-full w-5"></span> | |
| <span class="flex-grow"> | |
| <span class="font-medium text-gray-800">${speed.name}</span> | |
| <p class="mt-1 text-gray-500 text-sm">${speed.description}</p> | |
| </span> | |
| `; | |
| speedContainer.appendChild(speedOption); | |
| }); | |
| } | |
| // Load additional options into the UI | |
| function loadAdditionalOptions() { | |
| const additionalOptionsContainer = document.getElementById('additional-options'); | |
| additionalOptions.forEach(option => { | |
| const optionElement = document.createElement('label'); | |
| optionElement.className = 'checkbox-option cursor-pointer flex items-start'; | |
| optionElement.id = `label-${option.id}`; | |
| optionElement.innerHTML = ` | |
| <input type="checkbox" id="${option.id}" name="options[]" value="${option.name}" data-prezzo="${option.price}" class="hidden" onchange="calculateTotal()"> | |
| <span class="border border-gray-300 checkmark flex-shrink-0 h-5 mr-3 mt-1 rounded w-5"></span> | |
| <span class="flex-grow"> | |
| <span class="font-medium text-gray-800">${option.name}</span> | |
| <p class="mt-1 text-gray-500 text-sm">${option.description}</p> | |
| </span> | |
| `; | |
| additionalOptionsContainer.appendChild(optionElement); | |
| }); | |
| } | |
| // Load optional accessories into the UI | |
| function loadOptionalAccessories() { | |
| const optionalAccessoriesContainer = document.getElementById('optional-accessories'); | |
| optionalAccessories.forEach(accessory => { | |
| const accessoryElement = document.createElement('label'); | |
| accessoryElement.className = 'checkbox-option cursor-pointer flex items-start'; | |
| accessoryElement.id = `label-${accessory.id}`; | |
| accessoryElement.innerHTML = ` | |
| <input type="checkbox" id="${accessory.id}" name="accessories[]" value="${accessory.name}" data-prezzo="${accessory.price}" class="hidden" onchange="calculateTotal()"> | |
| <span class="border border-gray-300 checkmark flex-shrink-0 h-5 mr-3 mt-1 rounded w-5"></span> | |
| <span class="flex-grow"> | |
| <span class="font-medium text-gray-800">${accessory.name}</span> | |
| <p class="mt-1 text-gray-500 text-sm">${accessory.description}</p> | |
| </span> | |
| `; | |
| optionalAccessoriesContainer.appendChild(accessoryElement); | |
| }); | |
| } | |
| // Select printer function | |
| function selectPrinter(printerId, price) { | |
| const printer = printers.find(p => p.id === printerId); | |
| document.getElementById('printer').value = printer.name; | |
| document.getElementById('printer').dataset.prezzo = price; | |
| // Update UI - remove selected class from all cards | |
| document.querySelectorAll('.printer-card').forEach(card => { | |
| card.classList.remove('selected', 'border-primary', 'bg-primary-50'); | |
| }); | |
| // Add selected class to clicked card | |
| document.getElementById(`printer-${printerId}`).classList.add('selected', 'border-primary', 'bg-primary-50'); | |
| // Show/hide speed selection | |
| const speedContainer = document.getElementById('speed-selection-container'); | |
| if (printer.hasSpeedOptions) { | |
| speedContainer.classList.remove('hidden'); | |
| // Reset speed selection when changing printer | |
| document.querySelectorAll('input[name="speed"]').forEach(radio => { | |
| radio.checked = false; | |
| }); | |
| } else { | |
| speedContainer.classList.add('hidden'); | |
| } | |
| // Manage disabled options | |
| manageOptions(printerId); | |
| calculateTotal(); | |
| } | |
| // Manage disabled options based on printer selection | |
| function manageOptions(printerId) { | |
| // Enable all options first | |
| document.querySelectorAll('input[type="checkbox"]').forEach(option => { | |
| option.disabled = false; | |
| document.getElementById(`label-${option.id}`).classList.remove('disabled-option'); | |
| }); | |
| // Disable additional options based on printer | |
| additionalOptions.forEach(option => { | |
| if (option.disabledFor.includes(printerId)) { | |
| document.getElementById(option.id).disabled = true; | |
| document.getElementById(`label-${option.id}`).classList.add('disabled-option'); | |
| document.getElementById(option.id).checked = false; | |
| } | |
| }); | |
| // Disable optional accessories based on printer | |
| optionalAccessories.forEach(accessory => { | |
| if (accessory.disabledFor.includes(printerId)) { | |
| document.getElementById(accessory.id).disabled = true; | |
| document.getElementById(`label-${accessory.id}`).classList.add('disabled-option'); | |
| document.getElementById(accessory.id).checked = false; | |
| } | |
| // Special handling for Queen module | |
| if (accessory.id === 'queen-module' && ['H7-35', 'Cubic64', 'Cubic-UV-DTF'].includes(printerId)) { | |
| document.getElementById(accessory.id).disabled = true; | |
| document.getElementById(`label-${accessory.id}`).classList.add('disabled-option'); | |
| document.getElementById(accessory.id).checked = false; | |
| } | |
| }); | |
| } | |
| // Calculate total price | |
| function calculateTotal() { | |
| const printer = document.getElementById('printer'); | |
| const checkboxes = document.querySelectorAll('input[name="options[]"]:checked, input[name="accessories[]"]:checked'); | |
| const name = document.getElementById('name').value; | |
| const surname = document.getElementById('surname').value; | |
| const email = document.getElementById('email').value; | |
| const phone = document.getElementById('phone').value; | |
| if (!printer.value) { | |
| document.getElementById('quote-summary').innerHTML = '<p class="text-gray-500 italic">Select a printer to begin</p>'; | |
| document.getElementById('generate-pdf-btn').disabled = true; | |
| return; | |
| } | |
| let total = parseFloat(printer.dataset.prezzo); | |
| let optionsList = `<li class="font-medium">${printer.value}</li>`; | |
| // Add speed option price if selected | |
| const speedOption = document.querySelector('input[name="speed"]:checked'); | |
| if (speedOption) { | |
| total += parseFloat(speedOption.dataset.prezzo); | |
| } | |
| checkboxes.forEach(checkbox => { | |
| let price = parseFloat(checkbox.dataset.prezzo); | |
| // Special handling for Queen module | |
| if (checkbox.value.includes('Queen module')) { | |
| const printerId = printers.find(p => p.name === printer.value).id; | |
| if (printerId === '6090-UV') { | |
| price = 7000; | |
| } else if (printerId === '1612') { | |
| price = 15000; | |
| } else if (printerId === '2513') { | |
| price = 25000; | |
| } | |
| } | |
| total += price; | |
| optionsList += `<li>+ ${checkbox.value}</li>`; | |
| }); | |
| // Update total display | |
| if (name && surname && email && phone) { | |
| document.getElementById('quote-summary').innerHTML = ` | |
| <div class="text-center"> | |
| <div class="mb-4 space-y-3"> | |
| <h4 class="font-medium text-gray-700">Your configuration:</h4> | |
| <ul class="space-y-1 text-gray-600 text-sm">${optionsList}</ul> | |
| </div> | |
| <p class="text-sm text-gray-500">Click "Request Quote" to receive the detailed quote</p> | |
| </div> | |
| `; | |
| } else { | |
| document.getElementById('quote-summary').innerHTML = ` | |
| <div class="text-center"> | |
| <div class="mb-4 space-y-3"> | |
| <h4 class="font-medium text-gray-700">Your configuration:</h4> | |
| <ul class="space-y-1 text-gray-600 text-sm">${optionsList}</ul> | |
| </div> | |
| <p class="text-sm text-gray-500">Fill all "Your details" fields to receive the detailed quote</p> | |
| </div> | |
| `; | |
| } | |
| // Enable/disable PDF button based on required fields | |
| const pdfBtn = document.getElementById('generate-pdf-btn'); | |
| if (name && surname && email && phone) { | |
| pdfBtn.disabled = false; | |
| pdfBtn.classList.remove('bg-gray-400'); | |
| pdfBtn.classList.add('bg-primary', 'hover:bg-primary-800'); | |
| } else { | |
| pdfBtn.disabled = true; | |
| pdfBtn.classList.remove('bg-primary', 'hover:bg-primary-800'); | |
| pdfBtn.classList.add('bg-gray-400'); | |
| } | |
| } | |
| // Generate PDF | |
| function generatePDF() { | |
| alert('PDF generation would happen here in a real implementation'); | |
| // In a real implementation, this would generate the PDF as shown in the original code | |
| } |