/*!
 * This file is part of FacturaScripts
 * Copyright (C) 2017-2024 Carlos Garcia Gomez  <carlos@facturascripts.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
var listViewDeleteCancel="",listViewDeleteConfirm="",listViewDeleteMessage="",listViewDeleteTitle="";function listViewCheckboxes(e){var t=$("#form"+e+" .listActionCB").prop("checked");$("#form"+e+" .listAction").each((function(){$(this).prop("checked",t)}))}function listViewDelete(e){const t=document.getElementById("dynamicListViewDeleteModal");t&&t.remove();const n=`\n    <div class="modal fade" id="dynamicListViewDeleteModal" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="dynamicListViewDeleteModalLabel" aria-hidden="true">\n      <div class="modal-dialog">\n        <div class="modal-content">\n          <div class="modal-header">\n            <h5 class="modal-title" id="dynamicConfirmActionModalLabel">${listViewDeleteTitle}</h5>\n            <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>\n          </div>\n          <div class="modal-body">\n            ${listViewDeleteMessage}\n          </div>\n          <div class="modal-footer">\n            <button type="button" class="btn btn-secondary btn-spin-action" data-bs-dismiss="modal">${listViewDeleteCancel}</button>\n            <button type="button" id="saveDynamicListViewDeleteModalBtn" class="btn btn-danger btn-spin-action">${listViewDeleteConfirm}</button>\n          </div>\n        </div>\n      </div>\n    </div>\n  `;document.body.insertAdjacentHTML("beforeend",n);const i=new bootstrap.Modal(document.getElementById("dynamicListViewDeleteModal"));return i.show(),document.getElementById("saveDynamicListViewDeleteModalBtn").addEventListener("click",(function(){listViewSetAction(e,"delete"),i.hide()})),document.getElementById("dynamicListViewDeleteModal").addEventListener("hidden.bs.modal",(function(){document.getElementById("dynamicListViewDeleteModal").remove()})),!1}function listViewOpenTab(e){$("#form"+e+" .toggle-ext-link").each((function(){$(this).hasClass("d-none")?$(this).removeClass("d-none"):$(this).addClass("d-none")}))}function listViewPrintAction(e,t){$("#form"+e).attr("target","_blank"),$("#form"+e+' :input[name="action"]').val("export"),$("#form"+e).append('<input type="hidden" name="option" value="'+t+'"/>'),$("#form"+e).submit(),$("#form"+e+' :input[name="action"]').val(""),$("#form"+e).attr("target",""),animateSpinner("remove")}function listViewSetAction(e,t){$("#form"+e+' :input[name="action"]').val(t),$("#form"+e).submit()}function listViewSetLoadFilter(e,t){$("#form"+e+' :input[name="loadfilter"]').val(t),$("#form"+e).submit()}function listViewSetOffset(e,t){$("#form"+e+' :input[name="action"]').val(""),$("#form"+e+' :input[name="offset"]').val(t),$("#form"+e).submit()}function listViewSetOrder(e,t){$("#form"+e+' :input[name="action"]').val(""),$("#form"+e+' :input[name="order"]').val(t),$("#form"+e).submit()}function listViewShowFilters(e){$("#form"+e+"Filters").toggle(500)}$(document).ready((function(){$(".clickableListRow").mousedown((function(e){if(1===e.which||2===e.which){var t=$(this).attr("data-href"),n=$(this).attr("data-bs-target");void 0!==t&&!1!==t&&(void 0!==n&&"_blank"===n?window.open($(this).attr("data-href")):2===e.which?$(".toggle-ext-link").each((function(){$(this).hasClass("d-none")?$(this).removeClass("d-none"):$(this).addClass("d-none")})):parent.document.location=$(this).attr("data-href"))}})),$(".noEnterKey").keypress((function(e){return!(13==e.which||13==e.keyCode)}))}));