// js/helpers/swal.js (function (global) { function saving() { return Swal.fire({ title: "Guardando…", text: "Por favor esperá un momento.", allowOutsideClick: false, allowEscapeKey: false, didOpen: () => Swal.showLoading(), }); } function ok(msg) { return Swal.fire({ icon: "success", title: "Listo", text: msg || "Operación realizada correctamente.", confirmButtonText: "Aceptar", }); } function warn(msg) { return Swal.fire({ icon: "warning", title: "Atención", text: msg || "Revisá la información ingresada.", confirmButtonText: "Aceptar", }); } function error(msg) { return Swal.fire({ icon: "error", title: "Error", text: msg || "Ocurrió un error.", confirmButtonText: "Aceptar", }); } function getErrorMessage(resp) { if (!resp) return "No se recibió respuesta del servidor."; if (typeof resp === "string") return resp; return resp.mensaje || resp.error || resp.message || "Ocurrió un error."; } global.SwalUI = { saving, ok, warn, error, getErrorMessage }; })(window);