Rev 33247 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function () {$(document).on('click', ".logistics", function () {loadlogistics("main-content");});$(document).on('click', ".provider", function () {loadprovider("main-content");});$(document).on('click', ".provider-tat", function () {loadproviderTat("main-content");});$(document).on('click', ".delay-billing", function () {loadDelayBilling("main-content")});$(document).on('click', ".public-provider-holiday", function () {loadpublicHoliday("main-content");});$(document).on('click', "#uploadshipping", function () {getAuthorisedWarehouses(function (warehouseId) {console.log(warehouseId);window.location.href = context + "/downloadUploadShippingTemplate?warehouseId=" + warehouseId;});});$(document).on('click', "#uploadTatTemplate", function () {window.location.href = context + "/downloadProviderTatTemplate";});$(document).on('click', "#delaydayTemplate", function () {window.location.href = context + "/downloadDelayDayTemplate";})$(document).on('click', ".providertat", function () {var providerId = $("#provider").val();console.log(providerId)doGetAjaxRequestHandler(context + "/getProviderTat?providerId=" + providerId,function (response) {console.log(response)$('.' + "providertatContainer").html(response);});});$(document).on('click', ".uploaddelaydayfile", function () {console.log("hello");if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined) {var url = `${context}/delayDayFileUpload`;console.log(url);var file = $("#delaydayfile")[0].files[0];let fileInput = $(this);console.log("file" + file);console.log("fileInput" + fileInput);doAjaxUploadRequestHandler(url,'POST',file, function (response) {console.log(response)alert("successfully uploaded");loadproviderTat("main-content");if (response == 'true') {}});}}});$(document).on('click', "#markDeliveredTemplate", function () {window.location.href = context + "/downloadMarkDeliveredTemplate";});$(document).on('click', ".uploadmarkdeliveredfile", function () {console.log("hello");if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined) {var url = `${context}/markDeliveredFileUpload`;console.log(url);var file = $("#markdeliveredfile")[0].files[0];let fileInput = $(this);console.log("file" + file);console.log("fileInput" + fileInput);doAjaxUploadRequestHandler(url,'POST',file, function (response) {console.log(response)alert("successfully uploaded");loadproviderTat("main-content");if (response == 'true') {}});}}});$(document).on('click', ".billedOrderUpload", function () {console.log("hello");if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined) {var url = `${context}/billedOrderFileUploader`;console.log(url);var file = $("#billedOrderFile")[0].files[0];let fileInput = $(this);console.log("file" + file);console.log("fileInput" + fileInput);doAjaxUploadRequestHandler(url,'POST',file, function (response) {console.log(response)if (response == true) {alert("successfully uploaded");loadlogistics("main-content");}});}}});$(document).on('click', "#delayBillingTemplate", function () {window.location.href = context + "/delayBillingTemplate";});$(document).on('click', ".generate-awb", function () {console.log("ghghkg");doPostAjaxRequestHandler(context + "/sctrachOffer/create",function (response) {console.log(response)});});$(document).on('click', ".uploadDelayBillingFile", function () {console.log("hello");if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined) {var url = `${context}/getDelayBillingFileUploader`;console.log(url);var file = $("#delayBillingFile")[0].files[0];let fileInput = $(this);console.log("file" + file);console.log("fileInput" + fileInput);doAjaxUploadRequestHandler(url,'POST',file, function (response) {if (response == true) {alert("successfully uploaded");console.log("response" + response);}});}}});$(document).on('click', ".providertatupload", function () {console.log("hello");if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined) {var url = `${context}/providerTatFileUploader`;console.log(url);var file = $("#providertatfile")[0].files[0];let fileInput = $(this);console.log("file" + file);console.log("fileInput" + fileInput);doAjaxUploadRequestHandler(url,'POST',file, function (response) {if (response == true) {alert("successfully uploaded");console.log("response" + response);}});}}});$(document).on('click', ".create-provider",function () {var name = $('#providerName').val();var email = $('#promoterEmail').val();var mobile = $('#providerMobile').val();var accountNo = $('#accountNo').val();var provideractive = $('#provideractive').val();if (name === "" && mobile === "" && email === ""&& accountNo === "") {alert("Field can't be empty");return;}if (name === "") {alert("Name is required");return;}if (accountNo === "") {alert("AccountNo is required");return;}if (email === "") {alert("email is required");return;}if (mobile === "") {alert("mobile Number is required");return;}if (provideractive === "") {alert("Status is required");return;}var providerdetailData = {}providerdetailData['name'] = nameproviderdetailData['email'] = emailproviderdetailData['mobile'] = mobileproviderdetailData['accountNo'] = accountNoproviderdetailData['provideractive'] = provideractive;console.log(providerdetailData);if (confirm("Are you sure you want to add Promoter!") == true) {doPostAjaxRequestWithJsonHandler(context+ "/createProvider", JSON.stringify(providerdetailData), function (response) {if (response == 'true') {alert("successfully Add");loadprovider("main-content");}});return false;}});$(document).on('click', ".public-holiday", function () {var date = $('#date').val();var occassion = $('#occassion').val();if (date === "") {alert("date is required");return;}if (occassion === "") {alert("occassion is required");return;}console.log(date);if (confirm("Are you sure you want add holiday!") == true) {doPostAjaxRequestHandler(context + "/createPublicHoliday?date="+ date + "&occassion="+ occassion, function (response) {if (response == true) {alert("successfully submit");loadpublicHoliday("main-content");}});}});});$(document).on("click", ".mk_provider_map_panel", function () {getProvidersMappingPanel("main-content");});$(document).on("click", ".mk_rider_map_panel", function () {getRvidersMappingPanel("main-content");});$(document).on("change", '#warehouseSelect', function () {var warehouseId = $('select[name="warehouseId"]').val();doGetAjaxRequestHandler(context + `/filter-providers?warehouseId=${warehouseId}`, function (response) {$('#filtered-providers').empty();$('#filtered-providers').append(`<option selected disabled>Select Provider</option>`);response.forEach(function (provider) {$('#filtered-providers').append(`<option value="${provider.id}">${provider.name}</option>`);});});});$(document).on("change", ".mk-provider-status", function () {let id = $(this).data('id');let status = $(this).val();if (confirm("Are you sure to change provider status")) {doPutAjaxRequestHandler(context + `/provider-status-update?id=${id}&status=${status}`, function (response) {if (response == 'true') {alert("Status changed successfully");loadprovider("main-content");}});}});$(document).on("change", ".provider-filter-by-status", function () {var status = $('select[name="provider-status-filter"]').val();doGetAjaxRequestHandler(context + `/provider?status=${status}`,function (response) {$('#' + "main-content").html(response);});});$(document).on("change", ".mk-wp-status", function () {let id = $(this).data('id');let status = $(this).val();if (confirm("Are you sure to change status")) {changedId = id;doPutAjaxRequestHandler(context + `/wp-status-update?id=${id}&status=${status}`, function (response) {if (response == 'true') {alert("Status changed successfully");getWarehouseProvidersTable($('select[name="selectWarehouse"]').val(), $('select[name="selectStatus"]').val());}});} else {getWarehouseProvidersTable($('select[name="selectWarehouse"]').val(), $('select[name="selectStatus"]').val());}});$(document).on("change", ".mk-wr-status", function () {let id = $(this).data('id');let status = $(this).val();if (confirm("Are you sure to change status")) {changedId = id;doPutAjaxRequestHandler(context + `/wr-status-update?id=${id}&status=${status}`, function (response) {if (response == 'true') {alert("Status changed successfully");getWarehouseRidersTable($('select[name="warehouse-filter"]').val(), $('select[name="status-filter"]').val());}});} else {getWarehouseRidersTable($('select[name="warehouse-filter"]').val(), $('select[name="status-filter"]').val());}});$(document).on("change", 'select[name="selectWarehouse"] ,select[name="selectStatus"]', function () {$('.mk-warehouse-providers').empty();var warehouseId = $('select[name="selectWarehouse"]').val();var status = $('select[name="selectStatus"]').val();getWarehouseProvidersTable(warehouseId, status);});$(document).on("change", 'select[name="status-filter"] ,select[name="warehouse-filter"]', function () {$('.mk-warehouse-providers').empty();var warehouseId = $('select[name="warehouse-filter"]').val();var status = $('select[name="status-filter"]').val();getWarehouseRidersTable(warehouseId, status);});$(document).on("click", "#mk-wp-mapping-submit", function () {if (confirm("Do you want to Map")) {var providerId = $('select[name="providerId"]').val();var warehouseId = $('select[name="warehouseId"]').val();var gstin = $('input[name="gstin"]').val();if (!gstin) {alert("GSTIN is required");return;}var status = $('select[name="status"]').val();doPostAjaxRequestHandler(context + `/wp-mapping-submit?warehouseId=${warehouseId}&providerId=${providerId}&gstin=${gstin}&status=${status}`, function (response) {if (response == 'true') {alert("Provider successfully mapped");getProvidersMappingPanel("main-content");}});}});$(document).on("click", "#mk-wr-mapping-submit", function () {if (confirm("Do you want to map Rider")) {var warehouseId = $('select[name="warehouseId"]').val();var riderName = $('input[name="riderName"]').val();var vehicleNo = $(' input[name="vehicleNo"]').val();if (!vehicleNo) {alert("Vehicle No is required");return;}var status = $('select[name="status"]').val();doPostAjaxRequestHandler(context + `/wr-mapping-submit?warehouseId=${warehouseId}&riderName=${riderName}&vehicleNo=${vehicleNo}&status=${status}`, function (response) {if (response == 'true') {alert("Rider successfully mapped");getRvidersMappingPanel("main-content");}});}});function getProvidersMappingPanel(domId) {doGetAjaxRequestHandler(context + "/provider-panel",function (response) {$('#' + domId).html(response);});}function loadlogistics(domId) {doGetAjaxRequestHandler(context + "/logistics",function (response) {$('#' + domId).html(response);});}function loadDelayBilling(domId) {doGetAjaxRequestHandler(context + "/delayBilling",function (response) {$('#' + domId).html(response);});}function loadprovider(domId) {doGetAjaxRequestHandler(context + `/provider?status=${true}`,function (response) {$('#' + domId).html(response);});}function loadproviderTat(domId) {doGetAjaxRequestHandler(context + "/providerTat",function (response) {$('#' + domId).html(response);});}function loadpublicHoliday(domId) {doGetAjaxRequestHandler(context + "/publicProviderHolidays",function (response) {$('#' + domId).html(response);});}function getRvidersMappingPanel(domId) {doGetAjaxRequestHandler(context + "/rider-mapping-panel",function (response) {$('#' + domId).html(response);});}function getWarehouseProvidersTable(warehouseId, status) {doGetAjaxRequestHandler(context + `/warehouse-providers?warehouseId=${warehouseId}&status=${status}`, function (response) {$('.mk-warehouse-providers').html(response);//manually remove loading fade$('div.modal-backdrop.fade').remove();});}function getWarehouseRidersTable(warehouseId, status) {doGetAjaxRequestHandler(context + `/riders-mapping?warehouseId=${warehouseId}&status=${status}`, function (response) {$('.mk-warehouse-riders').html(response);$('div.modal-backdrop.fade').remove();});}