UnknownSec Bypass
403
:
/
var
/
www
/
stp-bhaktisagar-backend
/
src
/
views
/ [
drwxrwxr-x
]
Menu
Upload
Mass depes
Mass delete
Terminal
Info server
About
name :
events.ejs
<!-- partial:partials/_navbar.html --> <div class="page-wrapper"> <%- include('header.ejs') %> <!-- partial --> <div class="page-content"> <div class="d-flex justify-content-between align-items-center flex-wrap grid-margin" > <div> <h4 class="mb-3 mb-md-0"><%= title %></h4> </div> <div class="d-flex align-items-center flex-wrap text-nowrap"> <a href="/add-event" class="btn btn-primary btn-icon-text mb-2 mb-md-0"> <i class="btn-icon-prepend" data-feather="plus"></i> Add </a> </div> </div> <div class="row"> <div class="col-lg-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Events</h4> <div class="table-responsive pt-3"> <table id="dataTable" class="table table-hover table-bordered" ></table> </div> </div> </div> </div> </div> </div> </div> <script> let dataTable; const enableChange = async (data, id, ele) => { Notiflix.Loading.circle("Please Wait..."); try { let r = await callApi("POST", `/api/events`, { id, visible: !data }); // console.log(r); if (r && r.status) { Notiflix.Notify.success(r.message); let res = await callApi("GET", `/api/event/${id}`); dataTable .row($(ele).parent().parent().parent()) .data({ ...res.data, }) .draw(); } } catch (e) { console.log("error", e); Notiflix.Notify.failure("Somthing went wrong."); } Notiflix.Loading.remove(); }; const deleteRow = async (id, button) => { // console.log(id, $(button).parent().parent()); let yes = await showConfirmation(); if (yes) { Notiflix.Loading.circle("Please Wait..."); try { let r = await callApi("DELETE", `/api/event/${id}`); // console.log(r); if (r && r.status) { Notiflix.Notify.success(r.message); dataTable.row($(button).parent().parent()).remove().draw(); } } catch (e) { console.log("error", e); Notiflix.Notify.failure("Somthing went wrong."); } Notiflix.Loading.remove(); } }; const sendNotification = async (id, button) => { // console.log(id, $(button).parent().parent()); let yes = await showConfirmation( "Are you sure you want to send notification?" ); if (yes) { Notiflix.Loading.circle("Please Wait..."); try { let r = await callApi("GET", `/api/event/send-notification/${id}`); // console.log(r); if (r && r.status) { Notiflix.Notify.success(r.message); } } catch (e) { console.log("error", e); Notiflix.Notify.failure("Somthing went wrong."); } Notiflix.Loading.remove(); } }; const init = async () => { Notiflix.Loading.circle("Loading..."); try { let r = await callApi("GET", `/api/events`); dataTable = new DataTable("#dataTable", { // stateSave: true, pageLength: 50, data: r.data, // columnDefs: [ // { // targets: [1,2], // width:'20%' // }, // ], order: [[0, "desc"]], columns: [ { title: "id", data: "id" }, { title: "Title", data: "title", render: function (data, type, row, meta) { return `<div style="width:200px;display:flex"><img class="mr-1" style="border-radius:5px; width:40px;height:40px;background-color:#eee;object-fit:cover;" src="${ row.image || "/assets/images/dummy.png" }"/><div> ${data}<br/>${row.notification_title}</div></div>`; }, }, { title: "Description", data: "description", render: function (data, type, row, meta) { return `<div style="width:200px;"> ${data}</div>`; }, }, { title: "Start Date Time", data: "start_datetime", render: function (data, type, row, meta) { return moment(data).format("DD-MMM-YYYY hh:mm A"); }, }, { title: "End Date Time", data: "end_datetime", render: function (data, type, row, meta) { return moment(data).format("DD-MMM-YYYY hh:mm A"); }, }, { title: "Visible", data: "visible", render: function (data, type, row, meta) { return `<div class="custom-control custom-switch"> <input onchange="enableChange(${data},${row.id},this)" type="checkbox" ${ data ? "checked" : "" } class="custom-control-input" id="switch${row.id}"> <label class="custom-control-label" for="switch${row.id}"></label> </div>`; }, }, // { // title: "Created At", // data: "created_at", // render: function (data, type, row, meta) { // return moment(data).format("DD-MMM-YYYY"); // }, // }, { title: "Action", data: "id", render: function (data, type, row, meta) { // console.log(data,meta) return `<a class="btn btn-sm btn-warning mr-1 mb-1" href="/add-event/${data}" >Edit</a> <button class="btn btn-sm btn-danger mr-1 mb-1" onclick="deleteRow(${data},this)" >Delete</button> <button title='Send Notification' class="btn btn-sm btn-info mb-1" onclick="sendNotification(${data},this)" ><i class='fas fa-paper-plane'/></button>`; }, }, ], }); } catch (e) { console.log("error", e); Notiflix.Notify.failure("Somthing went wrong."); } Notiflix.Loading.remove(); }; init(); </script>
Copyright © 2025 - UnknownSec