This commit is contained in:
ns77@siliconpin.com
2025-09-03 14:04:44 +00:00
parent 10881c6a5b
commit 533d1b572d
12 changed files with 410 additions and 218 deletions

View File

@@ -59,21 +59,45 @@ date_default_timezone_set('Asia/Kolkata');
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
<li><a href="/Admin/Create_AC_FD">New FD</a></li>
<li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
<li><a href="/Admin/Add_group">Add New Group</a></li>
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
<li><a href="/Admin/Trans_New">Transaction</a></li>
<li><a href="/Admin/Due">Deemand Sheet</a></li>
<li><a href="/Admin/Report">Report</a></li>
<!-- <li><a href="/Admin/Revert">Revert</a></li> -->
<?php
if($_SESSION['type'] === 'admin'){ ?>
<li><a href="/Admin/agent_View_report">Commission</a></li>
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
<?php } ?>
<?php
$userType = $_SESSION['type'] ?? '';
if ($userType === 'admin') {
// Admin gets everything
?>
<li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
<li><a href="/Admin/Create_AC_FD">New FD</a></li>
<li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
<li><a href="/Admin/Add_group">Add New Group</a></li>
<li><a href="/Admin/Trans_New">Transaction</a></li>
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
<li><a href="/Admin/agent_View_report">Commission</a></li>
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
<li><a href="/Admin/Report">Report</a></li>
<li><a href="/Admin/Due">Deemand Sheet</a></li>
<li><a href="/Admin/Settings_Agent">Agent Settings</a></li>
<?php
} elseif ($userType === 'bm') {
// Branch Manager menu
?>
<li><a href="/Admin/Create_AC_Recurring">New Recurring</a></li>
<li><a href="/Admin/Create_AC_FD">New FD</a></li>
<li><a href="/Admin/Create_AC_Loan">New Loan</a></li>
<li><a href="/Admin/Add_group">Add New Group</a></li>
<li><a href="/Admin/Trans_New">Transaction</a></li>
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
<li><a href="/Admin/agent_View_report">Commission</a></li>
<?php
} elseif ($userType === 'agent') {
// Agent menu
?>
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
<li><a href="/Admin/Due">Deemand Sheet</a></li>
<li><a href="/Admin/Report">Report</a></li>
<li><a href="/Admin/agent_View_report">Commission</a></li>
<?php
}
?>
</ul>
<ul class="nav navbar-nav navbar-right">
@@ -82,4 +106,4 @@ date_default_timezone_set('Asia/Kolkata');
</ul>
</div>
</div>
</nav>
</nav>

View File

@@ -28,7 +28,7 @@
while($a = $agents->fetch_assoc()){
$selected = (isset($_GET['agent']) && $_GET['agent']==$a['user_id']) ? "selected" : "";
echo "<option value='".$a['user_id']."' $selected>".$a['user_name']." (".$a['user_id'].")</option>";
}
}
}
?>
</select>
@@ -113,11 +113,12 @@ function report_view($type, $dt) {
$result = $conn->query($sql);
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes"));
echo "
<tr>
<td>".$row["AT_ID"]."</td>
".($_SESSION['type'] === 'admin' ? "<td>".$row["AA_AGENT"]."</td>" : "")."
<td>".$row["AT_TIMESTAMP"]."</td>
<td>".$kolkataTime."</td>
<td>".$row["AT_ACID"]."</td>
<td>".$row["AA_NAME"]."</td>
<td>".$row["AT_AMOUNT"]."</td>

View File

@@ -7,42 +7,56 @@
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// grafinn01
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user_id = $_POST['user_id'];
$user_id = $_POST['user_id'];
$user_name = $_POST['user_name'] ?? '';
$user_phone = $_POST['user_phone'] ?? '';
$type = $_POST['type'] ?? 'agent';
$comiRate = $_POST['comi_rate'] ?? null;
$passwordPlain = $_POST['password'] ?? '';
if (empty($_POST['user_name']) || empty($_POST['user_phone']) || empty($_POST['password'])) {
die("All fields are required.");
}
// Validation
if (empty($user_name) || empty($user_phone) || empty($passwordPlain)) {
$error = "All fields are required.";
} elseif (!preg_match("/^[0-9]{10}$/", $user_phone)) {
$error = "Invalid phone number format.";
} else {
$password = password_hash($passwordPlain, PASSWORD_DEFAULT);
$user_name = $_POST['user_name'];
$user_phone = $_POST['user_phone'];
$type = $_POST['type'] ?? 'agent';
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
// Profile Picture Upload
$profilePicPath = null;
if (isset($_FILES['profile_pic']) && $_FILES['profile_pic']['error'] === UPLOAD_ERR_OK) {
$uploadDir = __DIR__ . "/picture/";
if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
$fileTmp = $_FILES['profile_pic']['tmp_name'];
$fileName = time() . "_" . basename($_FILES['profile_pic']['name']);
$filePath = $uploadDir . $fileName;
if (move_uploaded_file($fileTmp, $filePath)) {
$profilePicPath = "picture/" . $fileName;
} else {
$error = "Failed to upload profile picture.";
}
}
if (!preg_match("/^[0-9]{10}$/", $user_phone)) {
die("Invalid phone number format");
}
if (!isset($error)) {
$table = $GLOBALS['arif_users'] ?? 'arif_users';
$sql = "INSERT INTO `$table`
(user_id, password, type, user_name, user_phone, comi_rate, profile_pic)
VALUES (?, ?, ?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssssss", $user_id, $password, $type, $user_name, $user_phone, $comiRate, $profilePicPath);
$table = $GLOBALS['arif_users'] ?? 'arif_users';
$sql = "INSERT INTO `$table` (user_id, password, type, user_name, user_phone) VALUES (?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Prepare failed: " . $conn->error);
}
$stmt->bind_param("sssss", $user_id, $password, $type, $user_name, $user_phone);
if ($stmt->execute()) {
echo "<div class='alert alert-success'>User <strong>{$user_name}</strong> added successfully.</div>";
} else {
echo "<div class='alert alert-danger'>Failed to add user <strong>{$user_name}</strong>. Error: " . $stmt->error . "</div>";
}
$stmt->close();
$conn->close();
if ($stmt->execute()) {
$success = "User <strong>{$user_name}</strong> added successfully.";
} else {
$error = "Failed to add user: " . $stmt->error;
}
$stmt->close();
}
}
}
$getAgentListsQuery = "SELECT * FROM " . $GLOBALS['arif_users'] . " ORDER BY type, user_id";
@@ -65,7 +79,7 @@
<div class="container">
<h3>Add New Agent</h3><hr>
<form method="post">
<form method="post" enctype="multipart/form-data">
<div class="row">
<!-- Left Column -->
<div class="col-md-6">
@@ -84,17 +98,27 @@
</div>
<div class="form-group">
<label for="type">User Type</label>
<select class="form-control" id="type" name="type" required>
<option value="agent" selected>Agent</option>
<select onchange="showCommissionField();" class="form-control" id="user-type" name="type" required>
<option value="">-Select-</option>
<option value="agent" >Agent</option>
<option value="admin">Admin</option>
<option value="supervisor">Supervisor</option>
<option value="bm">BRanch Manager</option>
</select>
</div>
<div class="form-group" id="commission-field" style="display: none;">
<label for="comi_rate">Commission Rate (%)</label>
<input type="number" class="form-control" id="comi_rate" name="comi_rate" value="3" placeholder="" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" name="password" placeholder="Enter Password" required>
</div>
<div class="form-group">
<label for="profile_pic">Profile Picture</label>
<input type="file" class="form-control" id="profile_pic" name="profile_pic" accept="image/*">
</div>
<div class="form-group">
<button type="submit" class="btn btn-success w-100">Add Agent</button>
@@ -115,10 +139,12 @@
<thead class="thead-dark">
<tr>
<th>ID</th>
<th>Profile</th>
<th>User ID</th>
<th>User Type</th>
<th>Name</th>
<th>Phone</th>
<th>Comi Rate (%)</th>
<th>Actions</th>
</tr>
</thead>
@@ -127,6 +153,14 @@
<?php foreach ($agentList as $user): ?>
<tr>
<td><?php echo htmlspecialchars($user['id']); ?></td>
<td>
<?php if(!empty($user['profile_pic'])): ?>
<img src="/CONTENT/ROOT_URI/Admin/<?php echo $user['profile_pic']; ?>" width="40" height="40" style="border-radius:50%;">
<?php else: ?>
<span>No Photo</span>
<?php endif; ?>
</td>
<td><?php echo htmlspecialchars($user['user_id']); ?></td>
<td class="badge-cell">
<span class="badge <?php echo $user['type'] === 'admin' ? 'badge-primary' : 'badge-secondary'; ?>">
@@ -135,6 +169,7 @@
</td>
<td><?php echo htmlspecialchars($user['user_name']); ?></td>
<td><?php echo htmlspecialchars($user['user_phone']); ?></td>
<td><?php echo htmlspecialchars($user['comi_rate']); ?></td>
<td>
<a href="edit_user?id=<?php echo $user['id']; ?>" class="btn btn-sm btn-warning">Edit</a>
<?php if($user['type'] !== 'admin') { ?>
@@ -234,6 +269,18 @@
}
notif.innerHTML = res_txt;
}
function showCommissionField(){
const selectedUserType = document.getElementById('user-type').value;
const commissionField = document.getElementById('commission-field');
if(selectedUserType === 'agent'){
commissionField.style.display = 'block';
}else{
commissionField.style.display = 'none';
}
}
</script>

View File

@@ -382,11 +382,12 @@ if(isset($_GET["no"])){
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
//$ID=$row["GC_ID"];
$kolkataTime = date("d M Y, h:i A", strtotime($row["AT_TIMESTAMP"] . " +5 hours 30 minutes"));
echo "
<tr>
<td>".$rowcount. "</td>
<td>".$row["AT_ID"]. "</td>
<td>".$row["AT_TIMESTAMP"]. "</td>
<td>".$kolkataTime. "</td>
<td>".$row["AT_ADMIN"]. "</td>
<td>".$row["AT_ACID"]. "</td>
<td>".$row["AT_AMOUNT"]. "</td>

View File

@@ -161,7 +161,7 @@ function view_list_ac($type) {
} else {
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TYPE`='".$type."' AND `AA_AGENT`='".$_SESSION['user_id']."' ORDER BY `AA_ID` DESC";
}
} elseif($_SESSION['type'] === 'admin') {
} elseif($_SESSION['type'] === 'admin' || $_SESSION['type'] === 'bm') {
if($type === 'Closed-Acc') {
$sql = "SELECT * FROM `".$GLOBALS['arif_ac']."` WHERE `AA_TYPE`='Loan' AND `STATUS`='closed' ORDER BY `AA_ID` DESC";
} elseif($type === 'Matured-Recurring') {

View File

@@ -1,120 +1,118 @@
<div class="container">
<table>
<!-- <tr>
<td>
<form>
<input type="date" name="tday">
<input type="submit" class="btn-info" value="Daily Report">
</form>
</td>
<td>
<form>
<input type="date" name="tmonth">
<input type="submit" class="btn-info" value="Monthly Report">
</form>
</td>
</tr> -->
<tr><td>.</td><td>.</td></tr>
<tr>
<td colspan="2">
<form method="post">
<select name="Agent">
<option value=""> Select Agent </option>
<?php
$users = glob(APP_DIR.'/CONTENT/ROOT_URI/Admin/users/*');
$user_arr = array();
for($i = 0; $i < count($users); $i++) {
$new_user = explode('/', $users[$i]);
$new_user = end($new_user);
echo '<option value="'.$new_user.'">'.$new_user.'</option>';
// $user_arr[$i] = $new_user;
}
?>
</select>
<label for="">From </label><input type="date" name="dFrom">
<label for="">To </label><input type="date" name="dTo">
<input type="submit" class="btn-info" value="Report">
</form>
</td>
</tr>
</table>
</div>
<?php
function report_view($type,$dt) {
$dateFrom=$dt;
if($type!="month" || $type!="day") {
$dateFrom= strtotime($dt); $dateFrom = date("Y-m-d", $dateFrom);
$dateTo= strtotime('+1 day', strtotime($type)); $dateTo = date("Y-m-d", $dateTo);
}
//$dateFrom=$dt;
else{
if($type=="month") {$dateFrom= strtotime('-1 day', strtotime($dt)); $dateFrom = date("Y-m-d", $dateFrom);}
$dateTo = strtotime('+1 '.$type, strtotime($dt));
$dateTo = date("Y-m-d", $dateTo);
}
echo '<div class="container"> <h3>'.$dateFrom." -> ".$dateTo."(Up to)</h3> </div>";
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
$totalAmount=0;
$agent="";if(isset($_POST['Agent'])) $agent=$_POST['Agent']; else $agent=$_SESSION['EMAIL'];
echo '
<div class="container" style="margin-top: 70px;">
<h5>VIEW REPORT:::::::: </h5><hr>
</div>
<div class="container">
<table class="table table-striped table-bordered table-hover table-responsive">
<tr>
<th>Transaction ID</th>
<th>Time</th>
<th>AC No</th>
<th>Name</th>
<th>Amount</th>
<th>commission</th>
</tr>';
$sql = "SELECT * FROM `".$GLOBALS['arif_tran']."` INNER JOIN `".$GLOBALS['arif_ac']."` ON `".$GLOBALS['arif_tran']."`.`AT_ACID`=`".$GLOBALS['arif_ac']."`.`AA_ACNO` WHERE `AT_TIMESTAMP` BETWEEN '".$dateFrom." 00:00:00.000000' AND '".$dateTo." 00:00:00.000000'
AND `AA_AGENT`= '".$agent."' ORDER BY `AT_ID` DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
//$ID=$row["GC_ID"];
// $tt=$row["AT_ID"]-10;
echo "
<tr>
<td>".$row["AT_ID"]. "</td>
<td>".$row["AT_TIMESTAMP"]. "</td>
<td>".$row["AT_ACID"]. "</td>
<td>".$row["AA_NAME"]. "</td>
<td>".$row["AT_AMOUNT"]. "</td>
<td>".$row["AT_AMOUNT"]/100*2.5 . "</td>
</tr>";$totalAmount+=$row["AT_AMOUNT"];
}
} else {
echo "0 results";
}
$conn->close();
echo '
</table>
<hr> <h2> Total Transaction amount : '.$totalAmount.'</h2>
<hr> <h2> Total Commission amount : '.$totalAmount/100*2.5 .'</h2>
</div>
';
}
if(isset($_POST['tday']) && $_POST['tday']!="") report_view('day',$_POST['tday']);
if(isset($_POST['tmonth']) && $_POST['tmonth']!="") report_view('month',$_POST['tmonth']);
if(isset($_POST['dFrom']) && $_POST['dTo']!="") report_view($_POST['dTo'],$_POST['dFrom']);
//if(isset($_GET['Type']) && $_GET['Type']=="Loan") view_list_ac('Loan');
// if(isset($_GET['Type']) && $_GET['Type']=="Recurring") view_list_ac('Recurring');
// if(isset($_GET['Type']) && $_GET['Type']=="FD") view_list_ac('FD');
// ---- Default date range ----
$today = date("Y-m-d"); // Today date
$monthStart = date("Y-m-01"); // first date of each month
$dFrom = $_GET['dFrom'] ?? $monthStart;
$dTo = $_GET['dTo'] ?? $today;
?>
<div class="container mt-4">
<div class="card shadow-lg p-4 rounded-3">
<h4 class="mb-3">Commission Report</h4>
<form method="get" class="row g-3">
<div class="col-md-3">
<label class="form-label">From</label>
<input value="<?= $dFrom ?>" type="date" name="dFrom" class="form-control" required>
</div>
<div class="col-md-3">
<label class="form-label">To</label>
<input value="<?= $dTo ?>" type="date" name="dTo" class="form-control" required>
</div>
<div class="col-md-3 d-flex align-items-end" style="margin-top: 25px;">
<button type="submit" class="btn btn-info w-100">Generate Report</button>
</div>
</form>
</div>
</div>
<?php
function commission_report($dateFrom, $dateTo) {
echo '<div class="container mt-4">
<div class="alert alert-primary shadow-sm">
<h5 class="mb-0">Commission Report: '.$dateFrom." → ".$dateTo.'</h5>
</div>
</div>';
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
if ($conn->connect_error) die("Connection failed: " . $conn->connect_error);
// ---- Login user type check ----
$loginType = $_SESSION['type'] ?? ''; // login session-এ type আছে
$loginId = $_SESSION['user_id']; // login user_id
// ---- Base Query ----
$sql = "SELECT u.user_id, u.user_name, u.comi_rate, COALESCE(SUM(t.AT_AMOUNT),0) as total_amount FROM `".$GLOBALS['arif_users']."` u LEFT JOIN `".$GLOBALS['arif_ac']."` a ON u.user_id = a.AA_AGENT LEFT JOIN `".$GLOBALS['arif_tran']."` t ON a.AA_ACNO = t.AT_ACID AND t.AT_TIMESTAMP BETWEEN '".$dateFrom." 00:00:00' AND '".$dateTo." 23:59:59' WHERE u.type = 'agent'";
// ---- if Agent self data filter ----
if ($loginType === 'agent') {
$sql .= " AND u.user_id = '".$loginId."'";
}
$sql .= " GROUP BY u.user_id, u.user_name, u.comi_rate ORDER BY u.user_name ASC";
$result = $conn->query($sql);
echo '
<div class="container mt-3">
<div class="card shadow-sm rounded-3">
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-hover align-middle">
<thead class="table-light">
<tr>
<th>Agent ID</th>
<th>Agent Name</th>
<th>Total Collection</th>
<th>Total Commission</th>
</tr>
</thead>
<tbody>';
$grandTotalCommission = 0;
$grandTotalCollection = 0;
if ($result && $result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$collection = $row["total_amount"];
$commission = ($collection * $row["comi_rate"]) / 100;
$grandTotalCollection += $collection;
$grandTotalCommission += $commission;
echo "
<tr>
<td>".$row["user_id"]."</td>
<td>".$row["user_name"]."</td>
<td>".number_format($collection,2)."</td>
<td>".number_format($commission,2)."</td>
</tr>";
}
} else {
echo "<tr><td colspan='4' class='text-center text-muted'>No agents found</td></tr>";
}
echo '
</tbody>
</table>';
// ---- if admin/bm then show grand total ----
if ($loginType !== 'agent') {
echo '<h5 class="text-end">
Grand Total Collection : <b>'.number_format($grandTotalCollection,2).'</b><br>
Grand Total Commission : <b>'.number_format($grandTotalCommission,2).'</b>
</h5>';
}
echo '
</div>
</div>
</div>
';
$conn->close();
}
// ---- Call commission function ----
commission_report($dFrom, $dTo);
?>

View File

@@ -1,10 +1,5 @@
<?php
session_start();
// Check if user is logged in and is admin
// if (!isset($_SESSION['type']) || $_SESSION['type'] !== 'admin') {
// header("Location: login.php");
// exit();
// }
// Database connection
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
@@ -37,6 +32,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user_phone = $_POST['user_phone'];
$type = $_POST['type'];
$user_id = $_POST['user_id'];
$profilePicPath = $user['profile_pic']; // default old pic
// Validate inputs
if (empty($user_name) || empty($user_phone) || empty($user_id)) {
@@ -44,29 +40,40 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} elseif (!preg_match("/^[0-9]{10}$/", $user_phone)) {
$error = "Invalid phone number format";
} else {
// --- Handle Profile Picture Upload ---
if (isset($_FILES['profile_pic']) && $_FILES['profile_pic']['error'] === UPLOAD_ERR_OK) {
$uploadDir = __DIR__ . "/picture/";
if (!file_exists($uploadDir)) {
mkdir($uploadDir, 0777, true);
}
$fileTmp = $_FILES['profile_pic']['tmp_name'];
$fileName = time() . "_" . basename($_FILES['profile_pic']['name']);
$filePath = $uploadDir . $fileName;
if (move_uploaded_file($fileTmp, $filePath)) {
$profilePicPath = "/picture/" . $fileName;
// পুরনো ফাইল ডিলিট (যদি থাকে)
if (!empty($user['profile_pic']) && file_exists(__DIR__ . "/" . $user['profile_pic'])) {
unlink(__DIR__ . "/" . $user['profile_pic']);
}
}
}
// Update query
if (!empty($_POST['password'])) {
// Update with password
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET
user_id = ?,
user_name = ?,
user_phone = ?,
type = ?,
password = ?
$sql = "UPDATE `".$GLOBALS['arif_users']."`
SET user_id = ?, user_name = ?, user_phone = ?, type = ?, password = ?, profile_pic = ?
WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $password, $id);
$stmt->bind_param("ssssssi", $user_id, $user_name, $user_phone, $type, $password, $profilePicPath, $id);
} else {
// Update without password
$sql = "UPDATE `".$GLOBALS['arif_users']."` SET
user_id = ?,
user_name = ?,
user_phone = ?,
type = ?
$sql = "UPDATE `".$GLOBALS['arif_users']."`
SET user_id = ?, user_name = ?, user_phone = ?, type = ?, profile_pic = ?
WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("ssssi", $user_id, $user_name, $user_phone, $type, $id);
$stmt->bind_param("sssssi", $user_id, $user_name, $user_phone, $type, $profilePicPath, $id);
}
if ($stmt->execute()) {
@@ -99,7 +106,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<?php endif; ?>
<?php if (!empty($user)): ?>
<form method="post">
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($user['id']); ?>">
<div class="row">
@@ -114,6 +121,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
<input type="text" class="form-control" id="user_name" name="user_name"
value="<?php echo htmlspecialchars($user['user_name']); ?>" required>
</div>
<div class="form-group mb-3">
<label for="profile_pic" class="form-label">Profile Picture</label><br>
<?php if (!empty($user['profile_pic'])): ?>
<img src="/CONTENT/ROOT_URI/Admin/<?php echo htmlspecialchars($user['profile_pic']); ?>" width="80" height="80" style="border-radius:50%; margin-bottom:10px;"><br>
<?php endif; ?>
<input type="file" class="form-control" id="profile_pic" name="profile_pic" accept="image/*">
</div>
</div>
<div class="col-md-6">
@@ -133,21 +148,15 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group mb-3">
<label for="password" class="form-label">New Password (leave blank to keep current)</label>
<input type="password" class="form-control" id="password" name="password">
<small class="text-muted">Password must be at least 8 characters long</small>
</div>
</div>
<div class="form-group mb-3">
<label for="password" class="form-label">New Password (leave blank to keep current)</label>
<input type="password" class="form-control" id="password" name="password">
<small class="text-muted">Password must be at least 8 characters long</small>
</div>
<div class="row">
<div class="col-md-12">
<button type="submit" class="btn btn-primary">Update User</button>
<a href="/Admin/Settings_Agent" class="btn ">Cancel</a>
</div>
<div class="form-group mb-3">
<button type="submit" class="btn btn-primary">Update User</button>
<a href="/Admin/Settings_Agent" class="btn">Cancel</a>
</div>
</form>
<?php else: ?>
@@ -165,19 +174,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
});
</script>
<style>
.badge-primary {
background-color: #007bff;
}
.badge-secondary {
background-color: #6c757d;
}
.badge-warning {
background-color: #ffc107;
}
<style>
.container {
max-width: 800px;
margin-top: 30px;
}
img { border:1px solid #ccc; }
</style>
<?php $conn->close(); ?>
<?php $conn->close(); ?>

View File

@@ -27,6 +27,7 @@
$_SESSION['user_id'] = $user['user_id'];
$_SESSION['type'] = $user['type'];
$_SESSION['name'] = $user['user_name'];
$_SESSION['profile_pic'] = $user['profile_pic'] ?? '';
echo "<div class='alert alert-success'>Login successful. Redirecting...</div>";
echo "<script>setTimeout(() => { window.location.href = '/Admin/View_AC?Type=Loan'; }, 2000);</script>";

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB