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AxC,EAAE,cAAeC,GAAawE,GAAG,QA/CjC,SAASQ,EAAaH,GACpBA,EAAEC,iBACF,IAAI9D,EAAUjB,EAAE8C,MAAMC,QAAQ,6BAC1B7B,EAAaD,EAAQE,KAAK,eAE9BF,EAAQP,SAAS,UACjBV,EAAE,oCAAsCkB,EAAa,KAAMjB,GAAaiF,WAAW,YACnF1C,GACF,EAyDF,GAEC,SAAUxC,GACT,SAASmF,IACP,IAAIC,EAAMpF,EAAE8C,MACRuC,EAAeD,EAAIE,SAAS,uCAC5BC,EAAaH,EAAII,QAAQ,YACzBC,EAAiBF,EAAWG,OAEhCH,SAAWrC,YAAY,oBACvBqC,EAAWrC,YAAY,aACvBuC,EAAevC,YAAY,aAEvBuC,EAAejF,SAAS,aAC1BR,EAAEyF,GAAgBtE,KAAK,YAAa,UAEpCnB,EAAEyF,GAAgBP,WAAW,aAG/BG,EAAaM,SAEN,CACT,CAEA3F,EAAE,YAAY4F,MAAM,WAClB5F,EAAE,uCAAuC2C,MAAMwC,EACjD,EACF,CAzBC,CAyBEpF","names":["jQuery","$","$filterForm","first","$button","operatorsWithoutValues","selectFilterTypes","$closeIcon","toggleProjectFilterForm","hasClass","removeClass","addClass","parseFilters","$advancedFilters","filters","each","_i","filter","$filter","filterName","attr","parsedOperator","val","parsedValue","parseFilterValue","operator","filterType","$valueBlock","checkbox","checked","includes","parseSelectFilterValue","selector","values","_","flatten","length","parseDateFilterValue","value","without","push","setSpacerVisibility","remaining","toggle","click","toggleMultiselect","$valueSelector","this","parents","$singleSelect","$multiSelect","toggleClass","submit","sendForm","show","orderParam","getUrlParameter","sParam","sParameterName","i","sPageURL","decodeURIComponent","window","location","search","substring","sURLVariables","split","undefined","query","encodeURIComponent","JSON","stringify","pathname","on","setValueVisibility","selectedOperator","$filterValue","addFilter","e","preventDefault","prop","removeFilter","removeAttr","toggleDescription","$el","otherTrigger","siblings","clickedRow","closest","descriptionRow","next","focus","ready"],"sourceRoot":"webpack:///","sources":["./src/app/core/augmenting/dynamic-scripts/project.js"],"sourcesContent":["//-- copyright\n// OpenProject is an open source project management software.\n// Copyright (C) 2012-2023 the OpenProject GmbH\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License version 3.\n//\n// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:\n// Copyright (C) 2006-2013 Jean-Philippe Lang\n// Copyright (C) 2010-2013 the ChiliProject Team\n//\n// This program is free software; you can redistribute it and/or\n// modify it under the terms of the GNU General Public License\n// as published by the Free Software Foundation; either version 2\n// of the License, or (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with this program; if not, write to the Free Software\n// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n//\n// See COPYRIGHT and LICENSE files for more details.\n//++\n\njQuery(function ($) {\n let $filterForm = $('form.project-filters').first();\n let $button = $('#projects-filter-toggle-button');\n let operatorsWithoutValues = ['*', '!*', 't', 'w'];\n let selectFilterTypes = ['list', 'list_all', 'list_optional'];\n let $closeIcon = $('#projects-filter-close-button');\n\n function toggleProjectFilterForm() {\n if ($button.hasClass('-active')) {\n $button.removeClass('-active');\n $filterForm.removeClass('-expanded');\n } else {\n $button.addClass('-active');\n $filterForm.addClass('-expanded');\n }\n }\n\n function parseFilters() {\n let $advancedFilters = $(\".advanced-filters--filter:not(.hidden)\", $filterForm);\n let filters = [];\n\n $advancedFilters.each(function (_i, filter) {\n let $filter = $(filter);\n let filterName = $filter.attr('filter-name');\n let parsedOperator = $('select[name=\"operator\"]', $filter).val();\n let parsedValue = parseFilterValue($filter, parsedOperator);\n\n if (parsedValue) {\n let filter = {}\n filter[filterName] = {'operator': parsedOperator, 'values': parsedValue};\n\n filters.push(filter);\n }\n });\n\n return filters;\n }\n\n function parseFilterValue($filter, operator) {\n let filterType = $filter.attr('filter-type');\n let $valueBlock = $('.advanced-filters--filter-value', $filter);\n let checkbox = $('input[type=\"checkbox\"]', $valueBlock)[0];\n\n if (checkbox) {\n return [checkbox.checked ? 't' : 'f'];\n }\n\n if (operatorsWithoutValues.includes(operator)) {\n return [];\n }\n\n if (selectFilterTypes.includes(filterType)) {\n // Operator expects presence of value(s)\n return parseSelectFilterValue($valueBlock);\n }\n\n if (['datetime_past', 'date'].includes(filterType)) {\n return parseDateFilterValue($valueBlock);\n }\n\n // not a select box nor datetime_past\n let value = $('input[name=\"value\"]', $valueBlock).val();\n if (value.length > 0) {\n return [value];\n }\n }\n\n function parseSelectFilterValue($valueBlock) {\n let selector;\n\n if ($valueBlock.hasClass('multi-value')) {\n selector = '.multi-select select[name=\"value[]\"]';\n } else {\n selector = '.single-select select[name=\"value\"]';\n }\n\n let values = $(selector, $valueBlock).val();\n values = _.flatten([values]);\n\n if (values.length > 0) {\n return values;\n }\n }\n\n function parseDateFilterValue($valueBlock) {\n let value;\n\n if ($valueBlock.hasClass('days')) {\n value = _.without([$('.days input[name=\"value\"]', $valueBlock).val()], '');\n } else if ($valueBlock.hasClass('on-date')) {\n value = _.without([$('.on-date input[name=\"value\"]', $valueBlock).val()], '');\n } else if ($valueBlock.hasClass('between-dates')) {\n let fromValue = $('.between-dates input[name=\"from_value\"]',\n $valueBlock).val();\n let toValue = $('.between-dates input[name=\"to_value\"]',\n $valueBlock).val();\n\n value = [fromValue, toValue];\n }\n\n if (value.length > 0) {\n return value;\n }\n }\n\n function sendForm() {\n $('#ajax-indicator').show();\n let filters = parseFilters();\n let orderParam = getUrlParameter('sortBy');\n\n\n let query = '?filters=' + encodeURIComponent(JSON.stringify(filters));\n if (orderParam && orderParam.length > 0) {\n query = query + '&sortBy=' + encodeURIComponent(orderParam);\n }\n\n window.location = window.location.pathname + query;\n return false;\n }\n\n function toggleMultiselect() {\n let $self = $(this);\n let $valueSelector = $self.parents('.advanced-filters--filter-value');\n\n let $singleSelect = $('.single-select select', $valueSelector);\n let $multiSelect = $('.multi-select select', $valueSelector);\n\n if ($valueSelector.hasClass('multi-value')) {\n let values = $multiSelect.val();\n let value = null;\n if (values && values.length > 1) {\n value = values[0];\n } else {\n value = values;\n }\n $singleSelect.val(value);\n } else {\n let value = $singleSelect.val();\n $multiSelect.val(value);\n }\n\n $valueSelector.toggleClass('multi-value');\n return false;\n }\n\n function addFilter(e) {\n e.preventDefault();\n $('[filter-name=\"' + $(this).val() + '\"]').removeClass('hidden');\n // If the user removes the filter the same filter has to be selectable from fresh again:\n $('#add_filter_select option:selected', $filterForm).prop('disabled', 'disabled');\n jQuery('#add_filter_select option:first-of-type').prop('selected', 'selected');\n setSpacerVisibility();\n return false;\n }\n\n function removeFilter(e) {\n e.preventDefault();\n let $filter = $(this).parents('.advanced-filters--filter');\n let filterName = $filter.attr('filter-name');\n\n $filter.addClass('hidden');\n $('#add_filter_select option[value=\"' + filterName + '\"]', $filterForm).removeAttr('disabled');\n setSpacerVisibility();\n }\n\n function setSpacerVisibility() {\n let remaining = $(\".advanced-filters--filter:not(.hidden)\").length;\n $('.advanced-filters--spacer').toggle(remaining > 0);\n }\n\n function setValueVisibility() {\n const selectedOperator = $(this).val();\n const $filter = $(this).parents('.advanced-filters--filter')\n const $filterValue = $('.advanced-filters--filter-value', $filter);\n if (['*', '!*', 't', 'w'].includes(selectedOperator)) {\n $filterValue.addClass('hidden');\n } else {\n $filterValue.removeClass('hidden');\n }\n\n if (['>t-', 't+', 't+'].includes(selectedOperator)) {\n $filterValue.addClass('days');\n $filterValue.removeClass('on-date');\n $filterValue.removeClass('between-dates');\n } else if (selectedOperator == '=d') {\n $filterValue.addClass('on-date');\n $filterValue.removeClass('days');\n $filterValue.removeClass('between-dates');\n } else if (selectedOperator == \"<>d\") {\n $filterValue.addClass('between-dates');\n $filterValue.removeClass('days');\n $filterValue.removeClass('on-date');\n }\n }\n\n // Register event listeners\n $('.advanced-filters--filter-value a.multi-select-toggle').click(toggleMultiselect);\n $button.click(toggleProjectFilterForm);\n $closeIcon.click(toggleProjectFilterForm);\n $filterForm.submit(sendForm);\n $('select[name=\"operator\"]', $filterForm).on('change', setValueVisibility)\n $('#add_filter_select', $filterForm).on('change', addFilter);\n $('.filter_rem', $filterForm).on('click', removeFilter);\n\n\n // Helpers\n function getUrlParameter(sParam) {\n var sPageURL = decodeURIComponent(window.location.search.substring(1)),\n sURLVariables = sPageURL.split('&'),\n sParameterName,\n i;\n\n for (i = 0; i < sURLVariables.length; i++) {\n sParameterName = sURLVariables[i].split('=');\n\n if (sParameterName[0] === sParam) {\n return sParameterName[1] === undefined ? true : sParameterName[1];\n }\n }\n };\n});\n\n(function ($) {\n function toggleDescription() {\n let $el = $(this);\n let otherTrigger = $el.siblings('.projects-table--description-toggle');\n let clickedRow = $el.closest('.project');\n let descriptionRow = clickedRow.next();\n\n clickedRow.toggleClass('-no-highlighting');\n clickedRow.toggleClass('-expanded');\n descriptionRow.toggleClass('-expanded');\n\n if (descriptionRow.hasClass('-expanded')) {\n $(descriptionRow).attr('aria-live', 'polite');\n } else {\n $(descriptionRow).removeAttr('aria-live');\n }\n\n otherTrigger.focus();\n\n return false;\n }\n\n $('document').ready(function () {\n $('.projects-table--description-toggle').click(toggleDescription);\n });\n})(jQuery);\n"],"x_google_ignoreList":[]}