@@ -62,6 +62,7 @@ function popAlertLate() {
62
62
$ ( 'divTabCahierMember' ) . getElementsByTagName ( 'input' ) [ 0 ] . focus ( ) ;
63
63
} ) ;
64
64
}
65
+
65
66
function popAlertAlreadyHavingABooking ( _owner ) {
66
67
let elem = openPopUp ( ) ;
67
68
@@ -429,138 +430,6 @@ function popAlertTooManyBookables() {
429
430
} ) ;
430
431
}
431
432
432
- function popAlertBookablesNotAvailable ( ) {
433
- if ( options . showAlertBookablesNotAvailable ) {
434
- // only show pop up if the option is activated, otherwise create the booking and finish the used bookings
435
-
436
- let elem = openPopUp ( ) ;
437
-
438
- let container = div ( elem ) ;
439
- container . classList . add ( 'PopUpAlertContainer' , 'available' ) ;
440
- container . classList . add ( 'Boxes' ) ;
441
-
442
- let close = div ( container ) ;
443
- close . className = 'divPopUpClose' ;
444
- close . onclick = function ( ) {
445
- closePopUp ( { target : elem } , elem ) ;
446
- } ;
447
-
448
- let d = div ( container ) ;
449
- d . style . textAlign = 'center' ;
450
- d . style . fontSize = '25px' ;
451
- d . innerHTML =
452
- "<img src='img/icons/alert.png' style='display: inline-block; vertical-align: middle; width:30px;'/> Embarcations déjà utilisées" ;
453
-
454
- grayBar ( container , 5 ) ;
455
- }
456
-
457
- let bookablesNotAvailable = [ ] ;
458
- for ( let i = 0 ; i < Cahier . bookings [ 0 ] . bookables . length ; i ++ ) {
459
- if ( Cahier . bookings [ 0 ] . bookables [ i ] . available === false ) {
460
- bookablesNotAvailable . push ( Cahier . bookings [ 0 ] . bookables [ i ] ) ;
461
- }
462
- }
463
-
464
- let nU , nV ;
465
- let bookingsToFinish = [ ] ;
466
-
467
- // 1.1
468
- if ( options . finishAllBookingsWithBookable ) {
469
- for ( let k = 0 ; k < bookablesNotAvailable . length ; k ++ ) {
470
- for ( let u = 0 ; u < Cahier . actualBookings . length ; u ++ ) {
471
- for ( let v = 0 ; v < Cahier . actualBookings [ u ] . bookables . length ; v ++ ) {
472
- if ( Cahier . actualBookings [ u ] . bookables [ v ] . id === bookablesNotAvailable [ k ] . id ) {
473
- nU = u ;
474
- nV = v ;
475
- break ;
476
- }
477
- }
478
- }
479
- bookingsToFinish = bookingsToFinish . concat ( Cahier . actualBookings [ nU ] . ids ) ;
480
- }
481
- bookingsToFinish = bookingsToFinish . deleteMultiples ( ) ;
482
- } else {
483
- for ( let k = 0 ; k < bookablesNotAvailable . length ; k ++ ) {
484
- for ( let u = 0 ; u < Cahier . actualBookings . length ; u ++ ) {
485
- for ( let v = 0 ; v < Cahier . actualBookings [ u ] . bookables . length ; v ++ ) {
486
- if ( Cahier . actualBookings [ u ] . bookables [ v ] . id === bookablesNotAvailable [ k ] . id ) {
487
- nU = u ;
488
- nV = v ;
489
- break ;
490
- }
491
- }
492
- }
493
- bookingsToFinish = bookingsToFinish . concat ( Cahier . actualBookings [ nU ] . ids [ nV ] ) ; // ids[nV]
494
- }
495
- }
496
-
497
- if ( options . showAlertBookablesNotAvailable ) {
498
- let t = div ( container ) ;
499
- let txt = '' ;
500
- for ( let w = 0 ; w < bookablesNotAvailable . length ; w ++ ) {
501
- txt +=
502
- '<li> Le ' +
503
- bookablesNotAvailable [ w ] . code +
504
- ' est déjà utilisé par ' +
505
- bookablesNotAvailable [ w ] . lastBooking . owner . name +
506
- '</li> <br/>' ;
507
- }
508
- txt += '' ;
509
- t . innerHTML = txt ;
510
-
511
- let names = [ ] ;
512
- for ( let x = 0 ; x < bookablesNotAvailable . length ; x ++ ) {
513
- names . push ( bookablesNotAvailable [ x ] . lastBooking . owner . name ) ;
514
- }
515
- names = names . deleteMultiples ( ) ;
516
-
517
- let pers = names [ 0 ] ;
518
- if ( names . length === 1 ) {
519
- pers = '* En continuant, la sortie de ' + pers + ' va être automatiquement terminée !' ;
520
- } else {
521
- for ( let y = 1 ; y < names . length - 1 ; y ++ ) {
522
- pers += ', ' + names [ y ] ;
523
- }
524
- pers += ' et de ' + names [ bookablesNotAvailable . length - 1 ] ;
525
- pers = '* En continuant, les sorties de ' + pers + ' vont être automatiquement terminées !' ;
526
- }
527
-
528
- let btnContainer = div ( container ) ;
529
- btnContainer . style . position = 'relative' ;
530
- btnContainer . style . textAlign = 'center' ;
531
-
532
- let btn = div ( btnContainer ) ;
533
- btn . classList . add ( 'Buttons' ) ;
534
- btn . style . display = 'inline-block' ;
535
- btn . innerHTML = 'Annuler' ;
536
- btn . addEventListener ( 'click' , function ( ) {
537
- closePopUp ( 'last' ) ;
538
- } ) ;
539
-
540
- btn = div ( btnContainer ) ;
541
- btn . classList . add ( 'Buttons' , 'ValidateButtons' ) ;
542
- btn . style . display = 'inline-block' ;
543
- btn . innerHTML = 'Continuer quand même*' ;
544
- btn . addEventListener ( 'click' , function ( ) {
545
- let comments = [ ] ;
546
- comments . fillArray ( bookingsToFinish . length , 'Terminée automatiquement' ) ;
547
- Requests . terminateBooking ( bookingsToFinish , comments , false ) ;
548
- animate ( ) ;
549
- closePopUp ( 'last' ) ;
550
- } ) ;
551
-
552
- let info = div ( btnContainer ) ;
553
- info . innerHTML = pers ;
554
- } else {
555
- // create & finish bookings directly as no pop up
556
- let comments = [ ] ;
557
- comments . fillArray ( bookingsToFinish . length , 'Terminée automatiquement' ) ;
558
- Requests . terminateBooking ( bookingsToFinish , comments , false ) ;
559
- animate ( ) ;
560
- closePopUp ( 'last' ) ;
561
- }
562
- }
563
-
564
433
function popAlertMissingLicense ( _license , _bookable ) {
565
434
let elem = openPopUp ( ) ;
566
435
0 commit comments