1import { ad as R, U as V, c as g, f as v, e as n, g as t, F as z, r, L as Y, o as q, C as s, G as u, B as j, d as C, h as d, b as B, i as G, t as D, j as Q, ab as J } from "./vendor-DwBTsVHv.js"; 2import { _ as W, U as T } from "./app-CVhtgxmC.js"; 3u.config({ top: "85px", duration: 2, maxCount: 3 }); 4const X = { name: "Modules", components: { QuestionCircleOutlined: V, SearchOutlined: R }, props: {}, setup(O) { 5 const e = r([]), L = r(25), a = r([{ value: "25", label: "25" }, { value: "50", label: "50" }, { value: "100", label: "100" }]), H = r([{ title: "Nombre", dataIndex: "name", key: "name", width: "70%", customFilterDropdown: true, onFilter: (o, f) => f.name.toString().toLowerCase().includes(o.toLowerCase()), onFilterDropdownVisibleChange: (o) => { 6 o && setTimeout(() => { 7 S.value.focus(); 8 }, 100); 9 } }, { title: "Fecha de Creaci\xF3n", dataIndex: "create", key: "create" }, { title: "Gestionar", key: "manage", width: 150, class: "text-center" }]), E = r(false), N = r({ pageSize: 10, showSizeChanger: true, pageSizeOptions: ["10", "20", "30", "40"], showTotal: (o) => `Total: ${o}`, showSizeChange: (o, f) => this.pageSize = f }), c = r(false), b = r(false), i = r(false), k = r(false), x = r({ name: null }), _ = r({ id: null, name: null }), F = r(null), A = r(null), I = r(false), U = r(null), w = Y({ searchText: "", searchedColumn: "" }), S = r(), l = () => { 10 E.value = true, axios.get(route("admin.module.get_all_modules")).then((o) => { 11 e.value = o.data, E.value = false; 12 }).catch((o) => { 13 E.value = false, console.error(o); 14 }); 15 }; 16 return q(l), { modules: e, per_page_ant: L, options: a, columns: H, table_loading: E, pagination: N, visibleCreateModal: c, loadingCreateModal: b, visibleEditModal: i, loadingEditModal: k, form_create: x, form_edit: _, creating_errors: F, editing_errors: A, general_loading: I, on_filtered: U, searchInput: S, searchText: "", searchedColumn: "", handleSearch: (o, f, P) => { 17 f(), w.searchText = o[0], w.searchedColumn = P; 18 }, handleReset: (o) => { 19 o(), w.searchText = ""; 20 }, getAllModules: l, create: () => { 21 T.methods.$validateFormAnt(null), b.value = true, axios.post(route("admin.module.create"), x.value).then((o) => { 22 o.data.ok ? (l(), setTimeout(() => { 23 c.value = false, x.value.name = null, u.success("M\xF3dulo creado correctamente."); 24 }, 500)) : u.warning("Ha ocurrido un error al crear el m\xF3dulo."), b.value = false; 25 }).catch((o) => { 26 o.response.status === 422 ? (F.value = o.response.data.errors, T.methods.$validateFormAnt(o.response.data.errors)) : (u.error("Ha ocurrido un error al procesar la solicitud. Por favor intente m\xE1s tarde."), c.value = false), b.value = false; 27 }); 28 }, edit: () => { 29 T.methods.$validateFormAnt(null), k.value = true, axios.post(route("admin.module.edit"), _.value).then((o) => { 30 o.data.ok ? setTimeout(() => { 31 l(), i.value = false, _.value.id = null, _.value.name = null, u.success("M\xF3dulo modificado correctamente."); 32 }, 500) : u.warning("Ha ocurrido un error al modificar el m\xF3dulo."), k.value = false; 33 }).catch((o) => { 34 o.response.status === 422 ? (F.value = o.response.data.errors, T.methods.$validateFormAnt(o.response.data.errors)) : (u.error("Ha ocurrido un error al procesar la solicitud. Por favor intente m\xE1s tarde."), c.value = false), k.value = false; 35 }); 36 }, dateFormat: (o) => j(o).format("DD/MM/YYYY"), modalCreateCancel: () => { 37 x.value.name = null, T.methods.$validateFormAnt(null), c.value = false; 38 }, modalEditCancel: () => { 39 i.value = false; 40 }, showModalCreate: () => { 41 c.value = true; 42 }, showModalEdit: (o) => { 43 i.value = true, _.value.id = o.id, _.value.name = o.name; 44 }, removeModule: (o) => { 45 axios.post(route("admin.module.delete"), { id: o }).then((f) => { 46 if (f.data.ok) l(), u.success("M\xF3dulo eliminado correctamente."); 47 else switch (f.data.code) { 48 case 23e3: 49 u.error("No se puede eliminar el m\xF3dulo. Existen registros asignados al mismo."); 50 break; 51 case 0: 52 u.warning(f.data.msg); 53 break; 54 default: 55 u.error("Ha ocurrido un error al eliminar el usuario. Por favor intente mas tarde."); 56 break; 57 } 58 }).catch((f) => { 59 }); 60 } }; 61} }, Z = { class: "container-gestion-modulos" }, K = { style: { padding: "8px" } }, $ = { key: 0 }, ee = { key: 1 }, ae = { key: 2, class: "d-flex align-items-center justify-content-center" }, oe = ["onClick"]; 62function te(O, e, L, a, H, E) { 63 const N = s("a-divider"), c = s("a-input"), b = s("SearchOutlined"), i = s("a-button"), k = s("search-outlined"), x = s("question-circle-outlined"), _ = s("a-popconfirm"), F = s("a-table"), A = s("a-col"), I = s("a-row"), U = s("a-card"), w = s("a-input-group"), S = s("a-modal"); 64 return C(), g(z, null, [v("div", Z, [n(U, { bordered: false, style: { width: "100%" } }, { default: t(() => [n(N, { orientation: "left", class: "mt-0 mb-3" }, { default: t(() => [e[6] || (e[6] = d(" Administraci\xF3n de M\xF3dulos ")), v("button", { type: "button", class: "btn btn-primary btn-sm ml-1", onClick: e[0] || (e[0] = (...l) => a.showModalCreate && a.showModalCreate(...l)) }, e[5] || (e[5] = [v("i", { class: "ft-plus" }, null, -1), d(" Nuevo ")]))]), _: 1, __: [6] }), n(I, null, { default: t(() => [n(A, { span: 24 }, { default: t(() => [n(F, { columns: a.columns, "data-source": a.modules, "row-key": "id", pagination: a.pagination, loading: a.table_loading, size: "small", class: "ant-table-striped mt-1", "row-class-name": (l, m) => m % 2 === 1 ? "table-striped" : null }, { customFilterDropdown: t(({ setSelectedKeys: l, selectedKeys: m, confirm: h, clearFilters: p, column: y }) => [v("div", K, [n(c, { ref: "searchInput", placeholder: `Buscar ${y.dataIndex}`, value: m[0], style: { width: "188px", "margin-bottom": "8px", display: "block" }, onChange: (M) => l(M.target.value ? [M.target.value] : []), onPressEnter: (M) => a.handleSearch(m, h, y.dataIndex) }, null, 8, ["placeholder", "value", "onChange", "onPressEnter"]), n(i, { type: "primary", size: "small", style: { width: "90px", "margin-right": "8px" }, onClick: (M) => a.handleSearch(m, h, y.dataIndex) }, { icon: t(() => [n(b)]), default: t(() => [e[7] || (e[7] = d(" Buscar "))]), _: 2, __: [7] }, 1032, ["onClick"]), n(i, { size: "small", style: { width: "90px" }, onClick: (M) => a.handleReset(p) }, { default: t(() => e[8] || (e[8] = [d(" Reiniciar ")])), _: 2, __: [8] }, 1032, ["onClick"])])]), customFilterIcon: t(({ filtered: l }) => [n(k, { style: J({ color: l ? "#f13e4b" : void 0 }) }, null, 8, ["style"])]), bodyCell: t(({ text: l, column: m, record: h }) => [a.searchText && a.searchedColumn === m.dataIndex ? (C(), g("span", $, [(C(true), g(z, null, G(l.toString().split(new RegExp(`(?<=${a.searchText})|(?=${a.searchText})`, "i")), (p, y) => (C(), g(z, null, [p.toLowerCase() === a.searchText.toLowerCase() ? (C(), g("mark", { key: y, class: "highlight" }, D(p), 1)) : (C(), g(z, { key: 1 }, [d(D(p), 1)], 64))], 64))), 256))])) : B("", true), m.key === "create" ? (C(), g("span", ee, D(a.dateFormat(h.created_at)), 1)) : B("", true), m.key === "manage" ? (C(), g("div", ae, [v("a", { onClick: Q((p) => a.showModalEdit(h), ["prevent"]) }, e[9] || (e[9] = [v("i", { class: "fal fa-edit warning mr-1" }, null, -1)]), 8, oe), n(_, { "ok-text": "Eliminar", "cancel-text": "Cancelar", placement: "leftTop", onConfirm: (p) => a.removeModule(h.id) }, { icon: t(() => [n(x, { style: { color: "red" } })]), title: t(() => e[10] || (e[10] = [v("p", null, [d(" Est\xE1s seguro que deseas"), v("br"), d(" eliminar el m\xF3dulo? ")], -1)])), default: t(() => [e[11] || (e[11] = v("a", { href: "#" }, [v("i", { class: "far fa-trash danger" })], -1))]), _: 2, __: [11] }, 1032, ["onConfirm"])])) : B("", true)]), _: 1 }, 8, ["columns", "data-source", "pagination", "loading", "row-class-name"])]), _: 1 })]), _: 1 })]), _: 1 })]), n(S, { visible: a.visibleCreateModal, "onUpdate:visible": e[2] || (e[2] = (l) => a.visibleCreateModal = l), title: "Nuevo m\xF3dulo", centered: "" }, { footer: t(() => [n(i, { key: "back", disabled: a.loadingCreateModal, onClick: a.modalCreateCancel }, { default: t(() => e[12] || (e[12] = [d("Cancelar")])), _: 1, __: [12] }, 8, ["disabled", "onClick"]), n(i, { key: "submit", type: "primary", loading: a.loadingCreateModal, onClick: a.create }, { default: t(() => e[13] || (e[13] = [d("Crear")])), _: 1, __: [13] }, 8, ["loading", "onClick"])]), default: t(() => [n(w, { size: "large" }, { default: t(() => [n(c, { id: "name", value: a.form_create.name, "onUpdate:value": e[1] || (e[1] = (l) => a.form_create.name = l), placeholder: "Nombre del m\xF3dulo", name: "name" }, null, 8, ["value"])]), _: 1 })]), _: 1 }, 8, ["visible"]), n(S, { visible: a.visibleEditModal, "onUpdate:visible": e[4] || (e[4] = (l) => a.visibleEditModal = l), title: "Actualizar m\xF3dulo", centered: "" }, { footer: t(() => [n(i, { key: "back", disabled: a.loadingEditModal, onClick: a.modalEditCancel }, { default: t(() => e[14] || (e[14] = [d("Cancelar")])), _: 1, __: [14] }, 8, ["disabled", "onClick"]), n(i, { key: "submit", type: "primary", loading: a.loadingEditModal, onClick: a.edit }, { default: t(() => e[15] || (e[15] = [d("Actualizar")])), _: 1, __: [15] }, 8, ["loading", "onClick"])]), default: t(() => [n(w, { size: "large" }, { default: t(() => [n(c, { id: "edit_name", value: a.form_edit.name, "onUpdate:value": e[3] || (e[3] = (l) => a.form_edit.name = l), placeholder: "Nombre del m\xF3dulo", name: "name" }, null, 8, ["value"])]), _: 1 })]), _: 1 }, 8, ["visible"])], 64); 65} 66const ce = W(X, [["render", te]]); 67export { 68 ce as default 69};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.