01.
<?php session_start();
02.
if
(!isset(
$_SESSION
[
'UserID'
])) {
03.
$_SESSION
[
'UserID'
] =
''
;
04.
$_SESSION
[
'Username'
] =
''
;
05.
}
06.
07.
include
'admin/Function/comfig.php'
;
08.
$sql
=
'SELECT * FROM product'
;
09.
$query
= mysqli_query(
$objCon
,
$sql
);
10.
?>
11.
<div
class
=
"container"
>
12.
<div
class
=
"card-body"
>
13.
<div
class
=
"table-responsive"
>
14.
<table
class
=
"table table-bordered"
id=
"dataTable"
width=
"100%"
cellspacing=
"0"
>
15.
<thead
class
=
"thead-dark text-center"
>
16.
<th scope=
"2"
>ยี่ห้อ</th>
17.
<th scope=
"col"
>รุ่น</th>
18.
<th scope=
"col"
>ชื่ออุปกรณ์</th>
19.
<th scope=
"col"
>จำนวน</th>
20.
<th scope=
"col"
>วันที่นำเข้า</th>
21.
<th>รูปสินค้า</th>
22.
<th></th>
23.
<tbody
class
=
"text-center"
>
24.
<?php
while
(
$result
= mysqli_fetch_array(
$query
, MYSQLI_ASSOC)) {
25.
?>
26.
<tr>
27.
<th><?php
echo
$result
[
'Brand'
]; ?></th>
28.
<th><?php
echo
$result
[
'Generation'
]; ?></th>
29.
<th><?php
echo
$result
[
'Device_name'
]; ?></th>
30.
<th><?php
echo
$result
[
'value'
]; ?></th>
31.
<th><?php
echo
$result
[
'Amount'
]; ?></th>
32.
<th><img src=
"admin/img/<?= $result['Brand_img']; ?>"
style=
"width:100px"
></th>
33.
<th><button
class
=
"btn btn-dark"
data-toggle=
"modal"
data-target=
"#product"
data-id=
"<?php echo $result['id']; ?>"
>ยืม<?php
echo
$result
[
'id'
]; ?></button></th>
34.
<?php
35.
} mysqli_close(
$objCon
); ?>
36.
</tr>
37.
</tbody>
38.
</table>
39.
</div>
40.
</div>
41.
</div>
42.
43.
<div
class
=
"modal fade"
id=
"product"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"Productid"
aria-hidden=
"true"
>
44.
45.
<div
class
=
"modal-dialog"
role=
"document"
>
46.
<div
class
=
"modal-content"
>
47.
<div
class
=
"modal-header"
>
48.
<h5
class
=
"modal-title"
id=
"Productid"
>ยืม อุปกรณ์ไอที <?php
echo
$result
[
'id'
]; ?></h5>
49.
<button type=
"button"
class
=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
50.
<span aria-hidden=
"true"
>×</span>
51.
</button>
52.
53.
</div>
54.
<form action=
"laypang/add.php"
method=
"post"
name=
"form"
id=
"demo-form2"
data-parsley-validate
class
=
"form-horizontal form-label-left"
>
55.
<?php
$return_date
=
date
((
'Y-m-d'
),
strtotime
(
'+15 days'
,
strtotime
(
date
(
'Y-m-d'
)))); ?>
56.
<div
class
=
"modal-body"
>
57.
<div
class
=
"form-group"
>
58.
<input type=
"date"
id=
"borrow_date"
required=
"required"
class
=
"form-control"
name=
"borrow_date"
value=
"<?php echo date('Y-m-d'); ?>"
>
59.
</div>
60.
<div
class
=
"form-group"
>
61.
<select
class
=
"form-control"
id=
"borrow_num"
name=
"borrow_num"
>>
62.
<option value=
"1"
>1</option>
63.
<option value=
"2"
>2</option>
64.
<option value=
"3"
>3</option>
65.
<option value=
"4"
>4</option>
66.
<option value=
"5"
>5</option>
67.
<option value=
"6"
>6</option>
68.
<option value=
"7"
>7</option>
69.
<option value=
"8"
>8</option>
70.
<option value=
"9"
>9</option>
71.
<option value=
"10"
>10</option>
72.
</select>
73.
</div>
74.
<div
class
=
"form-group"
>
75.
<input type=
"date"
id=
"return_date"
required=
"required"
class
=
"form-control"
name=
"return_date"
value=
"<?php echo $return_date; ?>"
>
76.
</div>
77.
78.
</div>
79.
<div
class
=
"modal-footer"
>
80.
<button type=
"reset"
class
=
"btn btn-secondary"
data-dismiss=
"modal"
>Close</button>
81.
<button type=
"submit"
class
=
"btn btn-primary"
>Save changes</button>
82.
<input TYPE=
"hidden"
NAME=
"UserID"
value=
"<?php echo $_SESSION['UserID']; ?>"
>
83.
<input TYPE=
"hidden"
NAME=
"product_id"
value=
"<?php echo $result['id']; ?>"
>
84.
85.
</form>
86.
</div>
87.
</div>
88.
</div>
89.
</div>