| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- function urlConfig(link) {
- var subDomain = $("#subDomain").val();
- return window.location.protocol + '//' + window.location.host + subDomain + link;
- }
- function proceduceRedirect() {
- var subDomain = $("#subDomain").val();
- var serviceName = $("#serviceName").val();
- window.location.href = subDomain + "/" + serviceName + "/Proceduces";
- }
- function approvesRedirect() {
- var subDomain = $("#subDomain").val();
- var serviceName = $("#serviceName").val();
- window.location.href = subDomain + "/" + serviceName + "/Approves";
- }
- function judgesRedirect() {
- var subDomain = $("#subDomain").val();
- var serviceName = $("#serviceName").val();
- window.location.href = subDomain + "/" + serviceName + "/Judges";
- }
- function categoryClick(categoryID) {
- console.log("categoryID: ", categoryID);
- $("#categoryID").val(categoryID);
- $("#page").val("1");
- $("#message-post").submit();
- }
- function refeshContentModel() {
- const myNode = document.getElementById("contentModel");
- while (myNode.lastElementChild) {
- myNode.removeChild(myNode.lastElementChild);
- }
- }
- function searchData() {
- $.ajax({
- type: "POST",
- url: urlConfig("/Message/Search"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- },
- success: function (data) {
- $('#informModel').html(data);
- $('#myInform').modal({ "backdrop": "static", keyboard: true });
- $('#myInform').modal('show');
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function exportData(telcoID, companyID) {
- console.log("excel");
- $.ajax({
- type: "POST",
- url: urlConfig("/Report/Export"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- telcoID: telcoID,
- companyID: companyID,
- },
- success: function (data) {
- $('#contentModel').html(data);
- $('#myContent').modal({ "backdrop": "static", keyboard: true });
- $('#myContent').modal('show');
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function exportAction() {
- // get all data
- var telcoID = $("#telcoExport").val();
- var companyID = $("#companyExport").val();
- var serviceID = $("#serviceExport").val();
- var startMonth = $("#fromDate").val();
- var endMonth = $("#toDate").val();
- $("#modeltelcoID").val(telcoID);
- $("#modelcompanyID").val(companyID);
- $("#modelserviceID").val(serviceID);
- $("#modelstartMonth").val(startMonth);
- $("#modelendMonth").val(endMonth);
- $("#report-export-action-form").submit();
- $('#myContent').modal('hide');
- }
- function addData(id) {
- console.log("id ", id);
- var serviceName = $("#serviceName").val();
- console.log("serviceName ", serviceName);
- $.ajax({
- type: "POST",
- url: urlConfig("/" + serviceName + "/Editing"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: id,
- action: 'add'
- },
- success: function (data) {
- $('#contentModel').html(data);
- $('#myContent').modal({ "backdrop": "static", keyboard: true });
- $('#myContent').modal('show');
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function editData(id, action) {
- console.log("id ", id);
- var serviceName = $("#serviceName").val();
- console.log("serviceName ", serviceName);
- $.ajax({
- type: "POST",
- url: urlConfig("/" + serviceName + "/Editing"),
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: id,
- action: action
- },
- success: function (data) {
- $('#contentModel').html(data);
- $('#myContent').modal({ "backdrop": "static", keyboard: true });
- $('#myContent').modal('show');
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function deleteData(id) {
- console.log("id ", id);
- var serviceName = $("#serviceName").val();
- $.ajax({
- type: "POST",
- url: urlConfig("/Partial/TreeConfirm"),
- data: {
- "message": "Are you sure ?",
- "id": id,
- "url": "/" + serviceName + "/DeletingAction"
- },
- success: function (data) {
- $('#informModel').html(data);
- $('#myInform').modal({ "backdrop": "static", keyboard: true });
- $('#myInform').modal('show');
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function pasteData(action, sourceID, destinationID) {
- console.log("action ", action);
- console.log("sourceID ", sourceID);
- console.log("destinationID ", destinationID);
- var serviceName = $("#serviceName").val();
- $.ajax({
- type: "POST",
- url: urlConfig(action == "1" ? "/" + serviceName + "/MovingAction" : action == "2" ? "/" + serviceName + "/CopyingAction" : null),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- sourceID: sourceID,
- destinationID: destinationID,
- },
- success: function (data) {
- $.ajax({
- type: "POST",
- url: "/Partial/TreeResponse",
- data: {
- "ids": data.ids,
- "message": data.message
- },
- success: function (data) {
- $('#informModel').html(data);
- $('#myInform').modal({ "backdrop": "static", keyboard: true });
- $('#myInform').modal('show');
- },
- failure: function (data) {
- alert(data);
- },
- error: function (data) {
- alert(data);
- }
- });
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- $(".clickable").on("click", function () {
- var id = $(this).attr("value");
- $(this).removeClass("none-parent-style");
- $(this).addClass("parent-style");
- //console.log("clickable " + id);
- $.ajax({
- type: "POST",
- url: urlConfig("/Tree/GetTreeData"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: id,
- },
- success: function (data) {
- //console.log(data);
- $('#child-items-' + id).html(data);
- getTableAction(id);
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- })
- //getTableAction("-1");
- function getTableAction(id) {
- //console.log("clickable " + id);
- $.ajax({
- type: "POST",
- url: urlConfig("/Tree/GetTableData"),
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: id,
- },
- success: function (data) {
- //console.log(data);
- $('#replaceable-table').html(data);
- },
- failure: function (data) {
- console.log(data);
- alert(data);
- },
- error: function (data) {
- console.log(data);
- alert(data);
- }
- });
- }
- function addAction() {
- //clickableOutClick();
- //var id = $("#itemID").val();
- //console.log("addAction " + id);
- //addData(id);
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("editAction " + id);
- editData(id, "add");
- }
- function editAction() {
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("editAction " + id);
- editData(id, "edit");
- }
- function deleteAction() {
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("deleteAction " + id);
- deleteData(id);
- }
- function moveAction() {
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("moveAction " + id);
- $("#sourceID").val(id);
- $("#action").val("1");
- $("#paste-button").removeClass("disable-click");
- }
- function pasteAction() {
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("pasteAction " + id);
- var sourceID = $("#sourceID").val();
- var action = $("#action").val();
- if (sourceID != null && action != null) {
- $("#destinationID").val(id);
- $("#paste-button").addClass("disable-click");
- pasteData(action, sourceID, id);
- }
- }
- function copyAction() {
- clickableOutClick();
- var id = $("#itemID").val();
- console.log("copyAction " + id);
- $("#sourceID").val(id);
- $("#action").val("2");
- $("#paste-button").removeClass("disable-click");
- }
|