Skip to content

Commit 6c29dc1

Browse files
committed
Drop unused code
1 parent c2e2a0b commit 6c29dc1

File tree

3 files changed

+3
-155
lines changed

3 files changed

+3
-155
lines changed

htdocs/cahier/methods.js

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -209,29 +209,9 @@ const Cahier = {
209209
}
210210
}
211211

212-
// not rechecking if bookables still available
213-
if (false) {
214-
//!options.checkIfBookablesNotAvailableWhenConfirming) {
215-
// if bookables already used
216-
let i;
217-
for (i = 0; i < Cahier.bookings[0].bookables.length; i++) {
218-
if (Cahier.bookings[0].bookables[i].available === false) {
219-
break;
220-
}
221-
}
222-
223-
if (Cahier.bookings[0].bookables.length != i) {
224-
popAlertBookablesNotAvailable(); // first terminates and then creates the new booking
225-
} else {
226-
Requests.createBooking();
227-
animate();
228-
}
229-
}
230212
// rechecking if bookings still available
231-
else {
232-
document.body.classList.add('waiting');
233-
Requests.checksBookablesAvailabilityBeforeConfirming(Cahier.bookings[0].bookables);
234-
}
213+
document.body.classList.add('waiting');
214+
Requests.checksBookablesAvailabilityBeforeConfirming(Cahier.bookings[0].bookables);
235215
}
236216
},
237217

htdocs/general/home.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ let options = {
1010
modifyBookablesButton: true,
1111
editBookingButton: true,
1212
finishAllBookingsWithBookable: false, // si créer une sortie avec une embarcation déjà utilisée, ça termine seulement le booking avec l'embarcation utilisée de M. Uti.
13-
// checkIfBookablesNotAvailableWhenConfirming: true,
1413
showAlertBookablesNotAvailable: false,
1514
showAlertNoWelcomeSession: true,
1615
minutesToEditBooking: 60, // after Fred's request

htdocs/general/pop-alert.js

Lines changed: 1 addition & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ function popAlertLate() {
6262
$('divTabCahierMember').getElementsByTagName('input')[0].focus();
6363
});
6464
}
65+
6566
function popAlertAlreadyHavingABooking(_owner) {
6667
let elem = openPopUp();
6768

@@ -429,138 +430,6 @@ function popAlertTooManyBookables() {
429430
});
430431
}
431432

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-
564433
function popAlertMissingLicense(_license, _bookable) {
565434
let elem = openPopUp();
566435

0 commit comments

Comments
 (0)