-
Notifications
You must be signed in to change notification settings - Fork 0
/
newJob.php
842 lines (763 loc) · 35.5 KB
/
newJob.php
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
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
<?php include_once "global.php";?>
<!DOCTYPE html>
<html class="no-js">
<head>
<!-- meta -->
<meta charset="utf-8">
<meta content="Flat, Clean, Responsive, admin template built with bootstrap 3" name="description">
<meta content="width=device-width, user-scalable=1, initial-scale=1, maximum-scale=1" name="viewport">
<meta content="Flat, Clean, Responsive, admin template built with bootstrap 3" name="description">
<meta content="width=device-width, user-scalable=1, initial-scale=1, maximum-scale=1" name="viewport">
<title>MoverAdmin | Simple Crew Management</title><!-- bootstrap -->
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet"><!-- /bootstrap -->
<title>MoverAdmin | Simple Crew Management</title><!-- bootstrap -->
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"><!-- /bootstrap -->
<!-- core styles -->
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/themes/smoothness/jquery-ui.css" rel="stylesheet">
<link href="/css/skins/palette.css" id="skin" rel="stylesheet">
<link href="/css/fonts/style.1.css" id="font" rel="stylesheet">
<link href="/plugins/datepicker/css/datepicker.css" rel="stylesheet">
<link href="/css/main.css" rel="stylesheet">
<link href="/css/animate.min.css" rel="stylesheet">
<link href="/vendor/offline/theme.css" rel="stylesheet">
<link href="/css/chosen.min.css" rel="stylesheet"><!-- /core styles -->
<link href="/css/main.css" rel="stylesheet">
<link href="/css/animate.min.css" rel="stylesheet">
<link href="/vendor/offline/theme.css" rel="stylesheet">
<link href="/css/job.css" rel="stylesheet"><!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- load modernizer -->
<script src="/vendor/modernizr.js"></script>
<style type="text/css">
.searchResults{
position: absolute;
background-color: white;
z-index: 1;
display: none;
top: 50px;
}
.searchResult{
cursor: pointer;
border-top: solid 1px rgb(180, 180, 180);
line-height: 70px;
}
.searchResult:hover{
background-color: #EEEEEE;
}
.searchResult>div>img{
width: 50px;
-webkit-border-radius: 25px;
-moz-border-radius: 25px;
border-radius: 25px;
}
.searchResult>.title{
font-size: 20px;
}
.chosen-select{
width: 100%;
}
.chosen-container-multi .chosen-choices li.search-field input[type=text]{
height: auto;
}
</style>
<style type="text/css">
.bootstrap-timepicker-hour, .bootstrap-timepicker-minute, .bootstrap-timepicker-meridian{
border: none;
}
</style>
</head><!-- body -->
<?php include 'includes/header.php';
//set vars
$startDate=date('m/d/Y');
$startTime='12:01:00';
$onsiteTime='12:01:00';
$notes='';
$regNum='';
$shipperName='';
$shipperPhone='';
$altShipperName='';
$altPhone='';
$originAddress='';
$originShuttle=0;
$originInstructions='';
$destinationAddress='';
$destinationShuttle=0;
$destinationInstructions='';
$status='';
$confirmedBy='';
$weight='';
$weightType='';
$vaultPackOrder='';
$shuttleTruckNumber='';
$insuranceChargesApply=0;
$originAptNum='';
$originCity='';
$originState='';
$originZip='';
$destinationAptNum='';
$destinationCity='';
$destinationState='';
$destinationZip='';
if(isset($_REQUEST['id'])){
$jobid=$_REQUEST['id'];
global $db;
$sql="SELECT * FROM moverAdmin.jobs WHERE idjobs=?";
$jobInfo=query($sql,$jobid)[0];
$ampm=' AM';
$onsiteampm=' AM';
if(!isset($jobInfo)){
$jobid='new';
} else {
// check if we have access
$sql="SELECT adminid FROM moverAdmin.jobs WHERE idjobs=?;";
$results=query($sql,$jobid);
$results=$results[0];
if($results['adminid']!=$_SESSION['userid']){
$jobid='new';
} else {
$startDate=$jobInfo['startDate'];
$startTime=$jobInfo['startTime'];
$onsiteTime=$jobInfo['onsiteTime'];
$notes=$jobInfo['notes'];
$regNum=$jobInfo['regNum'];
$shipperName=$jobInfo['shipperName'];
$shipperPhone=$jobInfo['shipperPhone'];
$altShipperName=$jobInfo['altShipperName'];
$altPhone=$jobInfo['altPhone'];
$originAddress=$jobInfo['originAddress'];
$originShuttle=$jobInfo['originShuttle'];
$originInstructions=$jobInfo['originInstructions'];
$destinationAddress=$jobInfo['destinationAddress'];
$destinationShuttle=$jobInfo['destinationShuttle'];
$destinationInstructions=$jobInfo['destinationInstructions'];
$status=$jobInfo['status'];
$confirmedBy=$jobInfo['confirmedBy'];
$weight=$jobInfo['weight'];
$weightType=$jobInfo['weightType'];
$vaultPackOrder=$jobInfo['vaultPackOrder'];
$shuttleTruckNumber=$jobInfo['shuttleTruckNumber'];
$insuranceChargesApply=$jobInfo['insuranceChargesApply'];
$originAptNum=$jobInfo['originAptNum'];
$originCity=$jobInfo['originCity'];
$originState=$jobInfo['originState'];
$originZip=$jobInfo['originZip'];
$destinationAptNum=$jobInfo['destinationAptNum'];
$destinationCity=$jobInfo['destinationCity'];
$destinationState=$jobInfo['destinationState'];
$destinationZip=$jobInfo['destinationZip'];
$multiselects = array('moveTypes','serviceTypes','drivers','laborers','equipment');
foreach($multiselects as $key=>$multiselect){
$sql="SELECT ".$multiselect."id FROM moverAdmin.".$multiselect."ForJob WHERE jobid=?;";
$results=query($sql,$jobid);
foreach($results as $key=>$result){
//jobmoveTypes
${"job".$multiselect}[]=$result[$multiselect.'id'];
}
}
}
}
} else {
$jobid='new';
}
if($startTime!=''){
$startHour=substr($jobInfo['startTime'],0,strpos($jobInfo['startTime'],':'));
$startMinute=substr($jobInfo['startTime'],1+strpos($jobInfo['startTime'],':',strpos($jobInfo['startTime'],':')),2);
if(substr($jobInfo['startTime'],0,strpos($jobInfo['startTime'],':'))>12){
$startHour=($startHour-12);
$ampm=' PM';
}
}
if($onsiteTime!=''){
$onsiteHour=substr($jobInfo['onsiteTime'],0,strpos($jobInfo['onsiteTime'],':'));
$onsiteMinute=substr($jobInfo['onsiteTime'],1+strpos($jobInfo['onsiteTime'],':',strpos($jobInfo['onsiteTime'],':')),2);
if(substr($jobInfo['onsiteTime'],0,strpos($jobInfo['onsiteTime'],':'))>12){
$onsiteHour=($onsiteHour-12);
$onsiteampm=' PM';
}
}
?>
<body>
<section class="main-content">
<!-- content wrapper -->
<div class="content-wrap">
<div class="col-md-12">
<h1 class="no-mg-t">
<?php
if($jobid=='new'){
echo 'New ';
} else {
echo 'Edit ';
}
?>
Job</h1>
</div>
<div class="col-md-12">
<div class="col-md-3 label">
<label for="startDate">Job Start Date</label>
</div>
<div class="col-md-8">
<input class="form-control" id="startDate" placeholder="05-15-2014" type="text" value="<?php if($startDate!=''){echo date('m/d/Y',strtotime($startDate));}?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="startTime">Job Start time</label>
</div>
<div class="col-md-8">
<input class="form-control" id="startTime" placeholder="h:mm PM" type="text" value="<?php if($startTime!=''){echo $startHour.':'.$startMinute.$ampm;}?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="onsiteTime">On-site time</label>
</div>
<div class="col-md-8 mg-b-lg">
<input class="form-control" id="onsiteTime" placeholder="h:mm PM" type="text" value="<?php if($onsiteTime!=''){echo $onsiteHour.':'.$onsiteMinute.$onsiteampm;}?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="moveTypes">Move Type</label>
</div>
<div class="col-md-8">
<select class="form-control chosen-select" id="moveTypes" multiple>
<?php
$sql="SELECT * FROM moverAdmin.moveTypes;";
$results=query($sql);
foreach($results as $key => $moveType){
echo '<option value="'.$moveType['idmoveTypes'].'">';
echo $moveType['typeName'];
echo '</option>';
}
?>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="serviceTypes">Service Type</label>
</div>
<div class="col-md-8">
<select class="form-control chosen-select" id="serviceTypes" multiple>
<?php
$sql="SELECT * FROM moverAdmin.serviceTypes;";
$results=query($sql);
foreach($results as $key => $serviceType){
echo '<option value="'.$serviceType['idserviceTypes'].'">';
echo $serviceType['serviceName'];
echo '</option>';
}
?>
</select>
</div>
<div class="clearfix"></div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="regNumber">Reg Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="regNumber" placeholder="Reg Number" type="text" value="<?php echo $regNum;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="shipperName">Shipper Name</label>
</div>
<div class="col-md-8">
<input class="form-control" id="shipperName" placeholder="Shipper name" type="text" value="<?php echo $shipperName;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="phone">Phone Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="phone" placeholder="###-###-####" type="text" value="<?php echo $shipperPhone;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="altShipperName">Alternate Shipper Name</label>
</div>
<div class="col-md-8">
<input class="form-control" id="altShipperName" placeholder="Shipper name" type="text" value="<?php echo $altShipperName;?>" >
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="altPhone">Alternate Phone Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="altPhone" placeholder="###-###-####" type="text" value="<?php echo $altPhone; ?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originAddr">Origin Address</label>
</div>
<div class="col-md-8">
<input class="form-control" id="originAddr" placeholder="Address" type="text" value="<?php echo $originAddress;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originAptNum">Origin Apartment Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="originAptNum" placeholder="Apt Number" type="text" value="<?php echo $originAptNum;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originCity">Origin City</label>
</div>
<div class="col-md-8">
<input class="form-control" id="originCity" placeholder="City" type="text" value="<?php echo $originCity;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originState">Origin State</label>
</div>
<div class="col-md-8">
<select class="form-control" id="originState">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originShuttle">Origin Shuttle?</label><br>
</div>
<?php
$originShuttleYesCheckedString='';
$originShuttleNoCheckedString='';
if(isset($originShuttle) && ($originShuttle>0)){
$originShuttleYesCheckedString=' checked';
} else {
$originShuttleNoCheckedString=' checked';
}
?>
<div class="col-md-8">
<input id="originShuttleYes" name="originShuttle" type="radio" value="1" <?php echo $originShuttleYesCheckedString;?>>
<label for="originShuttleYes">Yes</label>
<input id="originShuttleNo" name="originShuttle" type="radio" value="0" <?php echo $originShuttleNoCheckedString;?>>
<label for="originShuttleNo">No</label>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originSpecial">Origin Special Instructions</label>
</div>
<div class="col-md-8">
<input class="form-control" id="originSpecial" placeholder="Special Instructions" type="text" value="<?php echo $originInstructions;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destination">Destination</label>
</div>
<div class="col-md-8">
<input class="form-control" id="destination" placeholder="Address" type="text" value="<?php echo $destinationAddress;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destinationAptNum">Destination Apartment Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="destinationAptNum" placeholder="Apt Number" type="text" value="<?php echo $destinationAptNum;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="originCity">Destination City</label>
</div>
<div class="col-md-8">
<input class="form-control" id="destinationCity" placeholder="City" type="text" value="<?php echo $destinationCity;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destinationState">DestinationState</label>
</div>
<div class="col-md-8">
<select class="form-control" id="destinationState">
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District Of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destinationShuttle">Destination Shuttle?</label><br>
</div>
<?php
$destinationShuttleYesCheckedString='';
$destinationShuttleNoCheckedString='';
if(isset($destinationShuttle) && ($destinationShuttle>0)){
$destinationShuttleYesCheckedString=' checked';
} else {
$destinationShuttleNoCheckedString=' checked';
}
?>
<div class="col-md-8">
<input id="destinationShuttleYes" name="destinationShuttle" type="radio" value="1" <?php echo $destinationShuttleYesCheckedString;?>>
<label for="destinationShuttleYes">Yes</label>
<input id="destinationShuttleNo" name="destinationShuttle" type="radio" value="0" <?php echo $destinationShuttleNoCheckedString;?>>
<label for="destinationShuttleNo">No</label>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destinationSpecial">Destination Special Instructions</label>
</div>
<div class="col-md-8 mg-b-lg">
<input class="form-control" id="destinationSpecial" placeholder="Special Instructions" type="text" value="<?php echo $destinationInstructions;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">Status</div>
<div class="col-md-8">
<select class="form-control" id="status">
<option>Not confirmed</option>
<option>Confirmed</option>
<option>Left voice mail</option>
<option>No answer</option>
<option>Busy signal</option>
<option>Confirmed by CSR</option>
<option>Do Not Call</option>
<option>Confirmed by dispatch</option>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="destination">Confirmed By</label>
</div>
<div class="col-md-8">
<input class="form-control" id="confirmedBy" placeholder="Confirmed by" type="text" value="<?php echo $confirmedBy;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="weight">Weight</label>
</div>
<div class="col-md-8">
<input class="form-control" id="weight" placeholder="####" type="text" value="<?php echo $weight;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="weightType">Weight Type</label>
</div>
<div class="col-md-8">
<input class="form-control" id="weightType" type="text" value="<?php echo $weightType;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="vault">Vault/Pack Order</label>
</div>
<div class="col-md-8 mg-b-lg">
<input class="form-control" id="vault" placeholder="Type something" type="text" value="<?php echo $vaultPackOrder;?>">
</div>
</div>
<div class="col-md-12">
<h1 class="no-mg-t">Crew</h1>
</div>
<div class="col-md-12">
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="drivers">Driver(s)</label>
</div>
<div class="col-md-8">
<select class="form-control chosen-select" id="drivers" multiple>
<?php
$query="SELECT * FROM moverAdmin.employees WHERE canDrive>0;";
$drivers=query($query);
foreach($drivers as $key=>$driver){
echo '<option value="'.$driver['idemployees'].'">'.$driver['first'].' '.$driver['last'].'</option>';
}
?>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="laborers">Laborer(s)</label>
</div>
<div class="col-md-8">
<select class="form-control chosen-select" id="laborers" multiple>
<?php
$query="SELECT * FROM moverAdmin.employees;";
$laborers=query($query);
foreach($laborers as $key=>$laborer){
echo '<option value="'.$laborer['idemployees'].'">'.$laborer['first'].' '.$laborer['last'].'</option>';
}
?>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="driverNotes">Driver Notes</label>
</div>
<div class="col-md-8 mg-b-lg">
<input class="form-control" id="driverNotes" placeholder="Notes" type="text" value="<?php echo $notes;?>">
</div>
</div>
<div class="col-md-12">
<h1 class="no-mg-t">Equipment</h1>
</div>
<div class="col-md-12">
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="equipment">Equipment</label>
</div>
<div class="col-md-8">
<select class="form-control chosen-select" id="equipment" multiple>
<?php
$query="SELECT * FROM moverAdmin.equipment;";
$equipments=query($query);
foreach($equipments as $key=>$equipment){
echo '<option value="'.$equipment['idequipment'].'">'.$equipment['name'].'</option>';
}
?>
</select>
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="shuttleTruckNumber">Shuttle Truck Number</label>
</div>
<div class="col-md-8">
<input class="form-control" id="shuttleTruckNumber" placeholder="##" type="text" value="<?php echo $shuttleTruckNumber;?>">
</div>
<div class="clearfix"></div>
<div class="col-md-3 label">
<label for="insurance">Do daily insurance rates apply?</label><br>
</div>
<?php
$dailyInsYesCheckedString='';
$dailyInsNoCheckedString='';
if(isset($insuranceChargesApply) && ($insuranceChargesApply>0)){
$dailyInsYesCheckedString=' checked';
} else {
$dailyInsNoCheckedString=' checked';
}
?>
<div class="col-md-8">
<input checked id="insuranceYes" name="insurance" type="radio" value="1" <?php echo $dailyInsYesCheckedString;?>>
<label for="insuranceYes" onclick="">Yes</label>
<input id="insuranceNo" name="insurance" type="radio" value="0" <?php echo $dailyInsNoCheckedString;?>>
<label for="insuranceNo" onclick="">No</label>
</div>
<div class="clearfix"></div>
<div class="col-md-8 col-md-offset-3 mg-b-lg mg-t">
<button class="btn btn-default" id="submit" type="submit">
<?php
if($jobid=='new'){
echo 'Add ';
} else {
echo 'Save ';
}
?>
Job</button> <!-- /content wrapper -->
</div>
</div>
</section>
<!-- /main content -->
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="/js/chosen.jquery.min.js"></script> <!-- /core scripts -->
<!-- theme scripts -->
<script src="/js/global.js"></script> <script src="/js/off-canvas.js"></script>
<script src="/vendor/jquery.placeholder.js"></script>
<script src="/vendor/offline/offline.min.js"></script> <script src="/vendor/pace/pace.min.js"></script>
<script src="/js/main.js"></script> <script src="/plugins/datepicker/js/bootstrap-datepicker.js"></script>
<link href="http://jdewit.github.io/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet">
<script src="/plugins/timepicker/timepicker.js"></script> <!-- /theme scripts -->
<script type="text/javascript">
// hack for origin/destination states
$("#originState").val("<?php echo $originState; ?>");
$("#destinationState").val("<?php echo $destinationState; ?>");
// hack for status
$("#status").val("<?php echo $status; ?>");
//hack for multiselects
<?php
foreach($multiselects as $multiselect){
${"job".$multiselect."String"}='';
foreach(${"job".$multiselect} as $key=>${"job".$multiselect}){
${"job".$multiselect."String"}.=','.${"job".$multiselect};
}
?>
$("#<?php echo $multiselect;?>").val("<?php echo ${"job".$multiselect."String"}; ?>".split(","));
//$("#equipment").val("<?php echo ',1,3'; ?>".split(","));
<?php
}
?>
$("#phone").keyup(function(){
var text = $("#phone").val();
text = text.replace(/(\d{3})(\d{3})(\d{4})/, "$1-$2-$3");
$("#phone").val(text)
});
$('#startDate').datepicker({
todayBtn: "linked"
});
$('#endDate').datepicker({
todayBtn: "linked"
});
$( "#startDate" ).change(function() {
if($('#endDate').val() == ''){
$('#endDate').val($('#startDate').val());
}
});
$('#startTime').click(function(){
console.log('this');
//Convert bootstrap 2 timpicker to 3
if ( $(this).hasClass('icon-chevron-up') ) {
$(this).removeClass('icon-chevron-up').addClass('glyphicon glyphicon-chevron-up');
}
if ( $(this).hasClass('icon-chevron-down') ) {
$(this).removeClass('icon-chevron-down').addClass('glyphicon glyphicon-chevron-down');
}
});
$('#startTime').timepicker();
$('#onsiteTime').timepicker();
$(".chosen-select").chosen();
$('#submit').click(function() {
var formData = new FormData();
var formData = {
jobid:'<?php echo $jobid;?>',
startDate :$('#startDate').val(),
startTime :$('#startTime').val(),
onsiteTime :$('#onsiteTime').val(),
regNum :$('#regNumber').val(),
shipperName :$('#shipperName').val(),
shipperPhone :$('#phone').val(),
altShipperName :$('#altShipperName').val(),
altPhone :$('#altPhone').val(),
originAddress :$('#originAddr').val(),
originAptNum :$('#originAptNum').val(),
originCity :$('#originCity').val(),
originState :$('#originState').val(),
originZip :$('#originZip').val(),
originShuttle :$('input[name=originShuttle]:checked').val(),
originInstructions :$('#originSpecial').val(),
destinationAddress :$('#destination').val(),
destinationAptNum :$('#destinationAptNum').val(),
destinationCity :$('#destinationCity').val(),
destinationState :$('#destinationState').val(),
destinationZip :$('#destinationZip').val(),
destinationShuttle :$('input[name=destinationShuttle]:checked').val(),
destinationInstructions :$('#destinationSpecial').val(),
status :$('#status').val(),
confirmedBy :$('#confirmedBy').val(),
weight :$('#weight').val(),
weightType :$('#weightType').val(), //this posts an array or "undefined if nothing is selected"
vaultPackOrder :$('#vault').val(),
notes :$('#driverNotes').val(),
shuttleTruckNumber :$('#shuttleTruckNumber').val(),
moveTypes :$('#moveTypes').val(),
serviceTypes:$('#serviceTypes').val(),
drivers:$('#drivers').val(),
laborers:$('#laborers').val(),
equipment:$('#equipment').val(),
insuranceChargesApply :$('input[name=insurance]:checked').val()
};
console.log(formData);
$.ajax({
type: 'POST',
url: '/newJobAjax.php?action=saveJob',
data: formData,
encode: true,
success: function(result){
//alert(result);
//$('#submit').hide();
window.location.replace("/jobs");
},
fail: function(result){
alert('Request failed. Please reload the page and try again.');
}
});
});
</script><!-- /body -->
<!-- page level scripts -->
<!-- /page level scripts -->
</body>
</html>