Rev 24014 | Rev 25374 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
$(function() {$('.send-notification').live('click', function() {loadNotificationPanel("main-content");});$('.create-notification-button').live('click', function() {var userIds = $('#fofo-users').val();console.log("multipleUsers",userIds);var campaignName = $('input[name="campaignName"]').val();var title = $('input[name="title"]').val();var message = $('input[name="message"]').val();var longNotificationtext = $('#longNotificationtext').val();var imageUrl = $('input[name="imageUrl"]').val();var type = $('#type').val();var expiryTime=$('#expireSat').val();var url = $('input[name="url"]').val();var notification_type =$('#notification_type').val();var messageText=$('#messageText').val();$('#sendsms').on('change', function(){this.value = this.checked ? true : false;}).change();if(userIds.length === 0 && campaignName === "" && title === "" && message === "" && expiryTime==="" && type===""){alert("Field can't be empty");return;}if(userIds.length === 0){alert("please select the user");return;}if(campaignName === ""){alert("Campaign name is required");return;}if(title === ""){alert("Title Name is required");return;}if(message === ""){alert("Message is required");return;}if(expiryTime === ""){alert("ExpiryTime is required");return;}if(type === ""){alert("type is required");return;}if(type === "url"){if(url === ""){alert("url is required");return;}}var notificationData ={};notificationData['userIds'] =$('#fofo-users').val();notificationData['campaignName'] = $('input[name="campaignName"]').val();notificationData['title']=$('input[name="title"]').val();notificationData['message']=$('#message').val();notificationData['longNotificationtext']=$('#longNotificationtext').val();notificationData['imageUrl']=$('input[name="imageUrl"]').val();notificationData['type']=$('#type').val();notificationData['url']=$('input[name="url"]').val();notificationData['expiresat']=startDate;notificationData['sendsms']=$('input[name="sendsms"]').val();notificationData['notification_type']=$('#notification_type').val();notificationData['messageText']=$('#messageText').val();console.log(notificationData)if(confirm("Are you sure you want to send notification!") == true){doPostAjaxRequestWithJsonHandler(context+"/sendNotification", JSON.stringify(notificationData), function(response){if (response == 'true') {alert("successfully send");loadNotificationPanel("main-content");}});return false;}});});function loadNotificationPanel(domId){doGetAjaxRequestHandler(context+ "/sendNotificationPanel", function(response){$('#' + domId).html(response);});}