-
Notifications
You must be signed in to change notification settings - Fork 0
/
clientListingsPage.php
168 lines (154 loc) · 6.05 KB
/
clientListingsPage.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
<?php
session_start();
if(isset($_SESSION['clientName'])) $clientName=$_SESSION['clientName'];
if(isset($_SESSION['clientID'])) $clientID=$_SESSION['clientID'];
require_once("db.php");
if (isset($_POST["submit"])) {
if(isset($_POST["listingID"])) $_SESSION['listingID']=$_POST["listingID"];
Header("Location: clientListingDetailView.php");
}
?>
<html lang="en" dir="ltr">
<head>
<title>Reynholm Industries</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="stylesheet.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<meta charset="utf-8">
</head>
<body onload="clearAll()">
<img src="reynholm.jpg" height=5% width=5% />
<ul class="nav nav-tabs">
<li class="active"><a href="clientLanding.php">Home</a></li>
<li><a href="clientListingsPage.php">Your Listings</a></li>
<li><a href="clientCurrentLoads.php">Loads in Transit</a></li>
<li><a href="clientPastLoads.php">Past Loads</a></li>
<li><a href="createListing.php">Create Listing</a></li>
<li><a href="clientAccountManagement.php">Manage Account</a></li>
</ul>
<script src="//cdnjs.cloudflare.com/ajax/libs/d3/4.7.2/d3.min.js"></script>
<script src="d3pie.min.js"></script>
<script>
function clearAll()
{document.getElementById("originDropdown").innerHTML="<?php
$sql="select distinct origin from listing where clientID='$clientID'";
$result = $mydb->query($sql);
echo "<select id='originDropdown' name='originDropdown'><option value=''></option>";
while($row=mysqli_fetch_array($result)){
$Selection=$row["origin"];
echo "<option value = '$Selection'>$Selection</option>";
}
echo "</select>";
?>";
document.getElementById("destinationDropdown").innerHTML="<?php
$sql="select distinct destination from listing where clientID='$clientID'";
$result = $mydb->query($sql);
echo "<select id='destinationDropdown'><option value=''></option>";
while($row=mysqli_fetch_array($result)){
$Selection=$row["destination"];
echo "<option value = '$Selection'>$Selection</option>";
}
echo "</select>";
?>"
document.getElementById("maxRPM").value="";
document.getElementById("minRPM").value="";
document.getElementById("maxWeight").value="";
document.getElementById("minWeight").value="";
document.getElementById("maxMiles").value="";
document.getElementById("minMiles").value="";
$(function(){
$.ajax({url:"clientListingsPageBackend.php?originDropdown="+
$("#originDropdown").val()+"&maxRPM="+
$("#maxRPM").val()+"&maxWeight="+
$("#maxWeight").val()+
"&destinationDropdown="+
$("#destinationDropdown").val()+
"&minRPM="+$("#minRPM").val()+
"&minWeight="+$("#minWeight").val()+
"&minMiles="+$("#minMiles").val()+
"&maxMiles="+$("#maxMiles").val()+
"&state="+$("#state").val(),
async:true,
success:function(result){
$("#contentArea").html(result);
}
})
})
}
</script>
<div style="left-margin:auto;right-margin:auto;display:block;width:850px;">
<table style="text-align:center;left-margin:auto;right-margin:auto;display:block;">
<tr>
<td>Origin:</td>
<td><?php
$sql="select distinct origin from listing where clientID='$clientID'";
$result = $mydb->query($sql);
echo "<select id='originDropdown' name='originDropdown'><option value=''></option>";
while($row=mysqli_fetch_array($result)){
$Selection=$row["origin"];
echo "<option value = '$Selection'>$Selection</option>";
}
echo "</select>";
?></td>
<td>Maximum Rate/Mile:</td>
<td><input type="number" id="maxRPM" name="maxRPM" value="" /></td>
<td>Minimum Rate/Mile:</td>
<td><input type="number" name="minRPM" id="minRPM" value="" /></td>
</tr>
<tr>
<td>Destination:</td>
<td><?php
$sql="select distinct destination from listing where clientID='$clientID'";
$result = $mydb->query($sql);
echo "<select id='destinationDropdown'><option value=''></option>";
while($row=mysqli_fetch_array($result)){
$Selection=$row["destination"];
echo "<option value = '$Selection'>$Selection</option>";
}
echo "</select>";
?></td>
<td>Maximum Weight:</td>
<td><input type="number" id="maxWeight" name="maxWeight" value="" /></td>
<td>Minimum Weight:</td>
<td><input type="number" id="minWeight" name="minWeight" value="" /></td>
</tr>
<tr>
<td><input type="hidden" name="state" id="state" value="" /></td>
<td><button id="resetSearch" name="resetSearch" onclick="clearAll();">Reset Search</button></td>
<td>Maximum Miles:</td>
<td><input type="number" name="maxMiles" id="maxMiles" value="" /></td>
<td>Minimum Miles:</td>
<td><input type="number" name="minMiles" id="minMiles" value="" /></td>
</tr>
</table>
</div>
<script src="jquery-3.1.1.min.js"></script>
<script>
$(function(){
$("#maxMiles, #maxRPM, #maxMiles, #maxWeight, #minMiles, #minWeight, #minRPM, #destinationDropdown, #originDropdown").change(function(){
$.ajax({url:"clientListingsPageBackend.php?originDropdown="+
$("#originDropdown").val()+"&maxRPM="+
$("#maxRPM").val()+"&maxWeight="+
$("#maxWeight").val()+
"&destinationDropdown="+
$("#destinationDropdown").val()+
"&minRPM="+$("#minRPM").val()+
"&minWeight="+$("#minWeight").val()+
"&minMiles="+$("#minMiles").val()+
"&maxMiles="+$("#maxMiles").val()+
"&state="+$("#state").val(),
async:true,
success:function(result){
$("#contentArea").html(result);
}
})
})
})
</script>
<div id="contentArea"></div>
<p style='margin-left: auto; display: block; margin-right: auto;'>
<a style="" href="logout.php">Click here to log out</a>
</p>
</body>
</html>