Rev 24317 | Rev 27755 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$(".create-service").live('click', function() {loadService("main-content");});$(".add-brand").live('click', function() {loadaddBrandToService("main-content");});$(".notApplicableService").live('click',function() {naCommentService = $(this).data('nacommentservice');console.log(naCommentService);var dialog = bootbox.dialog({message : "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"+ naCommentService + "</p>",closeButton : true});dialog.modal('show');});$(".notApplicableBrandService").live('click',function() {naCommentService = $(this).data('nacommentservice');console.log(naCommentService);var dialog = bootbox.dialog({message : "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"+ naCommentService + "</p>",closeButton : true});dialog.modal('show');});$(".add-brand").live('click', function() {loadaddBrandToService("main-content");});$(".add-service-details-for-partner").live('click',function() {fofoId = $("#partnerName").val();serviceId = $("#serviceName").val();applicableType = $("#applicableService").val();code = $("#code").val();partnerStatus = $("#partnerStatusTypeServices").val();na_comment = $("#na_comment_services").val();partnerCommentStatus = $("#partner_comment_status").val();if (applicableType == "" || applicableType == null|| applicableType == undefined) {alert("select appropriate applicableType");}else if (applicableType == 'NO') {if (na_comment == "" || na_comment == undefined) {alert("Na_comment can't be empty");return;}if (fofoId == "" || fofoId == null || fofoId == undefined) {alert("select appropriate partnerName");return;}if (serviceId == "" || serviceId == null|| serviceId == undefined) {alert("select appropriate serviceName");return;}}else{if (fofoId == "" || fofoId == null || fofoId == undefined) {alert("select appropriate partnerName");return;}if (serviceId == "" || serviceId == null|| serviceId == undefined) {alert("select appropriate serviceName");return;}if (code == "" || code == null|| code == undefined) {alert("enter appropriate code")return;}}console.log(fofoId, serviceId, applicableType, code,partnerStatus);addPartnerServiceDetails(fofoId, serviceId, applicableType,code, partnerStatus, na_comment,partnerCommentStatus);});$(".add-brand-service-details-for-partner").live('click',function() {fofoId = $("#partnerName").val();serviceId = $("#serviceName").val();serviceBrandId = $("#serviceBrandName").val();applicableType = $("#applicableService").val();active = $("#activeServiceBrand").val();partnerStatus = $("#partnerStatusTypeServices").val();na_comment = $("#na_comment_services").val();partnerCommentStatus = $("#partner_comment_status").val();if (applicableType == "NO") {if (na_comment == "" || na_comment == undefined) {alert("Na_comment can't be empty");return;}}if (fofoId == "" || fofoId == null || fofoId == undefined) {alert("select appropriate partnerName");return;} else if (serviceBrandId == "" || serviceBrandId == null|| serviceBrandId == undefined) {alert("select appropriate serviceBrandId");return;} else if (applicableType == "" || applicableType == null|| applicableType == undefined) {alert("select appropriate applicableType");} else if (active == "" || active == null|| active == undefined) {alert("select appropriate active")} else if (partnerStatus == "" || partnerStatus == null|| partnerStatus == undefined) {alert("select appropriate partnerStatus");} else {console.log(fofoId, serviceBrandId, applicableType, active,partnerStatus);addPartnerServiceBrandDetails(fofoId, serviceId,serviceBrandId, applicableType, active,partnerStatus, na_comment, partnerCommentStatus);}});$(".partner-service").live('click', function() {loadpartnerService("main-content");});$(".admin-partner-service").live('click', function() {loadAdminPartnerService("main-content", 0);});$(".add-partner-service-details").live('click', function() {loadaddPartnerServiceDetails("main-content");});$(".add-partner-brand-service-details").live('click', function() {loadaddPartnerBrandServiceDetails("main-content");});$(".activate-service").live('click', function() {serviceId = $(this).data('serviceid');fofoId = $("#partnerName").val();console.log(fofoId);console.log(serviceId);activatePartnerService(fofoId, serviceId);});$(".deactivate-service").live('click', function() {serviceId = $(this).data('serviceid');fofoId = $("#partnerName").val();console.log(fofoId);console.log(serviceId);deActivatePartnerService(fofoId, serviceId);});$(".activate-brand-service").live('click', function() {console.log("activate-brand-service clicked");serviceId = $(this).data('serviceid');fofoId = $("#partnerName").val();serviceBrandId = $(this).data('servicebrandid');console.log(fofoId);console.log(serviceId);console.log(serviceBrandId);activatePartnerBrandService(fofoId, serviceId, serviceBrandId);});$(".deactivate-brand-service").live('click', function() {console.log("activate-brand-service clicked");serviceId = $(this).data('serviceid');fofoId = $("#partnerName").val();serviceBrandId = $(this).data('servicebrandid');console.log(fofoId);console.log(serviceId);console.log(serviceBrandId);deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId);});$(".create-service-button").live('click',function() {console.log("create-service-button clicked");var serviceName = $('#createserviceName').val();if (serviceName === "" || serviceName === undefined|| serviceName == null) {alert("Input field can't be empty");return;}if (confirm("Are you sure you want to create Service!") == true) {createService("main-content", serviceName);}});$(".partner-service-search-button").live('click',function() {var fofoId = $('#partnerName').val();if (fofoId === "" || fofoId === undefined || fofoId == null) {alert("select appropriate partner");return;}doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="+ fofoId, function(response) {$('#' + "partnerServicesByID").html(response);});});$("#remove-added-brand-button").live('click',function() {var serviceId = $(this).data('id');var brand = $(this).data('brand');console.log(serviceId);console.log(brand)if (confirm("Are you sure you want to remove brand from Service!") == true) {removeBrandFromService("main-content", serviceId,brand);}});$(".service-brand-button").live('click', function() {var brands = $('#tag-listing-brands').val();var serviceId = $('#serviceName').val();console.log(brands);console.log(serviceId);if (serviceId === "" || serviceId === undefined) {alert("service not selected");return;}if (!brands) {alert("select brand");return;}if (confirm("Are you sure you want to add brand!") == true) {addBrandToService("main-content", brands, serviceId);}});$('#serviceName').live('change', function() {// $('#tag-listing-brand-value').text($(this).text());loadBrandsByServiceId("service-container", $(this).val());loadaddedBrandsbyserviceId("added-brand-to-service", $(this).val())});});function addPartnerServiceDetails(fofoId, serviceId, applicableType, code,partnerStatus, na_comment, partnerCommentStatus) {if (confirm("Are you sure you want to add services details!") == true) {var params = {"serviceId" : serviceId,"fofoId" : fofoId,"applicableType" : applicableType,"partnerStatus" : partnerStatus,"na_comment" : na_comment,"partnerCommentStatus" : partnerCommentStatus,"code" : code}doPostAjaxRequestWithParamsHandler(context+ "/addPartnerServicesDetails", params, function(response) {if (response == "true") {alert("successfully added partner Service Details");loadaddPartnerServiceDetails("main-content");}});}}function addPartnerServiceBrandDetails(fofoId, serviceId, serviceBrandId,applicableType, active, partnerStatus, na_comment,partnerCommentStatus, code) {if (confirm("Are you sure you want to add service brand details!") == true) {var params = {"serviceId" : serviceId,"serviceBrandId" : serviceBrandId,"fofoId" : fofoId,"applicableType" : applicableType,"active" : active,"partnerStatus" : partnerStatus,"na_comment" : na_comment,"partnerCommentStatus" : partnerCommentStatus,}doPostAjaxRequestWithParamsHandler(context+ "/addPartnerServiceBrandDetails", params, function(response) {if (response == "true") {alert("successfully added partner Service Brand Details");loadaddPartnerBrandServiceDetails("main-content");}});}}function configureBrandsDropDown() {$(document).ready(function() {$('#tag-listing-brands').multiselect({includeSelectAllOption : true,multiple : true,maxHeight : 200,buttonWidth : '180px',numberDisplayed : 1,nonSelectedText : 'Brands',nSelectedText : ' - Brands Selected',allSelectedText : 'All Brands Selected',enableFiltering : true,enableCaseInsensitiveFiltering : true});});}function loadService(domId) {doGetAjaxRequestHandler(context + "/getcreateService", function(response) {$('#' + domId).html(response);});}function loadaddedBrandsbyserviceId(domId, serviceId) {doGetAjaxRequestHandler(context + "/getAddedbrands?serviceId=" + serviceId,function(response) {$('#' + domId).html(response);});}function loadBrandsByServiceId(domId, serviceId) {doGetAjaxRequestHandler(context + "/getbrands?serviceId=" + serviceId,function(response) {$('#' + domId).html(response);configureBrandsDropDown();});}function createService(domId, serviceName) {console.log(serviceName);doPostAjaxRequestHandler(context + "/createService?serviceName="+ serviceName, function(response) {alert("Service Successfully Created");$('#' + domId).html(response);});}function loadaddBrandToService(domId) {doGetAjaxRequestHandler(context + "/addBrandsToService",function(response) {$('#' + domId).html(response);});}function addBrandToService(domId, brands, serviceId) {doPostAjaxRequestWithJsonHandler(context + "/addBrandsService?serviceId="+ serviceId, JSON.stringify(brands), function(response) {alert("Brands added successfully");loadBrandsByServiceId("service-container", serviceId);loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)$('#' + domId).html(response);});}function removeBrandFromService(domId, serviceId, brand) {doDeleteAjaxRequestHandler(context + "/removeBrandfromService?serviceId="+ serviceId + "&brand=" + brand, function(response) {alert("Brand removed from service successfully");loadBrandsByServiceId("service-container", serviceId);loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)$('#' + domId).html(response);});}function changeServices(partnerServiceId) {var serviceId = partnerServiceId.value;var fofoId = $("#partnerName").val();console.log(fofoId);console.log(serviceId);if (fofoId == "" || fofoId == 0 || fofoId == undefined) {var dialog = bootbox.dialog({title : "Are you sure want to change state of service!",message : "<div class=form-inline'>"+ "<label for='reason'>Reason:</label>"+ "<textarea class='form-control' rows='1' id='reason'></textarea>"+ "</div>",buttons : {cancel : {label : "cancel",className : 'btn-danger',callback : function() {loadpartnerService("main-content");}},ok : {label : "ok",className : 'btn-info',callback : function() {partnerStatusComment = $('#reason').val();console.log(partnerStatusComment);var params = {"serviceId" : serviceId,"partnerStatusComment" : partnerStatusComment}doPostAjaxRequestWithParamsHandler(context + "/changeStatePartnerService",params,function(response) {if (response == "true") {alert("successfully changed");loadpartnerService("main-content");}});}}}});} else {if (confirm("Are you sure you want to change!") == true) {var params = {"serviceId" : serviceId,"fofoId" : fofoId}doPostAjaxRequestWithParamsHandler(context+ "/changeStatePartnerService", params, function(response) {if (response == "true") {alert("successfully changed");loadAdminPartnerService("main-content", fofoId);}});}else{loadAdminPartnerService("main-content", fofoId);}}}function changeServiceNameForServiceBrand() {serviceId = $("#serviceName").val();console.log(serviceId);doGetAjaxRequestHandler(context + "/selectAddedbrands?serviceId="+ serviceId, function(response) {$('#' + "serviceBrandNameContainer").html(response);});}function configureAllPartnerName() {$(document).ready(function() {$('#partnerName').multiselect({includeSelectAllOption : true,maxHeight : 200,buttonWidth : '200px',numberDisplayed : 1,nonSelectedText : 'Partners',nSelectedText : ' - Partners Selected',allSelectedText : 'All Partners Selected',enableFiltering : true,enableCaseInsensitiveFiltering : true});});}function onChangeStateServiceBrand(partnerServiceBrandId, partnerServiceId) {var brandServiceId = partnerServiceBrandId.value;var fofoId = $("#partnerName").val();console.log(brandServiceId, partnerServiceId);if (fofoId == "" || fofoId == 0 || fofoId == undefined) {var dialog = bootbox.dialog({title : "Are you sure want to change state of service!",message : "<div class=form-inline'>"+ "<label for='reason'>Reason:</label>"+ "<textarea class='form-control' rows='1' id='reason'></textarea>"+ "</div>",buttons : {cancel : {label : "cancel",className : 'btn-danger',callback : function() {loadpartnerService("main-content");}},ok : {label : "ok",className : 'btn-info',callback : function() {partnerStatusComment = $('#reason').val();console.log(partnerStatusComment);var params = {"brandServiceId" : brandServiceId,"serviceId" : partnerServiceId,"partnerStatusComment" : partnerStatusComment}doPostAjaxRequestWithParamsHandler(context+ "/changeStatePartnerServiceBrand",params,function(response) {if (response == "true") {alert("successfully changed");loadpartnerService("main-content");}});}}}});} else {if (confirm("Are you sure you want to change!") == true) {var params = {"brandServiceId" : brandServiceId,"serviceId" : partnerServiceId,"fofoId" : fofoId}doPostAjaxRequestWithParamsHandler(context+ "/changeStatePartnerServiceBrand", params, function(response) {if (response == "true") {alert("successfully changed");loadAdminPartnerService("main-content", fofoId);}});} else {loadAdminPartnerService("main-content", fofoId);}}}function loadpartnerService(domId) {doGetAjaxRequestHandler(context + "/getPartnerServices",function(response) {$('#' + domId).html(response);});}function loadAdminPartnerService(domId, fofoId) {doGetAjaxRequestHandler(context+ "/getAdminPanelForPartnerServices?fofoId=" + fofoId, function(response) {$('#' + domId).html(response);if (fofoId != 0 || fofoId) {doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="+ fofoId, function(response) {$('#' + "partnerServicesByID").html(response);});}});}function activatePartnerService(fofoId, serviceId) {console.log(fofoId);var dialog = bootbox.dialog({title : "Are you sure you want to activate services!",message : "<div class=form-inline'>"+ "<label for='code'>Code:</label>"+ "<input class='form-control' type='text' id='code'/>"+ "</div>",buttons : {cancel : {label : "cancel",className : 'btn-danger',callback : function() {loadAdminPartnerService("main-content", fofoId);}},ok : {label : "ok",className : 'btn-info',callback : function() {code = $('#code').val();//console.log(partnerStatusComment);if(code==""||code==undefined||code==null){alert("code can't be empty");activatePartnerService(fofoId, serviceId);return;}var params = {"serviceId" : serviceId,"fofoId" : fofoId,"code":code}doPostAjaxRequestWithParamsHandler(context + "/activatePartnerService",params, function(response) {if (response == "true") {alert("successfully activate");loadAdminPartnerService("main-content", fofoId);}});}}}});}function deActivatePartnerService(fofoId, serviceId) {if (confirm("Are you sure you want to deactivate services!") == true) {var params = {"serviceId" : serviceId,"fofoId" : fofoId}doPostAjaxRequestWithParamsHandler(context+ "/deActivatePartnerService", params, function(response) {if (response == "true") {alert("successfully deactivate");loadAdminPartnerService("main-content", fofoId);}});}}function activatePartnerBrandService(fofoId, serviceId, serviceBrandId) {if (confirm("Are you sure you want to activate brand service!") == true) {var params = {"serviceId" : serviceId,"fofoId" : fofoId,"serviceBrandId" : serviceBrandId}doPostAjaxRequestWithParamsHandler(context+ "/activatePartnerbrandService", params, function(response) {if (response == "true") {alert("successfully activate");loadAdminPartnerService("main-content", fofoId);}});}}function deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId) {if (confirm("Are you sure you want to deactivate brand service!") == true) {var params = {"serviceId" : serviceId,"fofoId" : fofoId,"serviceBrandId" : serviceBrandId}doPostAjaxRequestWithParamsHandler(context+ "/deActivatePartnerbrandService", params, function(response) {if (response == "true") {alert("successfully deactivate");loadAdminPartnerService("main-content", fofoId);}});}}function loadaddPartnerServiceDetails(domId) {doGetAjaxRequestHandler(context + "/getAddPartnerServicesDetails",function(response) {$('#' + domId).html(response);});}function loadaddPartnerBrandServiceDetails(domId) {doGetAjaxRequestHandler(context + "/getAddPartnerBrandServiceDetails",function(response) {$('#' + domId).html(response);});}