implemented admin or bm approval functionality
This commit is contained in:
@@ -2,6 +2,47 @@
|
||||
include(__DIR__ . '/auth.php');
|
||||
require_login();
|
||||
date_default_timezone_set('Asia/Kolkata');
|
||||
$conn = new mysqli($GLOBALS['host'], $GLOBALS['user'], $GLOBALS['pass'], $GLOBALS['db']);
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$pendingCount = 0; // Default value
|
||||
|
||||
try {
|
||||
$table = 'fund_trans';
|
||||
|
||||
// Check user type and prepare appropriate query
|
||||
if ($_SESSION['type'] === 'admin') {
|
||||
// Admin can only see BM requests
|
||||
$countStmt = $conn->prepare("SELECT COUNT(*) AS pending_count FROM `$table` WHERE status = 0 AND request_usr_type = 'bm'");
|
||||
} elseif ($_SESSION['type'] === 'bm') {
|
||||
// BM can only see Admin requests
|
||||
$countStmt = $conn->prepare("SELECT COUNT(*) AS pending_count FROM `$table` WHERE status = 0 AND request_usr_type = 'admin'");
|
||||
} else {
|
||||
// Other user types see nothing
|
||||
$countStmt = false;
|
||||
$pendingCount = 0;
|
||||
}
|
||||
|
||||
if ($countStmt) {
|
||||
$countStmt->execute();
|
||||
$countResult = $countStmt->get_result();
|
||||
|
||||
if ($countResult) {
|
||||
$row = $countResult->fetch_assoc();
|
||||
$pendingCount = $row['pending_count'] ?? 0;
|
||||
}
|
||||
|
||||
$countStmt->close();
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
// Log error instead of showing to user
|
||||
error_log("Error getting pending count: " . $e->getMessage());
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
?>
|
||||
<style>
|
||||
.logo {
|
||||
@@ -19,6 +60,14 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Dropdown menu styling */
|
||||
.dropdown-menu > li > a {
|
||||
padding: 10px 20px;
|
||||
}
|
||||
.navbar-nav > li > .dropdown-menu {
|
||||
border-top: 2px solid #337ab7;
|
||||
}
|
||||
|
||||
/* Mobile-specific styles */
|
||||
@media (max-width: 767px) {
|
||||
.mobile-welcome,
|
||||
@@ -30,6 +79,21 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
.navbar-right {
|
||||
display: none !important; /* hide right side in mobile */
|
||||
}
|
||||
|
||||
/* Adjust dropdown for mobile */
|
||||
.navbar-nav .open .dropdown-menu {
|
||||
position: static;
|
||||
float: none;
|
||||
width: auto;
|
||||
margin-top: 0;
|
||||
background-color: transparent;
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
.navbar-nav .open .dropdown-menu > li > a {
|
||||
padding: 10px 15px 10px 35px;
|
||||
color: #777;
|
||||
}
|
||||
}
|
||||
|
||||
/* Desktop styles */
|
||||
@@ -56,9 +120,6 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
</button>
|
||||
|
||||
<!-- Mobile profile + welcome -->
|
||||
|
||||
|
||||
|
||||
<img class="mobile-profile"
|
||||
src="<?php echo $imagePath; ?>"
|
||||
width="40" height="40"
|
||||
@@ -72,39 +133,45 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
<?php
|
||||
$userType = $_SESSION['type'] ?? '';
|
||||
|
||||
if ($userType === 'admin') {
|
||||
if ($userType === 'admin' || $userType === 'bm') {
|
||||
?>
|
||||
<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>
|
||||
<!-- Create New Dropdown Menu -->
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
|
||||
Create New <span class="caret"></span>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="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 role="separator" class="divider"></li>
|
||||
<li><a href="/Admin/Add_group">Add New Group</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
|
||||
<!-- Other menu items -->
|
||||
<li><a href="/Admin/Trans_New">Transaction</a></li>
|
||||
<?php if ($userType === 'admin') { ?>
|
||||
<li><a href="/Admin/agent-targets">Agent Targets</a></li>
|
||||
<li><a href="/Admin/agent_View_report">Commission</a></li>
|
||||
<?php } ?>
|
||||
<li><a href="/Admin/agent_View_report">Commission</a></li>
|
||||
<?php if ($userType === 'admin') { ?>
|
||||
<li><a href="/Admin/View_AC?Type=Recurring">View A/C</a></li>
|
||||
<li><a href="/Admin/upcoming-maturity">Upcoming Maturity</a></li>
|
||||
<?php } ?>
|
||||
<li><a href="/Admin/upcoming-maturity">Upcoming Maturity</a></li>
|
||||
<?php if ($userType === 'admin') { ?>
|
||||
<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') {
|
||||
?>
|
||||
<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/upcoming-maturity">Upcoming Maturity</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
|
||||
<?php } ?>
|
||||
<?php
|
||||
} elseif ($userType === 'agent') {
|
||||
?>
|
||||
<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
|
||||
?>
|
||||
<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>
|
||||
@@ -136,7 +203,22 @@ date_default_timezone_set('Asia/Kolkata');
|
||||
?>
|
||||
</li>
|
||||
<li><a href="/Admin/Signout">Signout</a></li>
|
||||
<li>
|
||||
<a href="/Admin/notification" style="position: relative; display: inline-block; padding: 8px;">
|
||||
<?php if($pendingCount > 0) { ?>
|
||||
<div style="width: 18px; height: 18px; border-radius: 50%; background-color: #ff4444; position: absolute; top: 2px; right: 2px; z-index: 10; box-shadow: 0 0 0 2px rgba(255,255,255,0.8); font-size: 11px; font-weight: bold; color: white; text-align: center; line-height: 18px;">
|
||||
<?= $pendingCount > 99 ? '99+' : $pendingCount ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="22" height="22" viewBox="0 0 64 64" fill="#4a5568" style="filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));">
|
||||
<g>
|
||||
<path fill="currentColor" d="M56,44c-1.832,0-4-2.168-4-4V20C52,8.973,43.027,0,32,0S12,8.973,12,20v20c0,1.793-2.207,4-4,4 c-2.211,0-4,1.789-4,4s1.789,4,4,4h48c2.211,0,4-1.789,4-4S58.211,44,56,44z"></path>
|
||||
<path fill="currentColor" d="M32,64c4.418,0,8-3.582,8-8H24C24,60.418,27.582,64,32,64z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user