-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview_indexCustomer.php
111 lines (106 loc) · 5.69 KB
/
view_indexCustomer.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
<?php
require("controller_Customer.php");
// ngga usah pakai include soalnya hanya bertujuan untuk bisa mengenali file controller nya
// (ngga usah include semua yang ada di controller)
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Customer Page</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col p-0">
<?php
include("navbar.php");
?>
</div>
</div>
<div class="row mt-3 mb-3">
<div class="col d-flex justify-content-center">
<div class="card text-center" style="width: 1000px;">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="view_indexCustomer.php">Customer List</a>
</li>
<li class="nav-item">
<a class="nav-link" href="view_addCustomer.php">Add Customer</a>
</li>
</ul>
</div>
<div class="card-body">
<h1>Customer List</h1>
<table class="table table-dark table-striped-columns">
<thead>
<tr>
<th scope="col">No</th>
<th scope="col">Name</th>
<th scope="col">Profile Photo</th>
<th scope="col">Address</th>
<th scope="col">Email</th>
<th scope="col">Birthdate</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_SESSION['customerList'])) {
$customerList = read_Customer();
$id = 1;
if (count($customerList) > 0) {
foreach ($customerList as $index => $customer) {
?>
<tr>
<th scope="row"><?php echo $id; ?></th>
<td><?php echo $customer->name; ?></td>
<td>
<?php
echo '<img src="uploads/' . $customer->fileName . '" alt="' . $customer->fileName . '" style="width: 150px;">';
?>
</td>
<td><?php echo $customer->address; ?></td>
<td><?php echo $customer->email; ?></td>
<td style="width: 100px;"><?php echo $customer->birthdate; ?></td>
<td>
<a href="view_updateCustomer.php?updateCustomerID=<?php echo $index; ?>">
<button class="btn btn-warning mb-2">Update</button>
</a>
<br>
<a href="controller_Customer.php?deleteCustomerID=<?php echo $index; ?>" onclick="return confirm('Are you sure want to delete this customer?')">
<button class="btn btn-danger">Delete</button>
</a>
</td>
<?php
$id++;
?>
</tr>
<?php
}
} else {
?>
<tr>
<td colspan="7" class="p-5">
<div class="alert alert-danger" role="alert">
Oops.. There is no Customer Data!
</div>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4" crossorigin="anonymous"></script>
</body>
</html>