Subversion Repositories SmartDukaan

Rev

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

Rev 30492 Rev 33618
Line 1... Line 1...
1
$(function () {
1
$(function () {
2
	$(document).on('click', ".create-service", function () {
2
    $(document).on('click', ".create-service", function () {
3
		loadService("main-content");
3
        loadService("main-content");
4
	});
4
    });
5
 
5
 
6
	$(document).on('click', ".add-brand", function () {
6
    $(document).on('click', ".add-brand", function () {
7
		loadaddBrandToService("main-content");
7
        loadaddBrandToService("main-content");
8
	});
8
    });
9
 
9
 
10
	$(document).on('click', ".notApplicableBrandService",
10
    $(document).on('click', ".notApplicableBrandService",
11
		function () {
11
        function () {
12
			naCommentService = $(this).data('nacommentservice');
12
            naCommentService = $(this).data('nacommentservice');
13
			console.log(naCommentService);
13
            console.log(naCommentService);
14
			var dialog = bootbox.dialog({
14
            var dialog = bootbox.dialog({
15
				message: "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"
15
                message: "<h4 style='color:red'>NOTAPPLICABLE</h4><p>"
16
					+ naCommentService + "</p>",
16
                    + naCommentService + "</p>",
17
				closeButton: true
17
                closeButton: true
18
			});
18
            });
19
			dialog.modal('show');
19
            dialog.modal('show');
20
 
20
 
21
		});
21
        });
22
	$(document).on('click', ".add-brand", function () {
22
    $(document).on('click', ".add-brand", function () {
23
		loadaddBrandToService("main-content");
23
        loadaddBrandToService("main-content");
24
	});
24
    });
25
	$(document).on('click', ".activate-brand-service-modal", function () {
25
    $(document).on('click', ".activate-brand-service-modal", function () {
26
		console.log("activate-brand-service-modal clicked");
26
        console.log("activate-brand-service-modal clicked");
27
		serviceId = $(this).data('serviceid');
27
        serviceId = $(this).data('serviceid');
28
		fofoId = $("#partnerName").val();
28
        fofoId = $("#partnerName").val();
29
		serviceBrandId = $(this).data('servicebrandid');
29
        serviceBrandId = $(this).data('servicebrandid');
30
		console.log(fofoId);
30
        console.log(fofoId);
31
		console.log(serviceId);
31
        console.log(serviceId);
32
		console.log(serviceBrandId);
32
        console.log(serviceBrandId);
33
		var params = {
33
        var params = {
34
			"serviceId": serviceId,
34
            "serviceId": serviceId,
35
			"fofoId": fofoId,
35
            "fofoId": fofoId,
36
			"serviceBrandId": serviceBrandId
36
            "serviceBrandId": serviceBrandId
37
 
37
 
38
		}
38
        }
39
		doPostAjaxRequestWithParamsHandler(context
39
        doPostAjaxRequestWithParamsHandler(context
40
			+ "/activatePartnerbrandServiceModal", params, function (response) {
40
            + "/activatePartnerbrandServiceModal", params, function (response) {
41
 
41
 
42
			$('#myServiceActivateBrand').html(response);
42
            $('#myServiceActivateBrand').html(response);
43
 
43
 
44
		});
44
        });
45
 
45
 
46
 
46
 
47
	});
47
    });
48
 
48
 
49
	$(document).on('click', ".submit-brand-not-available", function () {
49
    $(document).on('click', ".submit-brand-not-available", function () {
50
 
50
 
51
		console.log("submit-brand-not-available");
51
        console.log("submit-brand-not-available");
52
		serviceId = $(this).data('serviceid');
52
        serviceId = $(this).data('serviceid');
53
		fofoId = $("#partnerName").val();
53
        fofoId = $("#partnerName").val();
54
		serviceBrandId = $(this).data('servicebrandid');
54
        serviceBrandId = $(this).data('servicebrandid');
55
		na_comment = $('input[name="reasonBrandNotAvailable"]').val();
55
        na_comment = $('input[name="reasonBrandNotAvailable"]').val();
56
		active = false;
56
        active = false;
57
		partnerStatus = "NOTWORKING";
57
        partnerStatus = "NOTWORKING";
58
		applicableType = "NO";
58
        applicableType = "NO";
59
 
59
 
60
		if (na_comment == "" || na_comment == undefined) {
60
        if (na_comment == "" || na_comment == undefined) {
61
			alert("Na_comment can't be empty");
61
            alert("Na_comment can't be empty");
62
			return;
62
            return;
63
		}
63
        }
64
 
64
 
65
		addPartnerServiceBrandDetails(fofoId, serviceId,
65
        addPartnerServiceBrandDetails(fofoId, serviceId,
66
			serviceBrandId, applicableType, active,
66
            serviceBrandId, applicableType, active,
67
			partnerStatus, na_comment);
67
            partnerStatus, na_comment);
68
		$('#myServiceActivateBrand').modal('hide');
68
        $('#myServiceActivateBrand').modal('hide');
69
		$('.modal-backdrop').remove();
69
        $('.modal-backdrop').remove();
70
 
70
 
71
	});
71
    });
72
 
72
 
73
	$(document).on('click', ".reason-brand-service-not-activates", function () {
73
    $(document).on('click', ".reason-brand-service-not-activates", function () {
74
 
74
 
75
		console.log("reason-brand-service-not-activates clicked");
75
        console.log("reason-brand-service-not-activates clicked");
76
		serviceId = $(this).data('serviceid');
76
        serviceId = $(this).data('serviceid');
77
		fofoId = $("#partnerName").val();
77
        fofoId = $("#partnerName").val();
78
		serviceBrandId = $(this).data('servicebrandid');
78
        serviceBrandId = $(this).data('servicebrandid');
79
		var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
79
        var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
80
		console.log(fofoId);
80
        console.log(fofoId);
81
		console.log(serviceId);
81
        console.log(serviceId);
82
		console.log(serviceBrandId);
82
        console.log(serviceBrandId);
83
		console.log(serviceBrandComment);
83
        console.log(serviceBrandComment);
84
		reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId, serviceBrandComment);
84
        reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId, serviceBrandComment);
85
 
85
 
86
	});
86
    });
87
 
87
 
88
 
88
 
89
	$(document).on('click', ".service-comment", function () {
89
    $(document).on('click', ".service-comment", function () {
90
		serviceId = $(this).data('serviceid');
90
        serviceId = $(this).data('serviceid');
91
		fofoId = $(this).data('fofoid');
91
        fofoId = $(this).data('fofoid');
92
		var row = $(this).closest("tr");
92
        var row = $(this).closest("tr");
93
 
93
 
94
		bootbox.dialog({
94
        bootbox.dialog({
95
			title: "Comment!",
95
            title: "Comment!",
96
			message: "<div class=form-inline'>"
96
            message: "<div class=form-inline'>"
97
				+ "<label for='code'>comment :</label>"
97
                + "<label for='code'>comment :</label>"
98
				+ "<input class='form-control' type='text' id='naTextComment'/>"
98
                + "<input class='form-control' type='text' id='naTextComment'/>"
99
				+ "</div>",
99
                + "</div>",
100
			buttons: {
100
            buttons: {
101
				cancel: {
101
                cancel: {
102
					label: "CANCEL",
102
                    label: "CANCEL",
103
					className: 'btn-danger',
103
                    className: 'btn-danger',
104
					callback: function () {
104
                    callback: function () {
105
						return;
105
                        return;
106
					}
106
                    }
107
				},
107
                },
108
				ok: {
108
                ok: {
109
					label: "OK",
109
                    label: "OK",
110
					className: 'btn-info',
110
                    className: 'btn-info',
111
					callback: function () {
111
                    callback: function () {
112
						naText = $('#naTextComment').val();
112
                        naText = $('#naTextComment').val();
113
						if (naText == "" || naText == undefined || naText == null) {
113
                        if (naText == "" || naText == undefined || naText == null) {
114
							alert("Comment text can't be empty");
114
                            alert("Comment text can't be empty");
115
							return;
115
                            return;
116
						}
116
                        }
117
						var params = {
117
                        var params = {
118
							"serviceId": serviceId,
118
                            "serviceId": serviceId,
119
							"fofoId": fofoId,
119
                            "fofoId": fofoId,
120
							"naText": naText
120
                            "naText": naText
121
						}
121
                        }
122
						doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceGenComment",
122
                        doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceGenComment",
123
							JSON.stringify(params), function (response) {
123
                            JSON.stringify(params), function (response) {
124
								alert("Successfully Submitted");
124
                                alert("Successfully Submitted");
125
								row.html(response);
125
                                row.html(response);
-
 
126
 
-
 
127
                            });
-
 
128
                    }
-
 
129
                }
-
 
130
            }
-
 
131
        });
-
 
132
    });
-
 
133
 
-
 
134
 
-
 
135
    $(document).on('click', ".follow-up-date", function () {
-
 
136
        serviceId = $(this).data('serviceid');
-
 
137
        fofoId = $(this).data('fofoid');
-
 
138
        name = $(this).data('name');
-
 
139
        gencomment = $(this).data('gencomment');
-
 
140
        console.log("fofoId" + fofoId);
-
 
141
        console.log("name -" + name);
-
 
142
        var row = $(this).closest("tr");
-
 
143
        doGetAjaxRequestHandler(`${context}/brandWiseFollowupDetails?fofoId=${fofoId}&serviceId=${serviceId}`, function (response) {
-
 
144
            var tableBodyContent = [];
-
 
145
            console.log("response - ", response);
-
 
146
            var result = JSON.parse(response);
-
 
147
            result.forEach(function (item) {
-
 
148
                console.log("Item - ", item);
-
 
149
 
-
 
150
                tableBodyContent.push(`<tr>
-
 
151
            <td>${item.brand}</td>
-
 
152
            <td>${item.followUpDate}</td>
-
 
153
        </tr>`);
-
 
154
            });
-
 
155
            bootbox.dialog({
-
 
156
                title: `<span style='color:black; font-size: medium'>${name}</span>`,
-
 
157
                message: `<div class=form-inline'>
-
 
158
 
-
 
159
                        <table class="table table-bordered ">
-
 
160
                            <thead>
-
 
161
                                <tr>
-
 
162
                                    <th>Brands</th>
-
 
163
                                    <th>Follow Up Date</th>
-
 
164
                                </tr>
-
 
165
                            </thead>
-
 
166
                            <tbody style="text-align: center">
-
 
167
<!--                            table body dynamically -->
-
 
168
                                ${tableBodyContent.join('')}
-
 
169
                            </tbody>
-
 
170
                        </table>
-
 
171
                        <h5 style="text-decoration: underline">Add and Update Follow up </h5>
-
 
172
                        <label for='followUpBrand'>Brand:</label>
-
 
173
                            <select id="followUpBrand" class="form-control">
-
 
174
                                <option value="Oppo">Oppo</option>
-
 
175
                                <option value="Vivo">Vivo</option>
-
 
176
                                <option value="Samsung">Samsung</option>
-
 
177
                                <option value="Realme">Realme</option>
-
 
178
                                <option value="Xiaomi">Xiaomi</option>
-
 
179
                            </select>
-
 
180
                         <label for='followUpDate'>Follow Up Date:</label>
-
 
181
                         <input class='form-control' type='date' id='followUpDate'/>
-
 
182
                      </div>`,
-
 
183
                buttons: {
-
 
184
                    cancel: {
-
 
185
                        label: "CANCEL",
-
 
186
                        className: 'btn-danger',
-
 
187
                        callback: function () {
-
 
188
                            return;
-
 
189
                        }
-
 
190
                    },
-
 
191
                    ok: {
-
 
192
                        label: "OK",
-
 
193
                        className: 'btn-info',
-
 
194
                        callback: function () {
-
 
195
                            followUpBrand = $('#followUpBrand').val();
-
 
196
                            followUpDate = $('#followUpDate').val();
-
 
197
 
-
 
198
 
-
 
199
                            var params = {
-
 
200
                                "serviceId": serviceId,
-
 
201
                                "fofoId": fofoId,
-
 
202
                                "naText": gencomment,
-
 
203
                                "followUpDate": followUpDate,
-
 
204
                                "followUpBrand": followUpBrand
126
 
205
 
127
							});
-
 
128
					}
-
 
129
				}
-
 
130
			}
-
 
131
		});
-
 
132
	});
-
 
133
 
-
 
134
 
-
 
135
	$(document).on('click', ".follow-up-date", function () {
-
 
136
		serviceId = $(this).data('serviceid');
-
 
137
		fofoId = $(this).data('fofoid');
-
 
138
		gencomment = $(this).data('gencomment');
-
 
139
		console.log("fofoId" + fofoId);
-
 
140
		var row = $(this).closest("tr");
-
 
141
 
-
 
142
		bootbox.dialog({
-
 
143
			title: "Follow Up Date",
-
 
144
			message: "<div class=form-inline'>"
-
 
145
				+ "<label for='followUpDate'>Follow Up Date:</label>"
-
 
146
				+ "<input class='form-control' type='date' id='followUpDate'/>"
-
 
147
				+ "</div>",
-
 
148
			buttons: {
-
 
149
				cancel: {
-
 
150
					label: "CANCEL",
-
 
151
					className: 'btn-danger',
-
 
152
					callback: function () {
206
                            };
153
						return;
-
 
154
					}
-
 
155
				},
-
 
156
				ok: {
-
 
157
					label: "OK",
-
 
158
					className: 'btn-info',
-
 
159
					callback: function () {
-
 
160
						followUpDate = $('#followUpDate').val();
-
 
161
 
-
 
162
 
-
 
163
						var params = {
-
 
164
							"serviceId": serviceId,
-
 
165
							"fofoId": fofoId,
-
 
166
							"naText": gencomment,
-
 
167
							"followUpDate": followUpDate
-
 
168
 
-
 
169
						}
-
 
170
 
207
 
171
 
208
 
172
						doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceFollowupDate",
209
						doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceFollowupDate",
173
							JSON.stringify(params), function (response) {
210
							JSON.stringify(params), function (response) {
174
								alert("Successfully Submit");
211
								alert("Successfully Submit");
175
								row.html(response);
212
								row.html(response);
176
 
213
 
177
							});
214
                            });
178
					}
215
                        }
179
				}
216
                    }
180
			}
217
                }
181
		});
218
            });
182
	});
219
        });
183
 
220
 
184
	$(document).on('click', ".service-mark-not-active", function () {
221
 
185
		serviceId = $(this).data('serviceid');
222
    });
186
		fofoId = $(this).data('fofoid');
223
 
187
		var row = $(this).closest("tr");
224
    $(document).on('click', ".service-mark-not-active", function () {
188
 
225
        serviceId = $(this).data('serviceid');
189
		bootbox.dialog({
226
        fofoId = $(this).data('fofoid');
190
			title: "Mark Not Applicable!",
227
        var row = $(this).closest("tr");
191
			message: "<div class=form-inline'>"
228
 
192
				+ "<label for='code'>Not Applicable Reason:</label>"
229
        bootbox.dialog({
193
				+ "<input class='form-control' type='text' id='naText'/>"
230
            title: "Mark Not Applicable!",
194
				+ "</div>",
231
            message: "<div class=form-inline'>"
195
			buttons: {
232
                + "<label for='code'>Not Applicable Reason:</label>"
196
				cancel: {
233
                + "<input class='form-control' type='text' id='naText'/>"
197
					label: "CANCEL",
234
                + "</div>",
198
					className: 'btn-danger',
235
            buttons: {
199
					callback: function () {
236
                cancel: {
200
						return;
237
                    label: "CANCEL",
201
					}
238
                    className: 'btn-danger',
202
				},
239
                    callback: function () {
203
				ok: {
240
                        return;
204
					label: "OK",
241
                    }
205
					className: 'btn-info',
242
                },
206
					callback: function () {
243
                ok: {
207
						naText = $('#naText').val();
244
                    label: "OK",
208
						if (naText == "" || naText == undefined || naText == null) {
245
                    className: 'btn-info',
209
							alert("NA text can't be empty");
246
                    callback: function () {
210
							return;
247
                        naText = $('#naText').val();
211
						}
248
                        if (naText == "" || naText == undefined || naText == null) {
212
						var params = {
249
                            alert("NA text can't be empty");
213
							"serviceId": serviceId,
250
                            return;
214
							"fofoId": fofoId,
251
                        }
215
							"naText": naText
252
                        var params = {
216
						}
253
                            "serviceId": serviceId,
217
						doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceNotavailable",
254
                            "fofoId": fofoId,
218
							JSON.stringify(params), function (response) {
255
                            "naText": naText
219
								alert("Successfully Marked NA");
256
                        }
220
								row.html(response);
257
                        doPostAjaxRequestWithJsonHandler(context + "/addPartnerServiceNotavailable",
221
 
258
                            JSON.stringify(params), function (response) {
222
							});
259
                                alert("Successfully Marked NA");
223
					}
260
                                row.html(response);
224
				}
261
 
225
			}
262
                            });
226
		});
263
                    }
227
	});
264
                }
228
 
265
            }
229
	$(document).on('click', ".markNA", function () {
266
        });
230
		let fofoId = $('#partnerName').val();
267
    });
231
		let serviceId = $(this).data("serviceid");
268
 
232
		bootbox.dialog({
269
    $(document).on('click', ".markNA", function () {
233
			title: "Mark Not Applicable!",
270
        let fofoId = $('#partnerName').val();
234
			message: "<div class=form-inline'>"
271
        let serviceId = $(this).data("serviceid");
235
				+ "<label for='code'>Not Applicable Reason:</label>"
272
        bootbox.dialog({
236
				+ "<input class='form-control' type='text' id='naText'/>"
273
            title: "Mark Not Applicable!",
237
				+ "</div>",
274
            message: "<div class=form-inline'>"
238
			buttons: {
275
                + "<label for='code'>Not Applicable Reason:</label>"
239
				cancel: {
276
                + "<input class='form-control' type='text' id='naText'/>"
240
					label: "CANCEL",
277
                + "</div>",
241
					className: 'btn-danger',
278
            buttons: {
242
					callback: function () {
279
                cancel: {
243
						return;
280
                    label: "CANCEL",
244
					}
281
                    className: 'btn-danger',
245
				},
282
                    callback: function () {
246
				ok: {
283
                        return;
247
					label: "OK",
284
                    }
248
					className: 'btn-info',
285
                },
249
					callback: function () {
286
                ok: {
250
						naText = $('#naText').val();
287
                    label: "OK",
251
						if (naText == "" || naText == undefined || naText == null) {
288
                    className: 'btn-info',
252
							alert("NA text can't be empty");
289
                    callback: function () {
253
							return;
290
                        naText = $('#naText').val();
254
						}
291
                        if (naText == "" || naText == undefined || naText == null) {
255
						var params = {
292
                            alert("NA text can't be empty");
256
							"serviceId": serviceId,
293
                            return;
257
							"fofoId": fofoId,
294
                        }
258
							"naText": naText
295
                        var params = {
259
						}
296
                            "serviceId": serviceId,
260
						doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable",
297
                            "fofoId": fofoId,
261
							JSON.stringify(params), function (response) {
298
                            "naText": naText
262
								alert("Successfully Marked NA");
299
                        }
263
								loadAdminPartnerService("main-content", fofoId);
300
                        doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable",
264
							});
301
                            JSON.stringify(params), function (response) {
265
					}
302
                                alert("Successfully Marked NA");
266
				}
303
                                loadAdminPartnerService("main-content", fofoId);
267
			}
304
                            });
268
		});
305
                    }
269
	});
306
                }
270
	$(document).on('click', ".markApplicable", function () {
307
            }
271
		let serviceId = $(this).data("serviceid");
308
        });
272
		if (confirm("Confirm?")) {
309
    });
273
			let fofoId = $('#partnerName').val();
310
    $(document).on('click', ".markApplicable", function () {
274
			var params = {
311
        let serviceId = $(this).data("serviceid");
275
				"serviceId": serviceId,
312
        if (confirm("Confirm?")) {
276
				"fofoId": fofoId,
313
            let fofoId = $('#partnerName').val();
277
				"naText": null
314
            var params = {
278
			}
315
                "serviceId": serviceId,
279
			doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable", JSON.stringify(params), function (response) {
316
                "fofoId": fofoId,
280
				alert("successfully Marked Applicable");
317
                "naText": null
281
				loadAdminPartnerService("main-content", fofoId);
318
            }
282
			});
319
            doPostAjaxRequestWithJsonHandler(context + "/partnerservice/applicable", JSON.stringify(params), function (response) {
283
 
320
                alert("successfully Marked Applicable");
284
		}
321
                loadAdminPartnerService("main-content", fofoId);
285
	});
322
            });
286
 
323
 
287
	$(document).on('click', ".add-service-details-for-partner",
324
        }
288
		function () {
325
    });
289
			fofoId = $("#partnerName").val();
326
 
290
			serviceId = $("#serviceName").val();
327
    $(document).on('click', ".add-service-details-for-partner",
291
			applicableType = $("#applicableService").val();
328
        function () {
292
			code = $("#code").val();
329
            fofoId = $("#partnerName").val();
293
			partnerStatus = $("#partnerStatusTypeServices").val();
330
            serviceId = $("#serviceName").val();
294
			na_comment = $("#na_comment_services").val();
331
            applicableType = $("#applicableService").val();
295
			partnerCommentStatus = $("#partner_comment_status").val();
332
            code = $("#code").val();
296
			if (applicableType == "" || applicableType == null
333
            partnerStatus = $("#partnerStatusTypeServices").val();
297
				|| applicableType == undefined) {
334
            na_comment = $("#na_comment_services").val();
298
				alert("select appropriate applicableType");
335
            partnerCommentStatus = $("#partner_comment_status").val();
299
			} else if (applicableType == 'NO') {
336
            if (applicableType == "" || applicableType == null
300
				if (na_comment == "" || na_comment == undefined) {
337
                || applicableType == undefined) {
301
					alert("Na_comment can't be empty");
338
                alert("select appropriate applicableType");
302
					return;
339
            } else if (applicableType == 'NO') {
303
				}
340
                if (na_comment == "" || na_comment == undefined) {
304
				if (fofoId == "" || fofoId == null || fofoId == undefined) {
341
                    alert("Na_comment can't be empty");
305
					alert("select appropriate partnerName");
342
                    return;
306
					return;
343
                }
307
				}
344
                if (fofoId == "" || fofoId == null || fofoId == undefined) {
308
				if (serviceId == "" || serviceId == null
345
                    alert("select appropriate partnerName");
309
					|| serviceId == undefined) {
346
                    return;
310
					alert("select appropriate serviceName");
347
                }
311
					return;
348
                if (serviceId == "" || serviceId == null
312
				}
349
                    || serviceId == undefined) {
313
			} else {
350
                    alert("select appropriate serviceName");
314
				if (fofoId == "" || fofoId == null || fofoId == undefined) {
351
                    return;
315
					alert("select appropriate partnerName");
352
                }
316
					return;
353
            } else {
317
				}
354
                if (fofoId == "" || fofoId == null || fofoId == undefined) {
318
				if (serviceId == "" || serviceId == null
355
                    alert("select appropriate partnerName");
319
					|| serviceId == undefined) {
356
                    return;
320
					alert("select appropriate serviceName");
357
                }
321
					return;
358
                if (serviceId == "" || serviceId == null
322
				}
359
                    || serviceId == undefined) {
323
				if (code == "" || code == null
360
                    alert("select appropriate serviceName");
324
					|| code == undefined) {
361
                    return;
325
					alert("enter appropriate code")
362
                }
326
					return;
363
                if (code == "" || code == null
327
				}
364
                    || code == undefined) {
328
			}
365
                    alert("enter appropriate code")
329
			console.log(fofoId, serviceId, applicableType, code,
366
                    return;
330
				partnerStatus);
367
                }
331
			addPartnerServiceDetails(fofoId, serviceId, applicableType,
368
            }
332
				code, partnerStatus, na_comment,
369
            console.log(fofoId, serviceId, applicableType, code,
333
				partnerCommentStatus);
370
                partnerStatus);
334
 
371
            addPartnerServiceDetails(fofoId, serviceId, applicableType,
335
		});
372
                code, partnerStatus, na_comment,
336
	$(document).on('click', ".add-brand-service-details-for-partner",
373
                partnerCommentStatus);
337
		function () {
374
 
338
			fofoId = $("#partnerName").val();
375
        });
339
			serviceId = $("#serviceName").val();
376
    $(document).on('click', ".add-brand-service-details-for-partner",
340
			serviceBrandId = $("#serviceBrandName").val();
377
        function () {
341
			applicableType = $("#applicableService").val();
378
            fofoId = $("#partnerName").val();
342
			active = $("#activeServiceBrand").val();
379
            serviceId = $("#serviceName").val();
343
			partnerStatus = $("#partnerStatusTypeServices").val();
380
            serviceBrandId = $("#serviceBrandName").val();
344
			na_comment = $("#na_comment_services").val();
381
            applicableType = $("#applicableService").val();
345
			partnerCommentStatus = $("#partner_comment_status").val();
382
            active = $("#activeServiceBrand").val();
346
			if (applicableType == "NO") {
383
            partnerStatus = $("#partnerStatusTypeServices").val();
347
				if (na_comment == "" || na_comment == undefined) {
384
            na_comment = $("#na_comment_services").val();
348
					alert("Na_comment can't be empty");
385
            partnerCommentStatus = $("#partner_comment_status").val();
349
					return;
386
            if (applicableType == "NO") {
350
				}
387
                if (na_comment == "" || na_comment == undefined) {
351
			}
388
                    alert("Na_comment can't be empty");
352
			if (fofoId == "" || fofoId == null || fofoId == undefined) {
389
                    return;
353
				alert("select appropriate partnerName");
390
                }
354
				return;
391
            }
355
			} else if (serviceBrandId == "" || serviceBrandId == null
392
            if (fofoId == "" || fofoId == null || fofoId == undefined) {
356
				|| serviceBrandId == undefined) {
393
                alert("select appropriate partnerName");
357
				alert("select appropriate serviceBrandId");
394
                return;
358
				return;
395
            } else if (serviceBrandId == "" || serviceBrandId == null
359
			} else if (applicableType == "" || applicableType == null
396
                || serviceBrandId == undefined) {
360
				|| applicableType == undefined) {
397
                alert("select appropriate serviceBrandId");
361
				alert("select appropriate applicableType");
398
                return;
362
			} else if (active == "" || active == null
399
            } else if (applicableType == "" || applicableType == null
363
				|| active == undefined) {
400
                || applicableType == undefined) {
364
				alert("select appropriate active")
401
                alert("select appropriate applicableType");
365
			} else if (partnerStatus == "" || partnerStatus == null
402
            } else if (active == "" || active == null
366
				|| partnerStatus == undefined) {
403
                || active == undefined) {
367
				alert("select appropriate partnerStatus");
404
                alert("select appropriate active")
368
			} else {
405
            } else if (partnerStatus == "" || partnerStatus == null
369
				console.log(fofoId, serviceBrandId, applicableType, active,
406
                || partnerStatus == undefined) {
370
					partnerStatus);
407
                alert("select appropriate partnerStatus");
371
				addPartnerServiceBrandDetails(fofoId, serviceId,
408
            } else {
372
					serviceBrandId, applicableType, active,
409
                console.log(fofoId, serviceBrandId, applicableType, active,
373
					partnerStatus, na_comment, partnerCommentStatus);
410
                    partnerStatus);
374
			}
411
                addPartnerServiceBrandDetails(fofoId, serviceId,
375
		});
412
                    serviceBrandId, applicableType, active,
376
	$(document).on('click', ".partner-service", function () {
413
                    partnerStatus, na_comment, partnerCommentStatus);
377
		loadpartnerService("main-content");
414
            }
378
	});
415
        });
379
	$(document).on('click', ".admin-partner-service", function () {
416
    $(document).on('click', ".partner-service", function () {
380
		loadAdminPartnerService("main-content", 0);
417
        loadpartnerService("main-content");
381
	});
418
    });
382
 
419
    $(document).on('click', ".admin-partner-service", function () {
383
	$(document).on('click', ".partner-finance-services", function () {
420
        loadAdminPartnerService("main-content", 0);
384
		showFinanceServices("main-content");
421
    });
385
 
422
 
386
	});
423
    $(document).on('click', ".partner-finance-services", function () {
387
 
424
        showFinanceServices("main-content");
388
	$(document).on('click', ".add-partner-service-details", function () {
425
 
389
		loadaddPartnerServiceDetails("main-content");
426
    });
390
	});
427
 
391
	$(document).on('click', ".add-partner-brand-service-details", function () {
428
    $(document).on('click', ".add-partner-service-details", function () {
392
		loadaddPartnerBrandServiceDetails("main-content");
429
        loadaddPartnerServiceDetails("main-content");
393
	});
430
    });
394
	$(document).on('click', ".service-mark-active", function () {
431
    $(document).on('click', ".add-partner-brand-service-details", function () {
395
		serviceId = $(this).data('serviceid');
432
        loadaddPartnerBrandServiceDetails("main-content");
396
		fofoId = $(this).data('fofoid');
433
    });
397
		var row = $(this).closest("tr");
434
    $(document).on('click', ".service-mark-active", function () {
398
		console.log(fofoId);
435
        serviceId = $(this).data('serviceid');
399
		console.log(serviceId);
436
        fofoId = $(this).data('fofoid');
400
		console.log(row);
437
        var row = $(this).closest("tr");
401
		activateFinanceServices(fofoId, serviceId, row);
438
        console.log(fofoId);
402
	});
439
        console.log(serviceId);
403
 
440
        console.log(row);
404
 
441
        activateFinanceServices(fofoId, serviceId, row);
405
	$(document).on('click', ".activate-service", function () {
442
    });
406
		serviceId = $(this).data('serviceid');
443
 
407
		fofoId = $("#partnerName").val();
444
 
408
		console.log(fofoId);
445
    $(document).on('click', ".activate-service", function () {
409
		console.log(serviceId);
446
        serviceId = $(this).data('serviceid');
410
		activatePartnerService(fofoId, serviceId);
447
        fofoId = $("#partnerName").val();
411
	});
448
        console.log(fofoId);
412
	$(document).on('click', ".deactivate-service", function () {
449
        console.log(serviceId);
413
		serviceId = $(this).data('serviceid');
450
        activatePartnerService(fofoId, serviceId);
414
		fofoId = $("#partnerName").val();
451
    });
415
		console.log(fofoId);
452
    $(document).on('click', ".deactivate-service", function () {
416
		console.log(serviceId);
453
        serviceId = $(this).data('serviceid');
417
		deActivatePartnerService(fofoId, serviceId);
454
        fofoId = $("#partnerName").val();
418
	});
455
        console.log(fofoId);
419
	$(document).on('click', ".activate-brand-service", function () {
456
        console.log(serviceId);
420
		console.log("activate-brand-servicel clicked");
457
        deActivatePartnerService(fofoId, serviceId);
421
		serviceId = $(this).data('serviceid');
458
    });
422
		fofoId = $("#partnerName").val();
459
    $(document).on('click', ".activate-brand-service", function () {
423
		serviceBrandId = $(this).data('servicebrandid');
460
        console.log("activate-brand-servicel clicked");
424
		console.log(fofoId);
461
        serviceId = $(this).data('serviceid');
425
		console.log(serviceId);
462
        fofoId = $("#partnerName").val();
426
		console.log(serviceBrandId);
463
        serviceBrandId = $(this).data('servicebrandid');
427
		activatePartnerBrandService(fofoId, serviceId, serviceBrandId);
464
        console.log(fofoId);
428
 
465
        console.log(serviceId);
429
	});
466
        console.log(serviceBrandId);
430
	$(document).on('click', ".deactivate-brand-service", function () {
467
        activatePartnerBrandService(fofoId, serviceId, serviceBrandId);
431
		console.log("activate-brand-service clicked");
468
 
432
		serviceId = $(this).data('serviceid');
469
    });
433
		fofoId = $("#partnerName").val();
470
    $(document).on('click', ".deactivate-brand-service", function () {
434
		var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
471
        console.log("activate-brand-service clicked");
435
		serviceBrandId = $(this).data('servicebrandid');
472
        serviceId = $(this).data('serviceid');
436
		console.log(fofoId);
473
        fofoId = $("#partnerName").val();
437
		console.log(serviceId);
474
        var serviceBrandComment = $('input[name="reasonBrandServiceNotActivate"]').val();
438
		console.log(serviceBrandId);
475
        serviceBrandId = $(this).data('servicebrandid');
439
		console.log(serviceBrandComment);
476
        console.log(fofoId);
440
		deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId, serviceBrandComment);
477
        console.log(serviceId);
441
 
478
        console.log(serviceBrandId);
442
	});
479
        console.log(serviceBrandComment);
443
	$(document).on('click', ".partner-not-interested-service", function () {
480
        deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId, serviceBrandComment);
444
 
481
 
445
		serviceId = $(this).data('serviceid');
482
    });
446
		fofoId = $("#partnerName").val();
483
    $(document).on('click', ".partner-not-interested-service", function () {
447
		var partnerNotInterestedComment = $('input[name="reasonPartnerNotInterested"]').val();
484
 
448
 
485
        serviceId = $(this).data('serviceid');
449
		console.log(fofoId);
486
        fofoId = $("#partnerName").val();
450
		console.log(serviceId);
487
        var partnerNotInterestedComment = $('input[name="reasonPartnerNotInterested"]').val();
451
		console.log(partnerNotInterestedComment);
488
 
452
 
489
        console.log(fofoId);
453
		if (partnerNotInterestedComment == "" || partnerNotInterestedComment == undefined) {
490
        console.log(serviceId);
454
			alert("Comment Should Be Filled");
491
        console.log(partnerNotInterestedComment);
455
			return;
492
 
456
		}
493
        if (partnerNotInterestedComment == "" || partnerNotInterestedComment == undefined) {
457
 
494
            alert("Comment Should Be Filled");
458
 
495
            return;
459
		deActivatePartnerServiceByPartner(fofoId, serviceId, partnerNotInterestedComment);
496
        }
460
 
497
 
461
	});
498
 
462
 
499
        deActivatePartnerServiceByPartner(fofoId, serviceId, partnerNotInterestedComment);
463
 
500
 
464
	$(document).on('click', ".service-mark-pni", function () {
501
    });
465
 
502
 
466
		serviceId = $(this).data('serviceid');
503
 
467
		fofoId = $(this).data('fofoid');
504
    $(document).on('click', ".service-mark-pni", function () {
468
		var partnerNotInterestedComment = "Partner Not Interested"
505
 
469
		var row = $(this).closest("tr");
506
        serviceId = $(this).data('serviceid');
470
		console.log(fofoId);
507
        fofoId = $(this).data('fofoid');
471
		console.log(serviceId);
508
        var partnerNotInterestedComment = "Partner Not Interested"
472
		console.log(row);
509
        var row = $(this).closest("tr");
473
 
510
        console.log(fofoId);
474
 
511
        console.log(serviceId);
475
		deActivateFinanceServicePartnerNotInterested(fofoId, serviceId, partnerNotInterestedComment, row);
512
        console.log(row);
476
 
513
 
477
	});
514
 
478
 
515
        deActivateFinanceServicePartnerNotInterested(fofoId, serviceId, partnerNotInterestedComment, row);
479
	$(document).on('click', ".action-on-brand", function () {
516
 
480
		serviceId = $(this).data('serviceid');
517
    });
481
		fofoId = $(this).data('fofoid');
518
 
482
		brandid = $(this).data('brandid');
519
    $(document).on('click', ".action-on-brand", function () {
483
		var row = $(this).closest("tr");
520
        serviceId = $(this).data('serviceid');
484
 
521
        fofoId = $(this).data('fofoid');
485
		console.log(fofoId);
522
        brandid = $(this).data('brandid');
486
		console.log(serviceId);
523
        var row = $(this).closest("tr");
487
		console.log(brandid);
524
 
488
		actionFinanceBrandService(fofoId, serviceId, brandid, row);
525
        console.log(fofoId);
489
 
526
        console.log(serviceId);
490
	});
527
        console.log(brandid);
491
 
528
        actionFinanceBrandService(fofoId, serviceId, brandid, row);
492
 
529
 
493
	$(document).on('click', ".deactivate-brand-service-modal", function () {
530
    });
494
		console.log("activate-brand-service clicked");
531
 
495
		serviceId = $(this).data('serviceid');
532
 
496
		fofoId = $("#partnerName").val();
533
    $(document).on('click', ".deactivate-brand-service-modal", function () {
497
		serviceBrandId = $(this).data('servicebrandid');
534
        console.log("activate-brand-service clicked");
498
		console.log(fofoId);
535
        serviceId = $(this).data('serviceid');
499
		console.log(serviceId);
536
        fofoId = $("#partnerName").val();
500
		console.log(serviceBrandId);
537
        serviceBrandId = $(this).data('servicebrandid');
501
		var params = {
538
        console.log(fofoId);
502
			"serviceId": serviceId,
539
        console.log(serviceId);
503
			"fofoId": fofoId,
540
        console.log(serviceBrandId);
504
			"serviceBrandId": serviceBrandId
541
        var params = {
505
 
542
            "serviceId": serviceId,
506
		}
543
            "fofoId": fofoId,
507
		doPostAjaxRequestWithParamsHandler(context
544
            "serviceBrandId": serviceBrandId
508
			+ "/deactivatePartnerbrandServiceModal", params, function (response) {
545
 
509
 
546
        }
510
			$('#myServiceDeActivateBrand').html(response);
547
        doPostAjaxRequestWithParamsHandler(context
511
 
548
            + "/deactivatePartnerbrandServiceModal", params, function (response) {
512
		});
549
 
513
	});
550
            $('#myServiceDeActivateBrand').html(response);
514
 
551
 
515
	$(document).on('click', ".notApplicableByPartner", function () {
552
        });
516
		console.log("notApplicableByPartner");
553
    });
517
 
554
 
518
		serviceId = $(this).data('serviceid');
555
    $(document).on('click', ".notApplicableByPartner", function () {
519
		fofoId = $("#partnerName").val();
556
        console.log("notApplicableByPartner");
520
 
557
 
521
		console.log(fofoId);
558
        serviceId = $(this).data('serviceid');
522
		console.log(serviceId);
559
        fofoId = $("#partnerName").val();
523
 
560
 
524
		var params = {
561
        console.log(fofoId);
525
			"serviceId": serviceId,
562
        console.log(serviceId);
526
			"fofoId": fofoId,
563
 
527
 
564
        var params = {
528
		}
565
            "serviceId": serviceId,
529
		doPostAjaxRequestWithParamsHandler(context
566
            "fofoId": fofoId,
530
			+ "/deactivatePartnerbrandServiceModal", params, function (response) {
567
 
531
 
568
        }
532
			$('#serviceDeactivateByPartnerModal').html(response);
569
        doPostAjaxRequestWithParamsHandler(context
533
 
570
            + "/deactivatePartnerbrandServiceModal", params, function (response) {
534
		});
571
 
535
	});
572
            $('#serviceDeactivateByPartnerModal').html(response);
536
 
573
 
537
 
574
        });
538
	$(document).on('click', ".create-service-button",
575
    });
539
		function () {
576
 
540
			console.log("create-service-button clicked");
577
 
541
			var serviceName = $('#createserviceName').val();
578
    $(document).on('click', ".create-service-button",
542
			if (serviceName === "" || serviceName === undefined
579
        function () {
543
				|| serviceName == null) {
580
            console.log("create-service-button clicked");
544
				alert("Input field can't be empty");
581
            var serviceName = $('#createserviceName').val();
545
				return;
582
            if (serviceName === "" || serviceName === undefined
546
			}
583
                || serviceName == null) {
547
			if (confirm("Are you sure you want to create Service!") == true) {
584
                alert("Input field can't be empty");
548
				createService("main-content", serviceName);
585
                return;
549
			}
586
            }
550
		});
587
            if (confirm("Are you sure you want to create Service!") == true) {
551
	$(document).on('click', ".partner-service-search-button",
588
                createService("main-content", serviceName);
552
		function () {
589
            }
553
			var fofoId = $('#partnerName').val();
590
        });
554
			if (fofoId === "" || fofoId === undefined || fofoId == null) {
591
    $(document).on('click', ".partner-service-search-button",
555
				alert("select appropriate partner");
592
        function () {
556
				return;
593
            var fofoId = $('#partnerName').val();
557
			}
594
            if (fofoId === "" || fofoId === undefined || fofoId == null) {
558
			doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
595
                alert("select appropriate partner");
559
				+ fofoId, function (response) {
596
                return;
560
				$('#' + "partnerServicesByID").html(response);
597
            }
561
			});
598
            doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
562
		});
599
                + fofoId, function (response) {
563
	$(document).on('click', "#remove-added-brand-button",
600
                $('#' + "partnerServicesByID").html(response);
564
		function () {
601
            });
565
			var serviceId = $(this).data('id');
602
        });
566
			var brand = $(this).data('brand');
603
    $(document).on('click', "#remove-added-brand-button",
567
			console.log(serviceId);
604
        function () {
568
			console.log(brand)
605
            var serviceId = $(this).data('id');
569
			if (confirm("Are you sure you want to remove brand from Service!") == true) {
606
            var brand = $(this).data('brand');
570
				removeBrandFromService("main-content", serviceId,
607
            console.log(serviceId);
571
					brand);
608
            console.log(brand)
572
			}
609
            if (confirm("Are you sure you want to remove brand from Service!") == true) {
573
		});
610
                removeBrandFromService("main-content", serviceId,
574
	$(document).on('click', ".service-brand-button", function () {
611
                    brand);
575
		var brands = $('#tag-listing-brands').val();
612
            }
576
		var serviceId = $('#serviceName').val();
613
        });
577
		console.log(brands);
614
    $(document).on('click', ".service-brand-button", function () {
578
		console.log(serviceId);
615
        var brands = $('#tag-listing-brands').val();
579
		if (serviceId === "" || serviceId === undefined) {
616
        var serviceId = $('#serviceName').val();
580
			alert("service not selected");
617
        console.log(brands);
581
			return;
618
        console.log(serviceId);
582
		}
619
        if (serviceId === "" || serviceId === undefined) {
583
		if (!brands) {
620
            alert("service not selected");
584
			alert("select brand");
621
            return;
585
			return;
622
        }
586
		}
623
        if (!brands) {
587
		if (confirm("Are you sure you want to add brand!") == true) {
624
            alert("select brand");
588
			addBrandToService("main-content", brands, serviceId);
625
            return;
589
		}
626
        }
590
	});
627
        if (confirm("Are you sure you want to add brand!") == true) {
591
	$(document).on('change', '#serviceName', function () {
628
            addBrandToService("main-content", brands, serviceId);
592
		// $('#tag-listing-brand-value').text($(this).text());
629
        }
593
		loadBrandsByServiceId("service-container", $(this).val());
630
    });
594
		loadaddedBrandsbyserviceId("added-brand-to-service", $(this).val())
631
    $(document).on('change', '#serviceName', function () {
595
	});
632
        // $('#tag-listing-brand-value').text($(this).text());
-
 
633
        loadBrandsByServiceId("service-container", $(this).val());
-
 
634
        loadaddedBrandsbyserviceId("added-brand-to-service", $(this).val())
-
 
635
    });
596
});
636
});
597
 
637
 
598
function addPartnerServiceDetails(fofoId, serviceId, applicableType, code,
638
function addPartnerServiceDetails(fofoId, serviceId, applicableType, code,
599
								  partnerStatus, na_comment, partnerCommentStatus) {
639
                                  partnerStatus, na_comment, partnerCommentStatus) {
600
	if (confirm("Are you sure you want to add services details!") == true) {
640
    if (confirm("Are you sure you want to add services details!") == true) {
601
		var params = {
641
        var params = {
602
			"serviceId": serviceId,
642
            "serviceId": serviceId,
603
			"fofoId": fofoId,
643
            "fofoId": fofoId,
604
			"applicableType": applicableType,
644
            "applicableType": applicableType,
605
			"partnerStatus": partnerStatus,
645
            "partnerStatus": partnerStatus,
606
			"na_comment": na_comment,
646
            "na_comment": na_comment,
607
			"partnerCommentStatus": partnerCommentStatus,
647
            "partnerCommentStatus": partnerCommentStatus,
608
			"code": code
648
            "code": code
609
		}
649
        }
610
		doPostAjaxRequestWithParamsHandler(context
650
        doPostAjaxRequestWithParamsHandler(context
611
			+ "/addPartnerServicesDetails", params, function (response) {
651
            + "/addPartnerServicesDetails", params, function (response) {
612
			if (response == "true") {
652
            if (response == "true") {
613
				alert("successfully added partner Service Details");
653
                alert("successfully added partner Service Details");
614
				loadaddPartnerServiceDetails("main-content");
654
                loadaddPartnerServiceDetails("main-content");
615
			}
655
            }
616
		});
656
        });
617
	}
657
    }
618
}
658
}
619
 
659
 
620
function reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId, serviceBrandComment) {
660
function reasonPartnerbrandServiceNotActivate(fofoId, serviceId, serviceBrandId, serviceBrandComment) {
621
	if (confirm("Are you sure you want to activate brand service!") == true) {
661
    if (confirm("Are you sure you want to activate brand service!") == true) {
622
		var params = {
662
        var params = {
623
			"serviceId": serviceId,
663
            "serviceId": serviceId,
624
			"fofoId": fofoId,
664
            "fofoId": fofoId,
625
			"serviceBrandId": serviceBrandId,
665
            "serviceBrandId": serviceBrandId,
626
			"serviceBrandComment": serviceBrandComment
666
            "serviceBrandComment": serviceBrandComment
627
 
667
 
628
		}
668
        }
629
		doPostAjaxRequestWithParamsHandler(context
669
        doPostAjaxRequestWithParamsHandler(context
630
			+ "/reasonPartnerbrandServiceNotActivate", params, function (response) {
670
            + "/reasonPartnerbrandServiceNotActivate", params, function (response) {
631
			if (response == "true") {
671
            if (response == "true") {
632
				alert("successfully set your Comment for brand service not activated");
672
                alert("successfully set your Comment for brand service not activated");
633
				$('#myServiceActivateBrand').modal('hide');
673
                $('#myServiceActivateBrand').modal('hide');
634
				$('.modal-backdrop').remove();
674
                $('.modal-backdrop').remove();
635
				loadAdminPartnerService("main-content", fofoId);
675
                loadAdminPartnerService("main-content", fofoId);
636
			}
676
            }
637
		});
677
        });
638
	}
678
    }
639
}
679
}
640
 
680
 
641
function addPartnerServiceBrandDetails(fofoId, serviceId, serviceBrandId,
681
function addPartnerServiceBrandDetails(fofoId, serviceId, serviceBrandId,
642
									   applicableType, active, partnerStatus, na_comment,
682
                                       applicableType, active, partnerStatus, na_comment,
643
									   partnerCommentStatus, code) {
683
                                       partnerCommentStatus, code) {
644
	if (confirm("Are you sure you want to add service brand details!") == true) {
684
    if (confirm("Are you sure you want to add service brand details!") == true) {
645
		var params = {
685
        var params = {
646
			"serviceId": serviceId,
686
            "serviceId": serviceId,
647
			"serviceBrandId": serviceBrandId,
687
            "serviceBrandId": serviceBrandId,
648
			"fofoId": fofoId,
688
            "fofoId": fofoId,
649
			"applicableType": applicableType,
689
            "applicableType": applicableType,
650
			"active": active,
690
            "active": active,
651
			"partnerStatus": partnerStatus,
691
            "partnerStatus": partnerStatus,
652
			"na_comment": na_comment,
692
            "na_comment": na_comment,
653
			"partnerCommentStatus": partnerCommentStatus,
693
            "partnerCommentStatus": partnerCommentStatus,
654
 
694
 
655
		}
695
        }
656
		console.log("params" + params);
696
        console.log("params" + params);
657
		doPostAjaxRequestWithParamsHandler(context
697
        doPostAjaxRequestWithParamsHandler(context
658
			+ "/addPartnerServiceBrandDetails", params, function (response) {
698
            + "/addPartnerServiceBrandDetails", params, function (response) {
659
			if (response == "true") {
699
            if (response == "true") {
660
				alert("successfully added partner Service Brand Details");
700
                alert("successfully added partner Service Brand Details");
661
				loadaddPartnerBrandServiceDetails("main-content");
701
                loadaddPartnerBrandServiceDetails("main-content");
662
			}
702
            }
663
		});
703
        });
664
	}
704
    }
665
}
705
}
666
 
706
 
667
function configureBrandsDropDown() {
707
function configureBrandsDropDown() {
668
	$('#tag-listing-brands').multiselect({
708
    $('#tag-listing-brands').multiselect({
669
		includeSelectAllOption: true,
709
        includeSelectAllOption: true,
670
		multiple: true,
710
        multiple: true,
671
		maxHeight: 200,
711
        maxHeight: 200,
672
		buttonWidth: '180px',
712
        buttonWidth: '180px',
673
		numberDisplayed: 1,
713
        numberDisplayed: 1,
674
		nonSelectedText: 'Brands',
714
        nonSelectedText: 'Brands',
675
		nSelectedText: ' - Brands Selected',
715
        nSelectedText: ' - Brands Selected',
676
		allSelectedText: 'All Brands Selected',
716
        allSelectedText: 'All Brands Selected',
677
		enableFiltering: true,
717
        enableFiltering: true,
678
		enableCaseInsensitiveFiltering: true
718
        enableCaseInsensitiveFiltering: true
679
	});
719
    });
680
}
720
}
681
 
721
 
682
function loadService(domId) {
722
function loadService(domId) {
683
	doGetAjaxRequestHandler(context + "/getcreateService", function (response) {
723
    doGetAjaxRequestHandler(context + "/getcreateService", function (response) {
684
		$('#' + domId).html(response);
724
        $('#' + domId).html(response);
685
	});
725
    });
686
}
726
}
687
 
727
 
688
function loadaddedBrandsbyserviceId(domId, serviceId) {
728
function loadaddedBrandsbyserviceId(domId, serviceId) {
689
	doGetAjaxRequestHandler(context + "/getAddedbrands?serviceId=" + serviceId,
729
    doGetAjaxRequestHandler(context + "/getAddedbrands?serviceId=" + serviceId,
690
		function (response) {
730
        function (response) {
691
			$('#' + domId).html(response);
731
            $('#' + domId).html(response);
692
		});
732
        });
693
}
733
}
694
 
734
 
695
function loadBrandsByServiceId(domId, serviceId) {
735
function loadBrandsByServiceId(domId, serviceId) {
696
	doGetAjaxRequestHandler(context + "/getbrands?serviceId=" + serviceId,
736
    doGetAjaxRequestHandler(context + "/getbrands?serviceId=" + serviceId,
697
		function (response) {
737
        function (response) {
698
			$('#' + domId).html(response);
738
            $('#' + domId).html(response);
699
			configureBrandsDropDown();
739
            configureBrandsDropDown();
700
		});
740
        });
701
 
741
 
702
}
742
}
703
 
743
 
704
function createService(domId, serviceName) {
744
function createService(domId, serviceName) {
705
	console.log(serviceName);
745
    console.log(serviceName);
706
	doPostAjaxRequestHandler(context + "/createService?serviceName="
746
    doPostAjaxRequestHandler(context + "/createService?serviceName="
707
		+ serviceName, function (response) {
747
        + serviceName, function (response) {
708
		alert("Service Successfully Created");
748
        alert("Service Successfully Created");
709
		$('#' + domId).html(response);
749
        $('#' + domId).html(response);
710
	});
750
    });
711
}
751
}
712
 
752
 
713
function loadaddBrandToService(domId) {
753
function loadaddBrandToService(domId) {
714
	doGetAjaxRequestHandler(context + "/addBrandsToService",
754
    doGetAjaxRequestHandler(context + "/addBrandsToService",
715
		function (response) {
755
        function (response) {
716
			$('#' + domId).html(response);
756
            $('#' + domId).html(response);
717
		});
757
        });
718
}
758
}
719
 
759
 
720
function addBrandToService(domId, brands, serviceId) {
760
function addBrandToService(domId, brands, serviceId) {
721
	doPostAjaxRequestWithJsonHandler(context + "/addBrandsService?serviceId="
761
    doPostAjaxRequestWithJsonHandler(context + "/addBrandsService?serviceId="
722
		+ serviceId, JSON.stringify(brands), function (response) {
762
        + serviceId, JSON.stringify(brands), function (response) {
723
		alert("Brands added successfully");
763
        alert("Brands added successfully");
724
		loadBrandsByServiceId("service-container", serviceId);
764
        loadBrandsByServiceId("service-container", serviceId);
725
		loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
765
        loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
726
		$('#' + domId).html(response);
766
        $('#' + domId).html(response);
727
	});
767
    });
728
}
768
}
729
 
769
 
730
function removeBrandFromService(domId, serviceId, brand) {
770
function removeBrandFromService(domId, serviceId, brand) {
731
 
771
 
732
	doDeleteAjaxRequestHandler(context + "/removeBrandfromService?serviceId="
772
    doDeleteAjaxRequestHandler(context + "/removeBrandfromService?serviceId="
733
		+ serviceId + "&brand=" + brand, function (response) {
773
        + serviceId + "&brand=" + brand, function (response) {
734
		alert("Brand removed from service successfully");
774
        alert("Brand removed from service successfully");
735
		loadBrandsByServiceId("service-container", serviceId);
775
        loadBrandsByServiceId("service-container", serviceId);
736
		loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
776
        loadaddedBrandsbyserviceId("added-brand-to-service", serviceId)
737
		$('#' + domId).html(response);
777
        $('#' + domId).html(response);
738
	});
778
    });
739
}
779
}
740
 
780
 
741
function showFinanceServices(domId) {
781
function showFinanceServices(domId) {
742
	doGetAjaxRequestHandler(context + "/getFinanceServicesAllPartner", function (response) {
782
    doGetAjaxRequestHandler(context + "/getFinanceServicesAllPartner", function (response) {
743
 
783
 
744
		$('#' + domId).html(response);
784
        $('#' + domId).html(response);
745
	});
785
    });
746
}
786
}
747
 
787
 
748
 
788
 
749
function changeServices(partnerServiceId) {
789
function changeServices(partnerServiceId) {
750
	var serviceId = partnerServiceId.value;
790
    var serviceId = partnerServiceId.value;
751
	var fofoId = $("#partnerName").val();
791
    var fofoId = $("#partnerName").val();
752
	console.log(fofoId);
792
    console.log(fofoId);
753
	console.log(serviceId);
793
    console.log(serviceId);
754
	if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
794
    if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
755
		var dialog = bootbox
795
        var dialog = bootbox
756
			.dialog({
796
            .dialog({
757
				title: "Are you sure want to change state of service!",
797
                title: "Are you sure want to change state of service!",
758
				message: "<div class=form-inline'>"
798
                message: "<div class=form-inline'>"
759
					+ "<label for='reason'>Reason:</label>"
799
                    + "<label for='reason'>Reason:</label>"
760
					+ "<textarea class='form-control' rows='1' id='reason'></textarea>"
800
                    + "<textarea class='form-control' rows='1' id='reason'></textarea>"
761
					+ "</div>",
801
                    + "</div>",
762
				buttons: {
802
                buttons: {
763
					cancel: {
803
                    cancel: {
764
						label: "cancel",
804
                        label: "cancel",
765
						className: 'btn-danger',
805
                        className: 'btn-danger',
766
						callback: function () {
806
                        callback: function () {
767
							loadpartnerService("main-content");
807
                            loadpartnerService("main-content");
768
						}
808
                        }
769
					},
809
                    },
770
					ok: {
810
                    ok: {
771
						label: "ok",
811
                        label: "ok",
772
						className: 'btn-info',
812
                        className: 'btn-info',
773
						callback: function () {
813
                        callback: function () {
774
							partnerStatusComment = $('#reason').val();
814
                            partnerStatusComment = $('#reason').val();
775
							console.log(partnerStatusComment);
815
                            console.log(partnerStatusComment);
776
							var params = {
816
                            var params = {
777
								"serviceId": serviceId,
817
                                "serviceId": serviceId,
778
								"partnerStatusComment": partnerStatusComment
818
                                "partnerStatusComment": partnerStatusComment
779
							}
819
                            }
780
							doPostAjaxRequestWithParamsHandler(
820
                            doPostAjaxRequestWithParamsHandler(
781
								context + "/changeStatePartnerService",
821
                                context + "/changeStatePartnerService",
782
								params,
822
                                params,
783
								function (response) {
823
                                function (response) {
784
									if (response == "true") {
824
                                    if (response == "true") {
785
										alert("successfully changed");
825
                                        alert("successfully changed");
786
										loadpartnerService("main-content");
826
                                        loadpartnerService("main-content");
787
									}
827
                                    }
788
								});
828
                                });
789
 
829
 
790
						}
830
                        }
791
					}
831
                    }
792
				}
832
                }
793
			});
833
            });
794
 
834
 
795
	} else {
835
    } else {
796
		if (confirm("Are you sure you want to change!") == true) {
836
        if (confirm("Are you sure you want to change!") == true) {
797
			var params = {
837
            var params = {
798
				"serviceId": serviceId,
838
                "serviceId": serviceId,
799
				"fofoId": fofoId
839
                "fofoId": fofoId
800
 
840
 
801
			}
841
            }
802
			doPostAjaxRequestWithParamsHandler(context
842
            doPostAjaxRequestWithParamsHandler(context
803
				+ "/changeStatePartnerService", params, function (response) {
843
                + "/changeStatePartnerService", params, function (response) {
804
				if (response == "true") {
844
                if (response == "true") {
805
					alert("successfully changed");
845
                    alert("successfully changed");
806
					loadAdminPartnerService("main-content", fofoId);
846
                    loadAdminPartnerService("main-content", fofoId);
807
				}
847
                }
808
			});
848
            });
809
		} else {
849
        } else {
810
			loadAdminPartnerService("main-content", fofoId);
850
            loadAdminPartnerService("main-content", fofoId);
811
		}
851
        }
812
	}
852
    }
813
}
853
}
814
 
854
 
815
function changeServiceNameForServiceBrand() {
855
function changeServiceNameForServiceBrand() {
816
 
856
 
817
	serviceId = $("#serviceName").val();
857
    serviceId = $("#serviceName").val();
818
	console.log(serviceId);
858
    console.log(serviceId);
819
	doGetAjaxRequestHandler(context + "/selectAddedbrands?serviceId="
859
    doGetAjaxRequestHandler(context + "/selectAddedbrands?serviceId="
820
		+ serviceId, function (response) {
860
        + serviceId, function (response) {
821
		$('#' + "serviceBrandNameContainer").html(response);
861
        $('#' + "serviceBrandNameContainer").html(response);
822
	});
862
    });
823
}
863
}
824
 
864
 
825
function configureAllPartnerName() {
865
function configureAllPartnerName() {
826
	$(document).ready(function () {
866
    $(document).ready(function () {
827
		$('#partnerName').multiselect({
867
        $('#partnerName').multiselect({
828
			includeSelectAllOption: true,
868
            includeSelectAllOption: true,
829
			maxHeight: 200,
869
            maxHeight: 200,
830
			buttonWidth: '200px',
870
            buttonWidth: '200px',
831
			numberDisplayed: 1,
871
            numberDisplayed: 1,
832
			nonSelectedText: 'Partners',
872
            nonSelectedText: 'Partners',
833
			nSelectedText: ' - Partners Selected',
873
            nSelectedText: ' - Partners Selected',
834
			allSelectedText: 'All Partners Selected',
874
            allSelectedText: 'All Partners Selected',
835
			enableFiltering: true,
875
            enableFiltering: true,
836
			enableCaseInsensitiveFiltering: true
876
            enableCaseInsensitiveFiltering: true
837
 
877
 
838
		});
878
        });
839
	});
879
    });
840
}
880
}
841
 
881
 
842
 
882
 
843
function onChangeStateServiceBrand(partnerServiceBrandId, partnerServiceId, brand) {
883
function onChangeStateServiceBrand(partnerServiceBrandId, partnerServiceId, brand) {
844
 
884
 
845
 
885
 
846
	console.log(brand);
886
    console.log(brand);
847
 
887
 
848
	var brandServiceId = partnerServiceBrandId.value;
888
    var brandServiceId = partnerServiceBrandId.value;
849
	var fofoId = $("#partnerName").val();
889
    var fofoId = $("#partnerName").val();
850
	console.log(brandServiceId, partnerServiceId);
890
    console.log(brandServiceId, partnerServiceId);
851
	if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
891
    if (fofoId == "" || fofoId == 0 || fofoId == undefined) {
852
		var dialog = bootbox
892
        var dialog = bootbox
853
			.dialog({
893
            .dialog({
854
				title: "Are you sure want to change state of service!",
894
                title: "Are you sure want to change state of service!",
855
				message: "<div class=form-inline'>"
895
                message: "<div class=form-inline'>"
856
					+ "<label for='reason'>Reason:</label>"
896
                    + "<label for='reason'>Reason:</label>"
857
					+ "<textarea class='form-control' rows='1' id='reason'></textarea>"
897
                    + "<textarea class='form-control' rows='1' id='reason'></textarea>"
858
					+ "</div>",
898
                    + "</div>",
859
				buttons: {
899
                buttons: {
860
					cancel: {
900
                    cancel: {
861
						label: "cancel",
901
                        label: "cancel",
862
						className: 'btn-danger',
902
                        className: 'btn-danger',
863
						callback: function () {
903
                        callback: function () {
864
							loadpartnerService("main-content");
904
                            loadpartnerService("main-content");
865
						}
905
                        }
866
					},
906
                    },
867
					ok: {
907
                    ok: {
868
						label: "ok",
908
                        label: "ok",
869
						className: 'btn-info',
909
                        className: 'btn-info',
870
						callback: function () {
910
                        callback: function () {
871
							partnerStatusComment = $('#reason').val();
911
                            partnerStatusComment = $('#reason').val();
872
							console.log(partnerStatusComment);
912
                            console.log(partnerStatusComment);
873
							var params = {
913
                            var params = {
874
								"brand": brand,
914
                                "brand": brand,
875
								"brandServiceId": brandServiceId,
915
                                "brandServiceId": brandServiceId,
876
								"serviceId": partnerServiceId,
916
                                "serviceId": partnerServiceId,
877
								"partnerStatusComment": partnerStatusComment
917
                                "partnerStatusComment": partnerStatusComment
878
							}
918
                            }
879
							doPostAjaxRequestWithParamsHandler(
919
                            doPostAjaxRequestWithParamsHandler(
880
								context
920
                                context
881
								+ "/changeStatePartnerServiceBrand",
921
                                + "/changeStatePartnerServiceBrand",
882
								params,
922
                                params,
883
								function (response) {
923
                                function (response) {
884
									if (response == "true") {
924
                                    if (response == "true") {
885
										alert("successfully changed");
925
                                        alert("successfully changed");
886
										loadpartnerService("main-content");
926
                                        loadpartnerService("main-content");
887
									}
927
                                    }
888
 
928
 
889
								});
929
                                });
890
 
930
 
891
						}
931
                        }
892
					}
932
                    }
893
				}
933
                }
894
			});
934
            });
895
	} else {
935
    } else {
896
		if (confirm("Are you sure you want to change!") == true) {
936
        if (confirm("Are you sure you want to change!") == true) {
897
 
937
 
898
			var params = {
938
            var params = {
899
				"brandServiceId": brandServiceId,
939
                "brandServiceId": brandServiceId,
900
				"brand": brand,
940
                "brand": brand,
901
				"serviceId": partnerServiceId,
941
                "serviceId": partnerServiceId,
902
				"fofoId": fofoId
942
                "fofoId": fofoId
903
 
943
 
904
			}
944
            }
905
			doPostAjaxRequestWithParamsHandler(context
945
            doPostAjaxRequestWithParamsHandler(context
906
				+ "/changeStatePartnerServiceBrand", params, function (
946
                + "/changeStatePartnerServiceBrand", params, function (
907
				response) {
947
                response) {
908
				if (response == "true") {
948
                if (response == "true") {
909
					alert("successfully changed");
949
                    alert("successfully changed");
910
					loadAdminPartnerService("main-content", fofoId);
950
                    loadAdminPartnerService("main-content", fofoId);
911
				}
951
                }
912
			});
952
            });
913
 
953
 
914
		} else {
954
        } else {
915
 
955
 
916
			loadAdminPartnerService("main-content", fofoId);
956
            loadAdminPartnerService("main-content", fofoId);
917
		}
957
        }
918
	}
958
    }
919
}
959
}
920
 
960
 
921
function loadpartnerService(domId) {
961
function loadpartnerService(domId) {
922
	doGetAjaxRequestHandler(context + "/getPartnerServices",
962
    doGetAjaxRequestHandler(context + "/getPartnerServices",
923
		function (response) {
963
        function (response) {
924
			$('#' + domId).html(response);
964
            $('#' + domId).html(response);
925
		});
965
        });
926
 
966
 
927
}
967
}
928
 
968
 
929
function loadAdminPartnerService(domId, fofoId) {
969
function loadAdminPartnerService(domId, fofoId) {
930
	doGetAjaxRequestHandler(context
970
    doGetAjaxRequestHandler(context
931
		+ "/getAdminPanelForPartnerServices?fofoId=" + fofoId, function (
971
        + "/getAdminPanelForPartnerServices?fofoId=" + fofoId, function (
932
		response) {
972
        response) {
933
		$('#' + domId).html(response);
973
        $('#' + domId).html(response);
934
		if (fofoId != 0 || fofoId) {
974
        if (fofoId != 0 || fofoId) {
935
			doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
975
            doGetAjaxRequestHandler(context + "/getPartnerServices?fofoId="
936
				+ fofoId, function (response) {
976
                + fofoId, function (response) {
937
				$('#' + "partnerServicesByID").html(response);
977
                $('#' + "partnerServicesByID").html(response);
938
			});
978
            });
939
		}
979
        }
940
 
980
 
941
	});
981
    });
942
}
982
}
943
 
983
 
944
function activatePartnerService(fofoId, serviceId) {
984
function activatePartnerService(fofoId, serviceId) {
945
	console.log(fofoId);
985
    console.log(fofoId);
946
	bootbox.dialog({
986
    bootbox.dialog({
947
		title: "Are you sure you want to activate services!",
987
        title: "Are you sure you want to activate services!",
948
		message: "<div class=form-inline'>"
988
        message: "<div class=form-inline'>"
949
			+ "<label for='code'>Code:</label>"
989
            + "<label for='code'>Code:</label>"
950
			+ "<input class='form-control' type='text' id='code'/>"
990
            + "<input class='form-control' type='text' id='code'/>"
951
			+ "</div>",
991
            + "</div>",
952
		buttons: {
992
        buttons: {
953
			cancel: {
993
            cancel: {
954
				label: "cancel",
994
                label: "cancel",
955
				className: 'btn-danger',
995
                className: 'btn-danger',
956
				callback: function () {
996
                callback: function () {
957
					return;
997
                    return;
958
				}
998
                }
959
			},
999
            },
960
			ok: {
1000
            ok: {
961
				label: "ok",
1001
                label: "ok",
962
				className: 'btn-info',
1002
                className: 'btn-info',
963
				callback: function () {
1003
                callback: function () {
964
					code = $('#code').val();
1004
                    code = $('#code').val();
965
					//console.log(partnerStatusComment);
1005
                    //console.log(partnerStatusComment);
966
					if (code == "" || code == undefined || code == null) {
1006
                    if (code == "" || code == undefined || code == null) {
967
						alert("code can't be empty");
1007
                        alert("code can't be empty");
968
						activatePartnerService(fofoId, serviceId);
1008
                        activatePartnerService(fofoId, serviceId);
969
						return;
1009
                        return;
970
					}
1010
                    }
971
					var params = {
1011
                    var params = {
972
						"serviceId": serviceId,
1012
                        "serviceId": serviceId,
973
						"fofoId": fofoId,
1013
                        "fofoId": fofoId,
974
						"code": code
1014
                        "code": code
975
					}
1015
                    }
976
					doPostAjaxRequestWithParamsHandler(context + "/activatePartnerService",
1016
                    doPostAjaxRequestWithParamsHandler(context + "/activatePartnerService",
977
						params, function (response) {
1017
                        params, function (response) {
978
							if (response == "true") {
1018
                            if (response == "true") {
979
								alert("successfully activate");
1019
                                alert("successfully activate");
980
								loadAdminPartnerService("main-content", fofoId);
1020
                                loadAdminPartnerService("main-content", fofoId);
981
							}
1021
                            }
982
						});
1022
                        });
983
				}
1023
                }
984
			}
1024
            }
985
		}
1025
        }
986
	});
1026
    });
987
}
1027
}
988
 
1028
 
989
function activateFinanceServices(fofoId, serviceId, row) {
1029
function activateFinanceServices(fofoId, serviceId, row) {
990
	console.log(fofoId);
1030
    console.log(fofoId);
991
 
1031
 
992
	console.log(row);
1032
    console.log(row);
993
	bootbox.dialog({
1033
    bootbox.dialog({
994
		title: "Are you sure you want to activate services!",
1034
        title: "Are you sure you want to activate services!",
995
		message: "<div class=form-inline'>"
1035
        message: "<div class=form-inline'>"
996
			+ "<label for='code'>Code:</label>"
1036
            + "<label for='code'>Code:</label>"
997
			+ "<input class='form-control' type='text' id='code'/>"
1037
            + "<input class='form-control' type='text' id='code'/>"
998
			+ "</div>",
1038
            + "</div>",
999
		buttons: {
1039
        buttons: {
1000
			cancel: {
1040
            cancel: {
1001
				label: "cancel",
1041
                label: "cancel",
1002
				className: 'btn-danger',
1042
                className: 'btn-danger',
1003
				callback: function () {
1043
                callback: function () {
1004
					return;
1044
                    return;
1005
				}
1045
                }
1006
			},
1046
            },
1007
			ok: {
1047
            ok: {
1008
				label: "ok",
1048
                label: "ok",
1009
				className: 'btn-info',
1049
                className: 'btn-info',
1010
				callback: function () {
1050
                callback: function () {
1011
					code = $('#code').val();
1051
                    code = $('#code').val();
1012
					//console.log(partnerStatusComment);
1052
                    //console.log(partnerStatusComment);
1013
					if (code == "" || code == undefined || code == null) {
1053
                    if (code == "" || code == undefined || code == null) {
1014
						alert("code can't be empty");
1054
                        alert("code can't be empty");
1015
						activatePartnerService(fofoId, serviceId);
1055
                        activatePartnerService(fofoId, serviceId);
1016
						return;
1056
                        return;
1017
					}
1057
                    }
1018
					var params = {
1058
                    var params = {
1019
						"serviceId": serviceId,
1059
                        "serviceId": serviceId,
1020
						"fofoId": fofoId,
1060
                        "fofoId": fofoId,
1021
						"code": code
1061
                        "code": code
1022
					}
1062
                    }
1023
					doPostAjaxRequestWithParamsHandler(context + "/activateFinanceServices",
1063
                    doPostAjaxRequestWithParamsHandler(context + "/activateFinanceServices",
1024
						params, function (response) {
1064
                        params, function (response) {
1025
 
1065
 
1026
							row.html(response);
1066
                            row.html(response);
1027
							alert("successfully submit");
1067
                            alert("successfully submit");
1028
 
1068
 
1029
						});
1069
                        });
1030
				}
1070
                }
1031
			}
1071
            }
1032
		}
1072
        }
1033
	});
1073
    });
1034
}
1074
}
1035
 
1075
 
1036
function deActivatePartnerService(fofoId, serviceId) {
1076
function deActivatePartnerService(fofoId, serviceId) {
1037
	if (confirm("Are you sure you want to deactivate services!") == true) {
1077
    if (confirm("Are you sure you want to deactivate services!") == true) {
1038
		var params = {
1078
        var params = {
1039
			"serviceId": serviceId,
1079
            "serviceId": serviceId,
1040
			"fofoId": fofoId
1080
            "fofoId": fofoId
1041
 
1081
 
1042
		}
1082
        }
1043
		doPostAjaxRequestWithParamsHandler(context
1083
        doPostAjaxRequestWithParamsHandler(context
1044
			+ "/deActivatePartnerService", params, function (response) {
1084
            + "/deActivatePartnerService", params, function (response) {
1045
			if (response == "true") {
1085
            if (response == "true") {
1046
				alert("successfully deactivate");
1086
                alert("successfully deactivate");
1047
				loadAdminPartnerService("main-content", fofoId);
1087
                loadAdminPartnerService("main-content", fofoId);
1048
			}
1088
            }
1049
		});
1089
        });
1050
	}
1090
    }
1051
}
1091
}
1052
 
1092
 
1053
function activatePartnerBrandService(fofoId, serviceId, serviceBrandId) {
1093
function activatePartnerBrandService(fofoId, serviceId, serviceBrandId) {
1054
	if (confirm("Are you sure you want to activate brand service!") == true) {
1094
    if (confirm("Are you sure you want to activate brand service!") == true) {
1055
		var params = {
1095
        var params = {
1056
			"serviceId": serviceId,
1096
            "serviceId": serviceId,
1057
			"fofoId": fofoId,
1097
            "fofoId": fofoId,
1058
			"serviceBrandId": serviceBrandId
1098
            "serviceBrandId": serviceBrandId
1059
 
1099
 
1060
		}
1100
        }
1061
		doPostAjaxRequestWithParamsHandler(context
1101
        doPostAjaxRequestWithParamsHandler(context
1062
			+ "/activatePartnerbrandService", params, function (response) {
1102
            + "/activatePartnerbrandService", params, function (response) {
1063
			if (response == "true") {
1103
            if (response == "true") {
1064
				alert("successfully activate");
1104
                alert("successfully activate");
1065
				$('#myServiceActivateBrand').modal('hide');
1105
                $('#myServiceActivateBrand').modal('hide');
1066
				$('.modal-backdrop').remove();
1106
                $('.modal-backdrop').remove();
1067
				loadAdminPartnerService("main-content", fofoId);
1107
                loadAdminPartnerService("main-content", fofoId);
1068
			}
1108
            }
1069
		});
1109
        });
1070
	}
1110
    }
1071
}
1111
}
1072
 
1112
 
1073
function actionFinanceBrandService(fofoId, serviceId, brandId, row) {
1113
function actionFinanceBrandService(fofoId, serviceId, brandId, row) {
1074
	if (confirm("Are you sure you want to activate or deactivate brand service!") == true) {
1114
    if (confirm("Are you sure you want to activate or deactivate brand service!") == true) {
1075
		var params = {
1115
        var params = {
1076
			"serviceId": serviceId,
1116
            "serviceId": serviceId,
1077
			"fofoId": fofoId,
1117
            "fofoId": fofoId,
1078
			"serviceBrandId": brandId
1118
            "serviceBrandId": brandId
1079
 
1119
 
1080
		}
1120
        }
1081
		doPostAjaxRequestWithParamsHandler(context
1121
        doPostAjaxRequestWithParamsHandler(context
1082
			+ "/actionFinanceBrandService", params, function (response) {
1122
            + "/actionFinanceBrandService", params, function (response) {
1083
 
1123
 
1084
			alert("successfully activate");
1124
            alert("successfully activate");
1085
			row.html(response);
1125
            row.html(response);
1086
		});
1126
        });
1087
	}
1127
    }
1088
}
1128
}
1089
 
1129
 
1090
 
1130
 
1091
function deActivateFinanceServicePartnerNotInterested(fofoId, serviceId, partnerNotInterestedComment, row) {
1131
function deActivateFinanceServicePartnerNotInterested(fofoId, serviceId, partnerNotInterestedComment, row) {
1092
	console.log(row);
1132
    console.log(row);
1093
	if (confirm("Are you sure you want to Deactivate service!") == true) {
1133
    if (confirm("Are you sure you want to Deactivate service!") == true) {
1094
		var params = {
1134
        var params = {
1095
			"serviceId": serviceId,
1135
            "serviceId": serviceId,
1096
			"fofoId": fofoId,
1136
            "fofoId": fofoId,
1097
			"partnerNotInterestedComment": partnerNotInterestedComment
1137
            "partnerNotInterestedComment": partnerNotInterestedComment
1098
 
1138
 
1099
		}
1139
        }
1100
		doPostAjaxRequestWithParamsHandler(context
1140
        doPostAjaxRequestWithParamsHandler(context
1101
			+ "/deActivateFinanceServicePartnerNotInterested", params, function (response) {
1141
            + "/deActivateFinanceServicePartnerNotInterested", params, function (response) {
1102
 
1142
 
1103
			console.log(row);
1143
            console.log(row);
1104
			alert("successfully submit");
1144
            alert("successfully submit");
1105
			row.html(response);
1145
            row.html(response);
1106
 
1146
 
1107
		});
1147
        });
1108
	}
1148
    }
1109
}
1149
}
1110
 
1150
 
1111
function deActivatePartnerServiceByPartner(fofoId, serviceId, partnerNotInterestedComment) {
1151
function deActivatePartnerServiceByPartner(fofoId, serviceId, partnerNotInterestedComment) {
1112
	if (confirm("Are you sure you want to Deactivate service!") == true) {
1152
    if (confirm("Are you sure you want to Deactivate service!") == true) {
1113
		var params = {
1153
        var params = {
1114
			"serviceId": serviceId,
1154
            "serviceId": serviceId,
1115
			"fofoId": fofoId,
1155
            "fofoId": fofoId,
1116
			"partnerNotInterestedComment": partnerNotInterestedComment
1156
            "partnerNotInterestedComment": partnerNotInterestedComment
1117
 
1157
 
1118
		}
1158
        }
1119
		doPostAjaxRequestWithParamsHandler(context
1159
        doPostAjaxRequestWithParamsHandler(context
1120
			+ "/deActivatePartnerBrandServiceByPartner", params, function (response) {
1160
            + "/deActivatePartnerBrandServiceByPartner", params, function (response) {
1121
			if (response == "true") {
1161
            if (response == "true") {
1122
				alert("successfully activate");
1162
                alert("successfully activate");
1123
				$('#serviceDeactivateByPartnerModal').modal('hide');
1163
                $('#serviceDeactivateByPartnerModal').modal('hide');
1124
				$('.modal-backdrop').remove();
1164
                $('.modal-backdrop').remove();
1125
				loadAdminPartnerService("main-content", fofoId);
1165
                loadAdminPartnerService("main-content", fofoId);
1126
			}
1166
            }
1127
		});
1167
        });
1128
	}
1168
    }
1129
}
1169
}
1130
 
1170
 
1131
function deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId, serviceBrandComment) {
1171
function deActivatePartnerBrandService(fofoId, serviceId, serviceBrandId, serviceBrandComment) {
1132
	if (confirm("Are you sure you want to deactivate brand service!") == true) {
1172
    if (confirm("Are you sure you want to deactivate brand service!") == true) {
1133
		var params = {
1173
        var params = {
1134
			"serviceId": serviceId,
1174
            "serviceId": serviceId,
1135
			"fofoId": fofoId,
1175
            "fofoId": fofoId,
1136
			"serviceBrandId": serviceBrandId,
1176
            "serviceBrandId": serviceBrandId,
1137
			"serviceBrandComment": serviceBrandComment
1177
            "serviceBrandComment": serviceBrandComment
1138
		}
1178
        }
1139
		doPostAjaxRequestWithParamsHandler(context
1179
        doPostAjaxRequestWithParamsHandler(context
1140
			+ "/deActivatePartnerbrandService", params, function (response) {
1180
            + "/deActivatePartnerbrandService", params, function (response) {
1141
			if (response == "true") {
1181
            if (response == "true") {
1142
				alert("successfully deactivate");
1182
                alert("successfully deactivate");
1143
				$('#myServiceDeActivateBrand').modal('hide');
1183
                $('#myServiceDeActivateBrand').modal('hide');
1144
				$('.modal-backdrop').remove();
1184
                $('.modal-backdrop').remove();
1145
				loadAdminPartnerService("main-content", fofoId);
1185
                loadAdminPartnerService("main-content", fofoId);
1146
			}
1186
            }
1147
		});
1187
        });
1148
	}
1188
    }
1149
}
1189
}
1150
 
1190
 
1151
function loadaddPartnerServiceDetails(domId) {
1191
function loadaddPartnerServiceDetails(domId) {
1152
	doGetAjaxRequestHandler(context + "/getAddPartnerServicesDetails",
1192
    doGetAjaxRequestHandler(context + "/getAddPartnerServicesDetails",
1153
		function (response) {
1193
        function (response) {
1154
			$('#' + domId).html(response);
1194
            $('#' + domId).html(response);
1155
		});
1195
        });
1156
}
1196
}
1157
 
1197
 
1158
function loadaddPartnerBrandServiceDetails(domId) {
1198
function loadaddPartnerBrandServiceDetails(domId) {
1159
	doGetAjaxRequestHandler(context + "/getAddPartnerBrandServiceDetails",
1199
    doGetAjaxRequestHandler(context + "/getAddPartnerBrandServiceDetails",
1160
		function (response) {
1200
        function (response) {
1161
			$('#' + domId).html(response);
1201
            $('#' + domId).html(response);
1162
		});
1202
        });
1163
}
1203
}
1164
1204