-
Notifications
You must be signed in to change notification settings - Fork 2
/
updatePegawai.php
130 lines (121 loc) · 5.65 KB
/
updatePegawai.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
<?php
session_start();
require 'class.php';
if (!isset($_SESSION['uname']) && !isset($_SESSION['pwd'])) {
header("location: login.php");
}
$username = $_SESSION['uname'];
$role = $_SESSION['role'];
$id = $_GET['id'];
$row = (new Pegawai)->bacaDataById($id)->fetch_assoc();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dapur Perdana</title>
<link rel="stylesheet" href="dashboardstyle.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css" />
</head>
<body>
<div class="overlay" id="overlay"></div>
<nav class="sidebar">
<a class="logo">Dapur Perdana</a>
<div class="menu-content">
<ul class="menu-items">
<li class="item">
<a href="index.php"><i class="fa-solid fa-gauge-high"></i>Dashboard</a>
</li>
<li class="item">
<a href="supplier.php"><i class="fa-solid fa-truck-field"></i>Supplier</a>
</li>
<li class="item">
<div class="submenu-item">
<span> <i class="fa-solid fa-box"></i>Produk</span>
<i class="fa-solid fa-chevron-right"></i>
</div>
<ul class="menu-items submenu">
<div class="menu-title">
<i class="fa-solid fa-chevron-left"></i>
Produk
</div>
<li class="item">
<a href="kategoriproduk.php"> <i class="fa-solid fa-circle"></i>Kategori Produk</a>
</li>
<li class="item">
<a href="daftarproduk.php"><i class="fa-solid fa-circle"></i>Daftar Produk</a>
</li>
</ul>
</li>
<li class="item">
<a href="penyesuaian.php"> <i class="fa-solid fa-boxes-stacked"></i>Penyesuaian</a>
</li>
<li class="item">
<div class="submenu-item">
<span> <i class="fa-solid fa-book"></i>Laporan</span>
<i class="fa-solid fa-chevron-right"></i>
</div>
<ul class="menu-items submenu">
<div class="menu-title">
<i class="fa-solid fa-chevron-left"></i>
Laporan
</div>
<li class="item">
<a href="laporanpenjualan.php"> <i class="fa-solid fa-circle"></i>Laporan Penjualan</a>
</li>
</ul>
</li>
<?php
if ($role == 'pemilik') {
echo '<li class="item">';
echo '<a href="pegawai.php"> <i class="fa-solid fa-user-plus"></i>Pegawai</a>';
echo '</li>';
}
?>
<li class="item">
<a href="logout.php"> <i class="fa-solid fa-arrow-right-from-bracket"></i>Logout</a>
</li>
</ul>
<div class="user-profile">
<i class="fas fa-user-circle user-icon"></i>
<?php echo '<span class="user-name">' . $username . '</span>'; ?>
</div>
</div>
</nav>
<form class="form-container popup-form" method="POST" action="updatePegawai_proses.php">
<span class="form-title">Edit Pegawai</span>
<input type="text" placeholder="Username" required name="edit_username" value="<?php echo isset($row['username']) ? $row['username'] : ''; ?>">
<input type="text" placeholder="Nama" required name="edit_nama" value="<?php echo isset($row['nama']) ? $row['nama'] : ''; ?>">
<div class="password-container">
<input type="password" placeholder="Password" required name="edit_password" id="passwordInput" value="<?php echo isset($row['password']) ? $row['password'] : ''; ?>">
<span class="toggle-password" onclick="togglePassword()"><i class="fas fa-eye" id="toggleIcon"></i></span>
</div>
<select name="edit_role" required>
<option value="" disabled>Select Role</option>
<option value="pemilik" <?php echo isset($row['role']) && $row['role'] === 'pemilik' ? 'selected' : ''; ?>>Pemilik</option>
<option value="karyawan" <?php echo isset($row['role']) && $row['role'] === 'karyawan' ? 'selected' : ''; ?>>Karyawan</option>
</select>
<input type="hidden" name="id" value="<?= $row['id'] ?>">
<div class="button-container">
<a type="button" class="cancel-button" href="pegawai.php" style='text-decoration:none;text-align:center'>Cancel</a>
<button type="submit" class="submit-button" id="submitEditForm" name="submit">Edit</button>
</div>
</form>
<script>
function togglePassword() {
var passwordInput = document.getElementById("passwordInput");
var toggleIcon = document.getElementById("toggleIcon");
if (passwordInput.type === "password") {
passwordInput.type = "text";
toggleIcon.classList.remove("fa-eye");
toggleIcon.classList.add("fa-eye-slash");
} else {
passwordInput.type = "password";
toggleIcon.classList.remove("fa-eye-slash");
toggleIcon.classList.add("fa-eye");
}
}
</script>
</body>
</html>