Subversion Repositories SmartDukaan

Rev

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

Rev 34671 Rev 35548
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
	$(document).on('click', ".team-commitment", function() {
6
    $(document).on('click', ".team-commitment", function () {
7
		loadTeamCommitment("main-content");
7
        loadTeamCommitment("main-content");
8
	});
8
    });
9
 
9
 
10
 
10
 
11
	$(document).on('click', ".partner-health", function() {
11
    $(document).on('click', ".partner-health", function () {
12
		loadPartnerHealth("main-content");
12
        loadPartnerHealth("main-content");
13
	});
13
    });
14
 
14
 
15
	$(document).on('click', ".lead-detail", function() {
15
    $(document).on('click', ".lead-detail", function () {
16
		loadLeadDetail("main-content");
16
        loadLeadDetail("main-content");
17
	});
17
    });
18
 
18
 
19
 
19
 
-
 
20
    $(document).on('click', ".submitCommitment",
-
 
21
        function () {
-
 
22
            var startDateTime = getDatesFromPicker('input[name="commitmentDate"]').startDate;
-
 
23
            doGetAjaxRequestHandler(context + "/getTeamCommitment?date="
-
 
24
                + startDateTime, function (response) {
-
 
25
                $('.teamcommitmentcontainer').html(response);
20
 
26
 
21
	$(document).on('click', ".submitCommitment",
-
 
22
		function() {
27
            });
23
			var startDateTime = getDatesFromPicker('input[name="commitmentDate"]').startDate;
-
 
24
			doGetAjaxRequestHandler(context + "/getTeamCommitment?date="
-
 
25
				+ startDateTime, function(response) {
28
        });
26
					$('.teamcommitmentcontainer').html(response);
-
 
27
 
29
 
28
				});
-
 
29
		});
-
 
30
 
30
 
-
 
31
    $(document).on('click', ".submitDateWiseLead", function () {
31
 
32
 
32
 
33
 
-
 
34
        var leadDate = $("#dateWiseLead").val();
-
 
35
        var status = $("#statusFilter").val();
-
 
36
        var color = $("#colorFilter").val();
33
 
37
 
-
 
38
        if (color == null) {
-
 
39
            color = "";
-
 
40
        }
34
 
41
 
35
 
42
 
36
	$(document).on('click', ".submitDateWiseLead", function() {
43
        console.log(leadDate);
37
 
44
 
-
 
45
        doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function (response) {
-
 
46
            $('#' + 'main-content').html(response);
-
 
47
        });
38
 
48
 
39
		var leadDate = $("#dateWiseLead").val();
-
 
40
		var status = $("#statusFilter").val();
-
 
41
		var color = $("#colorFilter").val();
-
 
42
 
49
 
43
		if (color == null) {
-
 
44
			color = "";
-
 
45
		}
50
    })
-
 
51
    ;$(document).on('click', ".downloadDateWiseLead", function () {
46
 
52
 
47
 
53
 
-
 
54
        var leadDate = $("#dateWiseLead").val();
-
 
55
        var status = $("#statusFilter").val();
48
		console.log(leadDate);
56
        var color = $("#colorFilter").val();
49
 
57
 
-
 
58
        if (color == null) {
-
 
59
            color = "";
-
 
60
        }
-
 
61
        // console.log(leadDate);
50
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function(response) {
62
        // doGetAjaxRequestHandler(context + "/downloadDateWiseLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function(response) {
51
			$('#' + 'main-content').html(response);
63
        // 	$('#' + 'main-content').html(response);
52
		});
64
        // });
53
 
65
 
-
 
66
        console.log(leadDate);
-
 
67
        let endPoint = `${context}/downloadDateWiseLead?leadStatus=${status}&color=${color}&leadDate=${leadDate}`;
-
 
68
        window.location.href = endPoint;
54
 
69
 
55
	})
70
    });
56
	;$(document).on('click', ".downloadDateWiseLead", function () {
-
 
57
 
71
 
58
 
72
 
59
		var leadDate = $("#dateWiseLead").val();
73
    $(document).on('click', ".visit-request-plan", function () {
60
		var status = $("#statusFilter").val();
-
 
61
		var color = $("#colorFilter").val();
-
 
62
 
74
 
63
		if (color == null) {
-
 
64
			color = "";
-
 
65
		}
-
 
66
		// console.log(leadDate);
-
 
67
		// doGetAjaxRequestHandler(context + "/downloadDateWiseLead?leadStatus=" + status + "&color=" + color + "&leadDate=" + leadDate, function(response) {
75
        doGetAjaxRequestHandler(context + "/visitPlan", function (response) {
68
		// 	$('#' + 'main-content').html(response);
76
            $('#' + 'main-content').html(response);
69
		// });
77
        });
70
 
78
 
71
		console.log(leadDate);
79
    });
72
		let endPoint = `${context}/downloadDateWiseLead?leadStatus=${status}&color=${color}&leadDate=${leadDate}`;
-
 
73
		window.location.href = endPoint;
-
 
74
 
80
 
75
	});
-
 
-
 
81
    $(document).on('click', ".visitPlan", function () {
76
 
82
 
-
 
83
        let dateWisePlan = $("#dateVisitSearch").val();
77
 
84
 
-
 
85
        doGetAjaxRequestHandler(context + "/visit/getVisitPlan?date=" + dateWisePlan, function (response) {
78
	$(document).on('click', ".visit-request-plan", function() {
86
            $('#' + 'main-content').html(response);
-
 
87
        });
79
 
88
 
80
		doGetAjaxRequestHandler(context + "/visitPlan", function(response) {
-
 
81
			$('#' + 'main-content').html(response);
-
 
82
		});
89
    });
83
 
90
 
-
 
91
    $(document).on('click', ".lead-close", function () {
-
 
92
        loadClosedLead("main-content");
84
	});
93
    });
85
 
94
 
86
	$(document).on('click', ".visitPlan", function() {
95
    $(document).on('click', "#lead-close-paginated .next",
-
 
96
        function () {
87
 
97
 
88
		let dateWisePlan = $("#dateVisitSearch").val();
98
            var searchText = $("#authUser").val();
-
 
99
            // var searchTxt=$("#scheme-search-text").val();
-
 
100
            console.log(searchText);
-
 
101
            if (typeof (searchText) == "undefined" || !searchText) {
-
 
102
                searchText = "";
-
 
103
            }
89
 
104
 
-
 
105
            if ((searchText)) {
-
 
106
                var params = {};
-
 
107
                params['searchTerm'] = searchText;
90
		doGetAjaxRequestHandler(context + "/visit/getVisitPlan?date=" + dateWisePlan, function(response) {
108
                loadPaginatedNextItems('/searchLeadPaginated', params,
-
 
109
                    'lead-close-paginated', 'close-lead-table',
91
			$('#' + 'main-content').html(response);
110
                    'lead-close-container');
92
		});
111
            } else {
93
 
112
 
-
 
113
                loadPaginatedNextItems('/getPaginatedClosedLeads', null,
-
 
114
                    'lead-close-paginated', 'close-lead-table',
-
 
115
                    'lead-close-container');
-
 
116
            }
-
 
117
            $(this).blur();
94
	});
118
        });
95
 
119
 
96
	$(document).on('click', ".lead-close", function() {
120
    $(document).on('click', "#lead-close-paginated .previous",
-
 
121
        function () {
-
 
122
            var searchText = $("#authUser").val();
-
 
123
            // var searchTxt=$("#scheme-search-text").val();
-
 
124
            console.log(searchText);
-
 
125
            if (typeof (searchText) == "undefined" || !searchText) {
97
		loadClosedLead("main-content");
126
                searchText = "";
98
	});
127
            }
99
 
128
 
-
 
129
            if ((searchText)) {
-
 
130
                var params = {};
-
 
131
                params['searchTerm'] = searchText;
-
 
132
                loadPaginatedPreviousItems('/searchLeadPaginated', params,
-
 
133
                    'lead-close-paginated', 'close-lead-table',
-
 
134
                    'lead-close-container');
-
 
135
            } else {
-
 
136
                loadPaginatedPreviousItems('/getPaginatedClosedLeads',
100
	$(document).on('click', "#lead-close-paginated .next",
137
                    null, 'lead-close-paginated', 'close-lead-table',
-
 
138
                    'lead-close-container');
101
		function() {
139
            }
-
 
140
            $(this).blur();
-
 
141
        });
102
 
142
 
103
			var searchText = $("#authUser").val();
143
    $(document).on('click', "#close-lead-search-button", function () {
104
			// var searchTxt=$("#scheme-search-text").val();
144
        var searchText = $("#authUser").val();
105
			console.log(searchText);
-
 
106
			if (typeof (searchText) == "undefined" || !searchText) {
145
        if (typeof (searchText) == "undefined" || !searchText) {
107
				searchText = "";
146
            searchText = "";
-
 
147
        }
-
 
148
        loadLeadSearchInfo(searchText);
108
			}
149
    });
109
 
150
 
-
 
151
    $(document).on("keyup", "#authUser", function (e) {
110
			if ((searchText)) {
152
        var keyCode = e.keyCode || e.which;
111
				var params = {};
153
        if (keyCode == 13) {
112
				params['searchTerm'] = searchText;
154
            $("#close-lead-search-button").click();
-
 
155
        }
-
 
156
    });
113
				loadPaginatedNextItems('/searchLeadPaginated', params,
157
    $(document).on('click', ".view",
-
 
158
        function () {
114
					'lead-close-paginated', 'close-lead-table',
159
            var id = $(this).data('requestid');
115
					'lead-close-container');
160
            console.log(id);
-
 
161
            doGetAjaxRequestHandler(context + "/getLeadActivity?leadId="
116
			} else {
162
                + id, function (response) {
117
 
163
 
118
				loadPaginatedNextItems('/getPaginatedClosedLeads', null,
-
 
119
					'lead-close-paginated', 'close-lead-table',
-
 
120
					'lead-close-container');
164
                console.log(response)
121
			}
-
 
122
			$(this).blur();
-
 
123
		});
-
 
124
 
165
 
125
	$(document).on('click', "#lead-close-paginated .previous",
-
 
126
		function() {
-
 
127
			var searchText = $("#authUser").val();
-
 
128
			// var searchTxt=$("#scheme-search-text").val();
166
                $('#fetchLeadActivityData .modal-content').html(response);
129
			console.log(searchText);
-
 
130
			if (typeof (searchText) == "undefined" || !searchText) {
-
 
131
				searchText = "";
-
 
132
			}
-
 
133
 
167
 
134
			if ((searchText)) {
-
 
135
				var params = {};
168
            });
136
				params['searchTerm'] = searchText;
-
 
137
				loadPaginatedPreviousItems('/searchLeadPaginated', params,
-
 
138
					'lead-close-paginated', 'close-lead-table',
-
 
139
					'lead-close-container');
-
 
140
			} else {
169
        });
141
				loadPaginatedPreviousItems('/getPaginatedClosedLeads',
-
 
142
					null, 'lead-close-paginated', 'close-lead-table',
-
 
143
					'lead-close-container');
-
 
144
			}
-
 
145
			$(this).blur();
-
 
146
		});
-
 
147
 
170
 
148
	$(document).on('click', "#close-lead-search-button", function() {
171
    $(document).on('click', ".newLead", function () {
149
		var searchText = $("#authUser").val();
172
        $('#newEntryLeadModal').modal('show');
150
		if (typeof (searchText) == "undefined" || !searchText) {
-
 
151
			searchText = "";
-
 
152
		}
-
 
153
		loadLeadSearchInfo(searchText);
173
        $("#scheduleTime").hide();
154
	});
174
    });
155
 
175
 
156
	$(document).on("keyup", "#authUser", function(e) {
176
    $(document).on('click', ".show-lead", function () {
157
		var keyCode = e.keyCode || e.which;
177
        var status = $("#statusFilter").val();
158
		if (keyCode == 13) {
178
        doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status, function (response) {
159
			$("#close-lead-search-button").click();
179
            $('#' + 'main-content').html(response);
160
		}
180
        });
161
	});
181
    });
162
	$(document).on('click', ".view",
-
 
163
		function() {
-
 
164
			var id = $(this).data('requestid');
-
 
165
			console.log(id);
-
 
166
			doGetAjaxRequestHandler(context + "/getLeadActivity?leadId="
-
 
167
				+ id, function(response) {
-
 
168
 
182
 
169
					console.log(response)
-
 
170
 
183
 
-
 
184
    $(document).on('click', ".show-colowise-lead", function () {
-
 
185
        var status = $("#statusFilter").val();
-
 
186
        var color = $("#colorFilter").val();
-
 
187
        doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color, function (response) {
171
					$('#fetchLeadActivityData .modal-content').html(response);
188
            $('#' + 'main-content').html(response);
-
 
189
        });
-
 
190
    });
172
 
191
 
173
				});
-
 
174
		});
-
 
-
 
192
    $(document).on('click', "#uploadIvoryLead", function () {
175
 
193
 
176
	$(document).on('click', ".newLead", function() {
194
        window.location.href = context + "/downloadIvoryLead";
177
		$('#newEntryLeadModal').modal('show');
-
 
178
		$("#scheduleTime").hide();
-
 
179
	});
195
    });
180
 
196
 
181
	$(document).on('click', ".show-lead", function() {
197
    $(document).on('click', ".submitLeadGenerate", function () {
182
		var status = $("#statusFilter").val();
-
 
183
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status, function(response) {
-
 
184
			$('#' + 'main-content').html(response);
-
 
185
		});
-
 
186
	});
-
 
187
 
198
 
-
 
199
        console.log("hello");
-
 
200
        if (confirm('Confirm upload ?')) {
-
 
201
            var fileSelector = $(this)[0];
-
 
202
            if (fileSelector != undefined) {
-
 
203
                var url = `${context}/csvFileAndSetLead`;
-
 
204
                console.log(url);
-
 
205
                var file = $(".fileLeadGenerate")[0].files[0];
-
 
206
                let fileInput = $(this);
-
 
207
                console.log("file" + file);
-
 
208
                console.log("fileInput" + fileInput);
-
 
209
                doAjaxUploadRequestHandler(
-
 
210
                    url,
-
 
211
                    'POST',
-
 
212
                    file, function (response) {
188
 
213
 
-
 
214
                        console.log("reponse" + response);
189
 
215
 
-
 
216
                        if (response == true) {
-
 
217
                            alert("successfully uploaded");
190
 
218
 
191
 
219
 
192
	$(document).on('click', ".show-colowise-lead", function() {
-
 
193
		var status = $("#statusFilter").val();
220
                        }
194
		var color = $("#colorFilter").val();
221
                    });
195
		doGetAjaxRequestHandler(context + "/getOpenLead?leadStatus=" + status + "&color=" + color, function(response) {
-
 
196
			$('#' + 'main-content').html(response);
-
 
197
		});
-
 
198
	});
-
 
199
 
222
 
-
 
223
            }
-
 
224
        } else {
200
	$(document).on('click', "#uploadIvoryLead", function() {
225
            // Do nothing!
-
 
226
        }
-
 
227
    });
201
 
228
 
202
		window.location.href = context + "/downloadIvoryLead";
-
 
203
	});
-
 
204
 
229
 
205
	$(document).on('click', ".submitLeadGenerate", function() {
230
    $(document).on('click', ".lead-request",
-
 
231
        function () {
206
 
232
 
207
		console.log("hello");
-
 
208
		if (confirm('Confirm upload ?')) {
233
            var firstName = $('input[name="firstName"]').val();
209
			var fileSelector = $(this)[0];
234
            var lastName = $('input[name="lastName"]').val();
210
			if (fileSelector != undefined) {
235
            var mobile = $('input[name="mobile"]').val();
211
				var url = `${context}/csvFileAndSetLead`;
236
            var address = $('input[name="address"]').val();
212
				console.log(url);
237
            var status = $("#status").val();
213
				var file = $(".fileLeadGenerate")[0].files[0];
238
            var city = $('input[name="city"]').val();
214
				let fileInput = $(this);
239
            var state = $("#state").val();
215
				console.log("file" + file);
240
            var remark = $("#createRemark").val();
216
				console.log("fileInput" + fileInput);
241
            var assignTo = $("#createAssignTo").val();
217
				doAjaxUploadRequestHandler(
242
            var source = $("#leadSource").val();
218
					url,
-
 
219
					'POST',
-
 
220
					file, function(response) {
243
            var communicationType = $("#communicationTye").val();
221
 
244
 
222
						console.log("reponse" + response);
245
            var conversionprobability = $("#conversionprobabilit").val();
223
 
246
 
224
						if (response == true) {
-
 
225
							alert("successfully uploaded");
-
 
226
 
247
 
-
 
248
            var outletName = $('input[name="leadoutletName"]').val();
-
 
249
            var counterSize = $('input[name="leadcounterSize"]').val();
-
 
250
            var table = document.getElementById('brandtable');
-
 
251
            var brandValueJson = [];
-
 
252
            var leadBrands;
227
 
253
 
228
						}
-
 
229
					});
254
            console.log(conversionprobability)
230
 
255
 
231
			}
-
 
232
		}
-
 
233
		else {
-
 
234
			// Do nothing!
-
 
235
		}
-
 
236
	});
-
 
237
 
256
 
-
 
257
            if (firstName === "" && lastName === "" && mobile === ""
-
 
258
                && address === "" && status === "" && city === ""
-
 
259
                && state === "" && remark === "" && source === "") {
-
 
260
                alert("Field can't be empty");
-
 
261
                return;
-
 
262
            }
238
 
263
 
239
	$(document).on('click', ".lead-request",
-
 
240
		function() {
-
 
241
 
264
 
242
			var firstName = $('input[name="firstName"]').val();
265
            if (firstName === "") {
243
			var lastName = $('input[name="lastName"]').val();
266
                alert("First Name is required");
-
 
267
                return;
-
 
268
            }
244
			var mobile = $('input[name="mobile"]').val();
269
            if (lastName === "") {
245
			var address = $('input[name="address"]').val();
270
                alert("Last Name is required");
-
 
271
                return;
-
 
272
            }
246
			var status = $("#status").val();
273
            if (mobile === "") {
247
			var city = $('input[name="city"]').val();
274
                alert("Mobile is required");
-
 
275
                return;
-
 
276
            }
248
			var state = $("#state").val();
277
            if (status === "") {
249
			var remark = $("#createRemark").val();
278
                alert("Status is required");
-
 
279
                return;
-
 
280
            }
250
			var assignTo = $("#createAssignTo").val();
281
            if (address === "") {
251
			var source = $("#leadSource").val();
282
                alert("address is required");
-
 
283
                return;
-
 
284
            }
-
 
285
            if (city === "") {
252
			var communicationType = $("#communicationTye").val();
286
                alert("city is required");
-
 
287
                return;
-
 
288
            }
253
 
289
 
-
 
290
            if (state === "") {
254
			var conversionprobability = $("#conversionprobabilit").val();
291
                alert("state is required");
-
 
292
                return;
-
 
293
            }
-
 
294
            if (source === "") {
-
 
295
                alert("Source is required")
-
 
296
                return;
-
 
297
            }
255
 
298
 
-
 
299
            if (remark === "") {
-
 
300
                alert("Remark is required");
-
 
301
                return;
-
 
302
            }
256
 
303
 
257
			var outletName = $('input[name="leadoutletName"]').val();
304
            if (conversionprobability === "") {
258
			var counterSize = $('input[name="leadcounterSize"]').val();
305
                alert("Conversion Probability is required");
-
 
306
                return;
-
 
307
            }
-
 
308
            if (status == "followUp" || status == "pending" || status == "finalized") {
-
 
309
                if (outletName === "") {
259
			var table = document.getElementById('brandtable');
310
                    alert("Outlet Name is required");
260
			var brandValueJson = [];
311
                    return;
261
			var leadBrands;
312
                }
262
 
313
 
263
			console.log(conversionprobability)
314
                if (counterSize === "") {
-
 
315
                    alert("Counter Size is required");
-
 
316
                    return;
-
 
317
                }
264
 
318
 
-
 
319
                if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
-
 
320
                    alert("Front Document is required");
-
 
321
                    return;
-
 
322
                }
265
 
323
 
266
			if (firstName === "" && lastName === "" && mobile === ""
324
                if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
267
				&& address === "" && status === "" && city === ""
-
 
268
				&& state === "" && remark === "" && source === "") {
325
                    alert("Front With Market Document is required");
269
				alert("Field can't be empty");
326
                    return;
270
				return;
327
                }
271
			}
-
 
272
 
328
 
-
 
329
                if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
-
 
330
                    alert("Internal Left Shot Document is required");
-
 
331
                    return;
-
 
332
                }
273
 
333
 
274
			if (firstName === "") {
-
 
275
				alert("First Name is required");
334
                if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
276
				return;
-
 
277
			}
-
 
278
			if (lastName === "") {
-
 
279
				alert("Last Name is required");
335
                    alert("Internal Left Wall Document is required");
280
				return;
-
 
281
			}
-
 
282
			if (mobile === "") {
-
 
283
				alert("Mobile is required");
-
 
284
				return;
-
 
285
			}
-
 
286
			if (status === "") {
-
 
287
				alert("Status is required");
336
                    return;
288
				return;
-
 
289
			}
-
 
290
			if (address === "") {
-
 
291
				alert("address is required");
-
 
292
				return;
-
 
293
			}
-
 
294
			if (city === "") {
337
                }
295
				alert("city is required");
-
 
296
				return;
-
 
297
			}
-
 
298
 
338
 
299
			if (state === "") {
-
 
300
				alert("state is required");
-
 
301
				return;
-
 
302
			}
-
 
303
			if (source === "") {
-
 
304
				alert("Source is required")
-
 
305
				return;
-
 
306
			}
-
 
307
 
339
 
308
			if (remark === "") {
340
                if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
309
				alert("Remark is required");
341
                    alert("Internal Right Wall Document is required");
310
				return;
342
                    return;
311
			}
343
                }
312
 
344
 
313
			if (conversionprobability === "") {
-
 
314
				alert("Conversion Probability is required");
-
 
315
				return;
-
 
316
			}
-
 
317
			if (status == "followUp" || status == "pending" || status == "finalized") {
-
 
318
				if (outletName === "") {
-
 
319
					alert("Outlet Name is required");
-
 
320
					return;
-
 
321
				}
-
 
322
 
345
 
323
				if (counterSize === "") {
-
 
324
					alert("Counter Size is required");
346
                for (i = 1; i < table.rows.length; i++) {
325
					return;
-
 
326
				}
-
 
327
 
347
 
328
				if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
-
 
329
					alert("Front Document is required");
348
                    var objCells = table.rows[i].cells;
330
					return;
-
 
331
				}
-
 
332
 
349
 
-
 
350
                    leadBrands = {
-
 
351
                        brand: objCells[0].innerText,
333
				if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
352
                        value: objCells[1].getElementsByTagName('input')[0].value
-
 
353
                    }
334
					alert("Front With Market Document is required");
354
                    brandValueJson.push(leadBrands);
335
					return;
355
                }
336
				}
-
 
337
 
356
 
338
				if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
-
 
339
					alert("Internal Left Shot Document is required");
-
 
340
					return;
-
 
341
				}
-
 
342
 
357
 
343
				if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
-
 
344
					alert("Internal Left Wall Document is required");
-
 
345
					return;
358
            }
346
				}
-
 
347
 
359
 
348
 
360
 
-
 
361
            var leaddetailData = {}
349
				if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
362
            leaddetailData['firstName'] = firstName;
-
 
363
            leaddetailData['lastName'] = lastName
350
					alert("Internal Right Wall Document is required");
364
            leaddetailData['mobile'] = mobile
-
 
365
            leaddetailData['address'] = address
-
 
366
            leaddetailData['city'] = city
-
 
367
            leaddetailData['state'] = state
-
 
368
            leaddetailData['status'] = status
-
 
369
            leaddetailData['remark'] = remark
-
 
370
            leaddetailData['assignTo'] = assignTo
351
					return;
371
            leaddetailData['source'] = source
352
				}
-
 
-
 
372
            leaddetailData['colorCheck'] = conversionprobability
353
 
373
 
354
 
374
 
355
				for (i = 1; i < table.rows.length; i++) {
375
            if (status == "followUp") {
-
 
376
                leaddetailData['schelduleTimestamp'] = getDatesFromPicker('#scheduleTime').startDate;
356
 
377
 
357
					var objCells = table.rows[i].cells;
378
                leaddetailData['communicationType'] = communicationType
-
 
379
            }
358
 
380
 
359
					leadBrands = {
-
 
360
						brand: objCells[0].innerText,
-
 
361
						value: objCells[1].getElementsByTagName('input')[0].value
-
 
362
					}
-
 
363
					brandValueJson.push(leadBrands);
-
 
364
				}
-
 
365
 
381
 
-
 
382
            leaddetailData['outletName'] = outletName;
366
 
383
 
367
			}
-
 
-
 
384
            leaddetailData['counterSize'] = counterSize;
368
 
385
 
369
 
386
 
370
			var leaddetailData = {}
-
 
371
			leaddetailData['firstName'] = firstName;
-
 
372
			leaddetailData['lastName'] = lastName
-
 
373
			leaddetailData['mobile'] = mobile
-
 
374
			leaddetailData['address'] = address
387
            leaddetailData['leadBrands'] = brandValueJson;
375
			leaddetailData['city'] = city
-
 
376
			leaddetailData['state'] = state
-
 
377
			leaddetailData['status'] = status
-
 
378
			leaddetailData['remark'] = remark
-
 
379
			leaddetailData['assignTo'] = assignTo
-
 
380
			leaddetailData['source'] = source
-
 
381
			leaddetailData['colorCheck'] = conversionprobability
-
 
382
 
388
 
-
 
389
            console.log(localStorage.getItem("frontp"));
383
 
390
 
384
 
391
 
385
			if (status == "followUp") {
392
            leaddetailData['frontp'] = localStorage
386
				leaddetailData['schelduleTimestamp'] = getDatesFromPicker('#scheduleTime').startDate;
393
                .getItem("frontph");
387
 
394
 
388
				leaddetailData['communicationType'] = communicationType
-
 
389
			}
-
 
390
 
395
 
-
 
396
            leaddetailData['frontWithMarket'] = localStorage
-
 
397
                .getItem("internalMarketh");
391
 
398
 
392
 
399
 
-
 
400
            leaddetailData['internalLongShot'] = localStorage
-
 
401
                .getItem("leftShoth");
393
 
402
 
394
			leaddetailData['outletName'] = outletName;
-
 
395
 
403
 
396
			leaddetailData['counterSize'] = counterSize;
404
            leaddetailData['internalLeftWall'] = localStorage
-
 
405
                .getItem("leftWallh");
397
 
406
 
398
 
407
 
399
			leaddetailData['leadBrands'] = brandValueJson;
408
            leaddetailData['internalRightWall'] = localStorage
-
 
409
                .getItem("rightWallh");
400
 
410
 
401
			console.log(localStorage.getItem("frontp"));
411
            console.log(leaddetailData);
402
 
412
 
-
 
413
            if (confirm("Are you sure you want to add lead!") == true) {
-
 
414
                doPostAjaxRequestWithJsonHandler(context + "/createLead",
-
 
415
                    JSON.stringify(leaddetailData), function (response) {
-
 
416
                        if (response == 'true') {
-
 
417
                            alert("successfully Add");
-
 
418
                            $('#newEntryLeadModal').modal('hide');
-
 
419
                            $('.modal-backdrop').remove();
-
 
420
                            loadLead("main-content");
-
 
421
                        } else {
-
 
422
                            alert(response);
-
 
423
                        }
-
 
424
                    });
403
 
425
 
404
			leaddetailData['frontp'] = localStorage
426
                return false;
-
 
427
            }
-
 
428
        });
405
				.getItem("frontph");
429
    var leadId = null;
-
 
430
    var row = null;
-
 
431
    $(document).on('click', ".editLead", function () {
-
 
432
        $('#editLeadData').modal('show');
406
 
433
 
-
 
434
        $("#remark").val("");
-
 
435
        $("#assignTo").val("");
-
 
436
        $("#editStatus").val("");
-
 
437
        $("#reason").val("");
-
 
438
        $("#editCity").val("");
-
 
439
        $("#editState").val("");
-
 
440
        $("#editScheduleTime").hide();
407
 
441
 
408
			leaddetailData['frontWithMarket'] = localStorage
-
 
409
				.getItem("internalMarketh");
-
 
410
 
442
 
-
 
443
        localStorage.removeItem("frontph");
-
 
444
        localStorage.removeItem("leftShoth");
-
 
445
        localStorage.removeItem("rightWallh");
-
 
446
        localStorage.removeItem("leftWallh");
-
 
447
        localStorage.removeItem("internalMarketh");
411
 
448
 
412
			leaddetailData['internalLongShot'] = localStorage
449
        row = $(this).closest("tr");
413
				.getItem("leftShoth");
450
        leadId = $(this).data('leadid');
414
 
451
 
-
 
452
        doAjaxRequestHandler(
-
 
453
            context + "/getLeadDetailByLeadId?leadId=" + leadId,
-
 
454
            "GET",
-
 
455
            function (response) {
415
 
456
 
416
			leaddetailData['internalLeftWall'] = localStorage
457
                var data = response.response;
-
 
458
                if (!data) return;
417
				.getItem("leftWallh");
459
                console.log(data);
-
 
460
                $("#editCity").val(data.city);
-
 
461
                $("#editState").val(data.state);
-
 
462
                $("input[name='outletName']").val(data.outletName);
-
 
463
                $("input[name='counterSize']").val(data.counterSize);
-
 
464
            }
-
 
465
        );
-
 
466
    });
418
 
467
 
419
 
468
 
420
			leaddetailData['internalRightWall'] = localStorage
469
    $(document).on('click', ".lead-edit-request",
421
				.getItem("rightWallh");
470
        function () {
422
 
471
 
423
			console.log(leaddetailData);
-
 
424
 
472
 
425
			if (confirm("Are you sure you want to add lead!") == true) {
473
            console.log(row);
426
				doPostAjaxRequestWithJsonHandler(context + "/createLead",
474
            var rowIndex = $(this).closest('tr').prevAll().length;
427
					JSON.stringify(leaddetailData), function(response) {
475
            var remark = $('input[name="remark"]').val();
428
						if (response == 'true') {
476
            var assignTo = $("#assignTo").val();
429
							alert("successfully Add");
477
            var editStatus = $("#editStatus").val();
430
							$('#newEntryLeadModal').modal('hide');
478
            var city = $('input[name="editCity"]').val();
431
							$('.modal-backdrop').remove();
479
            var state = $("#editState").val();
432
							loadLead("main-content");
480
            var reason = $("#reason").val();
433
						} else {
-
 
434
							alert(response);
-
 
435
						}
-
 
436
					});
-
 
437
 
481
 
438
				return false;
482
            var leadDate = $("#dateWiseLead").val();
439
			}
-
 
440
		});
-
 
441
	var leadId = null;
483
            var leadStatus = $("#statusFilter").val();
442
	var row = null;
484
            var color = $("#colorFilter").val();
443
	$(document).on('click', ".editLead", function() {
485
            var communicationType = $("#communicationType").val();
444
		$('#editLeadData').modal('show');
-
 
445
 
486
 
446
		$('input[name="remark"]').val("")
487
            var conversionprobability = $("#conversionprobability").val();
447
		$("#assignTo").val("")
-
 
448
		$("#editStatus").val("");
-
 
449
		$("#reason").val("");
-
 
450
		$("#statusFilter").val("");
-
 
451
 
488
 
452
		localStorage.removeItem("frontph");
-
 
453
		localStorage.removeItem("leftShoth");
-
 
454
		localStorage.removeItem("rightWallh");
-
 
455
		localStorage.removeItem("leftWallh");
-
 
456
		localStorage.removeItem("internalMarketh");
489
            console.log(conversionprobability)
457
 
490
 
458
 
491
 
459
		row = $(this).closest("tr");
-
 
460
		$("#editScheduleTime").hide();
-
 
461
		leadId = $(this).data('leadid');
-
 
462
		console.log(leadId)
492
            console.log(leadDate)
463
		$('#lead-detail-view').show();
-
 
464
		doAjaxRequestHandler(context + "/getLeadDetailByLeadId?leadId=" + leadId, "GET",
-
 
465
			function(response) {
-
 
466
				console.log(response)
493
            console.log(leadStatus)
467
 
494
 
-
 
495
            console.log(color)
468
				console.log(response.response)
496
            console.log(reason)
469
 
497
 
-
 
498
            if (remark === "" && assignTo === "" && editStatus === "") {
-
 
499
                alert("All fields is required");
470
				var data = response.response;
500
                return;
-
 
501
            }
471
 
502
 
-
 
503
            if (assignTo === "") {
-
 
504
                alert("assignTo is required");
472
				if (data != null) {
505
                return;
-
 
506
            }
473
 
507
 
474
					$('#lead-detail-view').hide();
508
            if (remark === "") {
475
					$('input[name="outletName"]').val(data.outletName);
509
                alert("Remark is required");
476
					$('input[name="counterSize"]').val(data.counterSize);
510
                return;
477
				}
511
            }
478
 
512
 
479
			});
-
 
480
 
513
 
-
 
514
            if (editStatus === "") {
-
 
515
                alert("status is required");
-
 
516
                return;
-
 
517
            }
481
 
518
 
-
 
519
            if (editStatus === "notInterested") {
-
 
520
                if (reason == null) {
-
 
521
                    alert("Reason  is required");
-
 
522
                    return;
-
 
523
                }
482
	});
524
            }
-
 
525
            var leadActivityData = {}
-
 
526
            leadActivityData['id'] = leadId;
-
 
527
            leadActivityData['remark'] = remark;
-
 
528
            leadActivityData['assignTo'] = assignTo
-
 
529
            leadActivityData['status'] = editStatus
-
 
530
            leadActivityData['reason'] = reason
-
 
531
            leadActivityData['colorCheck'] = conversionprobability
-
 
532
            if (city && city.trim() !== "") {
-
 
533
                leadActivityData.city = city;
-
 
534
            }
483
 
535
 
-
 
536
            if (state && state.trim() !== "") {
484
	$(document).on('click', ".lead-edit-request",
537
                leadActivityData.state = state;
485
		function() {
538
            }
486
 
539
 
487
 
540
 
488
			console.log(row);
-
 
489
			var rowIndex = $(this).closest('tr').prevAll().length;
541
            if (editStatus == "followUp") {
490
			var remark = $('input[name="remark"]').val();
542
                leadActivityData['scheldule'] = getDatesFromPicker('input[name="editScheduleTime"]').startDate
491
			var assignTo = $("#assignTo").val();
-
 
492
			var editStatus = $("#editStatus").val();
543
                leadActivityData['communicationType'] = communicationType
493
			var reason = $("#reason").val();
-
 
494
 
544
 
495
			var leadDate = $("#dateWiseLead").val();
-
 
496
			var leadStatus = $("#statusFilter").val();
-
 
497
			var color = $("#colorFilter").val();
545
            }
498
			var communicationType = $("#communicationType").val();
-
 
499
 
546
 
-
 
547
            console.log(leadActivityData);
500
			var conversionprobability = $("#conversionprobability").val();
548
            if (confirm("Are you sure you want to add lead!") == true) {
-
 
549
                doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function (response) {
-
 
550
                    console.log(response);
-
 
551
                    $('#editLeadData').modal('hide');
-
 
552
                    $('.modal-backdrop').remove();
-
 
553
                    row.html(response);
-
 
554
                });
-
 
555
            }
501
 
556
 
502
			console.log(conversionprobability)
557
        });
503
 
558
 
504
 
559
 
505
			console.log(leadDate)
560
    $(document).on('click', ".show-partner-health",
506
			console.log(leadStatus)
561
        function () {
507
 
562
 
508
			console.log(color)
-
 
509
			console.log(reason)
563
            var email = $("#authUserFilter").val();
510
 
564
 
-
 
565
            console.log(email)
511
			if (remark === "" && assignTo === "" && editStatus === "") {
566
            doGetAjaxRequestHandler(context + "/partnerHealth?email="
512
				alert("All fields is required");
567
                + email, function (response) {
513
				return;
568
                console.log(response)
514
			}
-
 
-
 
569
                $('#' + 'main-content').html(response);
515
 
570
 
516
			if (assignTo === "") {
571
            });
517
				alert("assignTo is required");
-
 
518
				return;
572
        });
519
			}
-
 
520
 
573
 
521
			if (remark === "") {
-
 
522
				alert("Remark is required");
-
 
523
				return;
-
 
524
			}
-
 
525
 
574
 
-
 
575
    $(document).on('click', ".lead-detail-entry",
-
 
576
        function () {
526
 
577
 
527
			if (editStatus === "") {
578
            console.log("hello");
-
 
579
            var outletName = $('input[name="outletName"]').val();
-
 
580
            var counterSize = $('input[name="counterSize"]').val();
-
 
581
            var table = document.getElementById('editbrandtable');
528
				alert("status is required");
582
            var brandValueJson = [];
529
				return;
583
            var leadBrands;
530
			}
-
 
531
 
584
 
532
			if (editStatus === "notInterested") {
-
 
533
				if (reason == null) {
585
            if (outletName === "") {
534
					alert("Reason  is required");
586
                alert("Outlet Name is required");
535
					return;
587
                return;
536
				}
-
 
537
			}
-
 
538
			var leadActivityData = {}
588
            }
539
			leadActivityData['id'] = leadId;
-
 
540
			leadActivityData['remark'] = remark;
-
 
541
			leadActivityData['assignTo'] = assignTo
-
 
542
			leadActivityData['status'] = editStatus
-
 
543
			leadActivityData['reason'] = reason
-
 
544
			leadActivityData['colorCheck'] = conversionprobability
-
 
545
 
589
 
-
 
590
            if (counterSize === "") {
-
 
591
                alert("Counter Size is required");
-
 
592
                return;
-
 
593
            }
546
 
594
 
547
			if (editStatus == "followUp") {
-
 
548
				leadActivityData['scheldule'] = getDatesFromPicker('input[name="editScheduleTime"]').startDate
595
            if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
549
				leadActivityData['communicationType'] = communicationType
596
                alert("Front Document is required");
-
 
597
                return;
-
 
598
            }
550
 
599
 
-
 
600
            if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
-
 
601
                alert("Front With Market Document is required");
-
 
602
                return;
551
			}
603
            }
552
 
604
 
553
			console.log(leadActivityData);
-
 
554
			if (confirm("Are you sure you want to add lead!") == true) {
-
 
555
				doPostAjaxRequestWithJsonHandler(context + "/editLead", JSON.stringify(leadActivityData), function(response) {
605
            if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
556
					console.log(response);
-
 
557
					$('#editLeadData').modal('hide');
606
                alert("Internal Left Shot Document is required");
558
					$('.modal-backdrop').remove();
-
 
559
					row.html(response);
607
                return;
560
				});
608
            }
561
			}
-
 
562
 
609
 
-
 
610
            if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
-
 
611
                alert("Internal Left Wall Document is required");
-
 
612
                return;
563
		});
613
            }
564
 
614
 
565
 
615
 
-
 
616
            if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
-
 
617
                alert("Internal Right Wall Document is required");
-
 
618
                return;
-
 
619
            }
566
 
620
 
567
	$(document).on('click', ".show-partner-health",
-
 
568
		function() {
-
 
569
 
621
 
570
			var email = $("#authUserFilter").val();
622
            for (i = 1; i < table.rows.length; i++) {
571
 
623
 
572
			console.log(email)
-
 
573
			doGetAjaxRequestHandler(context + "/partnerHealth?email="
-
 
574
				+ email, function(response) {
-
 
575
					console.log(response)
-
 
576
					$('#' + 'main-content').html(response);
624
                var objCells = table.rows[i].cells;
577
 
625
 
-
 
626
                leadBrands = {
-
 
627
                    brand: objCells[0].innerText,
-
 
628
                    value: objCells[1].getElementsByTagName('input')[0].value
578
				});
629
                }
-
 
630
                brandValueJson.push(leadBrands);
579
		});
631
            }
580
 
632
 
581
 
633
 
582
	$(document).on('click', ".lead-detail-entry",
634
            var leadDetailObject = {};
583
		function() {
-
 
584
 
635
 
585
			console.log("hello");
-
 
586
			var outletName = $('input[name="outletName"]').val();
-
 
587
			var counterSize = $('input[name="counterSize"]').val();
-
 
588
			var table = document.getElementById('editbrandtable');
636
            leadDetailObject['leadId'] = leadId;
589
			var brandValueJson = [];
-
 
590
			var leadBrands;
-
 
591
 
637
 
592
			if (outletName === "") {
-
 
593
				alert("Outlet Name is required");
-
 
594
				return;
-
 
595
			}
-
 
596
 
638
 
597
			if (counterSize === "") {
-
 
598
				alert("Counter Size is required");
639
            leadDetailObject['outletName'] = outletName;
599
				return;
-
 
600
			}
-
 
601
 
640
 
602
			if (localStorage.getItem("frontph") == "undefined" && localStorage.getItem("frontph") == null) {
-
 
603
				alert("Front Document is required");
641
            leadDetailObject['counterSize'] = counterSize;
604
				return;
-
 
605
			}
-
 
606
 
642
 
607
			if (localStorage.getItem("internalMarketh") == "undefined" || localStorage.getItem("internalMarketh") == null) {
-
 
608
				alert("Front With Market Document is required");
643
            leadDetailObject['leadBrands'] = brandValueJson;
609
				return;
-
 
610
			}
-
 
611
 
644
 
612
			if (localStorage.getItem("leftShoth") == "undefined" || localStorage.getItem("leftShoth") == null) {
-
 
613
				alert("Internal Left Shot Document is required");
-
 
614
				return;
-
 
615
			}
-
 
616
 
645
 
617
			if (localStorage.getItem("leftWallh") == "undefined" || localStorage.getItem("leftWallh") == null) {
-
 
618
				alert("Internal Left Wall Document is required");
646
            console.log(localStorage.getItem("frontp"));
619
				return;
-
 
620
			}
-
 
621
 
647
 
622
 
648
 
623
			if (localStorage.getItem("rightWallh") == "undefined" || localStorage.getItem("rightWallh") == null) {
649
            leadDetailObject['frontp'] = localStorage
624
				alert("Internal Right Wall Document is required");
650
                .getItem("frontph");
625
				return;
-
 
626
			}
-
 
627
 
651
 
628
 
652
 
-
 
653
            leadDetailObject['frontWithMarket'] = localStorage
629
			for (i = 1; i < table.rows.length; i++) {
654
                .getItem("internalMarketh");
630
 
655
 
631
				var objCells = table.rows[i].cells;
-
 
632
 
656
 
633
				leadBrands = {
-
 
634
					brand: objCells[0].innerText,
-
 
635
					value: objCells[1].getElementsByTagName('input')[0].value
657
            leadDetailObject['internalLongShot'] = localStorage
636
				}
-
 
637
				brandValueJson.push(leadBrands);
658
                .getItem("leftShoth");
638
			}
-
 
639
 
659
 
640
 
660
 
641
			var leadDetailObject = {};
661
            leadDetailObject['internalLeftWall'] = localStorage
-
 
662
                .getItem("leftWallh");
642
 
663
 
643
			leadDetailObject['leadId'] = leadId;
-
 
644
 
664
 
-
 
665
            leadDetailObject['internalRightWall'] = localStorage
-
 
666
                .getItem("rightWallh");
645
 
667
 
646
			leadDetailObject['outletName'] = outletName;
668
            console.log(leadDetailObject);
647
 
669
 
-
 
670
            if (confirm("Are you sure you want to add lead detail!") == true) {
-
 
671
                doPostAjaxRequestWithJsonHandler(context + "/leadDetail", JSON.stringify(leadDetailObject), function (response) {
648
			leadDetailObject['counterSize'] = counterSize;
672
                    console.log(response);
-
 
673
                    if (response == 'true') {
-
 
674
                        alert("Submit Successfully");
-
 
675
                    }
649
 
676
 
-
 
677
                });
-
 
678
            }
650
 
679
 
651
			leadDetailObject['leadBrands'] = brandValueJson;
680
        });
652
 
681
 
653
			console.log(localStorage.getItem("frontp"));
-
 
654
 
682
 
-
 
683
    $(document).on('change', '.frontp',
-
 
684
        function () {
655
 
685
 
656
			leadDetailObject['frontp'] = localStorage
686
            if (confirm('Document has been selected, Do you want to upload ?')) {
657
				.getItem("frontph");
-
 
658
 
687
 
-
 
688
                var documentId = uploadImage(this, "frontph");
659
 
689
 
660
			leadDetailObject['frontWithMarket'] = localStorage
-
 
661
				.getItem("internalMarketh");
-
 
662
 
690
 
-
 
691
            } else {
663
 
692
 
664
			leadDetailObject['internalLongShot'] = localStorage
693
            }
665
				.getItem("leftShoth");
694
        });
666
 
695
 
-
 
696
    $(document).on('change', '.internalMarket',
-
 
697
        function () {
667
 
698
 
668
			leadDetailObject['internalLeftWall'] = localStorage
699
            if (confirm('Document has been selected, Do you want to upload ?')) {
669
				.getItem("leftWallh");
-
 
670
 
700
 
-
 
701
                var documentId = uploadImage(this, "internalMarketh");
671
 
702
 
672
			leadDetailObject['internalRightWall'] = localStorage
-
 
673
				.getItem("rightWallh");
703
            } else {
674
 
704
 
-
 
705
            }
675
			console.log(leadDetailObject);
706
        });
676
 
707
 
677
			if (confirm("Are you sure you want to add lead detail!") == true) {
-
 
678
				doPostAjaxRequestWithJsonHandler(context + "/leadDetail", JSON.stringify(leadDetailObject), function(response) {
-
 
679
					console.log(response);
-
 
680
					if (response == 'true') {
-
 
681
						alert("Submit Successfully");
708
    $(document).on('change', '.leftShot',
682
					}
-
 
683
 
709
 
684
				});
710
        function () {
-
 
711
            if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
712
                var documentId = uploadImage(this, "leftShoth");
685
			}
713
            } else {
686
 
714
 
-
 
715
            }
687
		});
716
        });
688
 
717
 
-
 
718
    $(document).on('change', '.leftWall',
-
 
719
        function () {
-
 
720
            if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
721
                var documentId = uploadImage(this, "leftWallh");
-
 
722
            } else {
689
 
723
 
690
	$(document).on('change', '.frontp',
-
 
691
		function() {
-
 
692
 
-
 
693
			if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
694
 
-
 
695
				var documentId = uploadImage(this, "frontph");
-
 
696
 
-
 
697
 
-
 
698
 
-
 
699
 
-
 
700
 
-
 
701
			} else {
-
 
702
 
-
 
703
			}
-
 
704
		});
-
 
705
 
-
 
706
	$(document).on('change', '.internalMarket',
-
 
707
		function() {
-
 
708
 
-
 
709
			if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
710
 
-
 
711
				var documentId = uploadImage(this, "internalMarketh");
-
 
712
 
-
 
713
			} else {
-
 
714
 
-
 
715
			}
-
 
716
		});
-
 
717
 
-
 
718
	$(document).on('change', '.leftShot',
-
 
719
 
-
 
720
		function() {
-
 
721
			if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
722
				var documentId = uploadImage(this, "leftShoth");
-
 
723
			} else {
-
 
724
 
-
 
725
			}
-
 
726
		});
-
 
727
 
-
 
728
	$(document).on('change', '.leftWall',
-
 
729
		function() {
-
 
730
			if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
731
				var documentId = uploadImage(this, "leftWallh");
-
 
732
			} else {
724
            }
733
 
-
 
734
			}
-
 
735
		});
-
 
736
 
-
 
737
	$(document).on('change', '.rightWall',
-
 
738
		function() {
-
 
739
			if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
740
				var documentId = uploadImage(this, "rightWallh");
-
 
741
			} else {
725
        });
742
			}
-
 
743
		});
-
 
744
 
-
 
745
 
726
 
-
 
727
    $(document).on('change', '.rightWall',
-
 
728
        function () {
-
 
729
            if (confirm('Document has been selected, Do you want to upload ?')) {
-
 
730
                var documentId = uploadImage(this, "rightWallh");
-
 
731
            } else {
-
 
732
            }
-
 
733
        });
746
 
734
 
747
 
735
 
748
});
736
});
749
 
737
 
750
function uploadImage(fileSelector, attrName) {
738
function uploadImage(fileSelector, attrName) {
751
	var documentId;
739
    var documentId;
752
	if (fileSelector != undefined
740
    if (fileSelector != undefined
753
		&& fileSelector.files[0] != undefined) {
741
        && fileSelector.files[0] != undefined) {
754
		var url = context
742
        var url = context
755
			+ '/document-upload';
743
            + '/document-upload';
756
 
744
 
757
		console.log(url);
745
        console.log(url);
758
		var file = fileSelector.files[0];
746
        var file = fileSelector.files[0];
759
 
747
 
760
		console.log(file)
748
        console.log(file)
761
		doAjaxUploadRequestHandler(
749
        doAjaxUploadRequestHandler(
762
			url,
750
            url,
763
			'POST',
751
            'POST',
764
			file,
752
            file,
765
			function(response) {
753
            function (response) {
766
				console.log(response)
754
                console.log(response)
767
				documentId = response.response.document_id;
755
                documentId = response.response.document_id;
768
				console
756
                console
769
					.log("documentId : "
757
                    .log("documentId : "
770
						+ documentId);
758
                        + documentId);
771
 
759
 
772
 
760
 
773
				localStorage
761
                localStorage
774
					.setItem(
762
                    .setItem(
775
						attrName,
763
                        attrName,
776
						documentId);
764
                        documentId);
777
 
765
 
778
			});
766
            });
779
		return documentId;
767
        return documentId;
780
	}
768
    }
781
 
769
 
782
}
770
}
783
 
771
 
784
 
772
 
785
function loadLead(domId) {
773
function loadLead(domId) {
786
	doGetAjaxRequestHandler(context + "/getOpenLead", function(response) {
774
    doGetAjaxRequestHandler(context + "/getOpenLead", function (response) {
787
		$('#' + domId).html(response);
775
        $('#' + domId).html(response);
788
	});
776
    });
789
}
777
}
790
 
778
 
791
function loadClosedLead(domId, searchTerm) {
779
function loadClosedLead(domId, searchTerm) {
792
	doGetAjaxRequestHandler(context + "/getClosedLead", function(response) {
780
    doGetAjaxRequestHandler(context + "/getClosedLead", function (response) {
793
		$('#' + domId).html(response);
781
        $('#' + domId).html(response);
794
	})
782
    })
795
}
783
}
796
 
784
 
797
function statusAction() {
785
function statusAction() {
798
	var val = $('#status').val();
786
    var val = $('#status').val();
799
	if (val == "followUp") {
787
    if (val == "followUp") {
800
		$("#scheduleTime").show();
788
        $("#scheduleTime").show();
801
	} else {
789
    } else {
802
		$("#scheduleTime").hide();
790
        $("#scheduleTime").hide();
803
	}
791
    }
804
 
792
 
805
}
793
}
806
 
794
 
807
 
795
 
808
function editStatusAction() {
796
function editStatusAction() {
809
	var val = $('#editStatus').val();
797
    var val = $('#editStatus').val();
810
	if (val == "followUp") {
798
    if (val == "followUp") {
811
		$("#editScheduleTime").show();
799
        $("#editScheduleTime").show();
812
	} else {
800
    } else {
813
		$("#editScheduleTime").hide();
801
        $("#editScheduleTime").hide();
814
	}
802
    }
815
 
803
 
816
}
804
}
817
 
805
 
818
function loadLeadSearchInfo(search_text) {
806
function loadLeadSearchInfo(search_text) {
819
	loadSearchLead("main-content", search_text);
807
    loadSearchLead("main-content", search_text);
820
}
808
}
821
 
809
 
822
function loadTeamCommitment(domId) {
810
function loadTeamCommitment(domId) {
823
	doGetAjaxRequestHandler(context + "/teamCommitment",
811
    doGetAjaxRequestHandler(context + "/teamCommitment",
824
		function(response) {
812
        function (response) {
825
			$('#' + domId).html(response);
813
            $('#' + domId).html(response);
826
		});
814
        });
827
}
815
}
828
 
816
 
829
function loadLeadDetail(domId) {
817
function loadLeadDetail(domId) {
830
	doGetAjaxRequestHandler(context + "/getLeadDetail",
818
    doGetAjaxRequestHandler(context + "/getLeadDetail",
831
		function(response) {
819
        function (response) {
832
			$('#' + domId).html(response);
820
            $('#' + domId).html(response);
833
		});
821
        });
834
}
822
}
835
 
823
 
836
function loadPartnerHealth(domId) {
824
function loadPartnerHealth(domId) {
837
	doGetAjaxRequestHandler(context + "/partnerHealth",
825
    doGetAjaxRequestHandler(context + "/partnerHealth",
838
		function(response) {
826
        function (response) {
839
			$('#' + domId).html(response);
827
            $('#' + domId).html(response);
840
		});
828
        });
841
}
829
}
842
 
830
 
843
function loadSearchLead(domId, search_text) {
831
function loadSearchLead(domId, search_text) {
844
	doGetAjaxRequestHandler(context + "/searchLeads?searchTerm=" + search_text,
832
    doGetAjaxRequestHandler(context + "/searchLeads?searchTerm=" + search_text,
845
		function(response) {
833
        function (response) {
846
			$('#' + domId).html(response);
834
            $('#' + domId).html(response);
847
		});
835
        });
848
}
836
}
849
 
837
 
850
$(document).on('click', ".arr-button-mk",
838
$(document).on('click', ".arr-button-mk",
851
	function () {
839
    function () {
852
		var startDate = $('.arr-start_date').val();
840
        var startDate = $('.arr-start_date').val();
853
		doGetAjaxRequestHandler(context + "/rbmTodayArr?startDate=" + startDate, function (response) {
841
        doGetAjaxRequestHandler(context + "/rbmTodayArr?startDate=" + startDate, function (response) {
854
			$('#main-content').html(response);
842
            $('#main-content').html(response);
855
 
843
 
856
		});
844
        });
857
	});
845
    });
858
 
846
 
859
$(document).on('click', ".rbm-today-arr",
847
$(document).on('click', ".rbm-today-arr",
860
	function () {
848
    function () {
861
		doGetAjaxRequestHandler(context + "/rbmTodayArr", function (response) {
849
        doGetAjaxRequestHandler(context + "/rbmTodayArr", function (response) {
862
			$('#main-content').html(response);
850
            $('#main-content').html(response);
-
 
851
 
-
 
852
        });
-
 
853
    });
-
 
854
$(document).on('click', '.reassign', function () {
-
 
855
    $('#bulkReassignFile').val(null);
-
 
856
    $('#bulkReassignFile').click();
-
 
857
});
-
 
858
 
-
 
859
$(document).on('change', '#bulkReassignFile', function () {
-
 
860
 
-
 
861
    if (!confirm("Confirm bulk reassign upload?")) {
-
 
862
        return;
-
 
863
    }
-
 
864
 
-
 
865
    var file = this.files[0];
-
 
866
    if (!file) {
-
 
867
        alert("No file selected");
-
 
868
        return;
-
 
869
    }
-
 
870
 
-
 
871
    doAjaxUploadRequestHandler(
-
 
872
        context + "/upload-assign-id",
-
 
873
        'POST',
-
 
874
        file,
-
 
875
        function (response) {
-
 
876
            alert("Bulk reassignment completed");
-
 
877
            loadLead("main-content");
-
 
878
        }
-
 
879
    );
-
 
880
});
863
 
881
 
864
		});
-
 
865
	});
-