2 * ================================================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ================================================================================
20 app.controller('broadcastController', function ($scope, modalService, $modal,AdminService,$routeParams){
21 //$scope.broadcastMessage=${broadcastMessage};
22 //$scope.broadcastSites=${broadcastSites};
23 //console.log($scope.broadcastMessage);
24 $scope.broadcastMessage=[];
25 $scope.broadcastSites=[];
26 AdminService.getBroadcast($routeParams.messageLocationId, $routeParams.messageLocation, $routeParams.messageId).then(function(data){
28 $scope.data = JSON.parse(j.data);
29 $scope.broadcastMessage=JSON.parse($scope.data.broadcastMessage);
30 $scope.broadcastSites=JSON.parse($scope.data.broadcastSites);
31 console.log($scope.broadcastMessage);
32 console.log($scope.broadcastMessage.id);
33 console.log($scope.broadcastSites);
37 console.log("failed");
41 $scope.save = function() {
42 var uuu = "broadcast/save";
43 var postData={broadcastMessage: $scope.broadcastMessage};
48 contentType: 'application/json',
49 data: JSON.stringify(postData),
50 success : function(data){
51 window.location.href = "admin#/broadcast_list";
53 error : function(data){
54 modalService.showFailure("Fail","Error while saving.");
59 $scope.close = function() {
60 window.location.href = "admin#/broadcast_list";
66 $( "#startDatepicker" ).datepicker();
67 $( "#endDatepicker" ).datepicker();
69 $( "#startDatepicker" ).change(function() {
70 var tempStartDate = moment($( "#startDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
71 $( "#startDateHidden" ).val(tempStartDate.toString());
72 //alert( $( "#startDateHidden" ).val() );
74 $( "#endDatepicker" ).change(function() {
75 var tempEndDate = moment($( "#endDatepicker" ).val()).format('YYYY-MM-DD hh:mm:ss.S');
76 $( "#endDateHidden" ).val(tempEndDate.toString());
77 //alert( $( "#endDateHidden" ).val() );