{"version":3,"file":"app-DRcuyo-a.js","sources":["../../../app/javascript/app.js"],"sourcesContent":["import $ from \"jquery\"\nconst { get } = $\n\nfunction hamburger_nav() {\n // Add class au clique\n $(\".js-hamburger-btn\").click(function () {\n $(\".layout-sidebar\").addClass(\"navbar--open\")\n })\n\n // supprime class au clique hors menu et hors btn humburger\n $(\"body\").click(function (cible) {\n if ($(cible.target).closest(\".layout-sidebar\").length || $(cible.target).closest(\".js-hamburger-btn\").length) {\n return\n } else {\n $(\".layout-sidebar\").removeClass(\"navbar--open\")\n }\n })\n}\n\nfunction table_dropdown_function() {\n $(document).on(\"click\", \".js-table-dropdown tbody tr:not(.table-dropdown-item)\", function (cible) {\n if (!$(cible.target).closest(\".td-actions\").length && $(this).next(\".table-dropdown-item\").length) {\n $(this).next(\".table-dropdown-item\").toggle().siblings(\".table-dropdown-item\").hide()\n $(this).not(\".js-module-open-modal\").toggleClass(\"table-tr--active\").siblings().removeClass(\"table-tr--active\")\n\n var link = $(this).data(\"href\")\n\n if (typeof link !== \"undefined\") {\n $.ajax({\n type: \"GET\",\n url: link\n })\n }\n }\n })\n\n $(\".table-booking-container tr:not(.table-dropdown-item)\").click(function () {\n if ($(\".table-booking-container thead\").css(\"display\") == \"none\") {\n tr_target = $(this).offset().top\n\n setTimeout(function () {\n $(\"html, body\").animate({ scrollTop: tr_target }, 300)\n }, 100)\n }\n })\n\n /* menu mobile */\n $(\".js-table-drop-menu-mobile\").click(function () {\n var target = $(this).attr(\"menu-mobile-target\")\n\n $(\".td-actions-menu\").each(function () {\n if ($(this).attr(\"menu-mobile-target\") == target) {\n var menu = $(this).find(\".dropdown-menu\").html()\n $(\".modal-menu-mobile-actions\").html(menu)\n $(\".modal-menu-mobile-container\").css(\"display\", \"flex\").hide().fadeIn()\n $(\"html\").css(\"overflow-y\", \"hidden\")\n }\n })\n })\n /* close click cancel */\n $(\".modal-menu-mobile-container .modal-menu-cancel button\").click(function () {\n $(\".modal-menu-mobile-container\").hide()\n $(\"html\").css(\"overflow-y\", \"auto\")\n })\n /* close click action */\n $(\".modal-menu-mobile-container .modal-menu-mobile-actions\").on(\"click\", \"a\", function () {\n $(\".modal-menu-mobile-container\").hide()\n $(\"html\").css(\"overflow-y\", \"auto\")\n })\n}\n\nfunction tab() {\n $(\".js-ajax-target\").on(\"click\", \".js-tab\", function () {\n $(this).addClass(\"tab--active\").siblings().removeClass(\"tab--active\")\n var dataLink = $(this).attr(\"data-tab\")\n if (dataLink == \"practical-informations\") {\n slist(\"sortlist\")\n activeAttributes()\n }\n\n $(this)\n .parents(\".js-ajax-target\")\n .find(\".js-tab-article-content\")\n .each(function () {\n var dataArticle = $(this).attr(\"data-tab\")\n if (dataArticle == dataLink) {\n $(this).addClass(\"tab-article-content--active\").siblings().removeClass(\"tab-article-content\")\n } else {\n $(this).removeClass(\"tab-article-content--active\")\n }\n })\n\n if (dataLink == \"messages\") {\n scrollLastMessageIntoView()\n }\n\n /*table_border_cell();*/\n })\n}\n\nfunction tablist() {\n // Accessibilitéc: assets/tablist_accessibility.js\n $(\".js-tablist__btn\").on(\"click\", function () {\n $(this).addClass(\"tab--active\")\n $(\".js-tablist__btn\").not(this).removeClass(\"tab--active\")\n })\n}\n\nfunction boxvisu_modal() {\n /* Close btn */\n // $(\".js-boxvisu-modal-container\").on(\"click\", \".js-boxvisu-close-btn\", function(){\n // $('.js-boxvisu-modal-container').fadeOut();\n // $(\"html, body\").css(\"overflow-y\",\"auto\");\n // });\n /* Reinit visibility boxvisu */\n // if ($('.js-boxvisu-modal-container').length && $(\".js-boxvisu-modal\").length && $(\".js-boxvisu-modal\").css(\"position\") != \"absolute\") {\n // $('.js-boxvisu-modal-container').css(\"display\", \"block\");\n // $(\"html, body\").css(\"overflow-y\",\"auto\");\n // }\n // else if ($('.js-boxvisu-modal-container').length && $(\".js-boxvisu-modal\").length && $(\".js-boxvisu-modal\").css(\"position\") == \"absolute\") {\n // $('.js-boxvisu-modal-container').css(\"display\", \"none\");\n // $(\"html, body\").css(\"overflow-y\",\"auto\");\n // }\n}\n\nfunction table_boxvisu_function() {\n var currentRequest = null\n $(\".js-table-with-boxvisu tbody tr\").each(function () {\n /* Charge contenu en ajax on click */\n $(this).click(function (cible) {\n /* si le clique n'est pas sur un td d'actions */\n if (!$(cible.target).closest(\".td-actions\").length) {\n var link = $(this).data(\"href\")\n\n $(this).addClass(\"table-tr--active\").siblings().removeClass(\"table-tr--active\")\n /* transition pour vue desktop */\n if ($(\".js-boxvisu-modal\").length && $(\".boxvisu__container\").css(\"display\") != \"none\") {\n $(\".boxvisu-loader.fa-spinner\").remove()\n $(\".js-boxvisu-with-table\").fadeOut(300, function () {\n $(\".boxvisu__container\").append(\"\")\n currentRequest = $.ajax({\n type: \"GET\",\n url: link,\n beforeSend: function () {\n if (currentRequest != null) {\n currentRequest.abort()\n }\n }\n }).done(function () {\n $(\".boxvisu-loader.fa-spinner\").remove()\n $(\".js-boxvisu-with-table\").fadeIn(300)\n })\n })\n } else if ($(\".js-boxvisu-modal\").length && $(\".boxvisu__container\").css(\"display\") == \"none\") {\n /* Affiche le overview__module sur mobile */\n var btn_data = $(this).attr(\"data-module\")\n /* Overflow html hidden pour éviter les multiples barres de scroll */\n $(\"html, body\").css(\"overflow-y\", \"hidden\")\n /* affiche le module associé */\n $(\".js-overview-module__content\").each(function () {\n var module_data = $(this).attr(\"data-module\")\n\n if (module_data == btn_data) {\n $(this).parents(\".js-modules-container\").fadeIn()\n $(\".js-overview-module__content\").not(this).removeClass(\"overview-module__content--open\")\n var box = $(this).find(\".overview-module__box\")\n\n $(this).fadeIn(300, function () {\n $(this).append(\"