{"version":3,"file":"schedule-dehh42_N.js","sources":["../../../app/frontend/js/schedule.js"],"sourcesContent":["import $ from 'jquery'\nimport { createPopper } from '@popperjs/core'\nimport moment from 'moment'\n\nfunction applyFilters() {\n const requestedDisplacement = $('#DisplacementSelect').val();\n const requestedTeams = $('.filter-group.team-group .checkbox input')\n .toArray()\n .flatMap(function(element) {\n const $element = $(element);\n return $element.is(':checked') ? [$element.val()] : [];\n });\n\n if (requestedTeams.length === 0) {\n alert('You need to select at least one team!');\n return false;\n }\n\n const $rows = $('.schedule tr.body-row');\n let i = 0;\n const total = $rows.length;\n\n $rows.each(function() {\n const $this = $(this);\n const displacement = $this.find('.displacement').text().trim();\n const team = $this.find('.team').text().trim();\n const validDisplacement = requestedDisplacement === 'ALL' || displacement === requestedDisplacement;\n const validTeam = requestedTeams.includes(team);\n const validDate = !moment($this.find('.date').text(), 'MM/DD/YY').isBefore(moment(), 'day')\n const valid = validDisplacement && validTeam && validDate;\n $this.toggleClass('visible', valid);\n $this.toggleClass('invisible', !valid);\n $this.toggleClass('first', valid && i === 0);\n $this.toggleClass('last', valid && i === total - 1);\n $this.toggleClass('colored', valid && i % 2 === 0);\n if (valid) {\n i++;\n }\n });\n return true;\n}\n\n$(document).ready(function() {\n applyFilters();\n\n const $filter = $('.filter').first();\n const $button = $filter.find('.button');\n const $menu = $filter.find('.menu');\n const button = $button[0]\n const menu = $menu[0]\n\n $menu.hide();\n\n $('.filter .button').click(function() {\n $menu.show();\n $(this).parent().toggleClass('open');\n });\n\n $(document).click(function(e) {\n const $target = $(e.target);\n if ($target.closest('.filter .menu').length === 0 && $target.closest('.filter .button').length == 0) {\n $('.filter').removeClass('open');\n }\n });\n\n $('#DisplacementSelect').change(applyFilters);\n $('.filter-group.team-group .checkbox input').change(function() {\n if (!applyFilters()) {\n $(this).prop('checked', !$(this).is(':checked'));\n }\n });\n});\n"],"names":["applyFilters","requestedDisplacement","$","requestedTeams","element","$element","$rows","i","total","$this","displacement","team","validDisplacement","validTeam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