Subversion Repositories SmartDukaan

Rev

Rev 25649 | Rev 25683 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 25649 Rev 25651
Line 5... Line 5...
5
 
5
 
6
	$('.create-notification-button')
6
	$('.create-notification-button')
7
			.live(
7
			.live(
8
					'click',
8
					'click',
9
					function() {
9
					function() {
-
 
10
						console.log(localStorage.getItem("notifyDocument"));
10
						var userIds = $('#fofo-users').val().concat(
11
						var userIds = $('#fofo-users').val().concat(
11
								$('#internal-users').val());
12
								$('#internal-users').val());
12
						console.log("multipleUsers", userIds);
13
						console.log("multipleUsers", userIds);
-
 
14
 
13
						var campaignName = $('input[name="campaignName"]')
15
						var campaignName = $('input[name="campaignName"]')
14
								.val();
16
								.val();
15
						var title = $('input[name="title"]').val();
17
						var title = $('input[name="title"]').val();
16
						var message = $('input[name="message"]').val();
18
						var message = $('input[name="message"]').val();
17
						var imageUrl = $('input[name="imageUrl"]').val();
19
						var imageUrl = $('input[name="imageUrl"]').val();
Line 73... Line 75...
73
						notificationData['type'] = $('#type').val();
75
						notificationData['type'] = $('#type').val();
74
						notificationData['url'] = $('input[name="url"]').val();
76
						notificationData['url'] = $('input[name="url"]').val();
75
						notificationData['expiresat'] = startDate;
77
						notificationData['expiresat'] = startDate;
76
						notificationData['showImage'] = $(
78
						notificationData['showImage'] = $(
77
								'input[name="showImage"]').val();
79
								'input[name="showImage"]').val();
78
 
-
 
-
 
80
						notificationData['documentId'] = localStorage
-
 
81
								.getItem("notifyDocument");
79
						notificationData['annoucement'] = $('#annoucement')
82
						notificationData['annoucement'] = $('#annoucement')
80
								.val();
83
								.val();
81
						console.log(notificationData)
84
						console.log(notificationData)
82
 
85
 
83
						if (confirm("Are you sure you want to send notification!") == true) {
86
						if (confirm("Are you sure you want to send notification!") == true) {
Line 103... Line 106...
103
			response) {
106
			response) {
104
		$('#' + domId).html(response);
107
		$('#' + domId).html(response);
105
 
108
 
106
	});
109
	});
107
 
110
 
108
}
-
 
109
111
}
-
 
112
 
-
 
113
$(document)
-
 
114
		.on(
-
 
115
				'input',
-
 
116
				'#notifyDocument',
-
 
117
				function() {
-
 
118
					if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
119
						var fileSelector = $('#notifyDocument')[0];
-
 
120
						if (fileSelector != undefined
-
 
121
								&& fileSelector.files[0] != undefined) {
-
 
122
							var url = webApiScheme + '://' + webApiHost + ':'
-
 
123
									+ webApiPort + webApiRoot
-
 
124
									+ '/document-upload';
-
 
125
 
-
 
126
							console.log(url);
-
 
127
							var file = this.files[0];
-
 
128
							doAjaxUploadRequestHandler(
-
 
129
									url,
-
 
130
									'POST',
-
 
131
									file,
-
 
132
									function(response) {
-
 
133
										console.log(response);
-
 
134
										var documentId = response.response.document_id;
-
 
135
										console.log("documentId : "
-
 
136
												+ documentId);
-
 
137
										localStorage.setItem("notifyDocument",
-
 
138
												documentId);
-
 
139
										// $('#retailerDocument').attr("documentId",
-
 
140
										// localStorage.getItem("retailerDocument"));
-
 
141
										// return
-
 
142
										// documentId;
-
 
143
									});
-
 
144
							// alert("Retailer Shop Document
-
 
145
							// is required");
-
 
146
						}
-
 
147
					} else {
-
 
148
						// Do nothing!
-
 
149
					}
-
 
150
				});
-
 
151
110
152