-
Notifications
You must be signed in to change notification settings - Fork 0
/
searchBycar.js
113 lines (101 loc) · 3.64 KB
/
searchBycar.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
$(document).ready(function () {
$('#infoTable').on('click', 'tbody tr', function (event) {
$(this).addClass('highlight').siblings().removeClass('highlight');
console.log(this);
$("td", this).each(function (j) {
console.log(j);
});
});
$("#filter-form").submit(function (event) {
$(".help-block").remove();
const formData = {
year: $('#year-filter').val(),
color: $('#color-filter').val(),
model: $('#model-filter').val(),
status: $('#status-filter').val(),
louza : $('#CarID').val(),
start : $('#StartDate').val(),
end : $('#EndDate').val(),
};
console.log(formData);
//validate(formData);
$.ajax({
type: "POST",
url: 'filterBycar.php',
data: formData,
dataType: "json",
encode: true,
})
.done(function (data) {
// console.log(data);
$('#infoTable').bootstrapTable({
toggle: true,
pagination: true,
striped: true,
pageSize: 10,
clickToSelect: true,
columns: [{
field: 'rid',
title: 'res_ID'
},{
field: 'cid',
title: 'customer_ID'
},{
field: 'id',
title: 'Car_ID'
},{
field: 'pick',
title: 'pickup_Date'
},{
field: 'return',
title: 'return_Date'
},{
field: 'm',
title: 'model'
}, {
field: 'y',
title: 'year'
}, {
field: 'c',
title: 'color'
},{
field: 's',
title: 'status'
},{
field: 'o',
title: 'office_id'
},{
field: 'p',
title: 'price/day'
},{
field: 'res',
title: 'res_Date'
}],
data: data
});
})
.fail(function (jqXHR, exception) {
console.log("Fail");
// Our error logic here
var msg = '';
if (jqXHR.status === 0) {
msg = 'Not connect.\n Verify Network.';
} else if (jqXHR.status == 404) {
msg = 'Requested page not found. [404]';
} else if (jqXHR.status == 500) {
msg = 'Internal Server Error [500].';
} else if (exception === 'parsererror') {
msg = 'Requested JSON parse failed.';
} else if (exception === 'timeout') {
msg = 'Time out error.';
} else if (exception === 'abort') {
msg = 'Ajax request aborted.';
} else {
msg = 'Uncaught Error.\n' + jqXHR.responseText;
}
alert(msg);
$('#post').html(msg);
});
event.preventDefault();
});
});