Rev 27755 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(document).on('click', ".promoter-info", function() {loadPromotor("main-content", true);});$(document).on('click', ".inactive-promoter-info", function() {loadPromotorInactive("main-content", true);});var id = 0;var retailerId;var fofoId;$(document).on('click', "#promoter-info-paginated .next",function() {var fofo = fofoId;console.log(fofoId)if ((fofoId)) {var params = {};params['fofoId'] = fofo;loadPaginatedNextItems('/getPaginatedPromoterInfo', params,'promoter-info-paginated', 'promoter-Info-table','promoter-container');} else {loadPaginatedNextItems('/getPaginatedPromoterInfo', null,'promoter-info-paginated', 'promoter-Info-table','promoter-container');$(this).blur();}});$(document).on('click', "#promoter-info-paginated .previous",function() {var fofo = fofoId;console.log(fofoId)if ((fofoId)) {var params = {};params['fofoId'] = fofo;loadPaginatedPreviousItems('/getPaginatedPromoterInfo', params,'promoter-info-paginated', 'promoter-Info-table','promoter-container');} else {loadPaginatedPreviousItems('/getPaginatedPromoterInfo', null,'promoter-info-paginated', 'promoter-Info-table','promoter-container');$(this).blur();}});$(document).on('click', "#promoter-inactive-info-paginated .next",function() {var fofo = fofoId;console.log(fofoId)if ((fofoId)) {var params = {};params['fofoId'] = fofo;loadPaginatedNextItems('/getPaginatedPromoterInactiveInfo', params,'promoter-inactive-info-paginated', 'promoter-Inactive-Info-table','promoter-inactive-container');} else {loadPaginatedNextItems('/getPaginatedPromoterInactiveInfo', null,'promoter-inactive-info-paginated', 'promoter-Inactive-Info-table','promoter-inactive-container');$(this).blur();}});$(document).on('click', "#promoter-inactive-info-paginated .previous",function() {var fofo = fofoId;console.log(fofoId)if ((fofoId)) {var params = {};params['fofoId'] = fofo;loadPaginatedPreviousItems('/getPaginatedPromoterInactiveInfo', params,'promoter-inactive-info-paginated', 'promoter-Inactive-Info-table','promoter-inactive-container');} else {loadPaginatedPreviousItems('/getPaginatedPromoterInactiveInfo', null,'promoter-inactive-info-paginated', 'promoter-Inactive-Info-table','promoter-inactive-container');$(this).blur();}});$(document).on('click', ".create-promoter",function() {var name = $('#promoterName').val();var brand = $('#tag-listing-brands').val();var email = $('#promoterEmail').val();var mobile = $('#promoterMobile').val();var retailerId = currentFofoId;var portalAccess = $('#sd-Portal-Access').val();var status = $('#status').val();retailerId = currentFofoId;console.log(id);if (name === "" && brand === "" && email === ""&& mobile === "") {alert("Field can't be empty");return;}if (name === "") {alert("Promoter Name is required");return;}if (brand === "") {alert("Brand is required");return;}if (email === "") {alert("email is required");return;}if (mobile === "") {alert("mobile Number is required");return;}if (status === "") {alert("Status is required");}var promoterdetailData = {}promoterdetailData['id'] = id;promoterdetailData['name'] = $('#promoterName').val();promoterdetailData['brand'] = $('#tag-listing-brands').val();promoterdetailData['email'] = $('#promoterEmail').val();promoterdetailData['mobile'] = $('#promoterMobile').val();promoterdetailData['retailerId'] = retailerId;promoterdetailData['sdPortalAccess'] = $('#sd-Portal-Access').val();promoterdetailData['status'] = $('#status').val();console.log(promoterdetailData);if (confirm("Are you sure you want to add Promoter!") == true) {doPostAjaxRequestWithJsonHandler(context+ "/createPromoter", JSON.stringify(promoterdetailData), function(response) {if (response == 'true') {alert("successfully Add");loadPromotor("main-content");id = 0;}});return false;}});$(document).on('click', ".updatePromoterdetail", function() {id = $(this).data('requestid');name = $(this).data('name');brand = $(this).data('brand');partner = $(this).data('partner');partnerid = $(this).data('partnerid');email = $(this).data('email')mobile = $(this).data('mobile')console.log(name);currentFofoId = partnerid;console.log(brand);console.log(partner);console.log(partnerid)$('#promoterName').val(name);$('#tag-listing-brands').val(brand);$('#promoterEmail').val(email);$('#promoterMobile').val(mobile);$('#partnerFofoId').val(partner);/*$('#promoterName').attr('readonly', true);$('#promoterMobile').attr('readonly', true);$('#promoterEmail').attr('readonly', true);$('#promoterMobile').attr('readonly', true);*/$('#partnerFofoId').attr('disabled', true);$('#tag-listing-brands').attr('disabled', true);});$(document).on('click', ".removePromoter",function() {id = $(this).data('requestid');if (confirm("Are you sure you want to remove Promoter Partner Store!") == true) {doPostAjaxRequestHandler(context+ "/removePromoterfromPartnerStore?id="+ id, function(response) {if (response == 'true') {alert("successfully remove");loadPromotor("main-content");id = 0;}});return false;}});$(document).on('click', ".inactivePromoter", function () {console.log('this is working or noyt')var id = $(this).data('requestid');if (confirm("Are you sure you want to InActive this Promoter")) {doPostAjaxRequestHandler(context + "/getPromoterInactive?id=" + id,function (response) {if (response === "true") {alert("successfully moved to active promoter");loadPromoter("main-content");}});}});$(document).on('click', ".activePromoter", function () {var id = $(this).data('requestid');if (confirm("Are you sure you want to Active this Promoter")) {doPostAjaxRequestHandler(context + "/activePromoterfromPartnerStore?id=" + id,function (response) {if (response === "true") {alert("successfully moved to active promoter");// loadPromoter("main-content");id = 0;}});}});$(document).on('click', "#promoter-fofo-search", function() {fofoId = partnerId;doGetAjaxRequestHandler(context + "/getPromoterInfo?fofoId=" + fofoId, function(response) {$('#' + "main-content").html(response);});});$(document).on('click', "#inactive-promoter-fofo-search", function() {fofoId = partnerId;doGetAjaxRequestHandler(context + "/getPromoterInactive?fofoId=" + fofoId, function(response) {$('#' + "main-content").html(response);});});});function loadPromotor(domId, active) {doGetAjaxRequestHandler(context + "/getPromoterInfo?active=true", function(response) {$('#' + domId).html(response);});}function loadPromotorInactive(domId, inactive) {doGetAjaxRequestHandler(context + "/getPromoterInactive?active=false", function(response) {$('#' + domId).html(response);});}