forked from matteveland/inventory_old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_product.php
165 lines (136 loc) · 4.61 KB
/
view_product.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
<?php
/**
* view_product.php
*
* @package default
*/
$page_title = 'All Product';
require_once 'includes/load.php';
// Checkin What level user has permission to view this page
page_require_level(2);
if ( isset( $_GET['id'] ) )
{
$product = find_by_id('products', (int)$_GET['id']);
$all_categories = find_all('categories');
$all_photo = find_all('media');
if ( ! $product ) {
$session->msg("d", "Missing product id.");
redirect('products.php');
}
} else {
$session->msg("d", "Missing product id.");
redirect('products.php');
}
?>
<?php include_once 'layouts/header.php'; ?>
<div class="row">
<div class="col-md-6">
<?php echo display_msg($msg); ?>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading clearfix">
<strong>
<span class="glyphicon glyphicon-th"></span>
<span>Product Detail</span></strong>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-6">
<h4><?php echo remove_junk(first_character($product['name']));?></h4>
<div><label>Description:</label></div>
<div><?php echo remove_junk($product['description']); ?></div>
</div>
<div class="col-md-1">
</div>
<div class="col-md-4">
<?php
foreach ($all_photo as $photo) {
if ( $product['media_id'] == $photo['id'] ) {
?>
<img class="img-thumbnail" src="uploads/products/<?php echo $photo['file_name']; ?>" alt="">
<?php
}
}
?>
</div>
</div>
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-10">
<div class="text-center"><label></label></div>
</div>
</div>
<div class="row">
<div class="col-md-1">
</div>
<div class="col-md-10">
<div class="panel-body">
<table class="table table-bordered">
<thead>
<tr>
<!-- ************************* -->
<th class="text-center" style="width: 10%;"> Category </th>
<th class="text-center" style="width: 10%;"> Location </th>
<th class="text-center" style="width: 10%;"> SKU </th>
<th class="text-center" style="width: 10%;"> Stock </th>
<th class="text-center" style="width: 15%;"> Cost Price </th>
<th class="text-center" style="width: 15%;"> Sale Price </th>
<th class="text-center" style="width: 15%;"> Product Added </th>
<th class="text-center" style="width: 50px;"> Actions </th>
</tr>
<!-- ************************* -->
</thead>
<tbody>
<!-- ************************* -->
<tr>
<?php
foreach ($all_categories as $category ) {
if ( $product['category_id'] == $category['id'] ) {
break;
}
}
?>
<td class="text-center"> <?php echo remove_junk($category['name']); ?></td>
<td class="text-center"> <?php echo remove_junk($product['location']); ?></td>
<td class="text-center"> <?php echo remove_junk($product['sku']); ?></td>
<td class="text-center"> <?php echo remove_junk($product['quantity']); ?></td>
<td class="text-center"> <?php echo formatcurrency( $product['buy_price'], $CURRENCY_CODE); ?></td>
<td class="text-center"> <?php echo formatcurrency( $product['sale_price'], $CURRENCY_CODE); ?></td>
<td class="text-center"> <?php echo read_date($product['date']); ?></td>
<!-- ************************* -->
<td class="text-center">
<div class="btn-group">
<a href="add_stock.php?id=<?php echo (int)$product['id'];?>" class="btn btn-xs btn-warning" data-toggle="tooltip" title="Add">
<span class="glyphicon glyphicon-th-large"></span>
</a>
<a href="edit_product.php?id=<?php echo (int)$product['id'];?>" class="btn btn-info btn-xs" title="Edit" data-toggle="tooltip">
<span class="glyphicon glyphicon-edit"></span>
</a>
<a href="delete_product.php?id=<?php echo (int)$product['id'];?>" onClick="return confirm('Are you sure you want to delete?')" class="btn btn-danger btn-xs" title="Delete" data-toggle="tooltip">
<span class="glyphicon glyphicon-trash"></span>
</a>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<?php
// print "<pre>";
// print_r($product);
// print "</pre>\n";
?>
</div>
</div>
</div>
</div>
<?php include_once 'layouts/footer.php'; ?>