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72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
// 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
}