Subversion Repositories SmartDukaan

Rev

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

Rev 32195 Rev 32301
Line 1... Line 1...
1
const MAIN_CONTAINER = "#main-content";
1
const MAIN_CONTAINER = "#main-content";
2
var logosmapping = {
2
var logosmapping = {
3
	mobile_insurance_providers: {
3
    mobile_insurance_providers: {
4
		"0": context + '/resources/images/icons/provider-logos/iffco.png',
4
        "0": context + '/resources/images/icons/provider-logos/iffco.png',
5
		"1": context + '/resources/images/icons/provider-logos/icici.jpg',
5
        "1": context + '/resources/images/icons/provider-logos/icici.jpg',
6
		"2": context + '/resources/images/icons/provider-logos/tataaig.png',
6
        "2": context + '/resources/images/icons/provider-logos/tataaig.png',
7
		"3": context + '/resources/images/icons/provider-logos/bharti.jpg',
7
        "3": context + '/resources/images/icons/provider-logos/bharti.jpg',
8
		"4": context + '/resources/images/icons/provider-logos/bharti.jpg',
8
        "4": context + '/resources/images/icons/provider-logos/bharti.jpg',
9
		"5": context + '/resources/images/icons/provider-logos/oneassist.jpeg'
9
        "5": context + '/resources/images/icons/provider-logos/oneassist.jpeg'
10
	}
10
    }
11
}
11
}
12
 
12
 
13
function badRequestAlert(response) {
13
function badRequestAlert(response) {
14
	console.log(response.responseText);
14
    console.log(response.responseText);
15
	var errorObject = JSON.parse(response.responseText);
15
    var errorObject = JSON.parse(response.responseText);
16
	errorObject = errorObject.response;
16
    errorObject = errorObject.response;
17
	bootbox.alert('Bad Request\n' + 'rejectedType : '
17
    bootbox.alert('Bad Request\n' + 'rejectedType : '
18
		+ errorObject.rejectedType + '\n' + 'rejectedValue : '
18
        + errorObject.rejectedType + '\n' + 'rejectedValue : '
19
		+ errorObject.rejectedValue + '\n' + 'message : '
19
        + errorObject.rejectedValue + '\n' + 'message : '
20
		+ errorObject.message);
20
        + errorObject.message);
21
}
21
}
22
 
22
 
23
function internalServerErrorAlert(response) {
23
function internalServerErrorAlert(response) {
24
	console.log(response.responseText);
24
    console.log(response.responseText);
25
	var errorObject = JSON.parse(response.responseText);
25
    var errorObject = JSON.parse(response.responseText);
26
	errorObject = errorObject.response;
26
    errorObject = errorObject.response;
27
	bootbox.alert('Internal Server Error\n' + 'rejectedType : '
27
    bootbox.alert('Internal Server Error\n' + 'rejectedType : '
28
		+ errorObject.rejectedType + '\n' + 'rejectedValue : '
28
        + errorObject.rejectedType + '\n' + 'rejectedValue : '
29
		+ errorObject.rejectedValue + '\n' + 'message : '
29
        + errorObject.rejectedValue + '\n' + 'message : '
30
		+ errorObject.message);
30
        + errorObject.message);
31
}
31
}
32
 
32
 
33
$(document).ajaxError(function(event, jqxhr, settings, thrownError) {
33
$(document).ajaxError(function (event, jqxhr, settings, thrownError) {
34
	if (typeof loaderDialogObj != "undefined") {
34
    if (typeof loaderDialogObj != "undefined") {
35
		loaderDialogObj.modal('hide');
35
        loaderDialogObj.modal('hide');
36
		// $('div.modal-backdrop.fade').remove();
36
        // $('div.modal-backdrop.fade').remove();
37
	}
37
    }
38
	if (jqxhr.status == 400) {
38
    if (jqxhr.status == 400) {
39
		// $('#error-prompt-model').modal();
39
        // $('#error-prompt-model').modal();
40
		badRequestAlert(jqxhr);
40
        badRequestAlert(jqxhr);
41
	} else {
41
    } else {
42
		internalServerErrorAlert(jqxhr);
42
        internalServerErrorAlert(jqxhr);
43
	}
43
    }
44
});
44
});
45
 
45
 
46
$(document).ajaxComplete(function() {
46
$(document).ajaxComplete(function () {
47
	if (typeof loaderDialogObj != "undefined") {
47
    if (typeof loaderDialogObj != "undefined") {
48
		loaderDialogObj.modal('hide');
48
        loaderDialogObj.modal('hide');
49
		// $('div.modal-backdrop.fade').remove();
49
        // $('div.modal-backdrop.fade').remove();
50
	}
50
    }
51
});
51
});
52
 
52
 
53
function ajaxStartHandler() {
53
function ajaxStartHandler() {
54
	if (typeof loaderDialogObj != "undefined")
54
    if (typeof loaderDialogObj != "undefined")
55
		loaderDialogObj.modal('show');
55
        loaderDialogObj.modal('show');
56
}
56
}
57
 
57
 
58
$(document).ajaxStart(ajaxStartHandler);
58
$(document).ajaxStart(ajaxStartHandler);
59
 
59
 
60
function doAjaxRequestWithParamsHandler(urlString, httpType, params,
60
function doAjaxRequestWithParamsHandler(urlString, httpType, params,
61
	callback_function) {
61
                                        callback_function) {
62
	$.ajax({
62
    $.ajax({
63
		url: urlString,
63
        url: urlString,
64
		async: true,
64
        async: true,
65
		cache: false,
65
        cache: false,
66
		data: params,
66
        data: params,
67
		// dataType:'json',
67
        // dataType:'json',
68
		type: httpType,
68
        type: httpType,
69
		success: function(response) {
69
        success: function (response) {
70
			callback_function(response);
70
            callback_function(response);
71
			$('.currency').each(function(index, ele) {
71
            $('.currency').each(function (index, ele) {
72
				if (!isNaN(parseInt($(ele).html()))) {
72
                if (!isNaN(parseInt($(ele).html()))) {
73
					$(ele).html(numberToComma($(ele).html()));
73
                    $(ele).html(numberToComma($(ele).html()));
74
				}
74
                }
75
			});
75
            });
76
		}
76
        }
77
	});
77
    });
78
}
78
}
79
 
79
 
80
function doGetAjaxRequestWithParamsHandler(urlString, params, callback_function) {
80
function doGetAjaxRequestWithParamsHandler(urlString, params, callback_function) {
81
	doAjaxRequestWithParamsHandler(urlString, "GET", params, callback_function);
81
    doAjaxRequestWithParamsHandler(urlString, "GET", params, callback_function);
82
}
82
}
83
 
83
 
84
function doPostAjaxRequestWithParamsHandler(urlString, params,
84
function doPostAjaxRequestWithParamsHandler(urlString, params,
85
	callback_function) {
85
                                            callback_function) {
86
	doAjaxRequestWithParamsHandler(urlString, "POST", params, callback_function);
86
    doAjaxRequestWithParamsHandler(urlString, "POST", params, callback_function);
87
}
87
}
88
 
88
 
89
function doAjaxRequestWithJsonHandler(urlString, httpType, json,
89
function doAjaxRequestWithJsonHandler(urlString, httpType, json,
90
	callback_function) {
90
                                      callback_function) {
91
	$.ajax({
91
    $.ajax({
92
		url: urlString,
92
        url: urlString,
93
		async: true,
93
        async: true,
94
		cache: false,
94
        cache: false,
95
		processData: false,
95
        processData: false,
96
		data: json,
96
        data: json,
97
		contentType: 'application/json',
97
        contentType: 'application/json',
98
		type: httpType,
98
        type: httpType,
99
		success: function(response) {
99
        success: function (response) {
100
			// console.log("response"+JSON.stringify(data));
100
            // console.log("response"+JSON.stringify(data));
101
			callback_function(response);
101
            callback_function(response);
102
			$('.currency').each(function(index, ele) {
102
            $('.currency').each(function (index, ele) {
103
				if (!isNaN(parseInt($(ele).html()))) {
103
                if (!isNaN(parseInt($(ele).html()))) {
104
					$(ele).html(numberToComma($(ele).html()));
104
                    $(ele).html(numberToComma($(ele).html()));
105
				}
105
                }
106
			});
106
            });
107
		}
107
        }
108
	});
108
    });
109
}
109
}
110
 
110
 
111
function doPostAjaxRequestWithJsonHandler(urlString, json, callback_function) {
111
function doPostAjaxRequestWithJsonHandler(urlString, json, callback_function) {
112
	doAjaxRequestWithJsonHandler(urlString, "POST", json, callback_function);
112
    doAjaxRequestWithJsonHandler(urlString, "POST", json, callback_function);
113
}
113
}
114
 
114
 
115
function doPutAjaxRequestWithJsonHandler(urlString, json, callback_function) {
115
function doPutAjaxRequestWithJsonHandler(urlString, json, callback_function) {
116
	doAjaxRequestWithJsonHandler(urlString, "PUT", json, callback_function);
116
    doAjaxRequestWithJsonHandler(urlString, "PUT", json, callback_function);
117
}
117
}
118
 
118
 
119
function doAjaxRequestHandler(urlString, httpType, callback_function) {
119
function doAjaxRequestHandler(urlString, httpType, callback_function) {
120
	$.ajax({
120
    $.ajax({
121
		url: urlString,
121
        url: urlString,
122
		async: true,
122
        async: true,
123
		cache: false,
123
        cache: false,
124
		type: httpType,
124
        type: httpType,
125
		success: function(response) {
125
        success: function (response) {
126
			callback_function(response);
126
            callback_function(response);
127
			$('.currency').each(function(index, ele) {
127
            $('.currency').each(function (index, ele) {
128
				if (!isNaN(parseInt($(ele).html()))) {
128
                if (!isNaN(parseInt($(ele).html()))) {
129
					$(ele).html(numberToComma($(ele).html()));
129
                    $(ele).html(numberToComma($(ele).html()));
130
				}
130
                }
131
			});
131
            });
132
		}
132
        }
133
	});
133
    });
134
}
134
}
135
 
135
 
136
function doGetAjaxRequestHandler(urlString, callback_function) {
136
function doGetAjaxRequestHandler(urlString, callback_function) {
137
	doAjaxRequestHandler(urlString, "GET", callback_function);
137
    doAjaxRequestHandler(urlString, "GET", callback_function);
138
}
138
}
139
 
139
 
140
function doPutAjaxRequestHandler(urlString, callback_function) {
140
function doPutAjaxRequestHandler(urlString, callback_function) {
141
	doAjaxRequestHandler(urlString, "PUT", callback_function);
141
    doAjaxRequestHandler(urlString, "PUT", callback_function);
142
}
142
}
143
 
143
 
144
function doPostAjaxRequestHandler(urlString, callback_function) {
144
function doPostAjaxRequestHandler(urlString, callback_function) {
145
	doAjaxRequestHandler(urlString, "POST", callback_function);
145
    doAjaxRequestHandler(urlString, "POST", callback_function);
146
}
146
}
147
 
147
 
148
function doDeleteAjaxRequestHandler(urlString, callback_function) {
148
function doDeleteAjaxRequestHandler(urlString, callback_function) {
149
	doAjaxRequestHandler(urlString, "DELETE", callback_function);
149
    doAjaxRequestHandler(urlString, "DELETE", callback_function);
150
}
150
}
151
 
151
 
152
function doAjaxUploadRequest(urlString, httpType, file) {
152
function doAjaxUploadRequest(urlString, httpType, file) {
153
	var response;
153
    var response;
154
	doAjaxUploadRequestHandler(urlString, httpType, file,
154
    doAjaxUploadRequestHandler(urlString, httpType, file,
155
		function(ajaxResponse) {
155
        function (ajaxResponse) {
156
			response = ajaxResponse;
156
            response = ajaxResponse;
157
		});
157
        });
158
	return response;
158
    return response;
159
}
159
}
160
 
160
 
161
function doAjaxUploadRequestHandler(urlString, httpType, file,
161
function doAjaxUploadRequestHandler(urlString, httpType, file,
162
	callback_function) {
162
                                    callback_function) {
163
	var formData = new FormData();
163
    var formData = new FormData();
164
	formData.append("file", file);
164
    formData.append("file", file);
165
	$.ajax({
165
    $.ajax({
166
		url: urlString,
166
        url: urlString,
167
		type: httpType,
167
        type: httpType,
168
		data: formData,
168
        data: formData,
169
		dataType: 'json',
169
        dataType: 'json',
170
		async: true,
170
        async: true,
171
		cache: false,
171
        cache: false,
172
		contentType: false,
172
        contentType: false,
173
		enctype: 'multipart/form-data',
173
        enctype: 'multipart/form-data',
174
		processData: false,
174
        processData: false,
175
		success: function(response) {
175
        success: function (response) {
176
			// console.log("response"+JSON.stringify(data));
176
            // console.log("response"+JSON.stringify(data));
177
			callback_function(response);
177
            callback_function(response);
178
		}
178
        }
179
	});
179
    });
180
}
180
}
181
 
181
 
182
function doAjaxUploadRequestJsonHandler(urlString, httpType, file, json,
182
function doAjaxUploadRequestJsonHandler(urlString, httpType, file, json,
183
	callback_function) {
183
                                        callback_function) {
184
	var formData = new FormData();
184
    var formData = new FormData();
185
	formData.append("file", file);
185
    formData.append("file", file);
186
	formData.append('json', new Blob([json]));
186
    formData.append('json', new Blob([json]));
187
	$.ajax({
187
    $.ajax({
188
		url: urlString,
188
        url: urlString,
189
		type: httpType,
189
        type: httpType,
190
		data: formData,
190
        data: formData,
191
		enctype: 'multipart/form-data',
191
        enctype: 'multipart/form-data',
192
		contentType: false,
192
        contentType: false,
193
		processData: false,
193
        processData: false,
194
		success: function(response) {
194
        success: function (response) {
195
			// console.log("response"+JSON.stringify(data));
195
            // console.log("response"+JSON.stringify(data));
196
			callback_function(response);
196
            callback_function(response);
197
		}
197
        }
198
	});
198
    });
199
}
199
}
200
 
200
 
201
function uploadDocument(file) {
201
function uploadDocument(file) {
202
	var url = context + '/document-upload';
202
    var url = context + '/document-upload';
203
	doAjaxUploadRequestHandler(url, 'POST', file, function(response) {
203
    doAjaxUploadRequestHandler(url, 'POST', file, function (response) {
204
		var documentId = response.response.document_id;
204
        var documentId = response.response.document_id;
205
		console.log("documentId : " + documentId);
205
        console.log("documentId : " + documentId);
206
		return documentId;
206
        return documentId;
207
	});
207
    });
208
}
208
}
209
 
209
 
210
function doAjaxGetDownload(urlString, fileName) {
210
function doAjaxGetDownload(urlString, fileName) {
211
	console.log("fileName : " + fileName);
211
    console.log("fileName : " + fileName);
212
	doAjaxDownload(urlString, "GET", null, fileName);
212
    doAjaxDownload(urlString, "GET", null, fileName);
213
}
213
}
214
 
214
 
215
function doAjaxPostDownload(urlString, data, fileName, callback) {
215
function doAjaxPostDownload(urlString, data, fileName, callback) {
216
	doAjaxDownload(urlString, "POST", data, fileName, callback);
216
    doAjaxDownload(urlString, "POST", data, fileName, callback);
217
}
217
}
218
 
218
 
219
function doAjaxDownload(urlString, httpType, data, fileName, callback) {
219
function doAjaxDownload(urlString, httpType, data, fileName, callback) {
220
	xhttp = new XMLHttpRequest();
220
    xhttp = new XMLHttpRequest();
221
	if (typeof loaderDialogObj != "undefined")
221
    if (typeof loaderDialogObj != "undefined")
222
		loaderDialogObj.modal('show');
222
        loaderDialogObj.modal('show');
223
	xhttp.onreadystatechange = function() {
223
    xhttp.onreadystatechange = function () {
224
		var a;
224
        var a;
225
		if (xhttp.readyState === 2) {
225
        if (xhttp.readyState === 2) {
226
			if (xhttp.status == 200) {
226
            if (xhttp.status == 200) {
227
				xhttp.responseType = "blob";
227
                xhttp.responseType = "blob";
228
			} else {
228
            } else {
229
				xhttp.responseType = "text";
229
                xhttp.responseType = "text";
230
			}
230
            }
231
		} else if (xhttp.readyState === 4 && xhttp.status === 200) {
231
        } else if (xhttp.readyState === 4 && xhttp.status === 200) {
232
			// Trick for making downloadable link
232
            // Trick for making downloadable link
233
			if (typeof loaderDialogObj != "undefined") {
233
            if (typeof loaderDialogObj != "undefined") {
234
				loaderDialogObj.modal('hide');
234
                loaderDialogObj.modal('hide');
235
				// $('div.modal-backdrop.fade').remove();
235
                // $('div.modal-backdrop.fade').remove();
236
			}
236
            }
237
 
237
 
238
			a = document.createElement('a');
238
            a = document.createElement('a');
239
			a.href = window.URL.createObjectURL(xhttp.response);
239
            a.href = window.URL.createObjectURL(xhttp.response);
240
			// Give filename you wish to download
240
            // Give filename you wish to download
241
			a.download = fileName;
241
            a.download = fileName;
242
			a.style.display = 'none';
242
            a.style.display = 'none';
243
			document.body.appendChild(a);
243
            document.body.appendChild(a);
244
			a.click();
244
            a.click();
245
		} else if (xhttp.readyState == 4 && xhttp.status === 400) {
245
        } else if (xhttp.readyState == 4 && xhttp.status === 400) {
246
			if (typeof loaderDialogObj != "undefined") {
246
            if (typeof loaderDialogObj != "undefined") {
247
				loaderDialogObj.modal('hide');
247
                loaderDialogObj.modal('hide');
248
				// $('div.modal-backdrop.fade').remove();
248
                // $('div.modal-backdrop.fade').remove();
249
			}
249
            }
250
			badRequestAlert(xhttp);
250
            badRequestAlert(xhttp);
251
		} else if (xhttp.readyState == 4 && xhttp.status === 500) {
251
        } else if (xhttp.readyState == 4 && xhttp.status === 500) {
252
			if (typeof loaderDialogObj != "undefined") {
252
            if (typeof loaderDialogObj != "undefined") {
253
				loaderDialogObj.modal('hide');
253
                loaderDialogObj.modal('hide');
254
				// $('div.modal-backdrop.fade').remove();
254
                // $('div.modal-backdrop.fade').remove();
255
			}
255
            }
256
			internalServerErrorAlert(xhttp);
256
            internalServerErrorAlert(xhttp);
257
		}
257
        }
258
	};
258
    };
259
	// Post data to URL which handles post request
259
    // Post data to URL which handles post request
260
	xhttp.open(httpType, urlString);
260
    xhttp.open(httpType, urlString);
261
	if (httpType == "POST") {
261
    if (httpType == "POST") {
262
		xhttp.setRequestHeader("Content-Type", "application/json");
262
        xhttp.setRequestHeader("Content-Type", "application/json");
263
	}
263
    }
264
	// You should set responseType as blob for binary responses
264
    // You should set responseType as blob for binary responses
265
	// xhttp.responseType = 'blob';
265
    // xhttp.responseType = 'blob';
266
	xhttp.send(data);
266
    xhttp.send(data);
267
}
267
}
268
 
268
 
269
function loadPaginatedCatalogNextItems(url, params, paginatedIdentifier,
269
function loadPaginatedCatalogNextItems(url, params, paginatedIdentifier,
270
	tableIdentifier, detailsContainerIdentifier) {
270
                                       tableIdentifier, detailsContainerIdentifier) {
271
	var start = $("#" + paginatedIdentifier + " .start").text();
271
    var start = $("#" + paginatedIdentifier + " .start").text();
272
 
272
 
273
	var end = $("#" + paginatedIdentifier + " .end").text();
273
    var end = $("#" + paginatedIdentifier + " .end").text();
274
 
274
 
275
	url = context + url + "?offset=" + end;
275
    url = context + url + "?offset=" + end;
276
 
276
 
277
	if (params != null) {
277
    if (params != null) {
278
		for (var key in params) {
278
        for (var key in params) {
279
			if (params.hasOwnProperty(key)) {
279
            if (params.hasOwnProperty(key)) {
280
				//console.log(key + " -> " + params[key]);
280
                //console.log(key + " -> " + params[key]);
281
				url = url + "&" + key + "=" + params[key];
281
                url = url + "&" + key + "=" + params[key];
282
			}
282
            }
283
		}
283
        }
284
	}
284
    }
285
 
285
 
286
	doGetAjaxRequestHandler(url, function(response) {
286
    doGetAjaxRequestHandler(url, function (response) {
287
		var size = $("#" + paginatedIdentifier + " .size").text();
287
        var size = $("#" + paginatedIdentifier + " .size").text();
288
		if ((parseInt(end) + 20) > parseInt(size)) {
288
        if ((parseInt(end) + 20) > parseInt(size)) {
289
			// console.log("(end + 10) > size == true");
289
            // console.log("(end + 10) > size == true");
290
			$("#" + paginatedIdentifier + " .end").text(size);
290
            $("#" + paginatedIdentifier + " .end").text(size);
291
		} else {
291
        } else {
292
			// console.log("(end + 10) > size == false");
292
            // console.log("(end + 10) > size == false");
293
			$("#" + paginatedIdentifier + " .end").text(+end + +20);
293
            $("#" + paginatedIdentifier + " .end").text(+end + +20);
294
		}
294
        }
295
		$("#" + paginatedIdentifier + " .start").text(+start + +20);
295
        $("#" + paginatedIdentifier + " .start").text(+start + +20);
296
		var last = $("#" + paginatedIdentifier + " .end").text();
296
        var last = $("#" + paginatedIdentifier + " .end").text();
297
		var temp = $("#" + paginatedIdentifier + " .size").text();
297
        var temp = $("#" + paginatedIdentifier + " .size").text();
298
		console.log("last" + last);
298
        console.log("last" + last);
299
		if (parseInt(last) >= parseInt(temp)) {
299
        if (parseInt(last) >= parseInt(temp)) {
300
			$("#" + paginatedIdentifier + " .next").prop('disabled', true);
300
            $("#" + paginatedIdentifier + " .next").prop('disabled', true);
301
			// $( "#good-inventory-paginated .end" ).text(temp);
301
            // $( "#good-inventory-paginated .end" ).text(temp);
302
		}
302
        }
303
		$('#' + tableIdentifier).html(response);
303
        $('#' + tableIdentifier).html(response);
304
		if (detailsContainerIdentifier != null) {
304
        if (detailsContainerIdentifier != null) {
305
			$('#' + detailsContainerIdentifier).html('');
305
            $('#' + detailsContainerIdentifier).html('');
306
		}
306
        }
307
		$("#" + paginatedIdentifier + " .previous").prop('disabled', false);
307
        $("#" + paginatedIdentifier + " .previous").prop('disabled', false);
308
	});
308
    });
309
 
309
 
310
}
310
}
311
 
311
 
312
function loadPaginatedCatalogPreviousItem(url, params, paginatedIdentifier,
312
function loadPaginatedCatalogPreviousItem(url, params, paginatedIdentifier,
313
	tableIdentifier, detailsContainerIdentifier) {
313
                                          tableIdentifier, detailsContainerIdentifier) {
314
	var start = $("#" + paginatedIdentifier + " .start").text();
314
    var start = $("#" + paginatedIdentifier + " .start").text();
315
	console.log("start" + start);
315
    console.log("start" + start);
316
	var end = $("#" + paginatedIdentifier + " .end").text();
316
    var end = $("#" + paginatedIdentifier + " .end").text();
317
	console.log("Startend" + end);
317
    console.log("Startend" + end);
318
	var size = $("#" + paginatedIdentifier + " .size").text();
318
    var size = $("#" + paginatedIdentifier + " .size").text();
319
	console.log("size" + size);
319
    console.log("size" + size);
320
	if (parseInt(end) == parseInt(size) && parseInt(end) % 20 != 0) {
320
    if (parseInt(end) == parseInt(size) && parseInt(end) % 20 != 0) {
321
		var mod = parseInt(end) % 20;
321
        var mod = parseInt(end) % 20;
322
		end = parseInt(end) + (20 - mod);
322
        end = parseInt(end) + (20 - mod);
323
	}
323
    }
324
	var pre = end - 20;
324
    var pre = end - 20;
325
	var lat = pre - 20;
325
    var lat = pre - 20;
326
	//console.log("preCatalog" +pre);
326
    //console.log("preCatalog" +pre);
327
 
327
 
328
	url = context + url + "?offset=" + pre;
328
    url = context + url + "?offset=" + pre;
329
 
329
 
330
	if (params != null) {
330
    if (params != null) {
331
		for (var key in params) {
331
        for (var key in params) {
332
			if (params.hasOwnProperty(key)) {
332
            if (params.hasOwnProperty(key)) {
333
				url = url + "&" + key + "=" + params[key];
333
                url = url + "&" + key + "=" + params[key];
334
			}
334
            }
335
		}
335
        }
336
	}
336
    }
337
 
337
 
338
	doGetAjaxRequestHandler(url, function(response) {
338
    doGetAjaxRequestHandler(url, function (response) {
339
		$("#" + paginatedIdentifier + " .end").text(+end - +20);
339
        $("#" + paginatedIdentifier + " .end").text(+end - +20);
340
		$("#" + paginatedIdentifier + " .start").text(+start - +20);
340
        $("#" + paginatedIdentifier + " .start").text(+start - +20);
341
		$('#' + tableIdentifier).html(response);
341
        $('#' + tableIdentifier).html(response);
342
		if (detailsContainerIdentifier != null) {
342
        if (detailsContainerIdentifier != null) {
343
			$('#' + detailsContainerIdentifier).html('');
343
            $('#' + detailsContainerIdentifier).html('');
344
		}
344
        }
345
		$("#" + paginatedIdentifier + " .next").prop('disabled', false);
345
        $("#" + paginatedIdentifier + " .next").prop('disabled', false);
346
		if (parseInt(lat) == 0) {
346
        if (parseInt(lat) == 0) {
347
			$("#" + paginatedIdentifier + " .previous").prop('disabled', true);
347
            $("#" + paginatedIdentifier + " .previous").prop('disabled', true);
348
		}
348
        }
349
	});
349
    });
350
 
350
 
351
}
351
}
352
 
352
 
353
function loadPaginatedNextItems(url, params, paginatedIdentifier,
353
function loadPaginatedNextItems(url, params, paginatedIdentifier,
354
	tableIdentifier, detailsContainerIdentifier) {
354
                                tableIdentifier, detailsContainerIdentifier) {
355
	var start = $("#" + paginatedIdentifier + " .start").text();
355
    var start = $("#" + paginatedIdentifier + " .start").text();
356
	var end = $("#" + paginatedIdentifier + " .end").text();
356
    var end = $("#" + paginatedIdentifier + " .end").text();
357
	url = context + url + "?offset=" + end;
357
    url = context + url + "?offset=" + end;
358
 
358
 
359
	if (params != null) {
359
    if (params != null) {
360
		for (var key in params) {
360
        for (var key in params) {
361
			if (params.hasOwnProperty(key)) {
361
            if (params.hasOwnProperty(key)) {
362
				// console.log(key + " -> " + p[key]);
362
                // console.log(key + " -> " + p[key]);
363
				url = url + "&" + key + "=" + params[key];
363
                url = url + "&" + key + "=" + params[key];
364
			}
364
            }
365
		}
365
        }
366
	}
366
    }
367
 
367
 
368
	doGetAjaxRequestHandler(url, function(response) {
368
    doGetAjaxRequestHandler(url, function (response) {
369
		var size = $("#" + paginatedIdentifier + " .size").text();
369
        var size = $("#" + paginatedIdentifier + " .size").text();
370
		if ((parseInt(end) + 10) > parseInt(size)) {
370
        if ((parseInt(end) + 10) > parseInt(size)) {
371
			console.log("(end + 10) > size == true");
371
            console.log("(end + 10) > size == true");
372
			$("#" + paginatedIdentifier + " .end").text(size);
372
            $("#" + paginatedIdentifier + " .end").text(size);
373
		} else {
373
        } else {
374
			console.log("(end + 10) > size == false");
374
            console.log("(end + 10) > size == false");
375
			$("#" + paginatedIdentifier + " .end").text(+end + +10);
375
            $("#" + paginatedIdentifier + " .end").text(+end + +10);
376
		}
376
        }
377
		$("#" + paginatedIdentifier + " .start").text(+start + +10);
377
        $("#" + paginatedIdentifier + " .start").text(+start + +10);
378
		var last = $("#" + paginatedIdentifier + " .end").text();
378
        var last = $("#" + paginatedIdentifier + " .end").text();
379
		var temp = $("#" + paginatedIdentifier + " .size").text();
379
        var temp = $("#" + paginatedIdentifier + " .size").text();
380
		if (parseInt(last) >= parseInt(temp)) {
380
        if (parseInt(last) >= parseInt(temp)) {
381
			$("#" + paginatedIdentifier + " .next").prop('disabled', true);
381
            $("#" + paginatedIdentifier + " .next").prop('disabled', true);
382
			// $( "#good-inventory-paginated .end" ).text(temp);
382
            // $( "#good-inventory-paginated .end" ).text(temp);
383
		}
383
        }
384
		$('#' + tableIdentifier).html(response);
384
        $('#' + tableIdentifier).html(response);
385
		if (detailsContainerIdentifier != null) {
385
        if (detailsContainerIdentifier != null) {
386
			$('#' + detailsContainerIdentifier).html('');
386
            $('#' + detailsContainerIdentifier).html('');
387
		}
387
        }
388
		$("#" + paginatedIdentifier + " .previous").prop('disabled', false);
388
        $("#" + paginatedIdentifier + " .previous").prop('disabled', false);
389
	});
389
    });
390
 
390
 
391
}
391
}
392
 
392
 
393
function loadPaginatedPreviousItems(url, params, paginatedIdentifier,
393
function loadPaginatedPreviousItems(url, params, paginatedIdentifier,
394
	tableIdentifier, detailsContainerIdentifier) {
394
                                    tableIdentifier, detailsContainerIdentifier) {
395
	var start = $("#" + paginatedIdentifier + " .start").text();
395
    var start = $("#" + paginatedIdentifier + " .start").text();
396
	var end = $("#" + paginatedIdentifier + " .end").text();
396
    var end = $("#" + paginatedIdentifier + " .end").text();
397
	var size = $("#" + paginatedIdentifier + " .size").text();
397
    var size = $("#" + paginatedIdentifier + " .size").text();
398
	if (parseInt(end) == parseInt(size) && parseInt(end) % 10 != 0) {
398
    if (parseInt(end) == parseInt(size) && parseInt(end) % 10 != 0) {
399
		var mod = parseInt(end) % 10;
399
        var mod = parseInt(end) % 10;
400
		end = parseInt(end) + (10 - mod);
400
        end = parseInt(end) + (10 - mod);
401
	}
401
    }
402
	var pre = end - 10;
402
    var pre = end - 10;
403
 
403
 
404
	url = context + url + "?offset=" + pre;
404
    url = context + url + "?offset=" + pre;
405
 
405
 
406
	if (params != null) {
406
    if (params != null) {
407
		for (var key in params) {
407
        for (var key in params) {
408
			if (params.hasOwnProperty(key)) {
408
            if (params.hasOwnProperty(key)) {
409
				url = url + "&" + key + "=" + params[key];
409
                url = url + "&" + key + "=" + params[key];
410
			}
410
            }
411
		}
411
        }
412
	}
412
    }
413
 
413
 
414
	doGetAjaxRequestHandler(url, function(response) {
414
    doGetAjaxRequestHandler(url, function (response) {
415
		$("#" + paginatedIdentifier + " .end").text(+end - +10);
415
        $("#" + paginatedIdentifier + " .end").text(+end - +10);
416
		$("#" + paginatedIdentifier + " .start").text(+start - +10);
416
        $("#" + paginatedIdentifier + " .start").text(+start - +10);
417
		$('#' + tableIdentifier).html(response);
417
        $('#' + tableIdentifier).html(response);
418
		if (detailsContainerIdentifier != null) {
418
        if (detailsContainerIdentifier != null) {
419
			$('#' + detailsContainerIdentifier).html('');
419
            $('#' + detailsContainerIdentifier).html('');
420
		}
420
        }
421
		$("#" + paginatedIdentifier + " .next").prop('disabled', false);
421
        $("#" + paginatedIdentifier + " .next").prop('disabled', false);
422
		if (parseInt(pre) == 0) {
422
        if (parseInt(pre) == 0) {
423
			$("#" + paginatedIdentifier + " .previous").prop('disabled', true);
423
            $("#" + paginatedIdentifier + " .previous").prop('disabled', true);
424
		}
424
        }
425
	});
425
    });
426
 
426
 
427
}
427
}
428
 
428
 
429
function numberToComma(x) {
429
function numberToComma(x) {
430
	if (isNaN(x)) {
430
    if (isNaN(x)) {
431
		x = x.replaceAll(",", '');
431
        x = x.replaceAll(",", '');
432
	}
432
    }
433
	x = parseFloat(x);
433
    x = parseFloat(x);
434
	x = Math.round(x * 100) / 100;
434
    x = Math.round(x * 100) / 100;
435
	x = x.toString();
435
    x = x.toString();
436
	x = x.split('.');
436
    x = x.split('.');
437
	var x1 = x[0];
437
    var x1 = x[0];
438
	var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
438
    var x2 = x.length > 1 && x[1] != '0' ? '.' + x[1] : '';
439
	var lastThree = x1.substring(x1.length - 3);
439
    var lastThree = x1.substring(x1.length - 3);
440
	var otherNumbers = x1.substring(0, x1.length - 3);
440
    var otherNumbers = x1.substring(0, x1.length - 3);
441
	if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
441
    if (x1.charAt(x1.length - 4) == ',' || x1.charAt(x1.length - 4) == '-') {
442
		console.log(lastThree)
442
        console.log(lastThree)
443
	} else {
443
    } else {
444
		if (otherNumbers != '')
444
        if (otherNumbers != '')
445
			lastThree = ',' + lastThree;
445
            lastThree = ',' + lastThree;
446
	}
446
    }
447
	return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
447
    return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + (lastThree)
448
		+ x2;
448
        + x2;
449
 
449
 
450
}
450
}
451
 
451
 
452
function getSingleDatePicker(startMoment) {
452
function getSingleDatePicker(startMoment) {
453
	var singleDatePicker = {
453
    var singleDatePicker = {
454
		"todayHighlight": true,
454
        "todayHighlight": true,
455
		"startDate": startMoment || moment(),
455
        "startDate": startMoment || moment(),
456
		"autoclose": true,
456
        "autoclose": true,
457
		"autoUpdateInput": true,
457
        "autoUpdateInput": true,
458
		"singleDatePicker": true,
458
        "singleDatePicker": true,
459
		"locale": {
459
        "locale": {
460
			'format': 'DD/MM/YYYY'
460
            'format': 'DD/MM/YYYY'
461
		}
461
        }
462
	};
462
    };
463
	return singleDatePicker;
463
    return singleDatePicker;
464
}
464
}
465
 
465
 
466
function getDatesFromPicker(pickerElement) {
466
function getDatesFromPicker(pickerElement) {
467
	return {
467
    return {
468
		startDate: $(pickerElement).data('daterangepicker').startDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS),
468
        startDate: $(pickerElement).data('daterangepicker').startDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS),
469
		endDate: $(pickerElement).data('daterangepicker').endDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS)
469
        endDate: $(pickerElement).data('daterangepicker').endDate.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS)
470
	}
470
    }
471
}
471
}
472
 
472
 
473
function getReporticoDatesFromPicker(pickerElement) {
473
function getReporticoDatesFromPicker(pickerElement) {
474
	let datePickerData = $(pickerElement).data('daterangepicker');
474
    let datePickerData = $(pickerElement).data('daterangepicker');
475
	let formattedEndDate = null;
475
    let formattedEndDate = null;
476
	if (typeof datePickerData.endDate == "object") {
476
    if (typeof datePickerData.endDate == "object") {
477
		formattedEndDate = datePickerData.endDate.format(moment.HTML5_FMT.DATE);
477
        formattedEndDate = datePickerData.endDate.format(moment.HTML5_FMT.DATE);
478
	}
478
    }
479
	return {
479
    return {
480
		startDate: datePickerData.startDate.format(moment.HTML5_FMT.DATE),
480
        startDate: datePickerData.startDate.format(moment.HTML5_FMT.DATE),
481
		endDate: formattedEndDate
481
        endDate: formattedEndDate
482
	};
482
    };
483
}
483
}
484
 
484
 
485
 
485
 
486
function getRangedDatePicker(showRanges, startMoment, endMoment) {
486
function getRangedDatePicker(showRanges, startMoment, endMoment) {
487
	if (typeof showRanges == "undefined") {
487
    if (typeof showRanges == "undefined") {
488
		showRanges = false;
488
        showRanges = false;
489
	}
489
    }
490
	var rangedDatePicker = {
490
    var rangedDatePicker = {
491
		"todayHighlight": true,
491
        "todayHighlight": true,
492
		"opens": "right",
492
        "opens": "right",
493
		"startDate": startMoment || moment().startOf('day'),
493
        "startDate": startMoment || moment().startOf('day'),
494
		"endDate": endMoment || moment().endOf('day'),
494
        "endDate": endMoment || moment().endOf('day'),
495
		"autoclose": true,
495
        "autoclose": true,
496
		"alwaysShowCalendars": false,
496
        "alwaysShowCalendars": false,
497
		"autoUpdateInput": true,
497
        "autoUpdateInput": true,
498
		"locale": {
498
        "locale": {
499
			'format': 'DD/MM/YYYY'
499
            'format': 'DD/MM/YYYY'
500
		}
500
        }
501
	};
501
    };
502
	if (showRanges) {
502
    if (showRanges) {
503
		rangedDatePicker['ranges'] = {
503
        rangedDatePicker['ranges'] = {
504
			'Today': [moment(), moment()],
504
            'Today': [moment(), moment()],
505
			'Yesterday': [moment().subtract(1, 'days'),
505
            'Yesterday': [moment().subtract(1, 'days'),
506
			moment().subtract(1, 'days')],
506
                moment().subtract(1, 'days')],
507
			'Last 7 Days': [moment().subtract(6, 'days'), moment()],
507
            'Last 7 Days': [moment().subtract(6, 'days'), moment()],
508
			'Last 30 Days': [moment().subtract(29, 'days'), moment()],
508
            'Last 30 Days': [moment().subtract(29, 'days'), moment()],
509
			'This Month': [moment().startOf('month'), moment().endOf('month')],
509
            'This Month': [moment().startOf('month'), moment().endOf('month')],
510
			'Last Month': [moment().subtract(1, 'month').startOf('month'),
510
            'Last Month': [moment().subtract(1, 'month').startOf('month'),
511
			moment()],
511
                moment()],
512
			'Last 3 Months': [moment().subtract(3, 'month').startOf('month'),
512
            'Last 3 Months': [moment().subtract(3, 'month').startOf('month'),
513
			moment()],
513
                moment()],
514
			'Last 6 Months': [moment().subtract(6, 'month').startOf('month'),
514
            'Last 6 Months': [moment().subtract(6, 'month').startOf('month'),
515
			moment()]
515
                moment()]
516
		}
516
        }
517
	}
517
    }
518
	return rangedDatePicker;
518
    return rangedDatePicker;
519
}
519
}
520
 
520
 
521
function showPosition(position) {
521
function showPosition(position) {
522
	if (typeof latitude == "undefined") {
522
    if (typeof latitude == "undefined") {
523
		var coords = {
523
        var coords = {
524
			latitude: position.coords.latitude,
524
            latitude: position.coords.latitude,
525
			longitude: position.coords.longitude
525
            longitude: position.coords.longitude
526
		}
526
        }
527
		doAjaxRequestWithJsonHandler('partner/location', 'PUT', JSON
527
        doAjaxRequestWithJsonHandler('partner/location', 'PUT', JSON
528
			.stringify(coords), function() {
528
            .stringify(coords), function () {
529
				latitude = position.coords.latitude;
529
            latitude = position.coords.latitude;
530
				longitude = position.coords.longitude;
530
            longitude = position.coords.longitude;
531
			});
531
        });
532
	}
532
    }
533
	// distance = getDistance(latitude, longitude, position.coords.latitude,
533
    // distance = getDistance(latitude, longitude, position.coords.latitude,
534
	// position.coords.longitude);
534
    // position.coords.longitude);
535
}
535
}
536
 
536
 
537
function getAuthorisedWarehouses(callback) {
537
function getAuthorisedWarehouses(callback) {
538
	bootBoxObj = {
538
    bootBoxObj = {
539
		size: "small",
539
        size: "small",
540
		title: "Choose Warehouse",
540
        title: "Choose Warehouse",
541
		callback: callback,
541
        callback: callback,
542
		inputType: 'select',
542
        inputType: 'select',
543
		inputOptions: typeof inputOptions == "undefined" ? undefined
543
        inputOptions: typeof inputOptions == "undefined" ? undefined
544
			: inputOptions
544
            : inputOptions
545
	}
545
    }
546
	if (typeof inputOptions == "undefined") {
546
    if (typeof inputOptions == "undefined") {
547
		doGetAjaxRequestHandler(context + "/authorisedWarehouses", function(
547
        doGetAjaxRequestHandler(context + "/authorisedWarehouses", function (
548
			response) {
548
            response) {
549
			response = JSON.parse(response);
549
            response = JSON.parse(response);
550
			inputOptions = [];
550
            inputOptions = [];
551
			response.forEach(function(warehouse) {
551
            response.forEach(function (warehouse) {
552
				inputOptions.push({
552
                inputOptions.push({
553
					text: warehouse.name,
553
                    text: warehouse.name,
554
					value: warehouse.id,
554
                    value: warehouse.id,
555
				});
555
                });
556
			});
556
            });
557
			bootBoxObj['inputOptions'] = inputOptions;
557
            bootBoxObj['inputOptions'] = inputOptions;
558
			bootbox.prompt(bootBoxObj);
558
            bootbox.prompt(bootBoxObj);
559
		});
559
        });
560
	} else if (inputOptions.length == 1) {
560
    } else if (inputOptions.length == 1) {
561
		callback(inputOptions[0].warehouse.id);
561
        callback(inputOptions[0].warehouse.id);
562
	} else {
562
    } else {
563
		bootbox.prompt(bootBoxObj);
563
        bootbox.prompt(bootBoxObj);
564
	}
564
    }
565
 
565
 
566
}
566
}
567
 
567
 
568
function getColorsForItems(catalogId, itemId, description, callback) {
568
function getColorsForItems(catalogId, itemId, description, callback) {
569
	colorCheckboxHandler(catalogId, itemId, description, callback);
569
    colorCheckboxHandler(catalogId, itemId, description, callback);
570
}
570
}
571
 
571
 
572
function colorNumberHandler(catalogId, itemId, title, actionText, callback) {
572
function colorNumberHandler(catalogId, itemId, title, actionText, callback) {
573
	doGetAjaxRequestHandler(context + "/itemsByCatalogId?catalogId="
573
    doGetAjaxRequestHandler(context + "/itemsByCatalogId?catalogId="
574
		+ catalogId + "&itemId=" + itemId, function(response) {
574
        + catalogId + "&itemId=" + itemId, function (response) {
575
			let coloredItems = JSON.parse(response);
575
        let coloredItems = JSON.parse(response);
576
			let modalBody = [];
576
        let modalBody = [];
577
			coloredItems.forEach(function(item) {
577
        coloredItems.forEach(function (item) {
578
				modalBody.push(`
578
            modalBody.push(`
579
                <div class="row">
579
                <div class="row">
580
                    <div class="col-sm-2">
580
                    <div class="col-sm-2">
581
                        ${item.color}
581
                        ${item.color}
582
                    </div>
582
                    </div>
583
                    <div class="col-sm-2">
583
                    <div class="col-sm-2">
584
                            <input data-itemid="${item.id}" type="text" class="form-control" />
584
                            <input data-itemid="${item.id}" type="text" class="form-control" />
585
                    </div>
585
                    </div>
586
                </div>
586
                </div>
587
            `);
587
            `);
588
			});
588
        });
589
			let dialogBoxHtml = `<div class="modal modal" tabindex="-1" role="dialog">
589
        let dialogBoxHtml = `<div class="modal modal" tabindex="-1" role="dialog">
590
                              <div class="modal-dialog" >
590
                              <div class="modal-dialog" >
591
                                <div class="modal-content">
591
                                <div class="modal-content">
592
                                  <div class="modal-header">
592
                                  <div class="modal-header">
593
                                    <h5 class="modal-title">${title}</h5>
593
                                    <h5 class="modal-title">${title}</h5>
594
                                  </div>
594
                                  </div>
Line 599... Line 599...
599
                                    <button type="button" class="btn btn-primary number_dialog">${actionText}</button>
599
                                    <button type="button" class="btn btn-primary number_dialog">${actionText}</button>
600
                                  </div>
600
                                  </div>
601
                                </div>
601
                                </div>
602
                              </div>
602
                              </div>
603
                            </div>`;
603
                            </div>`;
604
			let $dialog = $(dialogBoxHtml);
604
        let $dialog = $(dialogBoxHtml);
605
			let modalObj = $dialog.modal('show');
605
        let modalObj = $dialog.modal('show');
606
			modalObj.on('hidden.bs.modal', function(e) {
606
        modalObj.on('hidden.bs.modal', function (e) {
607
				$dialog.remove();
607
            $dialog.remove();
608
			});
608
        });
609
			$('button.number_dialog').on('click', function() {
609
        $('button.number_dialog').on('click', function () {
610
				let itemQty = [];
610
            let itemQty = [];
611
				let anySelected = false;
611
            let anySelected = false;
612
				$(modalObj).find('.modal-body').find('input').each(function() {
612
            $(modalObj).find('.modal-body').find('input').each(function () {
613
					$input = $(this);
613
                $input = $(this);
614
					if ($input.val() > 0) {
614
                if ($input.val() > 0) {
615
						itemQty.push({
615
                    itemQty.push({
616
							itemId: $input.data("itemid"),
616
                        itemId: $input.data("itemid"),
617
							quantity: $input.val()
617
                        quantity: $input.val()
618
						});
618
                    });
619
						anySelected = true;
619
                    anySelected = true;
620
					}
620
                }
621
				});
621
            });
622
				if (anySelected && confirm("Are you sure want to notify?")) {
622
            if (anySelected && confirm("Are you sure want to notify?")) {
623
					$that = $(this);
623
                $that = $(this);
624
					callback(itemQty, function() {
624
                callback(itemQty, function () {
625
						$that.off('click');
625
                    $that.off('click');
626
						modalObj.hide();
626
                    modalObj.hide();
627
					});
627
                });
628
				} else {
628
            } else {
629
					alert("Pls mention quantity");
629
                alert("Pls mention quantity");
630
				}
630
            }
631
			});
631
        });
632
		});
632
    });
633
}
633
}
634
 
634
 
635
 
635
 
636
function colorCheckboxHandler(catalogId, itemId, description, callback) {
636
function colorCheckboxHandler(catalogId, itemId, description, callback) {
637
	let bootBoxObj = {
637
    let bootBoxObj = {
638
		size: "small",
638
        size: "small",
639
		className: "item-wrapper",
639
        className: "item-wrapper",
640
		title: description,
640
        title: description,
641
		callback: callback,
641
        callback: callback,
642
		inputType: 'checkbox',
642
        inputType: 'checkbox',
643
	}
643
    }
644
	doGetAjaxRequestHandler(context + "/itemsByCatalogId?catalogId="
644
    doGetAjaxRequestHandler(context + "/itemsByCatalogId?catalogId="
645
		+ catalogId + "&itemId=" + itemId, function(response) {
645
        + catalogId + "&itemId=" + itemId, function (response) {
646
			coloredItems = JSON.parse(response);
646
        coloredItems = JSON.parse(response);
647
			inputOptions = [{
647
        inputOptions = [{
648
				text: "All",
648
            text: "All",
649
				value: "0",
649
            value: "0",
650
				onclick: "toggleAll('itemIds')"
650
            onclick: "toggleAll('itemIds')"
651
			}];
651
        }];
652
			coloredItems.forEach(function(item) {
652
        coloredItems.forEach(function (item) {
653
				inputOptions.push({
653
            inputOptions.push({
654
					text: item.color,
654
                text: item.color,
655
					value: item.id,
655
                value: item.id,
656
					selected: item.active
656
                selected: item.active
657
				});
657
            });
658
			});
658
        });
659
			bootBoxObj['inputOptions'] = inputOptions;
659
        bootBoxObj['inputOptions'] = inputOptions;
660
			promptObj = bootbox.prompt(bootBoxObj);
660
        promptObj = bootbox.prompt(bootBoxObj);
661
			promptObj.modal('show')
661
        promptObj.modal('show')
662
			$('.item-wrapper').find("input[type='checkbox']").slice(1).each(
662
        $('.item-wrapper').find("input[type='checkbox']").slice(1).each(
663
				function(index, checkbox) {
663
            function (index, checkbox) {
664
					checkbox.checked = coloredItems[index].active;
664
                checkbox.checked = coloredItems[index].active;
665
				});
665
            });
666
		});
666
    });
667
}
667
}
668
 
668
 
669
function getHotdealsForItems(catalogId, itemId, description, callback) {
669
function getHotdealsForItems(catalogId, itemId, description, callback) {
670
	bootBoxObj = {
670
    bootBoxObj = {
671
		size: "small",
671
        size: "small",
672
		className: "item-wrapper",
672
        className: "item-wrapper",
673
		title: description,
673
        title: description,
674
		callback: callback,
674
        callback: callback,
675
		inputType: 'checkbox',
675
        inputType: 'checkbox',
676
	}
676
    }
677
	doGetAjaxRequestHandler(context + "/hotdealsitemsByCatalogId?catalogId="
677
    doGetAjaxRequestHandler(context + "/hotdealsitemsByCatalogId?catalogId="
678
		+ catalogId + "&itemId=" + itemId, function(response) {
678
        + catalogId + "&itemId=" + itemId, function (response) {
679
			coloredItems = JSON.parse(response);
679
        coloredItems = JSON.parse(response);
680
			inputOptions = [{
680
        inputOptions = [{
681
				text: "All",
681
            text: "All",
682
				value: "0",
682
            value: "0",
683
				onclick: "toggleAll('itemIds')"
683
            onclick: "toggleAll('itemIds')"
684
			}];
684
        }];
685
			coloredItems.forEach(function(item) {
685
        coloredItems.forEach(function (item) {
686
				inputOptions.push({
686
            inputOptions.push({
687
					text: item.color,
687
                text: item.color,
688
					value: item.id,
688
                value: item.id,
689
					selected: item.hotDeals
689
                selected: item.hotDeals
690
				});
690
            });
691
			});
691
        });
692
			bootBoxObj['inputOptions'] = inputOptions;
692
        bootBoxObj['inputOptions'] = inputOptions;
693
			promptObj = bootbox.prompt(bootBoxObj);
693
        promptObj = bootbox.prompt(bootBoxObj);
694
			promptObj.modal('show')
694
        promptObj.modal('show')
695
			$('.item-wrapper').find("input[type='checkbox']").slice(1).each(
695
        $('.item-wrapper').find("input[type='checkbox']").slice(1).each(
696
				function(index, checkbox) {
696
            function (index, checkbox) {
697
					checkbox.checked = coloredItems[index].hotDeals;
697
                checkbox.checked = coloredItems[index].hotDeals;
698
				});
698
            });
699
		});
699
    });
700
}
700
}
701
 
701
 
702
$(document).on('change', ".item-wrapper input[type='checkbox']:first",
702
$(document).on('change', ".item-wrapper input[type='checkbox']:first",
703
	function() {
703
    function () {
704
		if (this.value == "0") {
704
        if (this.value == "0") {
705
			$(this).closest('.item-wrapper').find("input[type='checkbox']")
705
            $(this).closest('.item-wrapper').find("input[type='checkbox']")
706
				.slice(1).prop('checked', $(this).prop('checked'));
706
                .slice(1).prop('checked', $(this).prop('checked'));
707
		}
707
        }
708
	});
708
    });
709
 
709
 
710
function getItemAheadOptions(jqElement, anyColor, callback) {
710
function getItemAheadOptions(jqElement, anyColor, callback) {
711
	console.log(anyColor)
711
    console.log(anyColor)
712
	jqElement.typeahead('destroy').typeahead({
712
    jqElement.typeahead('destroy').typeahead({
713
		source: function(q, process) {
713
        source: function (q, process) {
714
			if (q.length >= 3) {
714
            if (q.length >= 3) {
715
				return $.ajax(context + "/item?anyColor=" + anyColor, {
715
                return $.ajax(context + "/item?anyColor=" + anyColor, {
716
					global: false,
716
                    global: false,
717
					data: {
717
                    data: {
718
						query: q
718
                        query: q
719
					},
719
                    },
720
					success: function(data) {
720
                    success: function (data) {
721
						queryData = JSON.parse(data);
721
                        queryData = JSON.parse(data);
722
						process(queryData);
722
                        process(queryData);
723
					},
723
                    },
724
				});
724
                });
725
			}
725
            }
726
		},
726
        },
727
		delay: 300,
727
        delay: 300,
728
		items: 20,
728
        items: 20,
729
		displayText: function(item) {
729
        displayText: function (item) {
730
			return item.itemDescription;
730
            return item.itemDescription;
731
		},
731
        },
732
		autoSelect: true,
732
        autoSelect: true,
733
		afterSelect: callback
733
        afterSelect: callback
734
	});
734
    });
735
}
735
}
736
 
736
 
737
 
737
 
738
 
-
 
739
function getVendorItemAheadOptions(jqElement, vendorId, callback) {
738
function getVendorItemAheadOptions(jqElement, vendorId, callback) {
740
	jqElement.typeahead('destroy').typeahead({
739
    jqElement.typeahead('destroy').typeahead({
741
		source: function(q, process) {
740
        source: function (q, process) {
742
			if (q.length >= 3) {
741
            if (q.length >= 3) {
743
				return $.ajax(context + "/vendorItem?vendorId=" + vendorId, {
742
                return $.ajax(context + "/vendorItem?vendorId=" + vendorId, {
744
					global: false,
743
                    global: false,
745
					data: {
744
                    data: {
746
						query: q
745
                        query: q
747
					},
746
                    },
748
					success: function(data) {
747
                    success: function (data) {
749
						queryData = JSON.parse(data);
748
                        queryData = JSON.parse(data);
750
						process(queryData);
749
                        process(queryData);
751
					},
750
                    },
752
				});
751
                });
753
			}
752
            }
754
		},
753
        },
755
		delay: 300,
754
        delay: 300,
756
		items: 20,
755
        items: 20,
757
		displayText: function(item) {
756
        displayText: function (item) {
758
			return item.itemDescription;
757
            return item.itemDescription;
759
		},
758
        },
760
		autoSelect: true,
759
        autoSelect: true,
761
		afterSelect: callback
760
        afterSelect: callback
762
	});
761
    });
763
}
762
}
764
 
763
 
765
function getImeiAheadOptions(jqElement, fofoId, callback) {
764
function getImeiAheadOptions(jqElement, fofoId, callback) {
766
	jqElement.typeahead('destroy').typeahead({
765
    jqElement.typeahead('destroy').typeahead({
767
		source: function(q, process) {
766
            source: function (q, process) {
768
			if (q.length >= 3) {
767
                if (q.length >= 3) {
769
				return $.ajax(context + "/imei?fofoId=" + fofoId, {
768
                    return $.ajax(context + "/imei?fofoId=" + fofoId, {
770
					global: false,
769
                        global: false,
771
					data: {
770
                        data: {
772
						query: q
771
                            query: q
773
					},
772
                        },
774
					success: function(data) {
773
                        success: function (data) {
775
						queryData = JSON.parse(data);
774
                            queryData = JSON.parse(data);
776
						process(queryData);
775
                            process(queryData);
777
					},
776
                        },
778
				});
777
                    });
779
			}
778
                }
780
		},
779
            },
781
		delay: 300,
780
            delay: 300,
782
		items: 20,
781
            items: 20,
783
		displayText: function(imei) {
782
            displayText: function (imei) {
784
			return imei;
783
                return imei;
785
		},
784
            },
786
		autoSelect: true,
785
            autoSelect: true,
787
		afterSelect: callback
786
            afterSelect: callback
788
	}
787
        }
789
 
-
 
790
	);
788
    );
791
}
789
}
792
 
790
 
793
 
791
 
794
 
-
 
795
 
-
 
796
function getAllImeiAheadOptions(jqElement, callback) {
792
function getAllImeiAheadOptions(jqElement, callback) {
797
	jqElement.typeahead('destroy').typeahead({
793
    jqElement.typeahead('destroy').typeahead({
798
		source: function(q, process) {
794
        source: function (q, process) {
799
			if (q.length >= 3) {
795
            if (q.length >= 3) {
800
				return $.ajax(context + "/allimei", {
796
                return $.ajax(context + "/allimei", {
801
					global: false,
797
                    global: false,
802
					data: {
798
                    data: {
803
						query: q
799
                        query: q
804
					},
800
                    },
805
					success: function(data) {
801
                    success: function (data) {
806
						queryData = JSON.parse(data);
802
                        queryData = JSON.parse(data);
807
						process(queryData);
803
                        process(queryData);
808
					},
804
                    },
809
				});
805
                });
810
			}
806
            }
811
		},
807
        },
812
		delay: 300,
808
        delay: 300,
813
		items: 20,
809
        items: 20,
814
		displayText: function(imei) {
810
        displayText: function (imei) {
815
			return imei;
811
            return imei;
816
		},
812
        },
817
		autoSelect: true,
813
        autoSelect: true,
818
		afterSelect: callback
814
        afterSelect: callback
819
	});
815
    });
820
}
816
}
821
 
817
 
822
 
818
 
823
function getEntityAheadOptions(jqElement, callback) {
819
function getEntityAheadOptions(jqElement, callback) {
824
	jqElement.typeahead('destroy').typeahead({
820
    jqElement.typeahead('destroy').typeahead({
825
		source: function(q, process) {
821
        source: function (q, process) {
826
			if (q.length >= 3) {
822
            if (q.length >= 3) {
827
				return $.ajax(context + "/entity", {
823
                return $.ajax(context + "/entity", {
828
					global: false,
824
                    global: false,
829
					data: {
825
                    data: {
830
						query: q
826
                        query: q
831
					},
827
                    },
832
					success: function(data) {
828
                    success: function (data) {
833
						queryData = JSON.parse(data);
829
                        queryData = JSON.parse(data);
834
						process(queryData);
830
                        process(queryData);
835
					},
831
                    },
836
				});
832
                });
837
			}
833
            }
838
		},
834
        },
839
		delay: 300,
835
        delay: 300,
840
		items: 30,
836
        items: 30,
841
		displayText: function(entity) {
837
        displayText: function (entity) {
842
			return entity.title_s + "(" + entity.catalogId_i + ")";
838
            return entity.title_s + "(" + entity.catalogId_i + ")";
843
		},
839
        },
844
		autoSelect: true,
840
        autoSelect: true,
845
		afterSelect: callback
841
        afterSelect: callback
846
	});
842
    });
847
}
843
}
848
 
844
 
849
function getPartnerAheadOptions(jqElement, callback) {
845
function getPartnerAheadOptions(jqElement, callback) {
850
	jqElement.typeahead('destroy').typeahead({
846
    jqElement.typeahead('destroy').typeahead({
851
		source: function(q, process) {
847
        source: function (q, process) {
852
			if (q.length >= 3) {
848
            if (q.length >= 3) {
853
				return $.ajax(context + "/partners", {
849
                return $.ajax(context + "/partners", {
854
					global: false,
850
                    global: false,
855
					data: {
851
                    data: {
856
						query: q
852
                        query: q
857
					},
853
                    },
858
					success: function(data) {
854
                    success: function (data) {
859
						queryData = JSON.parse(data);
855
                        queryData = JSON.parse(data);
860
						process(queryData);
856
                        process(queryData);
861
					},
857
                    },
862
				});
858
                });
863
			}
859
            }
864
		},
860
        },
865
		delay: 300,
861
        delay: 300,
866
		items: 20,
862
        items: 20,
867
		displayText: function(partner) {
863
        displayText: function (partner) {
868
			return partner.displayName;
864
            return partner.displayName;
869
		},
865
        },
870
		autoSelect: true,
866
        autoSelect: true,
871
		afterSelect: callback
867
        afterSelect: callback
872
	});
868
    });
873
}
869
}
874
 
870
 
875
function getVendorAheadOptions(jqElement, callback) {
871
function getVendorAheadOptions(jqElement, callback) {
876
	jqElement.typeahead('destroy').typeahead({
872
    jqElement.typeahead('destroy').typeahead({
877
		source: function(q, process) {
873
        source: function (q, process) {
878
			if (q.length >= 3) {
874
            if (q.length >= 3) {
879
				return $.ajax(context + "/vendors", {
875
                return $.ajax(context + "/vendors", {
880
					global: false,
876
                    global: false,
881
					data: {
877
                    data: {
882
						query: q
878
                        query: q
883
					},
879
                    },
884
					success: function(data) {
880
                    success: function (data) {
885
						queryData = JSON.parse(data);
881
                        queryData = JSON.parse(data);
886
						process(queryData);
882
                        process(queryData);
887
					},
883
                    },
888
				});
884
                });
889
			}
885
            }
890
		},
886
        },
891
		delay: 300,
887
        delay: 300,
892
		items: 20,
888
        items: 20,
893
		displayText: function(vendor) {
889
        displayText: function (vendor) {
894
			return vendor.name;
890
            return vendor.name;
895
		},
891
        },
896
		autoSelect: true,
892
        autoSelect: true,
897
		afterSelect: callback
893
        afterSelect: callback
898
	});
894
    });
899
}
895
}
900
 
896
 
901
function loadPriceDrop(domId) {
897
function loadPriceDrop(domId) {
902
	doGetAjaxRequestHandler(context + "/getItemDescription",
898
    doGetAjaxRequestHandler(context + "/getItemDescription",
903
		function(response) {
899
        function (response) {
904
			$('#' + domId).html(response);
900
            $('#' + domId).html(response);
905
		});
901
        });
906
}
902
}
907
 
903
 
908
$(document).on('click', ".price_drop", function() {
904
$(document).on('click', ".price_drop", function () {
909
	loadPriceDrop("main-content");
905
    loadPriceDrop("main-content");
910
});
906
});
911
 
907
 
912
 
908
 
913
$(document).on('click', ".closed_pricedrop", function() {
909
$(document).on('click', ".closed_pricedrop", function () {
914
	loadClosedPriceDrop("main-content");
910
    loadClosedPriceDrop("main-content");
915
});
911
});
916
 
912
 
917
function loadClosedPriceDrop(domId) {
913
function loadClosedPriceDrop(domId) {
918
	doGetAjaxRequestHandler(context + "/getClosedPricedropItemDescription",
914
    doGetAjaxRequestHandler(context + "/getClosedPricedropItemDescription",
919
		function(response) {
915
        function (response) {
920
			$('#' + domId).html(response);
916
            $('#' + domId).html(response);
921
		});
917
        });
922
}
918
}
923
 
919
 
924
function notifyTypeChange(messageType, $container) {
920
function notifyTypeChange(messageType, $container) {
925
	var messageQueryString = "?messageType=" + messageType;
921
    var messageQueryString = "?messageType=" + messageType;
926
	if (messageType == null) {
922
    if (messageType == null) {
927
		messageQueryString = "";
923
        messageQueryString = "";
928
	}
924
    }
929
	doGetAjaxRequestHandler(context + "/notifications" + messageQueryString, function(response) {
925
    doGetAjaxRequestHandler(context + "/notifications" + messageQueryString, function (response) {
930
		if ($container != null) {
926
        if ($container != null) {
931
			loaderDialogObj.one('hidden.bs.modal', function() {
927
            loaderDialogObj.one('hidden.bs.modal', function () {
932
				$container.popover({
928
                $container.popover({
933
					container: $container,
929
                    container: $container,
934
					template: '<div class="popover popover1" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content popover2"></div></div>',
930
                    template: '<div class="popover popover1" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content popover2"></div></div>',
935
					content: response,
931
                    content: response,
936
					html: true,
932
                    html: true,
937
					placement: "bottom",
933
                    placement: "bottom",
938
					trigger: "manual",
934
                    trigger: "manual",
939
					sanitize: false
935
                    sanitize: false
940
				}).popover('show');
936
                }).popover('show');
941
				setTimeout(function() {
937
                setTimeout(function () {
942
					$container.focus().one('blur', function() {
938
                    $container.focus().one('blur', function () {
943
						$container.popover('destroy');
939
                        $container.popover('destroy');
944
					});
940
                    });
945
				}, 100);
941
                }, 100);
946
			});
942
            });
947
		}
943
        }
948
	});
944
    });
949
}
945
}
950
 
946
 
951
function downloadNotifyDocument(documentId, cid, documentName) {
947
function downloadNotifyDocument(documentId, cid, documentName) {
952
	doAjaxGetDownload(context + "/notifyDocument/download?cid=" + cid,
948
    doAjaxGetDownload(context + "/notifyDocument/download?cid=" + cid,
953
		documentName);
949
        documentName);
954
}
950
}
955
 
951
 
956
 
952
 
957
/* Create an array with the values of all the input boxes in a column */
953
/* Create an array with the values of all the input boxes in a column */
958
$.fn.dataTable.ext.order['dom-text'] = function(settings, col) {
954
$.fn.dataTable.ext.order['dom-text'] = function (settings, col) {
959
	return this.api().column(col, { order: 'index' }).nodes().map(function(td, i) {
955
    return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
960
		return $('input', td).val();
956
        return $('input', td).val();
961
	});
957
    });
962
}
958
}
963
 
959
 
964
/* Create an array with the values of all the input boxes in a column, parsed as numbers */
960
/* Create an array with the values of all the input boxes in a column, parsed as numbers */
965
$.fn.dataTable.ext.order['dom-text-numeric'] = function(settings, col) {
961
$.fn.dataTable.ext.order['dom-text-numeric'] = function (settings, col) {
966
	return this.api().column(col, { order: 'index' }).nodes().map(function(td, i) {
962
    return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
967
		return $('input', td).val() * 1;
963
        return $('input', td).val() * 1;
968
	});
964
    });
969
}
965
}
970
 
966
 
971
$.fn.dataTable.ext.order['dom-stock-numeric'] = function(settings, col) {
967
$.fn.dataTable.ext.order['dom-stock-numeric'] = function (settings, col) {
972
	return this.api().column(col, { order: 'index' }).nodes().map(function(td, i) {
968
    return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
973
		return $(td).html().split("/")[0] * 1;
969
        return $(td).html().split("/")[0] * 1;
974
	});
970
    });
975
}
971
}
976
/* Create an array with the values of all the select options in a column */
972
/* Create an array with the values of all the select options in a column */
977
$.fn.dataTable.ext.order['dom-select'] = function(settings, col) {
973
$.fn.dataTable.ext.order['dom-select'] = function (settings, col) {
978
	return this.api().column(col, { order: 'index' }).nodes().map(function(td, i) {
974
    return this.api().column(col, {order: 'index'}).nodes().map(function (td, i) {
979
		return $('select', td).val();
975
        return $('select', td).val();
980
	});
976
    });
981
}
977
}
982
 
978
 
983
/* Create an array with the values of all the checkboxes in a column */
979
/* Create an array with the values of all the checkboxes in a column */
984
$.fn.dataTable.ext.order['dom-checkbox'] = function(settings, col) {
980
$.fn.dataTable.ext.order['dom-checkbox'] = function (settings, col) {
985
	return this.api().column(col, {
981
    return this.api().column(col, {
986
		order: 'index'
982
        order: 'index'
987
	}).nodes().map(function(td, i) {
983
    }).nodes().map(function (td, i) {
988
		return $('input', td).prop('checked') ? '1' : '0';
984
        return $('input', td).prop('checked') ? '1' : '0';
989
	});
985
    });
990
}
986
}
991
 
987
 
992
$.fn.dataTable.Api.register('sum()', function() {
988
$.fn.dataTable.Api.register('sum()', function () {
993
	return this.flatten().reduce(function(a, b) {
989
    return this.flatten().reduce(function (a, b) {
994
		if (typeof a === 'string') {
990
        if (typeof a === 'string') {
995
			a = a.replace(/[^\d.-]/g, '') * 1;
991
            a = a.replace(/[^\d.-]/g, '') * 1;
996
			a = isNaN(a) ? 0 : a;
992
            a = isNaN(a) ? 0 : a;
997
		}
993
        }
998
		if (typeof b === 'string') {
994
        if (typeof b === 'string') {
999
			b = b.replace(/[^\d.-]/g, '') * 1;
995
            b = b.replace(/[^\d.-]/g, '') * 1;
1000
			b = isNaN(b) ? 0 : b;
996
            b = isNaN(b) ? 0 : b;
1001
		}
997
        }
1002
 
998
 
1003
		return a + b;
999
        return a + b;
1004
	}, 0);
1000
    }, 0);
1005
});
1001
});
1006
 
1002
 
1007
const debounce = (func, delay) => {
1003
const debounce = (func, delay) => {
1008
	let debounceTimer
1004
    let debounceTimer
1009
	return function() {
1005
    return function () {
1010
		const context = this
1006
        const context = this
1011
		const args = arguments
1007
        const args = arguments
1012
		clearTimeout(debounceTimer)
1008
        clearTimeout(debounceTimer)
1013
		debounceTimer
1009
        debounceTimer
1014
			= setTimeout(() => func.apply(context, args), delay)
1010
            = setTimeout(() => func.apply(context, args), delay)
1015
	}
1011
    }
1016
}
1012
}
1017
 
1013
 
-
 
1014
function parseDate(str) {
-
 
1015
    var m = str.match(/^(\d{1,2})[-/](\d{1,2})[-/](\d{4})$/);
-
 
1016
    return (m) ? new Date(m[3], m[2] - 1, m[1]) : null;
-
 
1017
}
1018
 
1018
 
1019
function ExportToExcel(container, fn) {
1019
function ExportToExcel(container, fn) {
1020
	let tableId = $(container).data('tableid');
1020
    let tableId = $(container).data('tableid');
1021
	var elt = document.getElementById(tableId);
1021
    var elt = document.getElementById(tableId);
1022
	if ($.fn.DataTable.isDataTable(`#${tableId}`)) {
1022
    if ($.fn.DataTable.isDataTable(`#${tableId}`)) {
1023
		elt = $(`#${tableId}`).DataTable().table(0).container();
1023
        elt = $(`#${tableId}`).DataTable().table(0).container();
-
 
1024
    }
-
 
1025
    ExportTableToExcel(elt, fn);
1024
	}
1026
}
-
 
1027
 
-
 
1028
function ExportTableToExcel(tableElt, fn) {
-
 
1029
    $table = $(tableElt)
-
 
1030
    $table.find('td').each((index, value) => {
-
 
1031
        let $tdElement = $(value);
-
 
1032
        console.log($tdElement);
-
 
1033
        let parsedDate = parseDate($tdElement.html());
-
 
1034
        if (parsedDate != null) {
-
 
1035
            let days = Math.floor(parsedDate.getTime() / 86400 * 1000);
-
 
1036
            $tdElement.data('v', days);
-
 
1037
            $tdElement.data("t", "n");
-
 
1038
            $tdElement.data("z", "yyyy-mm-dd");
-
 
1039
        }
-
 
1040
    });
-
 
1041
    console.log($table.get(0))
1025
	var wb = XLSX.utils.table_to_book(elt, { sheet: "sheet1" });
1042
    var wb = XLSX.utils.table_to_book($table.get(0), {sheet: "sheet1"});
1026
	XLSX.writeFile(wb, fn + '.xlsx');
1043
    XLSX.writeFile(wb, fn + '.xlsx');
1027
}
1044
}
1028
 
1045
 
1029
 
1046
 
1030
$(document).on('click', ".manage-pcm", function() {
1047
$(document).on('click', ".manage-pcm", function () {
1031
	managePCM();
1048
    managePCM();
1032
});
1049
});
1033
 
1050
 
1034
function managePCM() {
1051
function managePCM() {
1035
	doGetAjaxRequestHandler(`${context}/brand-pcm`, function(response) {
1052
    doGetAjaxRequestHandler(`${context}/brand-pcm`, function (response) {
1036
		$('#main-content').html(response);
1053
        $('#main-content').html(response);
1037
	});
1054
    });
1038
}
1055
}
1039
 
1056
 
1040
 
1057
 
-
 
1058
$(document).on('click', ".digify-retailer-login", function () {
1041
 
1059
 
1042
$(document).on('click', ".digify-retailer-login", function() {
-
 
1043
 
-
 
1044
	doGetAjaxRequestHandler(context + "/digify/register", function(response) {
1060
    doGetAjaxRequestHandler(context + "/digify/register", function (response) {
1045
 
1061
 
1046
 
1062
 
1047
		$('#main-content').html(response);
1063
        $('#main-content').html(response);
1048
 
1064
 
1049
	});
1065
    });
1050
	//$('#main-content').html(`<iframe class="wrapper" src="${context}/digify/register" style="width:100%;height:100vh"> </iframe>`);
1066
    //$('#main-content').html(`<iframe class="wrapper" src="${context}/digify/register" style="width:100%;height:100vh"> </iframe>`);
1051
	//$('#main-content').html(`<a class="wrapper" href="${context}/digify/register" target="_blank" style="width:100%;height:100vh"> </a>`);
1067
    //$('#main-content').html(`<a class="wrapper" href="${context}/digify/register" target="_blank" style="width:100%;height:100vh"> </a>`);
1052
 
1068
 
1053
});
1069
});
1054
 
1070
 
1055
$(document).on('click', '.warehousewise_stock', function() {
1071
$(document).on('click', '.warehousewise_stock', function () {
1056
	doGetAjaxRequestHandler(`${context}/warehouse/stock-qty`, function(response) {
1072
    doGetAjaxRequestHandler(`${context}/warehouse/stock-qty`, function (response) {
1057
		$('#main-content').html(response);
1073
        $('#main-content').html(response);
1058
	});
1074
    });
1059
});
1075
});
1060
 
1076
 
1061
 
1077
 
1062
 
1078
 
1063
 
1079