-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex555.js
544 lines (527 loc) · 27.5 KB
/
index555.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
var tempVariable = null;
var myApp = new Framework7({
modalTitle: '',
material: true,
pushState: true,
});
var $$ = Dom7;
var mainView = myApp.addView('.view-main', {
dynamicNavbar: true,
domCache: true
});
document.addEventListener("deviceready", deviceReady, false);
$$(document).on("click",".search-btn", function(e) {
if(isLoggedIn()){
var keyRef = $$(".key-ref-input").val();
if (keyRef!="") {
searchKeyFn(keyRef)
}else{
showToast("Enter Key Ref to proceed!");
}
}
});
$$(document).on("click",".show-search-input-btn", function(e) {
$(".vehicle-info-div").slideUp(1000);
$(".search-input-div").fadeIn(3000);
isSearchDivVisible = true;
});
$$(document).on("keypress",".key-ref-input", function(e) {
if(isLoggedIn())
var keyRef = $$(this).val();
if(e.which == 13) {
if (keyRef!="") {
searchKeyFn(keyRef);
}else{
showToast("Enter Key Ref to proceed!");
}
}
});
$$(document).on("click",".add-new-client-btn", function(e) {
if(isLoggedIn())
loadPage('add-new-client-page');
});
$$(document).on("click",".add-new-stock-btn", function(e) {
if(isLoggedIn())
loadPage('add-store-page');
});
$$(document).on("click",".add-new-paint-btn", function(e) {
if(isLoggedIn())
loadPage('add-paint-page');
});
$$(document).on("change",".option-goBack", function(e){
navigator.app.backHistory();
});
$$(document).on("click",".recent-card-key-ref", function(e) {
if(isLoggedIn())
goToOptionPage($$(this).attr("Key_Ref"));
});
$$(document).on("click",".go-to-login-page-btn", function(e) {
if(!isLoggedIn())
loadPage("login-page");
else
navigator.notification.confirm('You will be logged out, Press confirm to logout',function(buttonIndex){
if(buttonIndex==1){
loginStatus = false;
userId = null;
$$(".go-to-login-page-btn").html("<i class='material-icons color-green' style='font-size:36px;'>lock</i>");
window.localStorage.removeItem("userId");
window.localStorage.removeItem("loginStatus");
window.localStorage.removeItem("baseUrl");
window.localStorage.removeItem("branch_code");
}
},'CONFIRM LOGOUT',['Confirm','Cancel']);
});
$$(document).on("click",".login-btn", function(e) {
var branch = $$(".login-branch-input").val().trim().toUpperCase();
var password = $$(".login-password-input").val();
if(password!="" && branch!=""){
chooseServer(branch,function(ip,port){
var newBaseUrl = "http://"+ip+":"+port;
var socket = io(newBaseUrl);
socket.emit("login",branch,password,function(result){
stopProcess();
if(result!=false){
userId = result
loginStatus = true;
window.localStorage.setItem("userId",userId);
window.localStorage.setItem("loginStatus",true);
$$(".login-password-input").val("");
$$(".go-to-login-page-btn").html("<i class='material-icons color-red' style='font-size:36px;'>lock</i>");
showToast("Access granted!");
window.localStorage.setItem("baseUrl",newBaseUrl);
window.localStorage.setItem("branch_code",branch);
window.location = "index.html";
}else{
showToast("Invalid login credentials!");
}
});
processStatus(10000,'Please wait while checking your credentials!');
});
}else{
showToast("Please enter valid password!");
}
});
function chooseServer(branch_code,cb){
for (var i = 0; i < serverArray.length; i++){
var company_code=serverArray[i].company_code;
var local_ip=serverArray[i].local_ip;
var remote_ip=serverArray[i].remote_ip;
var port=serverArray[i].port;
if (branch_code==company_code) {
if(checkConnection()=='WiFi connection'){
cb(local_ip,port);
}else if(checkConnection()=='No network connection'){
cb(remote_ip,port);
showToast("You are not connected to the internet!");
}else{
cb(remote_ip,port);
}
}
}
}
$$(document).on("click",".register-client-btn", function(e) {
var socket = deviceReady.returnSocket();
var fname = $$(".fname-input").val();
var lname = $$(".lname-input").val();
var cellNo = $$(".cell-input").val();
var regNo = $$(".reg-no-input").val();
var vehicleMake = $$(".make_input").val();
var branch = $$(".select-branch-input").val();
if(fname.length>2){
if(lname.length>2){
if(regNo!="" || vehicleMake!=""){
if(phoneNoValidation(cellNo)!="Incorrect phone number"){
navigator.notification.confirm('Have you provided legit info? Press confirm button to proceed!',function(buttonIndex){
if(buttonIndex==1){
socket.emit("saveClient",fname,lname,cellNo,regNo,vehicleMake,branch,function(result){
if(result!=false){
goToOptionPage(result);
$$(".fname-input,.lname-input,.cell-input,.reg-no-input,.make_input").val("");
showToast("New client has been added successfully!");
}else{
showToast("Could not save "+fname+", Please try again later!");
}
});
}
},'CONFIRM CLIENT',['Confirm','Cancel']);
}else{
showToast(phoneNoValidation(cellNo));
}
}else{
showToast("All fields are mandatory!");
}
}else{
showToast("Please enter a valid last name!");
}
}else{
showToast("Please enter a valid first name!");
}
});
var bookingsArray = ['Licence Disk','Front Bumper','Bonnet','Right Front Fender','Right Front Door Mirror','Right Front Door','Right Rear Door','Right Rear Fender',
'Boot','Right Rear Tyre','Left Rear Tyre','Left Rear Fender','Left Rear Door','Left Front Door','Left Front Door Mirror','Left Front Fender','Left Front Headlamp',
'Right Front Headlamp','Front WindScreen','Roof','Engine','Left Front Tyre','Right Front Tyre','Spare wheel','Inside Boot','Left Front Door Inner Panel',
'Right Front Door Inner Panel','Left Rear Door Inner Panel','Right Rear Door Inner Panel','Right Front Carpet','Left Front Carpet','Right Rear Carpet',
'Left Rear Carpet','Left Front Seat','Right Front Seat','Rear Seats','Instrument Cover','Instrument Cluster','Console','Headlining','Radio','Keys'];
$$(document).on("click",".bookings-btn", function(e) {
if(isLoggedIn())
if(!isSearchDivVisible){
$$(".show-sub-header").text("BOOKINGS");
$$(".display-bookings-btn").show();
loadPage("capture-bookings-page");
$$(".display-other-btn").hide();
$$(".display-bookings-btn").html("");
for (var i = 0; i < bookingsArray.length; i++) {
$$(".display-bookings-btn").append("<a href='#' class='button button-fill capture-bookings-btn' style='border-radius: 5px;display:none;background: url(images/wallpaper.jpg);background-size: cover;color:#757575;font-weight:bold;' title='"+bookingsArray[i]+"' id='"+i+"'>CAPTURE</a>");
}
$$("[title='"+bookingsArray[0]+"']").show();
$$(".show-current-bookings-photo-div").text(bookingsArray[0]);
}else{
showToast("Please enter Key Ref to proceed!");
}
});
$$(document).on("click",".capture-bookings-btn", function(e) {
var nextIndex = parseFloat(this.id) + 1;
var elem = $$(this);
var socket = deviceReady.returnSocket();
openCamera(function(fileUrl){
var photoLocation = "../mag_qoutation/mag_snapshot/security_images/"+activeKeyRef+"/"+bookingsArray[elem.attr("id")] + Math.floor(Math.random()*899999+100000)+".png";
//var photoLocation = "../ais_new/public/images/mag_security/"+activeKeyRef+"/"+bookingsArray[elem.attr("id")]+".png";
uploadFile(fileUrl,photoLocation,"image/png",function(response){
if(response=='success'){
socket.emit("saveBookingPhoto",activeKeyRef,bookingsArray[elem.attr("id")],photoLocation,function(result){
stopProcess();
if(bookingsArray[elem.attr("id")]!="Keys"){
elem.hide();
$$("[title='"+bookingsArray[nextIndex]+"']").show();
$$(".show-current-bookings-photo-div").text(bookingsArray[nextIndex]);
}else{
getChecklist();
}
if(result){
showToast(bookingsArray[elem.attr("id")]+" has been uploaded!");
}
});
}
});
processStatus(60000,"Please wait while uploading "+bookingsArray[elem.attr("id")]);
})
});
$$(document).on("click",".add-other-photo-btn", function(e) {
if(isLoggedIn())
if(!isSearchDivVisible){
var photo_type = $(this).attr("title")
$$(".show-sub-header").text(photo_type);
$$(".display-other-btn").show();
loadPage("capture-bookings-page");
$$(".display-bookings-btn").hide();
$$(".show-current-bookings-photo-div").text(photo_type);
$$(".captureBtn").attr("title",photo_type);
}else{
showToast("Enter Key Ref to proceed!");
}
});
$$(document).on("click",".work-in-progress-btn", function(e) {
if(isLoggedIn())
if(!isSearchDivVisible){
loadPage("work-in-progress-page");
}else{
showToast("Enter Key Ref to proceed!");
}
});
$$(document).on("click",".captureBtn", function(e) {
var photo_type = $(this).attr("title");
var photoSource = $(this).attr("name");
saveOtherPhoto(photo_type,photo_type,photoSource);
});
$$(document).on("click",".get-client-details-btn", function(e) {
var socket = deviceReady.returnSocket();
loadPage("security-checklist-page");
socket.emit("getClientDetails",activeKeyRef,function(result){
stopProcess();
if(result.length>0){
$$(".check-reg-input").val(result[0].Reg_No);
$$(".check-make-input").val(result[0].Make);
$$(".check-model-input").val(result[0].Model);
$$(".check-chasis-input").val(result[0].Chasses_No);
$$(".check-towed-input").val(result[0].towed_by);
$$(".check-km-input").val(result[0].KM);
}else{
showToast("We couldn't find any info related to this key ref!");
}
});
processStatus(10000,"Retrieving data, Please wait...");
});
$$(document).on("click",".update-security-btn", function(e) {
var socket = deviceReady.returnSocket();
var Reg_No = $$(".check-reg-input").val();
var Make = $$(".check-make-input").val();
var Model = $$(".check-model-input").val();
var Chasses_No = $$(".check-chasis-input").val();
var towed_by = $$(".check-towed-input").val();
var KM = $$(".check-km-input").val();
if(Reg_No!="" && Make!="" && Chasses_No!=""){
navigator.notification.confirm('You are about to update '+activeKeyRef+'. Your user key will be used to update this client info!',function(buttonIndex){
if(buttonIndex==1){
socket.emit("updateClient",Reg_No,Make,Model,Chasses_No,towed_by,activeKeyRef,userId,KM,function(cb){
stopProcess();
if(cb){
showToast("Updated successfully!");
}else{
showToast("Could not update!");
}
})
processStatus(10000,"Updating info, please wait...");
}
},'CONFIRM UPDATE',['Confirm','Cancel']);
}else{
showToast("Please fill in correctly to proceed!");
}
});
$$(document).on("click",".work-in-progress-photo-btn", function(e) {
if(!isSearchDivVisible){
var photo_type = $(this).attr("title");
var photoSource = $(this).attr("name");
saveOtherPhoto("WORK IN PROGRESS",photo_type,photoSource);
}else{
showToast("Enter Key Ref to proceed!");
}
});
$$(document).on("click",".browse-stock-photo", function(e) {
openCamera(function(fileUrl){
tempVariable = fileUrl;
});
});
$$(document).on("click",".add-notes-btn", function(e) {
if(!isSearchDivVisible){
loadPage("add-notes-page")
}else{
showToast("Enter Key Ref to proceed!");
}
});
$$(document).on("click",".save-notes-btn", function(e) {
var notes = $$(".notes-input").val();
var socket = deviceReady.returnSocket();
if(notes.length>0){
socket.emit('saveNotes',notes,activeKeyRef,userId,function(cb){
stopProcess();
if(cb){
showToast("Notes saved!")
}else{
showToast('There was an error while trying to save notes!')
}
})
processStatus(10000,"Saving notes, Please wait...")
}else{
showToast("Please add something to proceed!");
}
});
$$(document).on("click",".add-stock-btn", function(e) {
var stockDesc = $$(".stock-desc-input").val();
var stockAmount = $$(".stock-amount-input").val();
var stockNa = $$(".stock-na-input").val();
var stockSupplier = $$(".stock-supplier-input").val();
var stockCategory = $$(".stock-category-input").val();
var stockBranch = $$(".stock-branch-input").val();
//var photoLocation = "files/images/stock"+ Math.floor(Math.random()*899999+100000) +".png";
//var photoLocation = "../mag_qoutation/photos/security_images/"+activeKeyRef+"/stock"+Math.floor(Math.random()*899999+100000) +".png";
var photoLocation = "../Ordering_system/stock_icon/stock"+Math.floor(Math.random()*899999+100000) +".png";
//var photoLocation = "../ais_new/public/images/mag_photos/"+activeKeyRef+"/stock"+ Math.floor(Math.random()*899999+100000) +".png";
var socket = deviceReady.returnSocket();
if(stockDesc.length>2 || stockAmount!="" || stockSupplier!=""){
navigator.notification.confirm('By pressing the confirm button you agree that all information provided is correct!',function(buttonIndex){
if(buttonIndex==1){
if(tempVariable==null){
socket.emit("saveStock",stockDesc,stockAmount,stockNa,stockSupplier,stockCategory,stockBranch,'',function(cb){
stopProcess();
if(cb){
showToast("You have successfully added new stock");
$$(".stock-desc-input,.stock-na-input,.stock-amount-input,.stock-supplier-input").val("");
}else{
showToast("There was an error while trying to add new stock!");
}
});
processStatus(60000,"Please wait while saving data...");
}else{
uploadFile(tempVariable,photoLocation,"image/png",function(response){
if(response=='success'){
socket.emit("saveStock",stockDesc,stockAmount,stockNa,stockSupplier,stockCategory,stockBranch,photoLocation,function(cb){
stopProcess();
if(cb){
showToast("You have successfully added new stock");
tempVariable=null;
$$(".stock-desc-input,.stock-na-input,.stock-amount-input,.stock-supplier-input").val("");
}else{
showToast("There was an error while trying to add new stock!");
}
});
}
});
processStatus(60000,"Please wait while saving data...");
}
}
},'CONFIRM STOCK',['Confirm','Cancel']);
}else{
showToast("Please fill in correctly to proceed!");
}
});
$$(document).on("click",".add-paint-btn", function(e) {
var paintDesc = $$(".paint-desc-input").val();
var paintAmount = $$(".paint-amount-input").val();
var paintQuantity = $$(".paint-quantity-input").val();
var paintSupplier = $$(".paint-supplier-input").val();
var paintSize = $$(".paint-size-input").val();
var paintBranch = $$(".paint-branch-input").val();
var photoLocation = "../Ordering_system/stock_icon/paint"+Math.floor(Math.random()*899999+100000) +".png";
//var photoLocation = "../ais_new/public/images/mag_security/"+activeKeyRef+"/paint"+ Math.floor(Math.random()*899999+100000) +".png";
var socket = deviceReady.returnSocket();
if(paintDesc.length>2 || paintAmount!="" || paintSupplier!=""){
navigator.notification.confirm('By pressing the confirm button you agree that all information provided is correct!',function(buttonIndex){
if(buttonIndex==1){
if(tempVariable==null){
socket.emit("savePaint",paintDesc,paintAmount,paintQuantity,paintSupplier,paintSize,paintBranch,'',function(cb){
stopProcess();
if(cb){
showToast("You have successfully added new paint");
$$(".paint-desc-input,.paint-quantity-input,.paint-amount-input,.paint-supplier-input").val("");
}else{
showToast("There was an error while trying to add new paint!");
}
});
processStatus(60000,"Please wait while saving data...");
}else{
uploadFile(tempVariable,photoLocation,"image/png",function(response){
if(response=='success'){
socket.emit("savePaint",paintDesc,paintAmount,paintQuantity,paintSupplier,paintSize,paintBranch,photoLocation,function(cb){
stopProcess();
if(cb){
showToast("You have successfully added new paint");
$$(".paint-desc-input,.paint-quantity-input,.paint-amount-input,.paint-supplier-input").val("");
tempVariable=null;
}else{
showToast("There was an error while trying to add new paint!");
}
});
}
});
processStatus(60000,"Please wait while saving data...");
}
}
},'CONFIRM PAINT',['Confirm','Cancel']);
}else{
showToast("Please fill in correctly to proceed!");
}
});
$$(document).on("click",".update-checklist-btn", function(e){
var socket = deviceReady.returnSocket();
var tyre_rf_make_input = $$(".tyre_rf_make_input").val();
var tyre_rf_status_input = $$(".tyre_rf_status_input").val();
var tyre_lf_make_input = $$(".tyre_lf_make_input").val();
var tyre_lf_status_input = $$(".tyre_lf_status_input").val();
var tyre_lr_make_input = $$(".tyre_lr_make_input").val();
var tyre_lr_status_input = $$(".tyre_lr_status_input").val();
var tyre_rr_make_input = $$(".tyre_rr_make_input").val();
var tyre_rr_status_input = $$(".tyre_rr_status_input").val();
var sparewheel_type_input = $$(".sparewheel_type_input").val();
var sparewheel_status_input = $$(".sparewheel_status_input").val();
var sparewheel_make_input = $$(".sparewheel_make_input").val();
var mag_rf_type_input = $$(".mag_rf_type_input").val();
var mag_rf_status_input = $$(".mag_rf_status_input").val();
var mag_lf_type_input = $$(".mag_lf_type_input").val();
var mag_lf_status_input = $$(".mag_lf_status_input").val();
var mag_rr_type_input = $$(".mag_rr_type_input").val();
var mag_rr_status_input = $$(".mag_rr_status_input").val();
var mag_lr_type_input = $$(".mag_lr_type_input").val();
var mag_lr_status_input = $$(".mag_lr_status_input").val();
var light_rf_status_input = $$(".light_rf_status_input").val();
var light_rf_none_input = $$(".light_rf_none_input").attr('status');
var light_lf_status_input = $$(".light_lf_status_input").val();
var light_lf_none_input = $$(".light_lf_none_input").attr('status');
var light_rr_status_input = $$(".light_rr_status_input").val();
var light_rr_none_input = $$(".light_rr_none_input").attr('status');
var light_lr_status_input = $$(".light_lr_status_input").val();
var light_lr_none_input = $$(".light_lr_none_input").attr('status');
var indicator_rf_status_input = $$(".indicator_rf_status_input").val();
var indicator_rf_none_input = $$(".indicator_rf_none_input").attr('status');
var indicator_lf_status_input = $$(".indicator_lf_status_input").val();
var indicator_lf_none_input = $$(".indicator_lf_none_input").attr('status');
var indicator_rr_status_input = $$(".indicator_rr_status_input").val();
var indicator_rr_none_input = $$(".indicator_rr_none_input").attr('status');
var indicator_lr_status_input = $$(".indicator_lr_status_input").val();
var indicator_lr_none_input = $$(".indicator_lr_none_input").attr('status');
var mirror_rf_status_input = $$(".mirror_rf_status_input").val();
var mirror_rf_none_input = $$(".mirror_rf_none_input").attr('status');
var mirror_lf_status_input = $$(".mirror_lf_status_input").val();
var mirror_lf_none_input = $$(".mirror_lf_none_input").attr('status');
var upholstry_rf_status_input = $$(".upholstry_rf_status_input").val();
var upholstry_rf_stained_input = $$(".upholstry_rf_stained_input").val();
var upholstry_lf_status_input = $$(".upholstry_lf_status_input").val();
var upholstry_lf_stained_input = $$(".upholstry_lf_stained_input").val();
var upholstry_rr_status_input = $$(".upholstry_rr_status_input").val();
var upholstry_rr_stained_input = $$(".upholstry_rr_stained_input").val();
var upholstry_lr_status_input = $$(".upholstry_lr_status_input").val();
var upholstry_lr_stained_input = $$(".upholstry_lr_stained_input").val();
var radio_status_input = $$(".radio_status_input").val();
var radio_face_status_input = $$(".radio_face_status_input").val();
var cd_shuttle_status_input = $$(".cd_shuttle_status_input").val();
var cd_player_status_input = $$(".cd_player_status_input").val();
var aerial_status_input = $$(".aerial_status_input").val();
var battery_status_input = $$(".battery_status_input").val();
var keys_status_input = $$(".keys_status_input").val();
var service_book_status_input = $$(".service_book_status_input").val();
var back_board_status_input = $$(".back_board_status_input").val();
var spanner_status_input = $$(".spanner_status_input").val();
var tools_status_input = $$(".tools_status_input").val();
var jack_status_input = $$(".jack_status_input").val();
var triangle_status_input = $$(".triangle_status_input").val();
var lock_nut_status_input = $$(".lock_nut_status_input").val();
var gear_lock_status_input = $$(".gear_lock_status_input").val();
var cig_lighter_status_input = $$(".cig_lighter_status_input").val();
var car_mats_status_input = $$(".car_mats_status_input").val();
var centre_caps_status_input = $$(".centre_caps_status_input").val();
navigator.notification.confirm('This key ref security checklist data will be updated. Press confirm to proceed!',function(buttonIndex){
if(buttonIndex==1){
socket.emit("update-checklist-event",activeKeyRef,tyre_rf_make_input,tyre_rf_status_input,tyre_lf_make_input,tyre_lf_status_input,tyre_lr_make_input,tyre_lr_status_input,tyre_rr_make_input,tyre_rr_status_input,sparewheel_make_input,sparewheel_type_input,sparewheel_status_input,mag_rf_type_input,mag_rf_status_input,mag_lf_type_input,mag_lf_status_input,mag_rr_type_input,mag_rr_status_input,mag_lr_type_input,mag_lr_status_input,light_rf_status_input,light_rf_none_input,light_lf_status_input,light_lf_none_input,light_rr_status_input,light_rr_none_input,light_lr_status_input,light_lr_none_input,indicator_rf_status_input,indicator_rf_none_input,indicator_lf_status_input,indicator_lf_none_input,indicator_rr_status_input,indicator_rr_none_input,indicator_lr_status_input,indicator_lr_none_input,mirror_rf_status_input,mirror_rf_none_input,mirror_lf_status_input,mirror_lf_none_input,upholstry_rf_status_input,upholstry_rf_stained_input,upholstry_lf_status_input,upholstry_lf_stained_input,upholstry_rr_status_input,upholstry_rr_stained_input,upholstry_lr_status_input,upholstry_lr_stained_input,radio_status_input,radio_face_status_input,cd_shuttle_status_input,cd_player_status_input,aerial_status_input,battery_status_input,keys_status_input,service_book_status_input,back_board_status_input,spanner_status_input,tools_status_input,jack_status_input,triangle_status_input,lock_nut_status_input,gear_lock_status_input,cig_lighter_status_input,car_mats_status_input,centre_caps_status_input,function(cb){
stopProcess();
if(cb){
showToast("security checklist updates success");
navigator.app.backHistory();
}else{
showToast("Could not update!");
}
});
processStatus(10000,'Updating security checklist...');
}
},'CONFIRM UPDATE',['Confirm','Cancel']);
});
$$(document).on("change",".advanced-checkbox", function(e) {
if($(this).attr("checked")){
$(this).removeAttr("checked").attr('status','');;
}else{
$(this).attr('checked','checked').attr('status','NONE');
}
});
function getChecklist(){
loadPage("security-checklist-page");
var socket = deviceReady.returnSocket();
$$(".security-checklist-header").text("SECURITY CHECK("+activeKeyRef+")");
socket.emit("get-more-checklist",activeKeyRef,function(result){
if(result.length>0){
$$(".tyre_rf_make_input").val(result[0].tyer_rf_make);
//$$(".tyre_rf_status_input").val();
//$('.tyre_rf_status_input option').removeAttr('selected').filter('[<option>'+result[0].tyer_rf_status+'</option>]').attr('selected', true);
$$(".tyre_lf_make_input").val(result[0].tyer_lf_make);
//$$(".tyre_lf_status_input").val();
$$(".tyre_lr_make_input").val(result[0].tyer_lr_make);
//$$(".tyre_lr_status_input").val();
$$(".sparewheel_type_input").val(result[0].tyer_rr_make);
$$(".sparewheel_type_input").val(result[0].s_wheel_make);
//$$(".tyre_rr_status_input").val();
}
})
}
$$(document).on("click",".security-checklist-btn", function(e) {
getChecklist();
});
$$(document).on("click",".scan-document-btn", function(e) {
showToast("This is feature is still under development!");
});