| 22956 |
ashik.ali |
1 |
function badRequestAlert(response){
|
|
|
2 |
console.log(response.responseText);
|
|
|
3 |
var errorObject = JSON.parse(response.responseText);
|
|
|
4 |
errorObject = errorObject.response;
|
|
|
5 |
alert('Bad Request\n'+
|
|
|
6 |
'rejectedType : '+errorObject.rejectedType+'\n'+
|
|
|
7 |
'rejectedValue : '+errorObject.rejectedValue+'\n'+
|
|
|
8 |
'message : '+errorObject.message);
|
|
|
9 |
}
|
| 23347 |
ashik.ali |
10 |
|
| 22956 |
ashik.ali |
11 |
function internalServerErrorAlert(response){
|
|
|
12 |
console.log(response.responseText);
|
|
|
13 |
var errorObject = JSON.parse(response.responseText);
|
|
|
14 |
errorObject = errorObject.response;
|
|
|
15 |
alert('Internal Server Error\n'+
|
|
|
16 |
'rejectedType : '+errorObject.rejectedType+'\n'+
|
|
|
17 |
'rejectedValue : '+errorObject.rejectedValue+'\n'+
|
|
|
18 |
'message : '+errorObject.message);
|
|
|
19 |
}
|
|
|
20 |
|
|
|
21 |
$( document ).ajaxError(function(event, jqxhr, settings, thrownError) {
|
| 23872 |
amit.gupta |
22 |
// $( ".log" ).text( "Triggered ajaxError handler." );
|
| 23946 |
amit.gupta |
23 |
loaderDialogObj.modal('hide');
|
| 22956 |
ashik.ali |
24 |
if(jqxhr.status == 400){
|
| 23872 |
amit.gupta |
25 |
// $('#error-prompt-model').modal();
|
| 22956 |
ashik.ali |
26 |
badRequestAlert(jqxhr);
|
|
|
27 |
}else{
|
|
|
28 |
internalServerErrorAlert(jqxhr);
|
|
|
29 |
}
|
|
|
30 |
});
|
|
|
31 |
|
| 23946 |
amit.gupta |
32 |
$(document).ajaxComplete(function(){
|
|
|
33 |
loaderDialogObj.modal('hide');
|
|
|
34 |
});
|
|
|
35 |
|
| 23918 |
amit.gupta |
36 |
$( document ).ajaxStart(function() {
|
| 23946 |
amit.gupta |
37 |
loaderDialogObj.modal('show');
|
| 23921 |
amit.gupta |
38 |
if(typeof showAlert !="undefined" && showAlert && $('#order-details').length == 0) {
|
| 23946 |
amit.gupta |
39 |
var investmentDialog = bootbox.dialog({
|
| 23921 |
amit.gupta |
40 |
title: '<h3 class="text-danger">ATTENTION! LOW INVESTMENT ALERT!</h3>',
|
|
|
41 |
message : "<h3>Dear Partner, your investment is below 90%</h3>"
|
| 23918 |
amit.gupta |
42 |
+ "<dl>"
|
| 23919 |
amit.gupta |
43 |
+ "<dt>Total Investment Required</dt><dd>- " + minimumInvestmentAmount +"</dd>"
|
| 23921 |
amit.gupta |
44 |
+ "<dt>Total Invested Amount</dt><dd>-" + totalInvestedAmount +"</dd>"
|
|
|
45 |
+ '<dt>Investment Amount Short By</dt><dd class="text-danger lead">- ' + shortAmount+'</dd></dl>'
|
|
|
46 |
+ '<pre class="text-danger">Please ensure minimum investment with us within 48 hours!\nNote - Please login again if your wallet/investments are updated!</pre>',
|
| 23918 |
amit.gupta |
47 |
buttons:{
|
|
|
48 |
cancel: {
|
|
|
49 |
label: "OK",
|
| 23919 |
amit.gupta |
50 |
className: 'btn-primary'
|
| 23918 |
amit.gupta |
51 |
}
|
| 23921 |
amit.gupta |
52 |
},
|
| 23918 |
amit.gupta |
53 |
});
|
| 23946 |
amit.gupta |
54 |
investmentDialog.on('shown.bs.modal', function(){
|
|
|
55 |
var dialogEl = investmentDialog.find('.modal-content')[0];
|
|
|
56 |
var dialogRect = dialogEl.getBoundingClientRect();
|
|
|
57 |
var height = window.innerHeight - dialogRect.height;
|
|
|
58 |
var width = window.innerWidth - dialogRect.width;
|
|
|
59 |
var left = Math.floor(Math.random()*width) - dialogRect.left
|
|
|
60 |
var top = Math.floor(Math.random()*height) - dialogRect.top
|
|
|
61 |
$(dialogEl).css("left",left).css("top",top);
|
|
|
62 |
});
|
| 23918 |
amit.gupta |
63 |
}
|
|
|
64 |
});
|
| 23026 |
ashik.ali |
65 |
|
| 23918 |
amit.gupta |
66 |
|
|
|
67 |
|
| 23193 |
ashik.ali |
68 |
function doAjaxRequestWithParamsHandler(urlString, httpType, params, callback_function){
|
|
|
69 |
$.ajax({
|
|
|
70 |
url: urlString,
|
| 23343 |
ashik.ali |
71 |
async: true,
|
| 23193 |
ashik.ali |
72 |
cache: false,
|
|
|
73 |
data: params,
|
| 23872 |
amit.gupta |
74 |
// dataType:'json',
|
| 23193 |
ashik.ali |
75 |
type: httpType,
|
|
|
76 |
success: function(response) {
|
|
|
77 |
callback_function(response);
|
| 23786 |
amit.gupta |
78 |
$('.currency').each(function(index,ele){
|
|
|
79 |
if(!isNaN(parseInt($(ele).html()))) {
|
|
|
80 |
$(ele).html(numberToComma($(ele).html()));
|
|
|
81 |
}
|
|
|
82 |
});
|
| 23193 |
ashik.ali |
83 |
}
|
|
|
84 |
});
|
|
|
85 |
}
|
|
|
86 |
|
| 23500 |
ashik.ali |
87 |
function doGetAjaxRequestWithParamsHandler(urlString, params, callback_function){
|
|
|
88 |
doAjaxRequestWithParamsHandler(urlString, "GET", params, callback_function);
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
function doPostAjaxRequestWithParamsHandler(urlString, params, callback_function){
|
|
|
92 |
doAjaxRequestWithParamsHandler(urlString, "POST", params, callback_function);
|
|
|
93 |
}
|
|
|
94 |
|
| 23032 |
ashik.ali |
95 |
function doAjaxRequestWithJsonHandler(urlString, httpType, json, callback_function){
|
|
|
96 |
$.ajax({
|
|
|
97 |
url: urlString,
|
| 23343 |
ashik.ali |
98 |
async: true,
|
| 23032 |
ashik.ali |
99 |
cache: false,
|
|
|
100 |
processData: false,
|
|
|
101 |
data: json,
|
|
|
102 |
contentType:'application/json',
|
|
|
103 |
type: httpType,
|
|
|
104 |
success: function(response) {
|
| 23872 |
amit.gupta |
105 |
// console.log("response"+JSON.stringify(data));
|
| 23032 |
ashik.ali |
106 |
callback_function(response);
|
| 23786 |
amit.gupta |
107 |
$('.currency').each(function(index,ele){
|
|
|
108 |
if(!isNaN(parseInt($(ele).html()))) {
|
|
|
109 |
$(ele).html(numberToComma($(ele).html()));
|
|
|
110 |
}
|
|
|
111 |
});
|
| 23032 |
ashik.ali |
112 |
}
|
|
|
113 |
});
|
|
|
114 |
}
|
|
|
115 |
|
| 23500 |
ashik.ali |
116 |
function doPostAjaxRequestWithJsonHandler(urlString, json, callback_function){
|
|
|
117 |
doAjaxRequestWithJsonHandler(urlString, "POST", json, callback_function);
|
|
|
118 |
}
|
| 23032 |
ashik.ali |
119 |
|
| 23500 |
ashik.ali |
120 |
function doPutAjaxRequestWithJsonHandler(urlString, json, callback_function){
|
|
|
121 |
doAjaxRequestWithJsonHandler(urlString, "PUT", json, callback_function);
|
|
|
122 |
}
|
|
|
123 |
|
| 23026 |
ashik.ali |
124 |
function doAjaxRequestHandler(urlString, httpType, callback_function){
|
| 22982 |
ashik.ali |
125 |
$.ajax({
|
|
|
126 |
url: urlString,
|
| 23343 |
ashik.ali |
127 |
async: true,
|
| 23026 |
ashik.ali |
128 |
cache: false,
|
| 22982 |
ashik.ali |
129 |
type: httpType,
|
|
|
130 |
success: function(response) {
|
|
|
131 |
callback_function(response);
|
| 23786 |
amit.gupta |
132 |
$('.currency').each(function(index,ele){
|
|
|
133 |
if(!isNaN(parseInt($(ele).html()))) {
|
|
|
134 |
$(ele).html(numberToComma($(ele).html()));
|
|
|
135 |
}
|
|
|
136 |
});
|
| 22982 |
ashik.ali |
137 |
}
|
|
|
138 |
});
|
|
|
139 |
}
|
|
|
140 |
|
| 23500 |
ashik.ali |
141 |
function doGetAjaxRequestHandler(urlString, callback_function){
|
|
|
142 |
doAjaxRequestHandler(urlString, "GET", callback_function);
|
|
|
143 |
}
|
|
|
144 |
|
|
|
145 |
function doPutAjaxRequestHandler(urlString, callback_function){
|
|
|
146 |
doAjaxRequestHandler(urlString, "PUT", callback_function);
|
|
|
147 |
}
|
|
|
148 |
|
| 23629 |
ashik.ali |
149 |
function doPostAjaxRequestHandler(urlString, callback_function){
|
|
|
150 |
doAjaxRequestHandler(urlString, "POST", callback_function);
|
|
|
151 |
}
|
|
|
152 |
|
| 23783 |
ashik.ali |
153 |
function doDeleteAjaxRequestHandler(urlString, callback_function){
|
|
|
154 |
doAjaxRequestHandler(urlString, "DELETE", callback_function);
|
|
|
155 |
}
|
|
|
156 |
|
| 23347 |
ashik.ali |
157 |
function doAjaxUploadRequest(urlString, httpType, file){
|
|
|
158 |
var response;
|
|
|
159 |
doAjaxUploadRequestHandler(urlString, httpType, file, function(ajaxResponse){
|
|
|
160 |
response = ajaxResponse;
|
|
|
161 |
});
|
|
|
162 |
return response;
|
|
|
163 |
}
|
|
|
164 |
|
| 23026 |
ashik.ali |
165 |
function doAjaxUploadRequestHandler(urlString, httpType, file, callback_function){
|
| 22982 |
ashik.ali |
166 |
var formData = new FormData();
|
|
|
167 |
formData.append("file", file);
|
|
|
168 |
$.ajax({
|
|
|
169 |
url: urlString,
|
|
|
170 |
type: httpType,
|
|
|
171 |
data: formData,
|
|
|
172 |
dataType: 'json',
|
| 23343 |
ashik.ali |
173 |
async: true,
|
| 22982 |
ashik.ali |
174 |
cache: false,
|
|
|
175 |
contentType: false,
|
|
|
176 |
enctype: 'multipart/form-data',
|
|
|
177 |
processData: false,
|
|
|
178 |
success: function(response) {
|
| 23872 |
amit.gupta |
179 |
// console.log("response"+JSON.stringify(data));
|
| 22982 |
ashik.ali |
180 |
callback_function(response);
|
|
|
181 |
}
|
|
|
182 |
});
|
|
|
183 |
}
|
| 24171 |
govind |
184 |
function doAjaxUploadRequestJsonHandler(urlString, httpType, file,json,callback_function){
|
|
|
185 |
var formData = new FormData();
|
|
|
186 |
formData.append("file", file);
|
|
|
187 |
formData.append('json',new Blob([json]));
|
|
|
188 |
$.ajax({
|
|
|
189 |
url: urlString,
|
|
|
190 |
type: httpType,
|
|
|
191 |
data: formData,
|
|
|
192 |
enctype: 'multipart/form-data',
|
|
|
193 |
contentType: false,
|
|
|
194 |
processData: false,
|
|
|
195 |
success: function(response) {
|
|
|
196 |
// console.log("response"+JSON.stringify(data));
|
|
|
197 |
callback_function(response);
|
|
|
198 |
}
|
|
|
199 |
});
|
|
|
200 |
}
|
| 22982 |
ashik.ali |
201 |
|
| 23347 |
ashik.ali |
202 |
function uploadDocument(file){
|
| 24079 |
amit.gupta |
203 |
var url = webApiScheme + '://'+ webApiHost + ':' + webApiPort + webApiRoot + '/document-upload';
|
| 23377 |
ashik.ali |
204 |
doAjaxUploadRequestHandler(url, 'POST', file, function(response){
|
|
|
205 |
var documentId = response.response.document_id;
|
|
|
206 |
console.log("documentId : "+documentId);
|
|
|
207 |
return documentId;
|
|
|
208 |
});
|
| 23347 |
ashik.ali |
209 |
}
|
|
|
210 |
|
| 23377 |
ashik.ali |
211 |
function doAjaxGetDownload(urlString, fileName){
|
|
|
212 |
console.log("fileName : "+fileName);
|
| 23343 |
ashik.ali |
213 |
doAjaxDownload(urlString, "GET", null, fileName);
|
| 22982 |
ashik.ali |
214 |
}
|
|
|
215 |
|
| 23377 |
ashik.ali |
216 |
function doAjaxPostDownload(urlString, data, fileName){
|
| 23343 |
ashik.ali |
217 |
doAjaxDownload(urlString, "POST", data, fileName);
|
| 21627 |
kshitij.so |
218 |
}
|
|
|
219 |
|
| 23343 |
ashik.ali |
220 |
function doAjaxDownload(urlString, httpType, data, fileName){
|
| 22488 |
ashik.ali |
221 |
xhttp = new XMLHttpRequest();
|
|
|
222 |
xhttp.onreadystatechange = function() {
|
|
|
223 |
var a;
|
| 23494 |
ashik.ali |
224 |
if(xhttp.readyState === 2){
|
|
|
225 |
if(xhttp.status == 200){
|
|
|
226 |
xhttp.responseType = "blob";
|
|
|
227 |
} else {
|
|
|
228 |
xhttp.responseType = "text";
|
|
|
229 |
}
|
|
|
230 |
}else if (xhttp.readyState === 4 && xhttp.status === 200) {
|
| 22488 |
ashik.ali |
231 |
// Trick for making downloadable link
|
|
|
232 |
a = document.createElement('a');
|
|
|
233 |
a.href = window.URL.createObjectURL(xhttp.response);
|
|
|
234 |
// Give filename you wish to download
|
| 23343 |
ashik.ali |
235 |
a.download = fileName;
|
| 22488 |
ashik.ali |
236 |
a.style.display = 'none';
|
|
|
237 |
document.body.appendChild(a);
|
|
|
238 |
a.click();
|
| 23494 |
ashik.ali |
239 |
}else if(xhttp.readyState == 4 && xhttp.status === 400){
|
|
|
240 |
badRequestAlert(xhttp);
|
|
|
241 |
}else if(xhttp.readyState == 4 && xhttp.status === 500){
|
|
|
242 |
internalServerErrorAlert(xhttp);
|
| 22488 |
ashik.ali |
243 |
}
|
|
|
244 |
};
|
|
|
245 |
// Post data to URL which handles post request
|
| 23343 |
ashik.ali |
246 |
xhttp.open(httpType, urlString);
|
|
|
247 |
if(httpType == "POST"){
|
|
|
248 |
xhttp.setRequestHeader("Content-Type", "application/json");
|
|
|
249 |
}
|
| 22488 |
ashik.ali |
250 |
// You should set responseType as blob for binary responses
|
| 23872 |
amit.gupta |
251 |
// xhttp.responseType = 'blob';
|
| 22488 |
ashik.ali |
252 |
xhttp.send(data);
|
| 23405 |
amit.gupta |
253 |
}
|
|
|
254 |
|
| 23629 |
ashik.ali |
255 |
function loadPaginatedNextItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
|
|
|
256 |
var start = $("#"+paginatedIdentifier+" .start").text();
|
|
|
257 |
var end = $("#"+paginatedIdentifier+" .end").text();
|
|
|
258 |
url = context + url + "?offset=" + end;
|
|
|
259 |
|
|
|
260 |
if(params != null){
|
|
|
261 |
for (var key in params) {
|
|
|
262 |
if (params.hasOwnProperty(key)) {
|
| 23872 |
amit.gupta |
263 |
// console.log(key + " -> " + p[key]);
|
| 23629 |
ashik.ali |
264 |
url = url +"&" + key + "=" + params[key];
|
|
|
265 |
}
|
|
|
266 |
}
|
|
|
267 |
}
|
|
|
268 |
|
|
|
269 |
doGetAjaxRequestHandler(url, function(response){
|
|
|
270 |
var size = $("#"+paginatedIdentifier+" .size").text();
|
|
|
271 |
if((parseInt(end) + 10) > parseInt(size)){
|
|
|
272 |
console.log("(end + 10) > size == true");
|
|
|
273 |
$("#"+paginatedIdentifier+" .end").text(size);
|
|
|
274 |
}else{
|
|
|
275 |
console.log("(end + 10) > size == false");
|
|
|
276 |
$("#"+paginatedIdentifier+" .end").text(+end + +10);
|
|
|
277 |
}
|
|
|
278 |
$("#"+paginatedIdentifier+" .start").text(+start + +10);
|
|
|
279 |
var last = $("#"+paginatedIdentifier+" .end").text();
|
|
|
280 |
var temp = $("#"+paginatedIdentifier+" .size").text();
|
|
|
281 |
if (parseInt(last) >= parseInt(temp)){
|
|
|
282 |
$("#"+paginatedIdentifier+" .next").prop('disabled', true);
|
| 23872 |
amit.gupta |
283 |
// $( "#good-inventory-paginated .end" ).text(temp);
|
| 23629 |
ashik.ali |
284 |
}
|
|
|
285 |
$('#'+tableIdentifier).html(response);
|
|
|
286 |
if(detailsContainerIdentifier != null){
|
|
|
287 |
$('#'+detailsContainerIdentifier).html('');
|
|
|
288 |
}
|
|
|
289 |
$("#"+paginatedIdentifier+" .previous").prop('disabled', false);
|
|
|
290 |
});
|
|
|
291 |
|
|
|
292 |
}
|
| 23405 |
amit.gupta |
293 |
|
| 23629 |
ashik.ali |
294 |
|
|
|
295 |
function loadPaginatedPreviousItems(url, params, paginatedIdentifier, tableIdentifier, detailsContainerIdentifier){
|
|
|
296 |
var start = $("#"+paginatedIdentifier+" .start").text();
|
|
|
297 |
var end = $("#"+paginatedIdentifier+" .end").text();
|
|
|
298 |
var size = $("#"+paginatedIdentifier+" .size").text();
|
| 23819 |
govind |
299 |
if(parseInt(end) == parseInt(size) && parseInt(end)%10 !=0){
|
| 23629 |
ashik.ali |
300 |
var mod = parseInt(end) % 10;
|
|
|
301 |
end = parseInt(end) + (10 - mod);
|
|
|
302 |
}
|
|
|
303 |
var pre = end - 20;
|
|
|
304 |
|
|
|
305 |
url = context + url + "?offset=" + pre;
|
|
|
306 |
|
|
|
307 |
if(params != null){
|
|
|
308 |
for (var key in params) {
|
|
|
309 |
if (params.hasOwnProperty(key)) {
|
|
|
310 |
url = url +"&" + key + "=" + params[key];
|
|
|
311 |
}
|
|
|
312 |
}
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
doGetAjaxRequestHandler(url, function(response){
|
|
|
316 |
$("#"+paginatedIdentifier+" .end").text(+end - +10);
|
|
|
317 |
$("#"+paginatedIdentifier+" .start").text(+start - +10);
|
|
|
318 |
$('#'+tableIdentifier).html(response);
|
|
|
319 |
if(detailsContainerIdentifier != null){
|
|
|
320 |
$('#'+detailsContainerIdentifier).html('');
|
|
|
321 |
}
|
|
|
322 |
$("#"+paginatedIdentifier+" .next").prop('disabled', false);
|
|
|
323 |
if (parseInt(pre)==0){
|
|
|
324 |
$("#"+paginatedIdentifier+" .previous").prop('disabled', true);
|
|
|
325 |
}
|
|
|
326 |
});
|
|
|
327 |
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
|
| 23405 |
amit.gupta |
331 |
function numberToComma(x) {
|
| 23786 |
amit.gupta |
332 |
x=parseInt(x);
|
| 23405 |
amit.gupta |
333 |
x=x.toString();
|
|
|
334 |
var lastThree = x.substring(x.length-3);
|
|
|
335 |
var otherNumbers = x.substring(0,x.length-3);
|
|
|
336 |
if(otherNumbers != '')
|
|
|
337 |
lastThree = ',' + lastThree;
|
|
|
338 |
return otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree;
|
| 23786 |
amit.gupta |
339 |
}
|
| 23870 |
amit.gupta |
340 |
|
|
|
341 |
function dateRangeCallback(start, end) {
|
| 23886 |
amit.gupta |
342 |
startMoment = start;
|
|
|
343 |
endMoment = end;
|
|
|
344 |
startDate = start.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
|
|
345 |
endDate = end.format(moment.HTML5_FMT.DATETIME_LOCAL_SECONDS);
|
| 23872 |
amit.gupta |
346 |
}
|
|
|
347 |
|
|
|
348 |
function getSingleDatePicker(){
|
|
|
349 |
var singleDatePicker =
|
|
|
350 |
{
|
|
|
351 |
"todayHighlight": true,
|
| 23886 |
amit.gupta |
352 |
"startDate": startMoment || moment(),
|
| 23872 |
amit.gupta |
353 |
"autoclose": true,
|
|
|
354 |
"autoUpdateInput": true,
|
|
|
355 |
"singleDatePicker": true,
|
|
|
356 |
"locale": {
|
|
|
357 |
'format': 'DD/MM/YYYY'
|
|
|
358 |
}
|
|
|
359 |
};
|
|
|
360 |
return singleDatePicker;
|
| 23886 |
amit.gupta |
361 |
}
|
|
|
362 |
|
|
|
363 |
function getRangedDatePicker(showRanges){
|
|
|
364 |
if(typeof showRanges=="undefined") {
|
|
|
365 |
showRanges = false;
|
|
|
366 |
}
|
|
|
367 |
var rangedDatePicker =
|
|
|
368 |
{
|
|
|
369 |
"todayHighlight": true,
|
| 23914 |
govind |
370 |
"opens": "right",
|
| 23886 |
amit.gupta |
371 |
"startDate": startMoment || moment(),
|
|
|
372 |
"endDate": endMoment || moment(),
|
|
|
373 |
"autoclose": true,
|
|
|
374 |
"alwaysShowCalendars": false,
|
|
|
375 |
"autoUpdateInput": true,
|
|
|
376 |
"locale": {
|
|
|
377 |
'format': 'DD/MM/YYYY'
|
|
|
378 |
}
|
|
|
379 |
};
|
|
|
380 |
if(showRanges) {
|
|
|
381 |
rangedDatePicker['ranges'] =
|
|
|
382 |
{
|
|
|
383 |
'Today': [moment(), moment()],
|
|
|
384 |
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
|
|
385 |
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
|
|
386 |
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
|
|
387 |
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
|
|
388 |
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
|
|
389 |
}
|
|
|
390 |
}
|
|
|
391 |
return rangedDatePicker;
|
| 23892 |
amit.gupta |
392 |
}
|
| 23946 |
amit.gupta |
393 |
function showPosition(position) {
|
| 24052 |
amit.gupta |
394 |
if(typeof latitude == "undefined") {
|
|
|
395 |
var coords = {latitude:position.coords.latitude, longitude:position.coords.longitude}
|
|
|
396 |
doAjaxRequestWithJsonHandler('partner/location', 'PUT', JSON.stringify(coords), function(){
|
| 24016 |
amit.gupta |
397 |
latitude = position.coords.latitude;
|
|
|
398 |
longitude = position.coords.longitude;
|
| 24052 |
amit.gupta |
399 |
});
|
|
|
400 |
}
|
| 24056 |
amit.gupta |
401 |
//distance = getDistance(latitude, longitude, position.coords.latitude, position.coords.longitude);
|
| 24168 |
amit.gupta |
402 |
}
|
|
|
403 |
|
|
|
404 |
function getAuthorisedWarehouses(callback){
|
|
|
405 |
bootBoxObj = {
|
|
|
406 |
size: "small",
|
|
|
407 |
title: "Choose Warehouse",
|
|
|
408 |
callback: callback,
|
|
|
409 |
inputType:'select',
|
|
|
410 |
inputOptions : typeof inputOptions == "undefined" ? undefined : inputOptions
|
|
|
411 |
}
|
|
|
412 |
if(typeof inputOptions=="undefined") {
|
|
|
413 |
doGetAjaxRequestHandler(context+"/authorisedWarehouses", function(response){
|
|
|
414 |
response = JSON.parse(response);
|
|
|
415 |
inputOptions = [];
|
|
|
416 |
response.forEach(function(warehouse){
|
|
|
417 |
inputOptions.push({
|
|
|
418 |
text:warehouse.name,
|
|
|
419 |
value:warehouse.id,
|
|
|
420 |
});
|
|
|
421 |
});
|
|
|
422 |
bootBoxObj['inputOptions'] = inputOptions;
|
|
|
423 |
bootbox.prompt(bootBoxObj);
|
|
|
424 |
});
|
|
|
425 |
} else if(inputOptions.length==1) {
|
|
|
426 |
callback(inputOptions[0].warehouse.id);
|
|
|
427 |
}
|
|
|
428 |
else {
|
|
|
429 |
bootbox.prompt(bootBoxObj);
|
|
|
430 |
}
|
|
|
431 |
|
| 23946 |
amit.gupta |
432 |
}
|