forked from OnkarKunjir/vector-cam
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_dashbord.php
164 lines (142 loc) · 6.27 KB
/
admin_dashbord.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
<?php
session_start();
if(!$_SESSION["admin"]){
header("location:http://127.0.0.1:8080/index.php");
die();
}
require "php_includes/db_handler.php";
$db = new db_handler;
$account = $db->get_admin_info($_SESSION["email"]);
// $featured_products = $db->get_featured_products();
// $products = $db->get_products();
$products = array_merge( $db->get_featured_products() , $db->get_products());
?>
<!DOCTYPE html>
<html>
<head>
<title>Dashbord</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/main.css">
<link rel="stylesheet" href="static/css/admin_dashbord.css">
</head>
<body>
<?php
require "php_includes/nav_bar.php";
?>
<main>
<div class="side-bar">
<div class="side-bar-item active-side-bar-item" onclick="update_sidebar(0)"><p>Overview</p></div>
<div class="side-bar-item" onclick="update_sidebar(1)"><p>Products</p></div>
<div class="side-bar-item" onclick="update_sidebar(2)"><p>Orders</p></div>
</div>
<div id="top"></div>
<div class="page-container" id="overview">
<div class="overview-content">
<h1>Accounts</h1>
<p><?php echo $db->count_accounts();?></p>
</div>
<div class="overview-content">
<h1>Products</h1>
<p><?php echo $db->count_products();?></p>
</div>
<div class="overview-content">
<h1>Sale</h1>
<p><?php echo $db->sum_transactions();?> ₹</p>
</div>
</div>
<div class="page-container hidden" id="products">
<div class="products-content">
<h1>Products</h1>
<?php
foreach($products as $p){
echo('
<div class="product" id="'.$p["product_id"].'-card">
<div class="product-image">
<img src="static/images/products/'.$p["product_id"].'/'.$p["product_id"].'.jpg" alt="">
</div>
<div class="product-details">
<h3>'.$p["product_name"].'</h3>
<p>'.$p["summary"].'</p>
<button id="'.$p["product_id"].'" onclick="remove_product(this)">Remove</button>
</div>
</div>
');
}
?>
<div class="fab-btn" id="add-product-btn">
<div class="fab-btn-content">
<a href="static/add_product.html">+</a>
</div>
</div>
<div class="fab-btn" id="back-to-top">
<div class="fab-btn-content">
<a href="#top">^</a>
</div>
</div>
</div>
</div>
<div class="page-container hidden" id="orders">
<p>Orders</p>
<?php
$users = $db->get_ordes_email();
foreach($users as $user){
echo('
<div class="order-customer-row">
<p>'.$user["email"].'</p>
');
$orders = $db->get_orders($user["email"]);
foreach($orders as $order){
$product = $db->get_product_info($order["product_id"]);
echo('
<div class="customer-order-row">
<div class="order-row-info">
<p>
<b>'.$product["product_id"].'</b> <br>
'.$order["price"].' ₹ <br>
'.$order["placed_date"].'
</p>
</div>
<div class="order-row-address">
<p>
'.$order["address"].'
</p>
</div>
</div>
');
}
echo('
</div>
');
}
?>
<!-- <div class="order-customer-row">
<p>[email protected]</p>
<div class="customer-order-row">
<div class="order-row-info">
<p>
<b>Vector cam</b> <br>
399 ₹ <br>
2020-03-11
</p>
</div>
<div class="order-row-address">
<p>
this is address okay.
</p>
</div>
</div>
</div> -->
<div class="fab-btn" id="back-to-top">
<div class="fab-btn-content">
<a href="#top">^</a>
</div>
</div>
</div>
</main>
<div class="toast hidden" id="success-toast"><p>Successful</p></div>
<div class="toast hidden" id="fail-toast"><p>Failed</p></div>
</body>
<script src="static/js/admin_dashbord.js"></script>
</html>