|
17 | 17 | function calculateRemainingTime(to: Date, currentNow: Date): string { |
18 | 18 | const diff = to.getTime() - currentNow.getTime(); |
19 | 19 | const minutes = Math.floor(diff / 60000); |
20 | | - return `${minutes} min verbleibend`; |
| 20 | + return `${minutes} `; |
21 | 21 | } |
22 | 22 |
|
23 | 23 | function formatTime(date: Date): string { |
|
30 | 30 | const diff = nextItem.from.getTime() - currentNow.getTime(); |
31 | 31 | return Math.floor(diff / 60000); // Minuten bis zum nächsten Termin |
32 | 32 | } |
| 33 | +
|
| 34 | + function calculateDuration(from: Date, to: Date): string { |
| 35 | + const diff = to.getTime() - from.getTime(); |
| 36 | + const minutes = Math.floor(diff / 60000); |
| 37 | + if (minutes < 60) { |
| 38 | + return `${minutes} min`; |
| 39 | + } else { |
| 40 | + const hours = Math.floor(minutes / 60); |
| 41 | + const remainingMinutes = minutes % 60; |
| 42 | + return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}min` : `${hours}h`; |
| 43 | + } |
| 44 | + } |
| 45 | +
|
| 46 | + function calculateMinutesUntil(from: Date, currentNow: Date): number { |
| 47 | + const diff = from.getTime() - currentNow.getTime(); |
| 48 | + return Math.floor(diff / 60000); |
| 49 | + } |
33 | 50 | </script> |
34 | 51 |
|
35 | 52 | <svelte:head> |
36 | 53 | <title>SLN Office - {room?.room || roomParam} | TRMNL</title> |
37 | | - <meta name="description" content="Raumbuchungen für {room?.room || roomParam}" /> |
| 54 | + <meta name="description" content="Bookings für {room?.room || roomParam}" /> |
38 | 55 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
39 | 56 | </svelte:head> |
40 | 57 |
|
41 | 58 | <div |
42 | | - style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 2px solid #000; padding-bottom: 10px;" |
| 59 | + style="display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #CCC; padding: 0 10px;" |
43 | 60 | > |
44 | 61 | <div> |
45 | 62 | <h1 style="font-size: 24px; font-weight: bold; color: #000; margin: 0;"> |
|
67 | 84 | </div> |
68 | 85 | {:else if currentItems.length === 0 && futureItems.length === 0} |
69 | 86 | <!-- Komplett frei - keine Termine --> |
70 | | - <div style="background: #666; color: #fff; padding: 40px; margin: 20px 0; text-align: center;"> |
71 | | - <div style="font-size: 48px; font-weight: bold;"> |
72 | | - FREE |
73 | | - </div> |
| 87 | + <div style="background: #666; color: #fff; padding: 40px; ; text-align: center;"> |
| 88 | + <div style="font-size: 100px; font-weight: bold;">FREE</div> |
74 | 89 | </div> |
75 | 90 | {:else} |
76 | 91 | <!-- Aktueller Termin läuft --> |
77 | 92 | {#if currentItems.length > 0} |
78 | 93 | {@const firstItem = currentItems[0]} |
79 | | - <div style="background: #000; color: #fff; padding: 20px; margin: 20px 0; text-align: center;"> |
80 | | - <div style="font-size: 36px; font-weight: bold; margin-bottom: 10px;"> |
81 | | - {calculateRemainingTime(firstItem.to, now)} |
82 | | - </div> |
83 | | - <div style="font-size: 14px; margin-bottom: 8px;"> |
84 | | - {formatTime(firstItem.from)} - {formatTime(firstItem.to)} Uhr |
85 | | - </div> |
86 | | - <div style="font-size: 16px; font-weight: bold; margin-bottom: 4px;"> |
87 | | - {firstItem.title || 'Buchung'} |
88 | | - </div> |
89 | | - <div style="font-size: 18px; font-weight: bold;"> |
90 | | - {firstItem.user.join(', ')} |
| 94 | + <div style="background: #000; color: #fff; padding: 20px; text-align: center;display: flex;"> |
| 95 | + <div style="width: 50%; float: left; text-align: left; font-size: 85px;">OCCUPIED</div> |
| 96 | + <div |
| 97 | + style="width: 50%; float: left; text-align: left; border-left: 1px solid #fff; padding-left: 50px;" |
| 98 | + > |
| 99 | + <div style="font-size: 36px; font-weight: bold; margin-bottom: 10px;"> |
| 100 | + <span style="font-size: 55px;">{calculateRemainingTime(firstItem.to, now)}min</span> remain |
| 101 | + </div> |
| 102 | + <div style="font-size: 18px; margin-bottom: 8px;"> |
| 103 | + {formatTime(firstItem.from)} - {formatTime(firstItem.to)} Uhr: |
| 104 | + {firstItem.title || 'Meeting'}<br /> |
| 105 | + {firstItem.user.join(', ')} |
| 106 | + </div> |
91 | 107 | </div> |
92 | 108 | </div> |
93 | | - <!-- Kein aktueller Termin, aber zukünftige vorhanden --> |
| 109 | + <!-- Kein aktueller Termin, aber zukünftige vorhanden --> |
94 | 110 | {:else if futureItems.length > 0} |
95 | 111 | {@const nextItem = futureItems[0]} |
96 | 112 | {@const freeMinutes = calculateFreeTime(futureItems, now)} |
97 | | - <div style="background: #666; color: #fff; padding: 20px; margin: 20px 0; text-align: center;"> |
98 | | - <div style="font-size: 36px; font-weight: bold; margin-bottom: 10px;"> |
99 | | - FREE FOR {freeMinutes} mins |
| 113 | + <div style="background: #666; color: #fff; padding: 20px; display: flex;"> |
| 114 | + <div |
| 115 | + style="font-size: 32px; font-weight: bold; margin-bottom: 10px; text-align: left; width: 30%; float: left;" |
| 116 | + > |
| 117 | + <span style="font-size: 70px;">FREE</span> <br />for {freeMinutes} mins |
100 | 118 | </div> |
101 | | - <div style="font-size: 14px; margin-bottom: 8px;"> |
102 | | - Nächster Termin: {formatTime(nextItem.from)} - {formatTime(nextItem.to)} Uhr |
103 | | - </div> |
104 | | - <div style="font-size: 16px; font-weight: bold; margin-bottom: 4px;"> |
105 | | - {nextItem.title || 'Buchung'} |
106 | | - </div> |
107 | | - <div style="font-size: 18px; font-weight: bold;"> |
108 | | - {nextItem.user.join(', ')} |
| 119 | + <div style="width: 70%;float: left; border-left: 1px solid #fff; padding-left: 50px;"> |
| 120 | + <div style="font-size: 24px; margin-bottom: 8px; text-align: left; "> |
| 121 | + <span style="font-size: 16px;"><strong>Upcoming:</strong></span> <br /> |
| 122 | + {formatTime(nextItem.from)} - {formatTime(nextItem.to)} Uhr<br /> |
| 123 | + {nextItem.title || 'Meeting'}<br /> |
| 124 | + {nextItem.user.join(', ')} |
| 125 | + </div> |
109 | 126 | </div> |
110 | 127 | </div> |
111 | 128 | {/if} |
112 | 129 |
|
113 | | - <!-- Weitere Buchungen als Liste --> |
| 130 | + <!-- Weitere Meetingen als Liste --> |
114 | 131 | <div style="margin: 20px 0;"> |
115 | | - <!-- Weitere aktuelle Buchungen (falls vorhanden) --> |
| 132 | + <!-- Weitere aktuelle Meetingen (falls vorhanden) --> |
116 | 133 | {#each currentItems.slice(1) as item} |
117 | 134 | <div style="background: #000; color: #fff; padding: 8px; margin-bottom: 4px;"> |
118 | 135 | <div style="font-weight: bold; font-size: 14px;">■ AKTIV: {item.user.join(', ')}</div> |
|
121 | 138 | </div> |
122 | 139 | {/each} |
123 | 140 |
|
124 | | - <!-- Zukünftige Buchungen (ohne erste, falls sie im Hero angezeigt wird) --> |
125 | | - {#each (currentItems.length > 0 ? futureItems : futureItems.slice(1)) as item} |
126 | | - <div style="color: #333; padding: 8px 0; border-bottom: 1px solid #ccc;"> |
127 | | - <div style="font-weight: bold; font-size: 14px;">□ GEPLANT: {item.user.join(', ')}</div> |
128 | | - <div>VON {formatTime(item.from)} Uhr BIS {formatTime(item.to)} Uhr</div> |
129 | | - <div>DAUER {item.duration}</div> |
| 141 | + <!-- Zukünftige Meetingen (ohne erste, falls sie im Hero angezeigt wird) --> |
| 142 | + {#each currentItems.length > 0 ? futureItems : futureItems.slice(1) as item} |
| 143 | + <div style="color: #333; padding: 8px 0; border-bottom: 2px solid #ccc;"> |
| 144 | + <div style="font-size: 18px; margin-left: 10px;"> |
| 145 | + 📅 <strong>in {calculateMinutesUntil(item.from, now)} min</strong> for {item.duration || |
| 146 | + calculateDuration(item.from, item.to)} |
| 147 | + | {item.title || 'Meeting'} |
| 148 | + </div> |
| 149 | + <div style="margin-left: 33px; font-size: 14px;"> |
| 150 | + {formatTime(item.from)} Uhr - {formatTime(item.to)} Uhr | {item.user.join(', ')} |
| 151 | + <br /> |
| 152 | + </div> |
130 | 153 | </div> |
131 | 154 | {/each} |
132 | 155 | </div> |
|
0 commit comments