@@ -21,7 +21,7 @@ export function loadActualBookings(_actualBookings) {
21
21
$ ( 'divTabCahierTableActualBookings' ) . previousElementSibling . title =
22
22
bookableNbr + ' embarcations, ' + participantNbr + ' personnes' ;
23
23
24
- let children = $ ( 'divTabCahierTables' ) . children ;
24
+ const children = $ ( 'divTabCahierTables' ) . children ;
25
25
for ( let j = 0 ; j < children . length ; j ++ ) {
26
26
if (
27
27
children [ j ] . id != 'divTabCahierTableActualBookings' &&
@@ -52,7 +52,7 @@ function coloring(booking) {
52
52
}
53
53
54
54
function actualizeActualBookings ( _actualBookings ) {
55
- let all = $ ( 'divTabCahierTableActualBookings' ) . getElementsByClassName ( 'TableEntries' ) ;
55
+ const all = $ ( 'divTabCahierTableActualBookings' ) . getElementsByClassName ( 'TableEntries' ) ;
56
56
for ( let i = 0 ; i < all . length ; i ++ ) {
57
57
if ( all [ i ] . id != 'divTabCahierTableActualBookingsTopBar' ) {
58
58
all [ i ] . parentNode . removeChild ( all [ i ] ) ;
@@ -61,14 +61,14 @@ function actualizeActualBookings(_actualBookings) {
61
61
}
62
62
63
63
if ( _actualBookings . length == 0 ) {
64
- let entry = div ( $ ( 'divTabCahierTableActualBookings' ) ) ;
64
+ const entry = div ( $ ( 'divTabCahierTableActualBookings' ) ) ;
65
65
entry . classList . add ( 'TableEntries' ) ;
66
66
entry . classList . add ( 'TableEntriesHover' ) ;
67
67
div ( entry ) ;
68
68
}
69
69
70
70
for ( let j = 0 ; j < _actualBookings . length ; j ++ ) {
71
- let container = div ( $ ( 'divTabCahierTableActualBookings' ) ) ;
71
+ const container = div ( $ ( 'divTabCahierTableActualBookings' ) ) ;
72
72
container . id = j ;
73
73
container . classList . add ( 'TableEntries' ) ;
74
74
container . classList . add ( 'TableEntriesHover' ) ;
@@ -96,11 +96,11 @@ function actualizeActualBookings(_actualBookings) {
96
96
}
97
97
} ) ;
98
98
99
- let divDate = div ( container ) ;
99
+ const divDate = div ( container ) ;
100
100
101
- let maxHours = 24 ;
101
+ const maxHours = 24 ;
102
102
if ( Date . now ( ) - new Date ( _actualBookings [ j ] . startDate ) . getTime ( ) > ( maxHours / 6 ) * 60 * 60 * 1000 ) {
103
- let d = div ( divDate ) ;
103
+ const d = div ( divDate ) ;
104
104
d . classList . add ( 'TableEntriesAlert' ) ;
105
105
d . style . filter = 'grayscale(1) invert(1)' ;
106
106
d . title = '+ de 4 heures' ;
@@ -123,7 +123,7 @@ function actualizeActualBookings(_actualBookings) {
123
123
divDate . id = 'SORTING' + new Date ( _actualBookings [ j ] . startDate ) . toISOString ( ) ; // for the sorting
124
124
divDate . innerHTML += new Date ( _actualBookings [ j ] . startDate ) . getNiceTime ( ':' , true ) ;
125
125
126
- let participantCount = div ( container ) ;
126
+ const participantCount = div ( container ) ;
127
127
participantCount . innerHTML = _actualBookings [ j ] . participantCount ;
128
128
participantCount . title = Cahier . getSingularOrPlural ( _actualBookings [ j ] . participantCount ) ;
129
129
@@ -132,7 +132,7 @@ function actualizeActualBookings(_actualBookings) {
132
132
if ( _actualBookings [ j ] . bookables . length == 0 ) {
133
133
createBookingBookableBox ( div ( container ) ) ;
134
134
} else {
135
- let c = div ( container ) ;
135
+ const c = div ( container ) ;
136
136
for ( let k = 0 ; k < _actualBookings [ j ] . bookables . length ; k ++ ) {
137
137
createBookingBookableBox ( c , _actualBookings [ j ] . bookables [ k ] ) ;
138
138
}
@@ -142,9 +142,9 @@ function actualizeActualBookings(_actualBookings) {
142
142
143
143
div ( container ) . innerHTML = getStartCommentFromBooking ( _actualBookings [ j ] ) . shorten ( 200 , 16 ) ;
144
144
145
- let d = div ( container ) ;
145
+ const d = div ( container ) ;
146
146
d . title = 'Terminer ou modifier cette sortie' ;
147
- let btn = div ( d ) ;
147
+ const btn = div ( d ) ;
148
148
btn . classList . add ( 'Buttons' ) ;
149
149
}
150
150
sortTable ( $ ( 'divTabCahierTableActualBookings' ) ) ;
@@ -153,11 +153,11 @@ function actualizeActualBookings(_actualBookings) {
153
153
// new search system
154
154
export function bookingTableSearch ( _table ) {
155
155
let bookings ;
156
- let txts = _table . previousElementSibling . previousElementSibling . value . split ( ' ' ) ;
156
+ const txts = _table . previousElementSibling . previousElementSibling . value . split ( ' ' ) ;
157
157
// means finishedBookings
158
158
if ( _table != $ ( 'divTabCahierTableActualBookings' ) ) {
159
159
let i ;
160
- let all = document . getElementsByClassName ( 'BookingsTable' ) ;
160
+ const all = document . getElementsByClassName ( 'BookingsTable' ) ;
161
161
for ( i = 1 ; i < all . length ; i ++ ) {
162
162
if ( all [ i ] == _table ) {
163
163
break ;
@@ -168,7 +168,7 @@ export function bookingTableSearch(_table) {
168
168
// means actualBookings
169
169
bookings = Cahier . actualBookings ;
170
170
}
171
- let result = [ ] ;
171
+ const result = [ ] ;
172
172
173
173
for ( let t = 0 ; t < txts . length ; t ++ ) {
174
174
result [ t ] = [ ] ;
@@ -208,7 +208,7 @@ export function bookingTableSearch(_table) {
208
208
}
209
209
210
210
// merge but only take the bookings which are in every search result !
211
- let send = result . mergeAND ( ) ;
211
+ const send = result . mergeAND ( ) ;
212
212
if ( _table == $ ( 'divTabCahierTableActualBookings' ) ) {
213
213
actualizeActualBookings ( send ) ;
214
214
} else {
@@ -217,15 +217,15 @@ export function bookingTableSearch(_table) {
217
217
}
218
218
219
219
function createBookingBookableBox ( elem , bookable = { code : 'ZZZ' } ) {
220
- let d = div ( elem ) ;
220
+ const d = div ( elem ) ;
221
221
if ( bookable . code != null ) {
222
222
d . id = bookable . code ;
223
223
} else {
224
224
d . id = '999' ;
225
225
}
226
226
227
- let img = div ( d ) ;
228
- let code = div ( d ) ;
227
+ const img = div ( d ) ;
228
+ const code = div ( d ) ;
229
229
230
230
if ( bookable == Cahier . personalBookable ) {
231
231
img . style . backgroundImage = 'url(img/icons/own-sail.png)' ;
@@ -245,7 +245,7 @@ function createBookingBookableBox(elem, bookable = {code: 'ZZZ'}) {
245
245
246
246
if ( bookable . code != null ) {
247
247
code . innerHTML = bookable . code ;
248
- let codeLength = bookable . code . pixelLength ( 20 ) ;
248
+ const codeLength = bookable . code . pixelLength ( 20 ) ;
249
249
div ( d ) . innerHTML = bookable . name . shorten ( 170 - codeLength , 18 ) ;
250
250
} else {
251
251
code . innerHTML = '' ;
@@ -257,8 +257,8 @@ function createBookingBookableBox(elem, bookable = {code: 'ZZZ'}) {
257
257
258
258
export function loadTableTopBars ( allTables = document . getElementsByClassName ( 'BookingsTable' ) ) {
259
259
for ( let u = 0 ; u < allTables . length ; u ++ ) {
260
- let table = allTables [ u ] ;
261
- let top = table . getElementsByClassName ( 'TableTopBar' ) [ 0 ] ;
260
+ const table = allTables [ u ] ;
261
+ const top = table . getElementsByClassName ( 'TableTopBar' ) [ 0 ] ;
262
262
const all = top . getElementsByTagName ( 'div' ) ;
263
263
264
264
for ( let i = 0 ; i < all . length ; i = i + 2 ) {
@@ -277,7 +277,7 @@ export function loadTableTopBars(allTables = document.getElementsByClassName('Bo
277
277
this . getElementsByTagName ( 'div' ) [ 0 ] . style . backgroundImage = 'url(img/icons/sort-desc.png)' ;
278
278
}
279
279
280
- let allButtons = this . parentElement . getElementsByTagName ( 'div' ) ;
280
+ const allButtons = this . parentElement . getElementsByTagName ( 'div' ) ;
281
281
for ( let k = 0 ; k < all . length ; k = k + 2 ) {
282
282
if ( allButtons [ k ] != this ) {
283
283
allButtons [ k ] . classList . remove ( 'BookingsTopBarSorted' ) ;
@@ -295,8 +295,8 @@ export function loadTableTopBars(allTables = document.getElementsByClassName('Bo
295
295
}
296
296
297
297
function sortTable ( table ) {
298
- let field = parseInt ( table . getElementsByClassName ( 'BookingsTopBarSorted' ) [ 0 ] . id ) ;
299
- let order = function ( ) {
298
+ const field = parseInt ( table . getElementsByClassName ( 'BookingsTopBarSorted' ) [ 0 ] . id ) ;
299
+ const order = function ( ) {
300
300
if (
301
301
table . getElementsByClassName ( 'BookingsTopBarSorted' ) [ 0 ] . getElementsByTagName ( 'div' ) [ 0 ] . style
302
302
. backgroundImage == 'url("img/icons/sort-desc.png")'
@@ -307,7 +307,7 @@ function sortTable(table) {
307
307
}
308
308
} ;
309
309
310
- let all = table . getElementsByClassName ( 'TableEntries' ) ;
310
+ const all = table . getElementsByClassName ( 'TableEntries' ) ;
311
311
let switching = true ;
312
312
while ( switching ) {
313
313
switching = false ;
@@ -343,32 +343,32 @@ export function newBookingTable(date, title = '?') {
343
343
}
344
344
345
345
export function createBookingsTable ( date , title ) {
346
- let input = document . createElement ( 'input' ) ;
346
+ const input = document . createElement ( 'input' ) ;
347
347
input . type = 'text' ;
348
348
input . value = '' ;
349
349
input . spellcheck = false ;
350
350
input . placeholder = 'Rechercher' ;
351
351
$ ( 'divTabCahierTables' ) . appendChild ( input ) ;
352
352
353
- let t = div ( $ ( 'divTabCahierTables' ) ) ;
353
+ const t = div ( $ ( 'divTabCahierTables' ) ) ;
354
354
t . classList . add ( 'BookingsTableText' ) ;
355
355
if ( title == '?' ) {
356
356
title = date . getNiceDate ( ) ;
357
357
}
358
358
t . innerHTML = title ;
359
359
360
- let table = div ( $ ( 'divTabCahierTables' ) ) ;
360
+ const table = div ( $ ( 'divTabCahierTables' ) ) ;
361
361
input . onkeyup = function ( ) {
362
362
bookingTableSearch ( table ) ;
363
363
} ;
364
364
table . id = date . toISOString ( ) ;
365
365
table . classList . add ( 'BookingsTable' ) ;
366
366
367
- let topBar = div ( table ) ;
367
+ const topBar = div ( table ) ;
368
368
topBar . classList . add ( 'TableEntries' ) ;
369
369
topBar . classList . add ( 'TableTopBar' ) ;
370
370
371
- let fields = [
371
+ const fields = [
372
372
'' ,
373
373
'' ,
374
374
'' ,
@@ -378,7 +378,7 @@ export function createBookingsTable(date, title) {
378
378
'Commentaire de départ' ,
379
379
"Commentaire d'arrivée" ,
380
380
] ;
381
- let images = [
381
+ const images = [
382
382
'icons/start' ,
383
383
'icons/end' ,
384
384
'icons/participant-count' ,
@@ -390,10 +390,10 @@ export function createBookingsTable(date, title) {
390
390
] ;
391
391
392
392
for ( let i = 0 ; i < fields . length ; i ++ ) {
393
- let d = div ( topBar ) ;
393
+ const d = div ( topBar ) ;
394
394
d . id = i ;
395
395
div ( d ) ;
396
- let img = document . createElement ( 'img' ) ;
396
+ const img = document . createElement ( 'img' ) ;
397
397
img . src = 'img/' + images [ i ] + '.png' ;
398
398
img . alt = '?' ;
399
399
d . appendChild ( img ) ;
@@ -402,7 +402,7 @@ export function createBookingsTable(date, title) {
402
402
403
403
topBar . getElementsByTagName ( 'div' ) [ 0 ] . classList . add ( 'BookingsTopBarSorted' ) ;
404
404
405
- let b = div ( table ) ;
405
+ const b = div ( table ) ;
406
406
b . style . position = 'absolute' ;
407
407
b . style . width = '100%' ;
408
408
b . style . height = '2px' ;
@@ -415,13 +415,13 @@ export function createBookingsTable(date, title) {
415
415
}
416
416
417
417
export function createNoBookingMessage ( date ) {
418
- let t = div ( $ ( 'divTabCahierTables' ) ) ;
418
+ const t = div ( $ ( 'divTabCahierTables' ) ) ;
419
419
t . classList . add ( 'BookingsTableTextNoBooking' ) ;
420
420
t . innerHTML = 'Aucune sortie le ' + date . getNiceDate ( ) ;
421
421
}
422
422
423
423
export function actualizeFinishedBookingListForDay ( bookings , table ) {
424
- let all = table . getElementsByClassName ( 'TableEntries' ) ;
424
+ const all = table . getElementsByClassName ( 'TableEntries' ) ;
425
425
for ( let i = 0 ; i < all . length ; i ++ ) {
426
426
if ( all [ i ] . classList . contains ( 'TableTopBar' ) === false ) {
427
427
all [ i ] . parentNode . removeChild ( all [ i ] ) ;
@@ -438,13 +438,13 @@ export function actualizeFinishedBookingListForDay(bookings, table) {
438
438
table . previousElementSibling . title = bookableNbr + ' embarcations, ' + participantNbr + ' personnes' ;
439
439
440
440
if ( bookings . length === 0 ) {
441
- let ent = div ( table ) ;
441
+ const ent = div ( table ) ;
442
442
ent . classList . add ( 'TableEntries' ) ;
443
443
ent . classList . add ( 'TableEntriesHover' ) ;
444
444
div ( ent ) ;
445
445
} else {
446
446
for ( let i = 0 ; i < bookings . length ; i ++ ) {
447
- let entry = div ( table ) ;
447
+ const entry = div ( table ) ;
448
448
entry . id = i ;
449
449
entry . classList . add ( 'TableEntries' ) ;
450
450
entry . classList . add ( 'TableEntriesHover' ) ;
@@ -471,7 +471,7 @@ export function actualizeFinishedBookingListForDay(bookings, table) {
471
471
if ( bookings [ i ] . bookables . length === 0 ) {
472
472
createBookingBookableBox ( div ( entry ) ) ;
473
473
} else {
474
- let c = div ( entry ) ;
474
+ const c = div ( entry ) ;
475
475
for ( let k = 0 ; k < bookings [ i ] . bookables . length ; k ++ ) {
476
476
createBookingBookableBox ( c , bookings [ i ] . bookables [ k ] ) ;
477
477
}
0 commit comments