Файловый менеджер - Редактировать - /home/clickysoft/public_html/charliapp-v2.clickysoft.net/public/js/get-data.js
Назад
var csrfToken = $('meta[name="csrf-token"]').attr("content"); var baseURL = $('meta[name="base-url"]').attr("content"); function showLoader() { $("#ajaxLoader").css("display", "flex"); } function hideLoader() { $("#ajaxLoader").css("display", "none"); } function toggleStatus(tableName, id) { // if (confirm("Are you sure to change the status?")) { $.ajax({ url: baseURL + "/change-status", type: "POST", data: { tableName, id }, dataType: "json", headers: { "X-CSRF-TOKEN": csrfToken }, beforeSend: function () { showLoader(); }, success: function (data) { if (!data.success) { alert(data.message); } else { $("#recordSts" + id).html(data.status); $("#btnSts" + id).text(data.buttonCaption); if (data.buttonCaption == "Enable") { $("#btnSts" + id).removeClass("btn-warning"); $("#btnSts" + id).addClass("btn-success"); } else { $("#btnSts" + id).removeClass("btn-success"); $("#btnSts" + id).addClass("btn-warning"); } } }, error: function () { alert("Something went wrong."); }, complete: function () { hideLoader(); }, }); // } } $(document).ready(function () { $(".data-by-selection").on("change", function () { var endPoint = $(this).attr("end-point"); var container = $(this).attr("container"); var multiSelection = $(this).attr("target-multi-selection"); var clearContainer = $(this).attr("clear-container") || ""; var getBookItems = $(this).attr("get-book-items") || "no"; var list = false; var val; if ($(this).find("option:selected").data("id") !== undefined) { val = $(this).find("option:selected").data("id"); list = true; } else { val = $(this).val(); } if ($(this).val() != "" && $(this).val() != null) { $.ajax({ url: baseURL + endPoint + val, dataType: "json", headers: { "X-CSRF-TOKEN": csrfToken }, beforeSend: function () { showLoader(); }, success: function (data) { var options = multiSelection == "no" ? '<option value="">Please select</option>' : ""; if (data.list && data.list.length > 0) { for (i = 0; i < data.list.length; i++) options += '<option value="' + (list ? data.list[i].title : data.list[i].id) + '"' + (list && 'data-id="' + data.list[i].id + '"') + ">" + data.list[i].title + "</option>"; } if (clearContainer != "") { $(clearContainer).html("").trigger("change"); } $("#" + container) .html(options) .trigger("change"); }, error: function () { alert("Something went wrong."); }, complete: function () { hideLoader(); }, }); if ( $("#user_id").val() != "" && $("#user_id").val() != null && getBookItems == "yes" ) { $.ajax({ url: baseURL + "/get-book-items/" + $("#user_id").val(), headers: { "X-CSRF-TOKEN": csrfToken }, beforeSend: function () { showLoader(); }, success: function (data) { // Brainstorms var brainstorms = '<option value="">Please select</option>'; for (var key in data.brainstorms) { brainstorms += '<option value="' + key + '">' + data.brainstorms[key] + "</option>"; } $("#brainstorm_item_id") .html(brainstorms) .trigger("change"); // Outlines var outlines = '<option value="">Please select</option>'; for (var key in data.outlines) { outlines += '<option value="' + key + '">' + data.outlines[key] + "</option>"; } $("#outline_item_id").html(outlines).trigger("change"); // Timelines var timelines = '<option value="">Please select</option>'; for (var key in data.timelines) { timelines += '<option value="' + key + '">' + data.timelines[key] + "</option>"; } $("#timeline_item_id") .html(timelines) .trigger("change"); // Plot Planners var plotplanners = '<option value="">Please select</option>'; for (var key in data.plotplanners) { plotplanners += '<option value="' + key + '">' + data.plotplanners[key] + "</option>"; } $("#plot_planner_item_id") .html(plotplanners) .trigger("change"); }, error: function () { alert("Something went wrong."); }, complete: function () { hideLoader(); }, }); } } else { if (clearContainer != "") { $(clearContainer).html("").trigger("change"); } } }); var bookItemContainer = { 1: "todo-item", 2: "brainstorm-item", 3: "outline-item", 4: "timeline-item", 5: "plot-planner-item", }; if ($("#task_type").length > 0) { $("#task_type").on("change", function () { $(".book-item").removeClass("show"); if ($(this).val() != "" && $(this).val() != null) { $(".book-item." + bookItemContainer[$(this).val()]).addClass( "show" ); } }); } });
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка