Subversion Repositories SmartDukaan

Rev

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

Rev 29473 Rev 29598
Line 1... Line 1...
1
$(function() {
1
$(function() {
2
	$(document).on('click', ".lead", function() {
2
	$(document).on('click', ".lead", function() {
3
		loadLead("main-content");
3
		loadLead("main-content");
4
	});
4
	});
5
	
5
 
6
	
6
 
7
	
7
 
8
	
8
 
9
	$(document).on('click', ".submitDateWiseLead", function() {
9
	$(document).on('click', ".submitDateWiseLead", function() {
10
		
10
 
11
		
11
 
12
		var leadDate = $("#dateWiseLead").val();
12
		var leadDate = $("#dateWiseLead").val();
13
		var status = $("#statusFilter").val();
13
		var status = $("#statusFilter").val();
14
		var color = $("#colorFilter").val();
14
		var color = $("#colorFilter").val();
15
		
15
 
16
		if(color == null)
16
		if (color == null) {
17
			{
-
 
18
			color = "";
17
			color = "";
19
			}
18
		}
20
		
19
 
21
	
20
 
22
		console.log(leadDate);
21
		console.log(leadDate);
23
		
22
 
24
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function(response) {
23
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function(response) {
25
			$('#' + 'main-content').html(response);
24
			$('#' + 'main-content').html(response);
26
		});
25
		});
27
		
26
 
28
	});
27
	});
29
 
28
 
30
	$(document).on('click', ".lead-close", function() {
29
	$(document).on('click', ".lead-close", function() {
31
		loadClosedLead("main-content");
30
		loadClosedLead("main-content");
32
	});
31
	});
Line 123... Line 122...
123
		var color = $("#colorFilter").val();
122
		var color = $("#colorFilter").val();
124
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color, function(response) {
123
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color, function(response) {
125
			$('#' + 'main-content').html(response);
124
			$('#' + 'main-content').html(response);
126
		});
125
		});
127
	});
126
	});
128
	
127
 
129
	$(document).on('click', "#uploadIvoryLead", function() {
128
	$(document).on('click', "#uploadIvoryLead", function() {
130
 
129
 
131
		window.location.href = context + "/downloadIvoryLead";
130
		window.location.href = context + "/downloadIvoryLead";
132
	});
131
	});
133
 
132
 
134
	$(document).on('click', ".submitLeadGenerate", function() {
133
	$(document).on('click', ".submitLeadGenerate", function() {
135
	    
134
 
136
	    console.log("hello");
135
		console.log("hello");
137
		if (confirm('Confirm upload ?')) {
136
		if (confirm('Confirm upload ?')) {
138
			var fileSelector = $(this)[0];
137
			var fileSelector = $(this)[0];
139
			if (fileSelector != undefined) {
138
			if (fileSelector != undefined) {
140
				var url = `${context}/csvFileAndSetLead`;
139
				var url = `${context}/csvFileAndSetLead`;
141
				console.log(url);
140
				console.log(url);
142
				var file = $(".fileLeadGenerate")[0].files[0];
141
				var file = $(".fileLeadGenerate")[0].files[0];
143
				let fileInput = $(this);
142
				let fileInput = $(this);
144
			console.log("file"+file);
143
				console.log("file" + file);
145
			console.log("fileInput"+fileInput);
144
				console.log("fileInput" + fileInput);
146
			doAjaxUploadRequestHandler(
145
				doAjaxUploadRequestHandler(
147
					url,
146
					url,
148
					'POST',
147
					'POST',
149
					file,function(response) {
148
					file, function(response) {
150
 
149
 
151
					console.log("reponse" + response);
150
						console.log("reponse" + response);
-
 
151
 
-
 
152
						if (response == true) {
-
 
153
							alert("successfully uploaded");
-
 
154
 
-
 
155
 
-
 
156
						}
152
				});
157
					});
153
		
158
 
154
			}		 
159
			}
155
		}
160
		}
156
		else {
161
		else {
157
		// Do nothing!
162
			// Do nothing!
158
		}
163
		}
159
	});
164
	});
160
	
165
 
161
	
166
 
162
	$(document).on('click', ".lead-request",
167
	$(document).on('click', ".lead-request",
163
		function() {
168
		function() {
164
 
169
 
165
			var firstName = $('input[name="firstName"]').val();
170
			var firstName = $('input[name="firstName"]').val();
166
			var lastName = $('input[name="lastName"]').val();
171
			var lastName = $('input[name="lastName"]').val();
Line 253... Line 258...
253
		});
258
		});
254
	var leadId = null;
259
	var leadId = null;
255
	var row = null;
260
	var row = null;
256
	$(document).on('click', ".editLead", function() {
261
	$(document).on('click', ".editLead", function() {
257
		$('#editLeadData').modal('show');
262
		$('#editLeadData').modal('show');
258
		 row = $(this).closest("tr");
263
		row = $(this).closest("tr");
259
		$("#editScheduleTime").hide();
264
		$("#editScheduleTime").hide();
260
		leadId = $(this).data('leadid');
265
		leadId = $(this).data('leadid');
261
		console.log(leadId)
266
		console.log(leadId)
262
 
267
 
263
	});
268
	});
264
 
269
 
265
	$(document).on('click', ".lead-edit-request",
270
	$(document).on('click', ".lead-edit-request",
266
		function() {
271
		function() {
267
		
272
 
268
		
273
 
269
		console.log(row);
274
			console.log(row);
270
		var rowIndex = $(this).closest('tr').prevAll().length;
275
			var rowIndex = $(this).closest('tr').prevAll().length;
271
 
276
 
272
			var remark = $('input[name="remark"]').val();
277
			var remark = $('input[name="remark"]').val();
273
			var assignTo = $("#assignTo").val();
278
			var assignTo = $("#assignTo").val();
274
			var editStatus = $("#editStatus").val();
279
			var editStatus = $("#editStatus").val();
275
			var reason = $("#reason").val();
280
			var reason = $("#reason").val();
276
			
281
 
277
			var leadDate = $("#dateWiseLead").val();
282
			var leadDate = $("#dateWiseLead").val();
278
			var leadStatus = $("#statusFilter").val();
283
			var leadStatus = $("#statusFilter").val();
279
			var color = $("#colorFilter").val();
284
			var color = $("#colorFilter").val();
280
			
285
 
281
			
286
 
282
			console.log(leadDate)
287
			console.log(leadDate)
283
			console.log(leadStatus)
288
			console.log(leadStatus)
284
			
289
 
285
			console.log(color)
290
			console.log(color)
286
			console.log(reason)
291
			console.log(reason)
287
 
292
 
288
			if (remark === "" && assignTo === "" && editStatus === "") {
293
			if (remark === "" && assignTo === "" && editStatus === "") {
289
				alert("All fields is required");
294
				alert("All fields is required");
Line 316... Line 321...
316
			leadActivityData['id'] = leadId;
321
			leadActivityData['id'] = leadId;
317
			leadActivityData['remark'] = remark;
322
			leadActivityData['remark'] = remark;
318
			leadActivityData['assignTo'] = assignTo
323
			leadActivityData['assignTo'] = assignTo
319
			leadActivityData['status'] = editStatus
324
			leadActivityData['status'] = editStatus
320
			leadActivityData['reason'] = reason
325
			leadActivityData['reason'] = reason
321
			
326
 
322
			if (editStatus == "followUp") {
327
			if (editStatus == "followUp") {
323
				leadActivityData['scheldule'] = startDate
328
				leadActivityData['scheldule'] = startDate
324
			}
329
			}
325
 
330
 
326
			console.log(leadActivityData);
331
			console.log(leadActivityData);
327
			if (confirm("Are you sure you want to add lead!") == true) {
332
			if (confirm("Are you sure you want to add lead!") == true) {
328
				doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function(response) {
333
				doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function(response) {
329
					console.log(response);
334
					console.log(response);
330
					$('#editLeadData').modal('hide');
335
					$('#editLeadData').modal('hide');
331
					$('.modal-backdrop').remove();
336
					$('.modal-backdrop').remove();
332
						row.html(response);
337
					row.html(response);
333
				});
338
				});
334
			}
339
			}
335
 
340
 
336
		});
341
		});
337
 
342