-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
151 lines (129 loc) · 3.08 KB
/
index.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
<?php include 'connect.php'; ?>
<?php include 'query.php'; ?>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
}
body{
margin: 0px;
padding: 0px;
margin-top: 24px;
}
.topbar{
overflow: hidden;
background-color: #db0536;
position: fixed;
top: 0;
width: 100%;
display: inline-block;
}
/* The sidepanel menu */
.sidepanel {
height: 100%;
width: 0;
position: fixed;
top: 0;
left: 0;
background-color: #e6e6e6;
overflow-x: hidden;
padding-top: 60px;
transition: 0.2s;
}
.sidepanel a:hover {
color: #fb3765;
}
.sidepanel .closebtn {
position: absolute;
top: 0;
left: 0;
font-size: 12px;
margin-left: 0;
}
.sidepanel .exportbtn {
position: absolute;
top: 0;
right: 0;
font-size: 12px;
margin-right: 0;
}
.openbtn {
font-size: 12px;
cursor: pointer;
background-color: #db0536;
color: white;
border: none;
}
.openbtn:hover {
background-color: #fb3765;
}
.remove{
color: red;
font-size:24px;
cursor: pointer;
}
</style>
<script type= "text/javascript" src="result_query.js"></script>
</head>
<body>
<div class="topbar">
<button class="openbtn" onclick="openCart()">☰ Show Cart</button>
</div>
<div class="logo">
<img src= "http://**.**.**.***/logo.jpg" alt="Logo" style = "height:75px;float:right">
</div>
<h1>Quoting Database Tool v1.0</h1>
<div class = "search">
<form id = "search_form" method = "get" onsubmit="return false;">
<label> Search Category: </label>
<select id = "category" name="category" onchange="highlight_column(); filter();">
<option value="N/A">--Select--</option>
<option value="hardware_description">Hardware Description</option>
<option value="hardware_category">Hardware Category</option>
<option value="manufacturer">Manufacturer</option>
<option value="manufacturer_PN">Manufacturer PN</option>
<option value="vendor">Vendor</option>
<option value="vendor_PN">Vendor PN</option>
<option value="project_number">Project Number</option>
</select>
<label>Search Criteria <input id = "criteria" type="text" name="criteria" onkeyup="filter()" onsubmit="return false;" onfocus="this.value=''"/></label>
</form>
</div>
<button onclick="clearCart()">Clear Shopping Cart</button>
<div id = "cart_panel" class = "sidepanel">
<button class="closebtn" onclick="closeCart()">☰Close Cart</button>
<button class="exportbtn" onclick="getShoppingCartData()">Export Shopping Cart</button>
<ul id= "shopping_cart" style="list-style-type:disc"></ul>
<p id="my_cart"></p>
<p id = "test1"></p>
</div>
<?php
$conn = connect_db();
$result = query_sql($conn);
$json = array();
if($result->num_rows >0){
while($row = $result->fetch_assoc()){
$json[] = $row;
}
}else{echo "0 results";}
?>
<script>
var result = <?php echo json_encode($json) ?>;
var shopping_cart = [];
if(result!=null){
gen_table(result);
}
export_json = JSON.stringify(shopping_cart);
</script>
<?php
$export_array = json_decode($_POST['export_json']);
?>
<div id="table_container"></div>
</body>
</html>