diff --git a/src/facilities/incubator/incubatorInteract.js b/src/facilities/incubator/incubatorInteract.js index 8d85f3633512200546e6078d2b071ec19d6cf885..76dabaa79e5266c7c57aa744ea4eba4647811aa6 100644 --- a/src/facilities/incubator/incubatorInteract.js +++ b/src/facilities/incubator/incubatorInteract.js @@ -145,6 +145,7 @@ App.UI.incubator = function() { qlIncubatorSort.classList.add("bold"); qlIncubatorSort.id = "qlIncubatorSort"; qlIncubatorSort.append(V.sortIncubatorList); + sortingBar.append(qlIncubatorSort); sortingBar.append(`.`); linkArray = []; @@ -673,6 +674,52 @@ App.UI.incubator = function() { ); } return el; + + function sortIncubatorPossiblesByName() { + let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); + $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-name'); + $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); + } + + function sortIncubatorPossiblesByPregnancyWeek() { + let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); + $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-week'); + $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); + } + + function sortIncubatorPossiblesByPregnancyCount() { + let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); + $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-count'); + $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); + } + + function sortIncubatorPossiblesByReservedSpots() { + let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); + $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-reserved-spots'); + $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); + } + + function sortIncubatorPossiblesByPreviousSort() { + let sort = V.sortIncubatorList; + if (sort !== 'unsorted') { + if (sort === 'Name') { + sortIncubatorPossiblesByName(); + } else if (sort === 'Reserved Incubator Spots') { + sortIncubatorPossiblesByReservedSpots(); + } else if (sort === 'Pregnancy Week') { + sortIncubatorPossiblesByPregnancyWeek(); + } else if (sort === 'Number of Children') { + sortIncubatorPossiblesByPregnancyCount(); + } + } + } + + + + + + + } function tankSettings() { diff --git a/src/js/quickListJS.js b/src/js/quickListJS.js index ebc5d09ca57774aeebae92fcf0055b7e08769427..ba8b35020f5167f628c663b1e0b94a2a3fe5d8be 100644 --- a/src/js/quickListJS.js +++ b/src/js/quickListJS.js @@ -46,45 +46,6 @@ App.UI.quickBtnScrollToHandler = function() { }, $speed); }; -globalThis.sortIncubatorPossiblesByName = function() { - let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); - $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-name'); - $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); -}; - -globalThis.sortIncubatorPossiblesByPregnancyWeek = function() { - let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); - $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-week'); - $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); -}; - -globalThis.sortIncubatorPossiblesByPregnancyCount = function() { - let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); - $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-count'); - $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); -}; - -globalThis.sortIncubatorPossiblesByReservedSpots = function() { - let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); - $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-reserved-spots'); - $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); -}; - -globalThis.sortIncubatorPossiblesByPreviousSort = function() { - let sort = V.sortIncubatorList; - if (sort !== 'unsorted') { - if (sort === 'Name') { - sortIncubatorPossiblesByName(); - } else if (sort === 'Reserved Incubator Spots') { - sortIncubatorPossiblesByReservedSpots(); - } else if (sort === 'Pregnancy Week') { - sortIncubatorPossiblesByPregnancyWeek(); - } else if (sort === 'Number of Children') { - sortIncubatorPossiblesByPregnancyCount(); - } - } -}; - globalThis.sortNurseryPossiblesByName = function() { let $sortedNurseryPossibles = $('#ql-nursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-name');