Rev 29851 | Rev 30757 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function () {$(document).on('click', ".customer-offer", function () {loadCustomerOffer("main-content");});$(document).on('click', ".samsung-upgrade-offer", function () {loadSamsungUpgradeOffer("main-content");});$(document).on('click', ".createoffer", function () {var offerName = $("#offername").val();if (offerName === "") {alert("Offer Name is required");return;}var params = {"offerName": offerName,"startDate": getDatesFromPicker('input[name="dateRange"]').startDate,"endDate": getDatesFromPicker('input[name="dateRange"]').endDate,}if (confirm("Are you sure you want to create offer!") == true) {doPostAjaxRequestWithParamsHandler(context+ "/createCustomerOffer", params, function (response) {if (response = true) {alert("create successfully");loadCustomerOffer("main-content");}});}});$(document).on('click', "#downloadCustomerOfferTemplate", function () {window.location.href = context + "/customerOffer/downloadTemplate";});$(document).on('click', ".downloadOffer", function () {var id = $(this).data('requestid');window.location.href = context + "/customerOfferItem/download?offerId=" + id;});$(document).on('click', ".extendeDate-button", function () {let id = $(this).data('requestid');let row = $(this).closest("tr");let params = {"id": id,"endDate": getDatesFromPicker('input[name="extendEndDate"]').endDate}if (confirm("Are you sure you want extend the offer") == true) {doPostAjaxRequestWithParamsHandler(context+ "/extendCustomerOffer", params, function (response) {row.html(response);});}});$(document).on('input', 'table#offer-customer-table input[type=file]', function () {var row = $(this).closest("tr");var id = $(row).find("td:eq(0)").text();if (confirm('Confirm upload ?')) {var fileSelector = $(this)[0];if (fileSelector != undefined&& fileSelector.files[0] != undefined) {var url = `${context}/customerOfferItem/upload?offerId=` + id;console.log(url);var file = this.files[0];console.log("file" + file);let fileInput = $(this);console.log("fileInput" + file);doAjaxUploadRequestHandler(url, 'POST', file, function (response) {console.log(response)alert("successfully uploaded");});}}});$(document).on('click', ".upgrade-approved", function () {var id = $(this).data('requestid');var row = $(this).closest("tr");if (confirm("Are you sure you want Approve r!") == true) {doPostAjaxRequestHandler(`${context}/approveSamsungUpgradeOffer?id=${id}`, function (response) {alert("Successfully Approved");row.html(response);return false;});}});$(document).on('click', ".upgrade-rejected", function () {let id = $(this).data('requestid');if (confirm("Are you sure you want Reject!") == true) {doPostAjaxRequestHandler(`${context}/rejectSamsungUpgradeOffer?id=${id}`, function (response) {if (response == 'true') {alert("Successfully Rejected");loadWalletRequest("main-content");}return false;});}});});function loadCustomerOffer(domId) {doGetAjaxRequestHandler(`${context}/getCustomerOffer`, function (response) {$('#' + domId).html(response);});}function loadSamsungUpgradeOffer(domId) {doGetAjaxRequestHandler(context + "/getSamsungUpgradeOffer", function (response) {$('#' + domId).html(response);});}