| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572 |
- 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);
- }
- }
- $(".edit-btn").on("click", function () {
- var tableType = $("#table-type").val();
- $.ajax({
- type: "POST",
- url: "/Config/Editing",
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- id: $(this).attr("value"),
- tableType: tableType,
- },
- 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);
- }
- });
- })
- $(".delete-btn").on("click", function () {
- var tableType = $("#table-type").val();
- var id = $(this).attr("value");
- console.log("id: ", id);
- console.log("tableType: ", tableType);
- $.ajax({
- type: "POST",
- url: "/Partial/Confirm",
- data: {
- "message": "Are you sure ?",
- "id": id,
- "tableType": tableType,
- "url": "/Config/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 searchData() {
- $.ajax({
- type: "POST",
- url: "/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 chooseTableTypeClick(tableType) {
- $(".tableType").val(tableType);
- $("#support-form").submit();
- }
- function chooseTypeClick(typeGet) {
- var telcoID = $("#telcoIndex").val();
- var companyID = $("#companyIndex").val();
- var dateGet = $("#dateGetIndex").val();
- console.log("telcoID: ", telcoID);
- console.log("companyID: ", companyID);
- $(".dateGet").val(dateGet);
- $(".typeGet").val(typeGet);
- $(".telcoID").val(telcoID);
- $(".companyID").val(companyID);
- $(".__RequestVerificationToken").val($('input[name=__RequestVerificationToken]').val());
- $("#report-index-form").submit();
- }
- function chooseDateClick(dateGet) {
- var telcoID = $("#telcoIndex").val();
- var companyID = $("#companyIndex").val();
- var typeGet = $("#typeGetIndex").val();
- console.log("telcoID: ", telcoID);
- console.log("companyID: ", companyID);
- $(".dateGet").val(dateGet);
- $(".typeGet").val(typeGet);
- $(".telcoID").val(telcoID);
- $(".companyID").val(companyID);
- $(".__RequestVerificationToken").val($('input[name=__RequestVerificationToken]').val());
- $("#report-index-form").submit();
- }
- function telcoClick(telcoID) {
- var typeGet = $("#typeGetIndex").val();
- var dateGet = $("#dateGetIndex").val();
- console.log("typeGet: ", typeGet);
- $(".dateGet").val(dateGet);
- $(".typeGet").val(typeGet);
- $(".telcoID").val(telcoID);
- $(".__RequestVerificationToken").val($('input[name=__RequestVerificationToken]').val());
- $("#report-index-form").submit();
- }
- function companyClick(telcoID, companyID) {
- var typeGet = $("#typeGetIndex").val();
- var dateGet = $("#dateGetIndex").val();
- console.log("typeGet: ", typeGet);
- $(".dateGet").val(dateGet);
- $(".typeGet").val(typeGet);
- $(".telcoID").val(telcoID);
- $(".companyID").val(companyID);
- $(".__RequestVerificationToken").val($('input[name=__RequestVerificationToken]').val());
- $("#report-index-form").submit();
- }
- function exportData(telcoID, companyID) {
- console.log("excel");
- $.ajax({
- type: "POST",
- url: "/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 telcoExportClick(telcoID) {
- console.log("telcoID: ", telcoID);
- if (telcoID != "-1") {
- $(".company-model-style").removeClass("disable");
- $(".service-model-style").removeClass("disable");
- exportData(telcoID, null);
- } else {
- $(".company-model-style").addClass("disable");
- $(".service-model-style").addClass("disable");
- $("#companyExport").val("-1");
- $("#serviceExport").val("-1");
- }
- }
- function companyExportClick(companyID) {
- var telcoID = $("#telcoExport").val();
- console.log("telcoID: ", telcoID);
- console.log("companyID: ", companyID);
- if (companyID != "-1") {
- $(".service-model-style").removeClass("disable");
- exportData(telcoID, companyID);
- } else {
- $(".service-model-style").addClass("disable");
- $("#serviceExport").val("-1");
- }
- }
- 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();
- //console.log("telcoID: ", telcoID);
- //console.log("companyID: ", companyID);
- //console.log("serviceID: ", serviceID);
- //console.log("startMonth: ", startMonth);
- //console.log("endMonth: ", endMonth);
- $("#modeltelcoID").val(telcoID);
- $("#modelcompanyID").val(companyID);
- $("#modelserviceID").val(serviceID);
- $("#modelstartMonth").val(startMonth);
- $("#modelendMonth").val(endMonth);
- $("#report-export-action-form").submit();
- $('#myContent').modal('hide');
- }
- function tableTypeClick(tableType) {
- $("#tableType").val(tableType);
- $("#config-form").submit();
- }
- function addConfigData(tableType) {
- console.log("addConfigData");
- $.ajax({
- type: "POST",
- url: "/Config/Adding",
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: {
- "__RequestVerificationToken": $('input[name=__RequestVerificationToken]').val(),
- tableType: tableType,
- },
- 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);
- }
- });
- }
- // for send mail
- function telcoServiceClick(telcoID) {
- //var companyID = $("#companyExport").val();
- console.log("telcoID: ", telcoID);
- //console.log("companyID: ", companyID);
- if (telcoID != "-1") {
- $(".company-model-style").removeClass("disable");
- $(".service-model-style").removeClass("disable");
- exportServiceData(telcoID, null);
- } else {
- $(".company-model-style").addClass("disable");
- $(".service-model-style").addClass("disable");
- $("#companyExport").val("-1");
- $("#serviceExport").val("-1");
- }
- }
- function companyServiceClick(companyID) {
- var telcoID = $("#telcoId").val();
- console.log("telcoID: ", telcoID);
- console.log("companyID: ", companyID);
- if (companyID != "-1") {
- $(".service-model-style").removeClass("disable");
- exportServiceData(telcoID, companyID);
- } else {
- $(".service-model-style").addClass("disable");
- $("#serviceExport").val("-1");
- }
- }
- function exportServiceData(telcoID, companyID) {
- console.log("exportSendMailData");
- var status = $("#status").val();
- var serviceName = $("#serviceName").val();
- var url = $("#url").val();
- var status = $("#status").val();
- var state = $("#state").val();
- var vSql = $("#vSql").val();
- var connection = $("#connection").val();
- var tableType = $("#tableType").val();
- //console.log("tableType: ", tableType);
- //console.log("listMail: ", listMail);
- //console.log("message: ", message);
- var formData = new FormData();
- formData.append('telcoId', telcoID);
- formData.append('companyId', companyID);
- formData.append('serviceName', serviceName);
- formData.append('url', url);
- formData.append('state', state);
- formData.append('vSql', vSql);
- formData.append('status', status);
- formData.append('connection', connection);
- formData.append('tableType', tableType);
- $.ajax({
- type: "POST",
- url: "/Config/ExportService",
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: formData,
- processData: false,
- contentType: false,
- 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);
- }
- });
- }
- // for send mail
- function telcoSendMailClick(telcoID) {
- //var companyID = $("#companyExport").val();
- console.log("telcoID: ", telcoID);
- //console.log("companyID: ", companyID);
- if (telcoID != "-1") {
- $(".company-model-style").removeClass("disable");
- $(".service-model-style").removeClass("disable");
- exportSendMailData(telcoID, null);
- } else {
- $(".company-model-style").addClass("disable");
- $(".service-model-style").addClass("disable");
- $("#companyExport").val("-1");
- $("#serviceExport").val("-1");
- }
- }
- function companySendMailClick(companyID) {
- var telcoID = $("#telcoId").val();
- console.log("telcoID: ", telcoID);
- console.log("companyID: ", companyID);
- if (companyID != "-1") {
- $(".service-model-style").removeClass("disable");
- exportSendMailData(telcoID, companyID);
- } else {
- $(".service-model-style").addClass("disable");
- $("#serviceExport").val("-1");
- }
- }
- function exportSendMailData(telcoID, companyID) {
- console.log("exportSendMailData");
- var status = $("#status").val();
- var serviceId = $("#serviceId").val();
- var timeSend = $("#timeSend").val();
- var listMail = $("#listMail").val();
- var message = $("#message").val();
- var tableType = $("#tableType").val();
- console.log("tableType: ", tableType);
- console.log("listMail: ", listMail);
- console.log("message: ", message);
- var formData = new FormData();
- formData.append('telcoId', telcoID);
- formData.append('companyId', companyID);
- formData.append('serviceId', serviceId);
- formData.append('timeSend', timeSend);
- formData.append('listMail', listMail);
- formData.append('message', message);
- formData.append('status', status);
- formData.append('tableType', tableType);
- $.ajax({
- type: "POST",
- url: "/Config/ExportSendMail",
- headers: { 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val() },
- data: formData,
- processData: false,
- contentType: false,
- 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 uploadData(typeTable) {
- var fileExtension = ['xls', 'xlsx'];
- var filename = $('#fileupload').val();
- if (filename.length == 0) {
- alert("Please select a file.");
- return false;
- }
- else {
- var extension = filename.replace(/^.*\./, '');
- if ($.inArray(extension, fileExtension) == -1) {
- alert("Please select only excel files.");
- return false;
- }
- }
- var fdata = new FormData();
- var fileUpload = $("#fileupload").get(0);
- var files = fileUpload.files;
- fdata.append(files[0].name, files[0]);
- fdata.append("typeTable", typeTable);
- $.ajax({
- type: "POST",
- url: "/Support/UploadAction",
- beforeSend: function (xhr) {
- xhr.setRequestHeader("XSRF-TOKEN",
- $('input:hidden[name="__RequestVerificationToken"]').val());
- },
- data: fdata,
- contentType: false,
- processData: false,
- success: function (response) {
- console.log(response);
- if (response.length == 0)
- alert('Some error occured while uploading');
- else {
- $('#importButton').prop("disabled", false);
- $('#divShow').hide();
- $('#divPrint').html(response);
- }
- },
- error: function (e) {
- $('#divPrint').html(e.responseText);
- }
- });
- }
- function importData(typeTable) {
- var timeNow = $("#timeNow").val();
- $.ajax({
- type: "POST",
- url: "/Support/ImportAction",
- beforeSend: function (xhr) {
- xhr.setRequestHeader("XSRF-TOKEN",
- $('input:hidden[name="__RequestVerificationToken"]').val());
- },
- data: {
- 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(),
- typeTable: typeTable,
- timeNow: timeNow,
- },
- success: function (data) {
- //$('#downloadButton').prop("disabled", false);
- $.ajax({
- type: "POST",
- url: "/Partial/Response",
- data: {
- "message": data.message
- },
- success: function (data) {
- $('#informModel').html(data);
- $('#myInform').modal({ "backdrop": "static", keyboard: true });
- $('#myInform').modal('show');
- },
- failure: function (data) {
- },
- error: function (data) {
- }
- });
- },
- error: function (e) {
- $('#divPrint').html(e.responseText);
- }
- });
- }
- function showFileClick(tableType) {
- $("#tableType").val(tableType);
- $("#actionFile").val("1");
- $("#support-form").submit();
- }
- function saveFileClick(tableType) {
- $("#tableType").val(tableType);
- $("#actionFile").val("2");
- $("#support-form").submit();
- }
- function downloadClick(typeTable) {
- $('#importButton').prop("disabled", true);
- //$('#downloadButton').prop("disabled", true);
- console.log("typeTable " + typeTable);
- $("#tableTypeDownload").val(typeTable);
- $("#support-download-form").submit();
- //$.ajax({
- // type: "POST",
- // url: "/Support/DownloadAction",
- // beforeSend: function (xhr) {
- // xhr.setRequestHeader("XSRF-TOKEN",
- // $('input:hidden[name="__RequestVerificationToken"]').val());
- // },
- // data: {
- // 'RequestVerificationToken': $('input[name=__RequestVerificationToken]').val(),
- // typeTable: typeTable,
- // },
- // success: function (data) {
- // console.log("data " + data);
- // },
- // error: function (e) {
- // $('#divPrint').html(e.responseText);
- // }
- //});
- }
- function exportStock() {
- }
- function downloadRegistry() {
- }
|