1import { _ as T, I as m, g as d, C as n, d as c, e as a, f as r, h as i, c as N, b as _, F as B } from "./vendor-DwBTsVHv.js"; 2import { _ as q } from "./app-Ci_-ARAC.js"; 3const F = { name: "AppScheduledNotifications", props: ["groups"], data() { 4 return { open_modal_scheduled: false, scheduled_form: { id: null, name: null, description: null, status: 1, group_id: null, date_send: null }, scheduled_rows: [], scheduled_columns: [{ title: "#", dataIndex: "id", key: "id" }, { title: "Nombre", dataIndex: "name", key: "name" }, { title: "Descripci\xF3n", dataIndex: "description", key: "description" }, { title: "Grupo", dataIndex: "group_name", key: "group_name" }, { title: "Estado", dataIndex: "status", key: "status" }, { title: "Fecha env\xEDo", dataIndex: "date_send", key: "date_send" }, { title: "Gestionar", dataIndex: "actions", key: "actions" }, { title: "Eliminar", dataIndex: "delete", key: "delete" }], scheduled_table_loading: false, scheduled_loading_btn: false, scheduled_loading_search: false, scheduled_search: null, scheduled_pagination: { pageSize: 20, showSizeChanger: true, pageSizeOptions: ["20", "30", "40", "50", "100"], showTotal: (t) => `Total: ${this.totalScheduledNotifications}` }, scheduled_current_page: 1, scheduled_page_size_request: 20, totalScheduledNotifications: 0 }; 5}, created() { 6 this.getScheduledNotifications(this.scheduled_search); 7}, methods: { getCurrentDateTimeLocal() { 8 const t = /* @__PURE__ */ new Date(), e = t.getTimezoneOffset() * 6e4; 9 return new Date(t.getTime() - e).toISOString().slice(0, 16); 10}, filterOption(t, e) { 11 return e.label.toLowerCase().indexOf(t.toLowerCase()) >= 0; 12}, getScheduledNotifications(t) { 13 t != null && (this.scheduled_loading_search = true), this.scheduled_table_loading = true, axios.post(route("admin.app.getScheduledNotifications"), { search: t, current_page: this.scheduled_current_page, page_size: this.scheduled_page_size_request }).then((e) => { 14 this.scheduled_rows = e.data.result; 15 const p = { ...this.scheduled_pagination }; 16 p.total = e.data.total_registers, this.totalScheduledNotifications = e.data.total_registers, this.scheduled_pagination = p, this.scheduled_table_loading = false, this.scheduled_loading_search = false; 17 }).catch(() => { 18 this.scheduled_table_loading = false, this.scheduled_loading_search = false; 19 }); 20}, searchScheduledByName: T.debounce(function() { 21 this.scheduled_search.length >
21= 3 ? (this.scheduled_current_page = 1, this.getScheduledNotifications(this.scheduled_search)) : this.scheduled_search.length === 0 && (this.scheduled_current_page = 1, this.getScheduledNotifications(null)); 22}, 500), handleScheduledTableChange(t) { 23 const e = { ...this.scheduled_pagination }; 24 e.current = t.current, this.scheduled_pagination = e, this.scheduled_current_page = t.current, this.scheduled_page_size_request = t.pageSize, this.scheduled_pagination.pageSize = this.scheduled_page_size_request, this.getScheduledNotifications(this.scheduled_search); 25}, resetScheduledForm() { 26 this.scheduled_form = { id: null, name: null, description: null, status: 1, group_id: null, date_send: null }; 27}, showModalScheduledCreate() { 28 this.resetScheduledForm(), this.open_modal_scheduled = true; 29}, showModalScheduledEdit(t) { 30 this.scheduled_form = { id: t.id, name: t.name, description: t.description, status: t.status, group_id: t.group_id, date_send: t.date_send_input }, this.open_modal_scheduled = true; 31}, handleOkScheduled() { 32 this.open_modal_scheduled = false; 33}, handleSaveScheduledNotification() { 34 if (this.scheduled_form.name == null || this.scheduled_form.name === "") return alert("Debes ingresar un nombre"), false; 35 if (this.scheduled_form.description == null || this.scheduled_form.description === "") return alert("Debes ingresar una descripci\xF3n"), false; 36 if (this.scheduled_form.group_id == null) return alert("Debes seleccionar un grupo"), false; 37 if (this.scheduled_form.date_send == null || this.scheduled_form.date_send === "") return alert("Debes seleccionar fecha y hora de env\xEDo"), false; 38 if (new Date(this.scheduled_form.date_send) < /* @__PURE__ */ new Date()) return alert("La fecha de env\xEDo no puede ser menor a la actual"), false; 39 this.scheduled_loading_btn = true; 40 const t = this.scheduled_form.id ? "admin.app.updateScheduledNotification" : "admin.app.createScheduledNotification"; 41 axios.post(route(t), this.scheduled_form).then(() => { 42 this.scheduled_loading_btn = false, this.open_modal_scheduled = false, this.getScheduledNotifications(this.scheduled_search), alert(this.scheduled_form.id ? "Notificaci\xF3n programada actualizada exitosamente" : "Notificaci\xF3n programada creada exitosamente"); 43 }).catch(() => { 44 this.scheduled_loading_btn = false, alert("Ha ocurrido un error, comun\xEDquese con el administrador"); 45 }); 46}, handleDeleteScheduledNotification(t) { 47 axios.post(route("admin.app.deleteScheduledNotification"), { id: t }).then(() => { 48 alert("Notificaci\xF3n programada eliminada exitosamente"), this.getScheduledNotifications(this.scheduled_search); 49 }).catch(() => { 50 alert("Ha ocurrido un error, comun\xEDquese con el administrador"); 51 }); 52} } }, U = { class: "d-flex align-items-center" }, L = ["onClick"], A = { class: "" }, G = { class: "d-flex flex-column mt-2" }; 53function M(t, e, p, V, l, o) { 54 const C = n("a-badge"), b = n("a-divider"), x = n("a-input-search"), v = n("a-col"), f = n("a-tag"), g = n("a-button"), w = n("a-table"), z = n("a-row"), S = n("a-input"), h = n("a-form-item"), O = n("a-textarea"), k = n("a-select"), y = n("a-select-option"), D = n("a-modal"), I = n("a-card"); 55 return c(), m(I, { bordered: false, style: { width: "100%" } }, { default: d(() => [a(b, { orientation: "left", class: "mt-0 mb-3" }, { default: d(() => [r("div", U, [a(C, { class: "mr-icon badge-color-primary", overflowCount: 99999999, count: l.totalScheduledNotifications }, { default: d(() => e[7] || (e[7] = [r("span", { class: "mr-2" }, "Env\xEDos de notificaciones programadas", -1)])), _: 1, __: [7] }, 8, ["count"]), a(b, { class: "ml-2", type: "vertical" }), r("button", { type: "button", class: "btn btn-primary btn-sm ml-2", onClick: e[0] || (e[0] = (s) => o.showModalScheduledCreate()) }, e[8] || (e[8] = [r("i", { class: "ft-plus" }, null, -1), i(" Nuevo ")]))])]), _: 1 }), a(z, null, { default: d(() => [a(v, { span: 24, class: "table-filters text-right" }, { default: d(() => [a(x, { value: l.scheduled_search, "onUpdate:value": e[1] || (e[1] = (s) => l.scheduled_search = s), placeholder: "Buscar por: nombre o descripci\xF3n", size: "small", style: { width: "300px" }, class: "text-left", loading: l.scheduled_loading_search, onChange: o.searchScheduledByName }, null, 8, ["value", "loading", "onChange"])]), _: 1 }), a(v, { span: 24 }, { default: d(() => [a(w, { columns: l.scheduled_columns, "data-source": l.scheduled_rows, rowKey: "id", pagination: l.scheduled_pagination, size: "small", class: "ant-table-striped mt-1", rowClassName: (s, u) => u % 2 === 1 ? "table-striped" : null, loading: l.scheduled_table_loading, scroll: { x: 1e3 }, onChange: o.handleScheduledTableChange }
55, { bodyCell: d(({ column: s, record: u }) => [s.key === "status" ? (c(), N(B, { key: 0 }, [u.status === 1 ? (c(), m(f, { key: 0, color: "green" }, { default: d(() => e[9] || (e[9] = [i("Activo")])), _: 1, __: [9] })) : _("", true), u.status === 0 ? (c(), m(f, { key: 1, color: "red" }, { default: d(() => e[10] || (e[10] = [i("Inactivo")])), _: 1, __: [10] })) : _("", true), u.status === 2 ? (c(), m(f, { key: 2, color: "yellow" }, { default: d(() => e[11] || (e[11] = [i("Enviado")])), _: 1, __: [11] })) : _("", true)], 64)) : _("", true), s.key === "actions" ? (c(), m(g, { key: 1, class: "btn btn-outline-dark btn-sm", onClick: (E) => o.showModalScheduledEdit(u) }, { default: d(() => e[12] || (e[12] = [i("Editar")])), _: 2, __: [12] }, 1032, ["onClick"])) : _("", true), s.key === "delete" ? (c(), N("i", { key: 2, class: "fa fa-trash text-danger", onClick: (E) => o.handleDeleteScheduledNotification(u.id) }, null, 8, L)) : _("", true)]), _: 1 }, 8, ["columns", "data-source", "pagination", "rowClassName", "loading", "onChange"])]), _: 1 })]), _: 1 }), r("div", A, [a(D, { class: "custom-modal", visible: l.open_modal_scheduled, width: "60%", title: l.scheduled_form.id ? "Editar notificaci\xF3n programada" : "Crear notificaci\xF3n programada", onOk: o.handleOkScheduled, onCancel: o.handleOkScheduled }, { footer: d(() => [a(g, { key: "back", class: "btn btn-outline-dark btn-sm", onClick: o.handleOkScheduled }, { default: d(() => e[15] || (e[15] = [i("Cancelar")])), _: 1, __: [15] }, 8, ["onClick"]), a(g, { key: "back", class: "btn btn-primary btn-sm", loading: l.scheduled_loading_btn, onClick: o.handleSaveScheduledNotification }, { default: d(() => e[16] || (e[16] = [i("Guardar")])), _: 1, __: [16] }, 8, ["loading", "onClick"])]), default: d(() => [r("div", G, [a(h, { label: "Nombre", name: "scheduled_name" }, { default: d(() => [a(S, { id: "scheduled_name", value: l.scheduled_form.name, "onUpdate:value": e[2] || (e[2] = (s) => l.scheduled_form.name = s), type: "text", name: "scheduled_name", placeholder: "Ingrese el nombre" }, null, 8, ["value"])]), _: 1 }), a(h, { label: "Descripci\xF3n", name: "scheduled_description" }, { default: d(() => [a(O, { id: "scheduled_description", value: l.scheduled_form.description, "onUpdate:value": e[3] || (e[3] = (s) => l.scheduled_form.description = s), name: "scheduled_description", placeholder: "Ingrese la descripci\xF3n" }, null, 8, ["value"])]), _: 1 }), a(h, { label: "Grupo", name: "scheduled_group" }, { default: d(() => [a(k, { value: l.scheduled_form.group_id, "onUpdate:value": e[4] || (e[4] = (s) => l.scheduled_form.group_id = s), "show-search": "", placeholder: "--Seleccione un grupo--", options: p.groups, "field-names": { value: "id", label: "name" }, filterOption: o.filterOption }, null, 8, ["value", "options", "filterOption"])]), _: 1 }), a(h, { label: "Estado", name: "scheduled_status" }, { default: d(() => [a(k, { value: l.scheduled_form.status, "onUpdate:value": e[5] || (e[5] = (s) => l.scheduled_form.status = s), placeholder: "--Seleccione un Estado--" }, { default: d(() => [a(y, { value: 1 }, { default: d(() => e[13] || (e[13] = [i("Activo")])), _: 1, __: [13] }), a(y, { value: 0 }, { default: d(() => e[14] || (e[14] = [i("Inactivo")])), _: 1, __: [14] })]), _: 1 }, 8, ["value"])]), _: 1 }), a(h, { label: "Fecha y hora de env\xEDo", name: "scheduled_date_send" }, { default: d(() => [a(S, { id: "scheduled_date_send", value: l.scheduled_form.date_send, "onUpdate:value": e[6] || (e[6] = (s) => l.scheduled_form.date_send = s), type: "datetime-local", name: "scheduled_date_send", min: o.getCurrentDateTimeLocal() }, null, 8, ["value", "min"])]), _: 1 })])]), _: 1 }, 8, ["visible", "title", "onOk", "onCancel"])])]), _: 1 }); 56} 57const j = q(F, [["render", M]]); 58export { 59 j as default 60};
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.