{"version":3,"file":"site.min.js","sources":["site.js"],"sourcesContent":["$(document).on(\"change\", \".checkEstado\", function (event) {\r\n $.ajax({\r\n url: $(this).data(\"url\"),\r\n type: \"POST\",\r\n data: { id: $(this).data(\"id\") },\r\n success: function (result) {\r\n if (result.isSuccess) {\r\n Swal.fire({\r\n icon: \"success\",\r\n title: result.message,\r\n });\r\n } else {\r\n Swal.fire({\r\n icon: \"error\",\r\n title: \"Error \" + result.message,\r\n });\r\n }\r\n },\r\n error: function (result) {\r\n alert(\"OCURRIÓ UN ERROR, INTENTA MÁS TARDE\");\r\n },\r\n });\r\n});\r\n\r\n$(document).on(\"change\", \".cascada\", function (event) {\r\n let $this = $(this);\r\n let hijo = $this.data(\"hijo\");\r\n let id = $this.val();\r\n if (id === \"\") {\r\n return;\r\n }\r\n let keyName = \"id\";\r\n if (typeof $this.data(\"key\") !== \"undefined\") {\r\n keyName = $this.data(\"key\");\r\n }\r\n\r\n $.ajax({\r\n url: $this.data(\"url\"),\r\n method: \"POST\",\r\n data: {\r\n [keyName]: id,\r\n },\r\n })\r\n .done(function (result) {\r\n let noRetornar = $this.data(\"no-retornar\");\r\n let callback = $this.data(\"callback\");\r\n let existeCallback =\r\n typeof callback !== \"undefined\" && typeof window[callback] === \"function\";\r\n if (typeof noRetornar === \"undefined\" && existeCallback) {\r\n window[callback](result, id);\r\n return;\r\n }\r\n\r\n hijo = hijo.split(\";\");\r\n for (let index = 0; index < hijo.length; index++) {\r\n const identificador = hijo[index];\r\n const element = $(identificador);\r\n if (element.length != 0) {\r\n element.empty();\r\n result.forEach((item) => {\r\n let miSelect = document.querySelector(identificador);\r\n let opt = document.createElement(\"option\");\r\n opt.appendChild(document.createTextNode(item.text));\r\n opt.value = item.value;\r\n miSelect.appendChild(opt);\r\n });\r\n element.selectpicker(\"refresh\");\r\n if (\r\n element.data(\"val\") &&\r\n element.data(\"val\") != undefined &&\r\n element.data(\"val\") != null\r\n ) {\r\n element.val(element.data(\"val\"));\r\n }\r\n }\r\n }\r\n if (hijo.length) {\r\n if (existeCallback) {\r\n window[callback](result, id);\r\n }\r\n }\r\n })\r\n .fail(function () {\r\n alert(\"OCURRIÓ UN ERROR, INTENTA MÁS TARDE\");\r\n });\r\n});\r\n\r\nfunction getAntiForgeryToken() {\r\n return $(\"input[name=__RequestVerificationToken]\").val();\r\n}\r\n\r\n$.ajaxPrefilter(function (options, originalOptions, jqXHR) {\r\n try {\r\n if (\r\n typeof originalOptions === \"undefined\" ||\r\n (typeof originalOptions.method === \"undefined\" &&\r\n typeof originalOptions.type === \"undefined\")\r\n ) {\r\n return;\r\n }\r\n if (typeof originalOptions.method !== \"undefined\") {\r\n if (\r\n originalOptions.method.toUpperCase() !== \"POST\" ||\r\n options.method.toUpperCase() !== \"POST\"\r\n ) {\r\n return;\r\n }\r\n }\r\n if (typeof originalOptions.type !== \"undefined\") {\r\n if (\r\n originalOptions.type.toUpperCase() !== \"POST\" ||\r\n options.type.toUpperCase() !== \"POST\"\r\n ) {\r\n return;\r\n }\r\n }\r\n jqXHR.setRequestHeader(\"RequestVerificationToken\", getAntiForgeryToken());\r\n } catch (e) {\r\n return;\r\n }\r\n});\r\n\r\n$(document).ajaxComplete(function (e, request, settings) {\r\n if (request.status == 460 || request.status == 401) {\r\n swal.fire({\r\n icon: \"error\",\r\n text: \"¡Al parecer la sesión se ha vencido, la página será refrescada!\",\r\n }).then(() => this.location.reload());\r\n }\r\n})"],"names":["getAntiForgeryToken","$","val","document","on","event","ajax","url","this","data","type","id","success","result","isSuccess","Swal","fire","icon","title","message","error","alert","let","$this","hijo","keyName","method","done","noRetornar","callback","existeCallback","window","split","index","length","identificador","element","empty","forEach","miSelect","querySelector","opt","createElement","appendChild","createTextNode","item","text","value","selectpicker","undefined","fail","ajaxPrefilter","options","originalOptions","jqXHR","toUpperCase","setRequestHeader","e","ajaxComplete","request","settings","status","swal","then","location","reload"],"mappings":"AAuFA,SAASA,sBACL,OAAOC,EAAE,0CAA0CC,MAxFvDD,EAAEE,UAA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