Rev 33750 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".vendor-catalog-pricing", function() {loadCreateVendorCatalogPricing("main-content");});$(document).on('click', ".vendor-catalog-pricing-request", function() {loadVendorCatalogPricingRequests("main-content");});$(document).on('click', ".vendor-catalog-pricing-pending-request", function () {loadVendorCatalogPricingPendingRequests("main-content");});$(document).on('click', ".vendor-price-circular", function() {loadVendorPriceCircular("main-content");});$(document).on('click', ".create-bulk-vendor-catalog-pricing", function () {createBulkPricing("main-content");});$(document).on('click', ".vendorcatalogpricing", function() {if (typeof currentModel === 'undefined' || currentModel === null || currentModel === '') {alert('Please search for the right model');} else {doGetAjaxRequestHandler(context + "/getVendorCatalogPricingByModel?catalogId=" + currentModel, function(response) {$('.vendorCatatlogPricingView').html(response);});}});$(document).on('click', ".createvendorcatalogpricing", function() {var row = $(this).closest("tr");var vendorId = $(this).data('vendorid');console.log(vendorId)var transferPrice = $(row).find(".transferp").val();var dealerPrice = $(row).find(".dealerp").val();var mop = $(row).find(".mopp").val();var effectedOn = $(row).find(".effectedDate").val();if (transferPrice === "" && dealerPrice === "" && mop === "" && effectedOn === "") {alert("Field can't be empty");return;}if (transferPrice === "") {alert("Transfer Price is required");return;}if (dealerPrice === "") {alert("Dealer Price is required");return;}if (mop === "") {alert("Mop is required");return;}if (effectedOn === "") {alert("EffectedOn Date is required");return;}var vendorCatalogPricing = {};vendorCatalogPricing['vendorId'] = vendorId;vendorCatalogPricing['catalogId'] = currentModelvendorCatalogPricing['tp'] = transferPricevendorCatalogPricing['dp'] = dealerPricevendorCatalogPricing['mop'] = mopvendorCatalogPricing['effectedOn'] = effectedOnconsole.log(JSON.stringify(vendorCatalogPricing))doAjaxRequestWithJsonHandler(context + "/createVendorCatalogPricing", 'POST', JSON.stringify(vendorCatalogPricing), function(response) {if (response == "true") {alert("Successfully Done")$(".vendorcatalogpricing").click();}});});$(document).on('click', ".createnewvendorcatalogpricing", function() {var vendorId = $('#vendorId').val();var transferPrice = $('#transferPrice').val();var dealerPrice = $('#dealerPrice').val();var mop = $('#mop').val();var effectedOn = $('#effectedOn').val();if (transferPrice === "" && dealerPrice === "" && mop === "" && effectedOn === "") {alert("Field can't be empty");return;}if (transferPrice === "") {alert("Transfer Price is required");return;}if (dealerPrice === "") {alert("Dealer Price is required");return;}if (mop === "") {alert("Mop is required");return;}if (effectedOn === "") {alert("EffectedOn Date is required");return;}var vendorCatalogPricing = {};vendorCatalogPricing['vendorId'] = vendorId;vendorCatalogPricing['catalogId'] = currentModelvendorCatalogPricing['tp'] = transferPricevendorCatalogPricing['dp'] = dealerPricevendorCatalogPricing['mop'] = mopvendorCatalogPricing['effectedOn'] = effectedOndoAjaxRequestWithJsonHandler(context + "/createVendorCatalogPricing", 'POST', JSON.stringify(vendorCatalogPricing), function(response) {if (response == "true") {alert("Successfully Done")$(".vendorcatalogpricing").click();loadCreateVendorCatalogPricing("main-content")}});});$(document).on('click', ".vendor-pricing-approve-request-send", function() {var row = $(this).closest("tr");console.log(row);var rowIndex = $(this).closest('tr').prevAll().length;console.log(rowIndex);var id = $(this).data('id');if (confirm("Are you sure you want to approve the request") == true) {doPostAjaxRequestHandler(context + "/verifyVendorCatalogPricingRequest?id=" + id + "&status=" + 'APPROVED',function(response) {console.log(response);if (response == 'true') {alert("successfully approved");loadVendorCatalogPricingRequests("main-content")}});}});$(document).on('click', ".vendor-pricing-rejected-request-send", function() {var row = $(this).closest("tr");console.log(row);var rowIndex = $(this).closest('tr').prevAll().length;console.log(rowIndex);var id = $(this).data('id');if (confirm("Are you sure you want to rejected the request") == true) {doPostAjaxRequestHandler(context + "/verifyVendorCatalogPricingRequest?id=" + id + "&status=" + 'REJECTED',function(response) {console.log(response);if (response == 'true') {alert("successfully rejected");loadVendorCatalogPricingRequests("main-content")}});}});$(document).on('click', ".vendorpricecircular", function() {var vendorId = $('#vendorId').val();var effectedDate = $('#effectedDate').val();if (vendorId === "" && effectedDate === "") {alert("Field can't be empty");return;}// if (vendorId === "") {// alert("Please select the vendor");// return;// }if (effectedDate === "") {alert("Please choose date");return;}doGetAjaxRequestHandler(context + "/getVendorPriceCircular?vendorId=" + vendorId + "&effectedDate=" + effectedDate, function(response) {$('.vendorpricecircularview').html(response);});});$(document).on('click', '.download-price-circular-report', function() {var startDate = $("#effectedDate").val();if (startDate == "" || startDate == undefined) {alert("start date is not be empty!!");return;}let endPoint = `${context}/downloadPriceCircularReport?startDate=${startDate}`;window.location.href = endPoint;});$(document).on('click', '.download-vendor-pricing-changes', function() {var startDate = $("#pricingChangesStartDate").val();var endDate = $("#pricingChangesEndDate").val();if (startDate === "" || startDate === undefined) {alert("Start date is required!");return;}if (endDate === "" || endDate === undefined) {alert("End date is required!");return;}if (startDate > endDate) {alert("Start date must be before end date!");return;}window.location.href = context + "/downloadVendorPricingChangesReport?startDate=" + startDate + "&endDate=" + endDate;});});function loadCreateVendorCatalogPricing(domId) {doGetAjaxRequestHandler(context + "/vendorCatalogPricing", function(response) {$('#' + domId).html(response);});}function loadVendorCatalogPricingRequests(domId) {doGetAjaxRequestHandler(context + "/vendorCatalogPricingRequests", function(response) {$('#' + domId).html(response);});}function loadVendorCatalogPricingPendingRequests(domId) {doGetAjaxRequestHandler(context + "/vendorCatalogPricingPendingRequests", function (response) {$('#' + domId).html(response);});}$(document).on('click', '.dateWisePricing', function () {var startDate = getDatesFromPicker('input[name="pricing-duration"]').startDate;var endDate = getDatesFromPicker('input[name="pricing-duration"]').endDate;doGetAjaxRequestHandler(context + "/datewiseVendorCatalogPricingPendingRequests?startDate=" + startDate + "&endDate=" + endDate, function (response) {$('#catalog-pricing-container').html(response);});});function loadVendorPriceCircular(domId) {doGetAjaxRequestHandler(context + "/vendorPriceCircular", function(response) {$('#' + domId).html(response);});}function createBulkPricing(domId) {doGetAjaxRequestHandler(context + "/createBulkPricing",function (response) {$('#' + domId).html(response);});}