Rev 30253 | Rev 30501 | Go to most recent revision | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function () {$(document).on('click', ".create-scheme", function () {loadScheme("main-content");});$(document).on('click', ".scheme-details", function () {var schemeId = $(this).attr('data');console.log("schemeId = " + schemeId);loadSchemeDetails(schemeId, "scheme-details-container");});$(document).on('click', ".active-scheme", function () {var schemeId = $(this).attr('data');console.log("active-scheme id : " + schemeId);var start = $("#schemes-paginated .start").text();// var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if (confirm("Are you sure you want to Active Scheme!")) {activeScheme(schemeId, offset, "schemes-table");}});$(document).on('click', ".expire-scheme", function () {var schemeId = $(this).attr('data');var expireDate = startDate;var start = $("#schemes-paginated .start").text();// var end = $( "#schemes-paginated .end" ).text();var offset = start - 1;if (confirm("Are you sure you want to Expire Scheme!")) {expireScheme(schemeId, expireDate, offset, "schemes-table");}});$(document).on('click', "#extendDatetime-button",function () {console.log("extendAll button click");var extendDatetime = $('input[name="extendDatetime"]').val();console.log("extendDatetime : " + extendDatetime);if (extendDatetime) {if (confirm("Are you sure you want to Extend expireDateTime for All Scheme!")) {extendAllScheme(extendDatetime, "schemes-table")}} else {alert("feild can't be blank");}});$(document).on('click', "#extendScheme-button",function () {console.log("extend button click");var extendDatetime = $('input[name="extendScheme"]').val();var schemeId = $('#schemeId').val()console.log("extendDatetime : " + extendDatetime);console.log(schemeId);if (extendDatetime) {if (confirm("Are you sure you want to Extend expireDateTime for Scheme!") == true) {extendSchemeById(schemeId)}} else {alert("field can't be blank");}});$(document).on('click', ".monthy-investment",function () {console.log("hello evaluateActualInvestmentPayout");window.location.href = context + "/evaluateActualInvestmentPayout";});$(document).on('click', ".process-investment", function () {if (confirm("Are you sure you want to Process Investment")) {processInvestment();}});$(document).on('click', ".processInvestmentDryRun",function () {console.log("processInvestmentDryRun");window.location.href = context + "/processInvestmentDryRun";});$(document).on('click', ".brand-wise-income",function () {var brand = $(this).data('brand');var status = $(this).data('status');var month = $(this).data('month');brandWiseIncome(brand, month, status);});$(document).on('click', ".imei_wise_income",function () {var catalogItemId = $(this).data('catalogitemid');var month = $(this).data('month');console.log(catalogItemId);imeiWiseIncome(catalogItemId, month);});$(document).on('change', "#month-wise-income", function () {var month = $(this).val();monthWiseIncome(month, "main-content");});$(document).on('click', ".schemes", function () {schemes("main-content");console.log("Active Schemes Button Clicked...")/*bootbox.confirm({message: "<div class = 'disclosurehindata'> <img src='resources/images/disclosure.png' style='width:100%'> </div>",buttons: {confirm: {label: 'I agree',className: 'btn-success'},cancel: {label: 'I disagree',className: 'btn-danger'}},callback: function (result) {if (result == true) {}}});*/});$(document).on('click', ".margin-calculator", function () {console.log("Active Schemes Button Clicked...")marginCalculator("main-content");});$(document).on('click', ".schemes-download-page", function () {console.log("Schemes Download Clicked...")loadSchemesDownloadPage("main-content");});$(document).on('click', ".schemes-update", function () {loadSchemeUpdatePage("main-content");});$(document).on('click', ".add-item", function () {schemeIds = $("#schemeids").val();itemIds = $("#catalogids").val();if (confirm("Are you sure you want to Add Model to Scheme!") == true) {if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {alert("fields shouldn't be blank");return;}updateSingleScheme(schemeIds, catalogIds);}});$(document).on('click', ".add-schemes", function () {let schemeIds = $("#schemeids").val();let catalogIds = $("#catalogids").val();if (confirm("Are you sure you want to Add Item to Scheme!") == true) {if (catalogIds.trim().length === 0 || schemeIds.trim().length === 0) {alert("fields shouldn't be blank");return;}updateSchemes(schemeIds, catalogIds);}});$(document).on('click', ".delete-schemes", function () {if (confirm("Delete model from Scheme?") == true) {schemeId = $(this).data('schemeid');catalogId = $(this).data('catalogid');deleteScheme(schemeId, catalogId);}});$(document).on('click', "#scheme-search-button",function () {var searchText = $("#scheme-search-text").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}doGetAjaxRequestHandler(context + "/getSchemes?searchScheme="+ searchText, function (response) {$('#' + "main-content").html(response);});});$(document).on("keyup", "#scheme-search-text", function (e) {var keyCode = e.keyCode || e.which;if (keyCode == 13) {$("#scheme-search-button").click();}});$(document).on('click', "#scheme-item-search-button", function () {var searchText = $("#scheme-item-search-text").val();var date = $(".schemes-date").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";alert("please select item");return;}if (typeof currentItem != "undefined") {console.log(currentItem);loadSchemeItemSearchInfo(currentItem, date);} else {console.log("reeffff")alert("Data No Found")}});$(document).on('click', "#scheme-imei-search-button", function () {var searchText = $("#scheme-imei-search-text").val();var date = $(".schemes-date").val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";alert("please select imei");return;}if (typeof imei != "undefined") {console.log(imei);loadSchemeImeiSearchInfo(imei, date);} else {console.log("reeffff")alert("Data No Found")}});$(document).on('click', ".categoryWiseSchemeHistory",function () {var category = $('#partner-category').val();console.log(category);doGetAjaxRequestHandler(context + "/getSchemes?partnerType="+ category, function (response) {$('#' + "main-content").html(response);$('#partner-category').val(category);window.dispatchEvent(new Event('resize'));});});$(document).on("keyup", "#scheme-item-search-text", function (e) {var keyCode = e.keyCode || e.which;if (keyCode == 13) {$("#scheme-item-search-button").click();}});});function configureTagListingItemsDescriptionDropDown() {$('.catalogItemsDescription').multiselect({includeSelectAllOption: true,maxHeight: 200,buttonWidth: '180px',numberDisplayed: 1,nonSelectedText: 'Models',nSelectedText: ' - Models Selected',allSelectedText: 'All Models Selected',enableFiltering: true,enableCaseInsensitiveFiltering: true});}function schemesDownload() {console.log("downloadItemLedgerReport Button clicked")var startDateTime = $('input[name="startDateTime"]').val();console.log("startDateTime : " + startDateTime);var endDateTime = $('input[name="endDateTime"]').val();console.log("endDateTime : " + endDateTime);doAjaxGetDownload(context + "/schemes/download?startDateTime="+ startDateTime + "&endDateTime=" + endDateTime,"SchemesReport.xlsx");}function selectedbrand() {var brands = $('#tag-listing-brands').val();console.log(brands);if (brands) {loadCatalogDescriptionByBrands("tag-listing-items-description-container", brands);}}function categoryChanged() {let categoryId = $('#category-list').val();if (categoryId) {loadBrandsByCategory("brand-list", categoryId);}}function loadSchemeDetails(schemeId, domId) {doGetAjaxRequestHandler(context + "/getSchemeById?schemeId=" + schemeId,function (response) {$('#' + domId).html(response);window.dispatchEvent(new Event('resize'));});}function activeScheme(schemeId, offset, domId) {doPutAjaxRequestHandler(context + "/activeSchemeById?schemeId=" + schemeId+ "&offset=" + offset, function (response) {$('#' + domId).html(response);$('#scheme-details-container').html('');});}function expireScheme(schemeId, expireDate, offset, domId) {doPutAjaxRequestHandler(context + "/expireSchemeById?schemeId=" + schemeId+ "&offset=" + offset + "&expireTimestamp=" + expireDate, function (response) {alert("Scheme - " + schemeId + " marked for expiry successfully!");$('#' + domId).html(response);$('#scheme-details-container').html('');});}function extendAllScheme(domId) {doPostAjaxRequestWithJsonHandler(context + "/extendAllSchemes", JSON.stringify(startDate), function (response) {if (response == 'true') {alert("Scheme All Extended successfully");schemes("main-content");} else {alert("No scheme Activated Currently");schemes("main-content");}});}function extendSchemeById(schemeId) {doPostAjaxRequestWithJsonHandler(context + "/extendSchemeById?schemeId="+ schemeId, JSON.stringify(startDate), function (response) {if (response == 'true') {alert("Scheme extended successfully");schemes("main-content");} else {alert("Scheme already Expired");schemes("main-content");}});}function processInvestment() {doPostAjaxRequestWithJsonHandler(context + "/payMonthlyInvestment", function (response) {alert("InvestmentPayout processed successfully");});}function loadScheme(domId) {doGetAjaxRequestHandler(context + "/createScheme", function (response) {$('#' + domId).html(response);createSchemeOnReady();categoryChanged();$('input[name="dateRange"]').daterangepicker(getRangedDatePicker(), dateRangeCallback);});}function loadCatalogDescriptionByBrands(domId, brands) {doPostAjaxRequestWithJsonHandler(context + '/getCatalogDescriptionByBrands',JSON.stringify(brands), function (response) {$('#' + domId).html(response);debugger;configureTagListingItemsDescriptionDropDown();});}function loadBrandsByCategory(domId, categoryId) {doGetAjaxRequestHandler(`${context}/getBrandsByCategory?categoryId=${categoryId}`,function (response) {$('#' + domId).html(response);configureBrandsDropDown();});}function schemes(domId) {doGetAjaxRequestHandler(context + "/getSchemes", function (response) {$('#' + domId).html(response);});}function marginCalculator(domId) {doGetAjaxRequestHandler(context + "/getMarginCalculator", function (response) {$('#' + domId).html(response);});}function loadSchemesDownloadPage(domId) {doGetAjaxRequestHandler(context + "/schemes/downloadPage", function (response) {$('#' + domId).html(response);});}function loadSchemeUpdatePage(domId) {doGetAjaxRequestHandler(context + "/schemes/update-schemes-page", function (response) {$('#' + domId).html(response);});}function brandWiseIncome(brand, month, status) {console.log(brand);console.log(month);doGetAjaxRequestHandler(context + "/brandWiseIncome?brand=" + brand + "&month=" + month + "&status=" + status, function (response) {$('.imei-wise-income-container').html('');$('.brand-wise-income-container').html(response);});}function monthWiseIncome(month, domId) {console.log(month);doGetAjaxRequestHandler(context + "/monthWisePartnerIncome/" + month, function (response) {console.log(response);$('#' + domId).html(response);})}function imeiWiseIncome(catalogItemId, month) {console.log(catalogItemId);console.log(month);doGetAjaxRequestHandler(context + "/getLastMonthImeiWiseIncome?catalogItemId=" + catalogItemId + "&month=" + month, function (response) {$('.imei-wise-income-container').html(response);});}function updateSingleScheme(shcemeIds, catalogIds) {doPostAjaxRequestWithJsonHandler(context + '/addItemToScheme', JSON.stringify({"catalogIds": catalogIds.split(",").map(Number),"schemeIds": schemeIds.split(",").map(Number)}), function (response) {if (response == 'true') {alert("Item Added to scheme successfully");// $('#newItemToSchemeModal').modal('hide');loadSchemeDetails(shcemeIds, "scheme-details-container");} else {alert("Item already present");loadSchemeDetails(shcemeIds, "scheme-details-container");}});}function updateSchemes(schemeIds, catalogIds) {doPostAjaxRequestWithJsonHandler(context + '/schemes/update', JSON.stringify({"catalogIds": catalogIds.split(",").map(Number),"schemeIds": schemeIds.split(",").map(Number)}), function (response) {if (response == 'true') {alert("Item Added to scheme successfully");// $('#newItemToSchemeModal').modal('hide');loadSchemeUpdatePage("main-content");}});}function deleteScheme(schemeId, catalogId) {doDeleteAjaxRequestHandler(context + "/schemes/delete?schemeId=" + schemeId+ "&catalogId=" + catalogId, function (response) {if (response == 'true') {alert("Model Deleted successfully from Scheme");loadSchemeDetails(schemeId, "scheme-details-container");}});}function loadSearchItemScheme(domId, selectedModel, date) {var searchText = $("#scheme-item-search-text").val();var category = $('#partner-category').val();if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}if (typeof (category) == "undefined" || !category) {category = "";}if (searchText && category) {doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&partnerType=${category}&date=${date}`, function (response) {$('#' + domId).html(response);$('#partner-category').val(category);});} else if (searchText) {doGetAjaxRequestHandler(`${context}/getSchemes?searchModel=${selectedModel}&date=${date}`, function (response) {$('#' + domId).html(response);$('#partner-category').val(category);});}}function loadSearchImeiScheme(domId, selected_imei, date) {var category = $('#partner-category').val();var searchText = $("#scheme-imei-search-text").val();var category = $('#partner-category').val();console.log(category)if (typeof (searchText) == "undefined" || !searchText) {searchText = "";}if (typeof (category) == "undefined" || !category) {category = "";}if ((searchText) && (category)) {doGetAjaxRequestHandler(context + "/getSchemes?searchImei="+ selected_imei + "&partnerType=" + category, function (response) {$('#' + domId).html(response);$('#partner-category').val(category);$('#scheme-imei-search-text').val(selected_imei);});} else if ((searchText)) {doGetAjaxRequestHandler(`${context}/getSchemes?searchImei=${selected_imei}&date=${date}`, function (response) {$('#' + domId).html(response);$('#scheme-imei-search-text').val(selected_imei);});}}function loadSchemeItemSearchInfo(selectedModel, date) {loadSearchItemScheme("main-content", selectedModel, date);}function loadSchemeImeiSearchInfo(selectedImei, date) {loadSearchImeiScheme("main-content", selectedImei, date);}