Differenze

Queste sono le differenze tra la revisione selezionata e la versione attuale della pagina.

Link a questa pagina di confronto

Entrambe le parti precedenti la revisioneRevisione precedente
Prossima revisione
Revisione precedente
gestione_turni_med [2025/08/12 10:05] neoadmingestione_turni_med [2025/08/12 10:16] (versione attuale) neoadmin
Linea 7: Linea 7:
         body {         body {
             font-family: Arial, sans-serif;             font-family: Arial, sans-serif;
-            margin: 20px;+            margin: 10px;
             background: #f5f5f5;             background: #f5f5f5;
 +            line-height: 1.4;
         }         }
                  
Linea 15: Linea 16:
             margin: 0 auto;             margin: 0 auto;
             background: white;             background: white;
-            padding: 20px+            padding: 15px
-            border-radius: 10px;+            border-radius: 8px;
             box-shadow: 0 2px 10px rgba(0,0,0,0.1);             box-shadow: 0 2px 10px rgba(0,0,0,0.1);
         }         }
Linea 24: Linea 25:
             background: linear-gradient(135deg, #2c3e50, #3498db);             background: linear-gradient(135deg, #2c3e50, #3498db);
             color: white;             color: white;
-            padding: 20px+            padding: 15px
-            border-radius: 10px+            border-radius: 8px
-            margin-bottom: 20px;+            margin-bottom: 15px; 
 +        } 
 +         
 +        .header h1 { 
 +            margin: 0 0 8px 0; 
 +            font-size: 22px; 
 +            font-weight: bold; 
 +        } 
 +         
 +        .header h2 { 
 +            margin: 0 0 5px 0; 
 +            font-size: 16px; 
 +            font-weight: normal; 
 +        } 
 +         
 +        .header p { 
 +            margin: 0; 
 +            font-size: 13px; 
 +            opacity: 0.9;
         }         }
                  
         .controls {         .controls {
             display: flex;             display: flex;
-            gap: 20px+            gap: 15px
-            margin-bottom: 20px;+            margin-bottom: 15px;
             flex-wrap: wrap;             flex-wrap: wrap;
 +            align-items: flex-end;
         }         }
                  
Linea 39: Linea 59:
             display: flex;             display: flex;
             flex-direction: column;             flex-direction: column;
-            gap: 5px;+            gap: 4px; 
 +        } 
 +         
 +        .control-group label { 
 +            font-size: 12px; 
 +            font-weight: bold; 
 +            color: #2c3e50;
         }         }
                  
         select, input, button {         select, input, button {
-            padding: 8px 12px;+            padding: 6px 10px;
             border: 1px solid #ddd;             border: 1px solid #ddd;
-            border-radius: 5px+            border-radius: 4px
-            font-size: 14px;+            font-size: 13px;
         }         }
                  
Linea 54: Linea 80:
             cursor: pointer;             cursor: pointer;
             font-weight: bold;             font-weight: bold;
 +            transition: background 0.3s;
         }         }
                  
Linea 760: Linea 787:
         }         }
  
-        function chiudiGestioneMedici() { +        function applicaStiliCaratteristiche(ws, numRighe, numColonne) { 
-            const gestione document.getElementById('gestioneMedici'); +            const range XLSX.utils.decode_range(ws['!ref']); 
-            if (gestionegestione.remove();+             
 +            const borderStyle = { 
 +                border: { 
 +                    top: { style: 'thin', color: { rgb: '000000' } }, 
 +                    bottom: { style: 'thin', color: { rgb: '000000' } }, 
 +                    left: { style: 'thin', color: { rgb: '000000' } }, 
 +                    right: { style: 'thin', color: { rgb: '000000' } } 
 +                } 
 +            }; 
 +             
 +            // Intestazione (riga 0) 
 +            for (let col = 0; col < numColonne; col++) { 
 +                const cellAddress = XLSX.utils.encode_cell({ r: 0, c: col }); 
 +                if (!ws[cellAddress]ws[cellAddress] = { v: '', s: {} }; 
 +                ws[cellAddress].s = { 
 +                    font: { bold: true, color: { rgb: 'FFFFFF' } }, 
 +                    fill: { fgColor: { rgb: '9b59b6' } }, 
 +                    alignment: { horizontal: 'center', vertical: 'center' }, 
 +                    border: borderStyle.border 
 +                }; 
 +            } 
 +             
 +            // Trova dove inizia la legenda 
 +            let inizioLegenda = -1; 
 +            for (let row = 0; row <= range.e.r; row++
 +                const cellAddress = XLSX.utils.encode_cell({ r: row, c: 0 }); 
 +                if (ws[cellAddress] && ws[cellAddress].v === 'LEGENDA') { 
 +                    inizioLegenda = row; 
 +                    break; 
 +                } 
 +            } 
 +             
 +            // Applica stili ai dati medici 
 +            for (let row = 1; row < (inizioLegenda > 0 ? inizioLegenda - 1 : range.e.r + 1); row++) { 
 +                for (let col = 0; col < numColonne; col++) { 
 +                    const cellAddress = XLSX.utils.encode_cell({ r: row, c: col }); 
 +                    if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                    ws[cellAddress].s = { 
 +                        alignment: { horizontal: 'center', vertical: 'center' }, 
 +                        border: borderStyle.border 
 +                    }; 
 +                } 
 +            } 
 +             
 +            // Applica stili alla legenda 
 +            if (inizioLegenda > 0) { 
 +                for (let row = inizioLegenda; row <= range.e.r; row++) { 
 +                    for (let col = 0; col < numColonne; col++) { 
 +                        const cellAddress = XLSX.utils.encode_cell({ r: row, c: col }); 
 +                        if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                         
 +                        if (row === inizioLegenda) { 
 +                            // Titolo legenda 
 +                            ws[cellAddress].s = { 
 +                                font: { bold: true, size: 12 }, 
 +                                fill: { fgColor: { rgb: 'f39c12' } }, 
 +                                alignment: { horizontal: 'center', vertical: 'center' }, 
 +                                border: borderStyle.border 
 +                            }; 
 +                        } else { 
 +                            // Contenuto legenda 
 +                            ws[cellAddress].s = { 
 +                                fill: { fgColor: { rgb: 'fef9e7' } }, 
 +                                alignment: { horizontal: 'center', vertical: 'center' }, 
 +                                border: borderStyle.border 
 +                            }; 
 +                        } 
 +                    } 
 +                } 
 +            } 
 +             
 +            // Larghezza colonne ottimizzata 
 +            ws['!cols'] = [ 
 +                { width: 8 }, { width: 10 }, { width: 15 }, { width: 10 }, { width: 10 }, 
 +                { width: 8 }, { width: 10 }, { width: 15 }, { width: 8 }, { width: 10 }, 
 +                { width: 15 }, { width: 8 }, { width: 10 }, { width: 10 }, { width: 10 } 
 +            ];
         }         }
  
Linea 794: Linea 897:
                                  
                 const ws = XLSX.utils.aoa_to_sheet(exportData);                 const ws = XLSX.utils.aoa_to_sheet(exportData);
 +                
 +                // Applica stili anche al foglio esportazione caratteristiche
 +                applicaStiliCaratteristiche(ws, exportData.length, 15);
 +                
                 XLSX.utils.book_append_sheet(wb, ws, 'Caratteristiche Medici');                 XLSX.utils.book_append_sheet(wb, ws, 'Caratteristiche Medici');
                                  
Linea 1888: Linea 1995:
                 const wb = XLSX.utils.book_new();                 const wb = XLSX.utils.book_new();
                                  
-                // FOGLIO 1: TURNI+                // FOGLIO 1: TURNI CON BORDI
                 const excelData = [];                 const excelData = [];
                                  
-                // Intestazioni+                // Intestazioni con stile
                 excelData.push(['P.O. "ALESSANDRO MANZONI" LECCO']);                 excelData.push(['P.O. "ALESSANDRO MANZONI" LECCO']);
                 excelData.push(['Dipartimento Materno-Infantile']);                 excelData.push(['Dipartimento Materno-Infantile']);
Linea 1900: Linea 2007:
                                  
                 // Intestazioni giorni                 // Intestazioni giorni
-                const rigaIntestazioni = ['', ''];+                const rigaIntestazioni = ['MEDICO', ''];
                 for (let giorno = 1; giorno <= giorni; giorno++) {                 for (let giorno = 1; giorno <= giorni; giorno++) {
                     const data = new Date(anno, mese, giorno);                     const data = new Date(anno, mese, giorno);
Linea 1913: Linea 2020:
                 const tuttiMedici = Object.keys(medici);                 const tuttiMedici = Object.keys(medici);
                 tuttiMedici.forEach(codMedico => {                 tuttiMedici.forEach(codMedico => {
-                    const rigaMedico = [medici[codMedico].nome, ''];+                    const rigaMedico = [medici[codMedico].nomeCompleto, ''];
                                          
                     for (let giorno = 1; giorno <= giorni; giorno++) {                     for (let giorno = 1; giorno <= giorni; giorno++) {
Linea 1934: Linea 2041:
  
                 const ws1 = XLSX.utils.aoa_to_sheet(excelData);                 const ws1 = XLSX.utils.aoa_to_sheet(excelData);
 +                
 +                // Applica stili e bordi al foglio turni
 +                applicaStiliExcel(ws1, excelData.length, rigaIntestazioni.length);
 +                
                 XLSX.utils.book_append_sheet(wb, ws1, 'Turni');                 XLSX.utils.book_append_sheet(wb, ws1, 'Turni');
  
Linea 1965: Linea 2076:
                                  
                 const ws2 = XLSX.utils.aoa_to_sheet(statsData);                 const ws2 = XLSX.utils.aoa_to_sheet(statsData);
 +                
 +                // Applica stili al foglio statistiche
 +                applicaStiliStatistiche(ws2, statsData.length, 11);
 +                
                 XLSX.utils.book_append_sheet(wb, ws2, 'Statistiche');                 XLSX.utils.book_append_sheet(wb, ws2, 'Statistiche');
  
-                // FOGLIO 3: VALIDAZIONE+                // FOGLIO 3: VALIDAZIONE CON BORDI
                 const validazione = validaTurniCompleti();                 const validazione = validaTurniCompleti();
                 const validazioneData = [];                 const validazioneData = [];
                 validazioneData.push(['VALIDAZIONE VINCOLI E CONTROLLI']);                 validazioneData.push(['VALIDAZIONE VINCOLI E CONTROLLI']);
 +                validazioneData.push([]);
 +                validazioneData.push(['RISULTATI', 'VALORE']);
                 validazioneData.push(['Controlli Superati', validazione.controlliSuperati]);                 validazioneData.push(['Controlli Superati', validazione.controlliSuperati]);
                 validazioneData.push(['Avvisi', validazione.avvisi.length]);                 validazioneData.push(['Avvisi', validazione.avvisi.length]);
-                validazioneData.push(['Errori', validazione.errori.length]);+                validazioneData.push(['Errori Critici', validazione.errori.length]); 
 +                validazioneData.push(['Punteggio Qualità (%)', validazione.punteggioQualita]);
                 validazioneData.push([]);                 validazioneData.push([]);
 +                
 +                if (validazione.successiImportanti.length > 0) {
 +                    validazioneData.push(['SUCCESSI IMPORTANTI', '']);
 +                    validazione.successiImportanti.forEach(successo => {
 +                        validazioneData.push([successo, '✅']);
 +                    });
 +                    validazioneData.push([]);
 +                }
                                  
                 if (validazione.avvisi.length > 0) {                 if (validazione.avvisi.length > 0) {
-                    validazioneData.push(['AVVISI:']);+                    validazioneData.push(['AVVISI (NON CRITICI)', '']);
                     validazione.avvisi.forEach(avviso => {                     validazione.avvisi.forEach(avviso => {
-                        validazioneData.push([avviso]);+                        validazioneData.push([avviso, '⚠️']);
                     });                     });
                     validazioneData.push([]);                     validazioneData.push([]);
Linea 1985: Linea 2111:
                                  
                 if (validazione.errori.length > 0) {                 if (validazione.errori.length > 0) {
-                    validazioneData.push(['ERRORI:']);+                    validazioneData.push(['ERRORI CRITICI', '']);
                     validazione.errori.forEach(errore => {                     validazione.errori.forEach(errore => {
-                        validazioneData.push([errore]);+                        validazioneData.push([errore, '❌']);
                     });                     });
                 }                 }
                                  
                 const ws3 = XLSX.utils.aoa_to_sheet(validazioneData);                 const ws3 = XLSX.utils.aoa_to_sheet(validazioneData);
 +                
 +                // Applica stili al foglio validazione
 +                applicaStiliValidazione(ws3, validazioneData.length, 2);
 +                
                 XLSX.utils.book_append_sheet(wb, ws3, 'Validazione');                 XLSX.utils.book_append_sheet(wb, ws3, 'Validazione');
  
-                // Esporta file+        // 🎨 FUNZIONI PER STILI EXCEL CON BORDI 
 +        function applicaStiliExcel(ws, numRighe, numColonne) { 
 +            const range = XLSX.utils.decode_range(ws['!ref']); 
 +             
 +            // Stili per bordi 
 +            const borderStyle = { 
 +                border: { 
 +                    top: { style: 'thin', color: { rgb: '000000' } }, 
 +                    bottom: { style: 'thin', color: { rgb: '000000' } }, 
 +                    left: { style: 'thin', color: { rgb: '000000' } }, 
 +                    right: { style: 'thin', color: { rgb: '000000' } } 
 +                } 
 +            }; 
 +             
 +            const headerStyle = { 
 +                font: { bold: true, color: { rgb: 'FFFFFF' } }, 
 +                fill: { fgColor: { rgb: '3498db' } }, 
 +                alignment: { horizontal: 'center', vertical: 'center' }, 
 +                border: { 
 +                    top: { style: 'medium', color: { rgb: '000000' } }, 
 +                    bottom: { style: 'medium', color: { rgb: '000000' } }, 
 +                    left: { style: 'medium', color: { rgb: '000000' } }, 
 +                    right: { style: 'medium', color: { rgb: '000000' } } 
 +                } 
 +            }; 
 +             
 +            const titleStyle = { 
 +                font: { bold: true, size: 14 }, 
 +                alignment: { horizontal: 'center' }, 
 +                border: borderStyle.border 
 +            }; 
 +             
 +            // Applica stili alle intestazioni (riga 7 - giorni) 
 +            for (let col = 0; col <= range.e.c; col++) { 
 +                const cellAddress = XLSX.utils.encode_cell({ r: 6, c: col }); 
 +                if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                ws[cellAddress].s = headerStyle; 
 +            } 
 +             
 +            // Applica bordi a tutte le celle dei dati 
 +            for (let row = 7; row <= range.e.r; row++) { 
 +                for (let col = 0; col <= range.e.c; col++) { 
 +                    const cellAddress = XLSX.utils.encode_cell({ r: row, c: col }); 
 +                    if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                     
 +                    if (col === 0) { 
 +                        // Prima colonna (nomi medici) - stile speciale 
 +                        ws[cellAddress].s = { 
 +                            font: { bold: true }, 
 +                            fill: { fgColor: { rgb: 'f8f9fa' } }, 
 +                            alignment: { horizontal: 'left', vertical: 'center' }, 
 +                            border: borderStyle.border 
 +                        }; 
 +                    } else { 
 +                        // Altre celle - bordi normali 
 +                        ws[cellAddress].s = { 
 +                            alignment: { horizontal: 'center', vertical: 'center' }, 
 +                            border: borderStyle.border 
 +                        }; 
 +                    } 
 +                } 
 +            } 
 +             
 +            // Applica stili ai titoli (prime 5 righe) 
 +            for (let row = 0; row < 5; row++) { 
 +                const cellAddress = XLSX.utils.encode_cell({ r: row, c: 0 }); 
 +                if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                ws[cellAddress].s = titleStyle; 
 +            } 
 +             
 +            // Imposta larghezza colonne 
 +            const colWidths = [{ width: 20 }, { width: 3 }]; 
 +            for (let i = 2; i < numColonne; i++) { 
 +                colWidths.push({ width: 12 }); 
 +            } 
 +            ws['!cols'] = colWidths; 
 +        } 
 +         
 +        function applicaStiliStatistiche(ws, numRighe, numColonne) { 
 +            const range = XLSX.utils.decode_range(ws['!ref']); 
 +             
 +            const borderStyle = { 
 +                border: { 
 +                    top: { style: 'thin', color: { rgb: '000000' } }, 
 +                    bottom: { style: 'thin', color: { rgb: '000000' } }, 
 +                    left: { style: 'thin', color: { rgb: '000000' } }, 
 +                    right: { style: 'thin', color: { rgb: '000000' } } 
 +                } 
 +            }; 
 +             
 +            // Intestazione (riga 1) 
 +            for (let col = 0; col < numColonne; col++) { 
 +                const cellAddress = XLSX.utils.encode_cell({ r: 1, c: col }); 
 +                if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                ws[cellAddress].s = { 
 +                    font: { bold: true, color: { rgb: 'FFFFFF' } }, 
 +                    fill: { fgColor: { rgb: '27ae60' } }, 
 +                    alignment: { horizontal: 'center', vertical: 'center' }, 
 +                    border: borderStyle.border 
 +                }; 
 +            } 
 +             
 +            // Dati 
 +            for (let row = 2; row <= range.e.r; row++) { 
 +                for (let col = 0; col < numColonne; col++) { 
 +                    const cellAddress = XLSX.utils.encode_cell({ r: row, c: col }); 
 +                    if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                    ws[cellAddress].s = { 
 +                        alignment: { horizontal: 'center', vertical: 'center' }, 
 +                        border: borderStyle.border 
 +                    }; 
 +                } 
 +            } 
 +             
 +            // Larghezza colonne 
 +            ws['!cols'] = [ 
 +                { width: 25 }, { width: 12 }, { width: 12 }, { width: 8 }, { width: 8 }, 
 +                { width: 10 }, { width: 10 }, { width: 12 }, { width: 8 }, { width: 12 }, { width: 12 } 
 +            ]; 
 +        } 
 +         
 +        function applicaStiliValidazione(ws, numRighe, numColonne) { 
 +            const range = XLSX.utils.decode_range(ws['!ref']); 
 +             
 +            const borderStyle = { 
 +                border: { 
 +                    top: { style: 'thin', color: { rgb: '000000' } }, 
 +                    bottom: { style: 'thin', color: { rgb: '000000' } }, 
 +                    left: { style: 'thin', color: { rgb: '000000' } }, 
 +                    right: { style: 'thin', color: { rgb: '000000' } } 
 +                } 
 +            }; 
 +             
 +            // Applica bordi a tutte le celle 
 +            for (let row = 0; row <= range.e.r; row++) { 
 +                for (let col = 0; col < numColonne; col++) { 
 +                    const cellAddress = XLSX.utils.encode_cell({ r: row, c: col }); 
 +                    if (!ws[cellAddress]) ws[cellAddress] = { v: '', s: {} }; 
 +                     
 +                    // Titoli sezioni in grassetto 
 +                    if (ws[cellAddress].v && typeof ws[cellAddress].v === 'string') { 
 +                        if (ws[cellAddress].v.includes('VALIDAZIONE') ||  
 +                            ws[cellAddress].v.includes('SUCCESSI') ||  
 +                            ws[cellAddress].v.includes('AVVISI') ||  
 +                            ws[cellAddress].v.includes('ERRORI')) { 
 +                            ws[cellAddress].s = { 
 +                                font: { bold: true, size: 12 }, 
 +                                fill: { fgColor: { rgb: 'e8f4fd' } }, 
 +                                alignment: { horizontal: 'left', vertical: 'center' }, 
 +                                border: borderStyle.border 
 +                            }; 
 +                        } else { 
 +                            ws[cellAddress].s = { 
 +                                alignment: { horizontal: 'left', vertical: 'center' }, 
 +                                border: borderStyle.border 
 +                            }; 
 +                        } 
 +                    } else { 
 +                        ws[cellAddress].s = { 
 +                            border: borderStyle.border 
 +                        }; 
 +                    } 
 +                } 
 +            } 
 +             
 +            // Larghezza colonne 
 +            ws['!cols'] = [{ width: 50 }, { width: 8 }]; 
 +        } 
 +                 
 +                // Esporta file con stili applicati
                 const fileName = `Turni_TIN_Perfezionati_${nomiMesi[mese]}_${anno}.xlsx`;                 const fileName = `Turni_TIN_Perfezionati_${nomiMesi[mese]}_${anno}.xlsx`;
                 XLSX.writeFile(wb, fileName);                 XLSX.writeFile(wb, fileName);
                                  
-                mostraMessaggio(`✅ File Excel esportato con successo: ${fileName}`, 'success');+                mostraMessaggio(`✅ File Excel esportato con bordi e stili: ${fileName}`, 'success');
                                  
             } catch (error) {             } catch (error) {
gestione_turni_med.1754985908.txt.gz · Ultima modifica: da neoadmin