accounting modules
This commit is contained in:
@@ -17,6 +17,36 @@ $topbar_picture = $_SESSION['login_profile_picture'] ?? '';
|
||||
$topbar_avatar_src = $topbar_picture
|
||||
? htmlspecialchars($server_url . 'uploads/profile/' . $topbar_picture, ENT_QUOTES, 'UTF-8')
|
||||
: htmlspecialchars($server_url . 'assets/images/avatar-1.jpg', ENT_QUOTES, 'UTF-8');
|
||||
|
||||
// ── App switcher ──────────────────────────────────────────────────────────────
|
||||
$topbar_app_access = $_SESSION['login_app_access'] ?? 'wms';
|
||||
|
||||
// Detect which app this page belongs to.
|
||||
// Master-data pages (/accounting/, /inventory/, /contact/, /setting/) are neutral — don't change the session.
|
||||
$_wms_paths = ['/dashboard/', '/ics/', '/order/', '/po/', '/reports/'];
|
||||
$_ac_paths = ['/ac_dashboard/', '/revenue/', '/expense/', '/finance/', '/journal/'];
|
||||
|
||||
$topbar_current_app = null; // null = neutral page (master data / setting)
|
||||
foreach ($_wms_paths as $_p) {
|
||||
if (str_contains($_SERVER['PHP_SELF'], $_p)) { $topbar_current_app = 'wms'; break; }
|
||||
}
|
||||
if (!$topbar_current_app) {
|
||||
foreach ($_ac_paths as $_p) {
|
||||
if (str_contains($_SERVER['PHP_SELF'], $_p)) { $topbar_current_app = 'accounting'; break; }
|
||||
}
|
||||
}
|
||||
|
||||
// Only persist to session when on a definitive app page
|
||||
if ($topbar_current_app) {
|
||||
$_SESSION['login_current_app'] = $topbar_current_app;
|
||||
}
|
||||
// Default session on first visit or neutral pages
|
||||
if (empty($_SESSION['login_current_app'])) {
|
||||
$_SESSION['login_current_app'] = ($topbar_app_access === 'accounting') ? 'accounting' : 'wms';
|
||||
}
|
||||
|
||||
$topbar_show_wms = in_array($topbar_app_access, ['all', 'wms']);
|
||||
$topbar_show_accounting = in_array($topbar_app_access, ['all', 'accounting']);
|
||||
?>
|
||||
|
||||
<div id="overlay" class="overlay"></div>
|
||||
@@ -59,6 +89,35 @@ $topbar_avatar_src = $topbar_picture
|
||||
<!-- Navbar nav -->
|
||||
<ul class="list-unstyled d-flex align-items-center mb-0 gap-1">
|
||||
|
||||
<!-- App switcher -->
|
||||
<?php if ($topbar_show_wms && $topbar_show_accounting): ?>
|
||||
<li class="dropdown">
|
||||
<a class="position-relative btn-icon btn-sm btn-light btn rounded-circle" data-bs-toggle="dropdown"
|
||||
aria-expanded="false" href="#" role="button" title="Switch App">
|
||||
<i class="ti ti-layout-grid" style="font-size:18px;"></i>
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-end p-2" style="min-width:170px;">
|
||||
<?php $_sess_app = $_SESSION['login_current_app'] ?? 'wms'; ?>
|
||||
<a href="<?php echo $server_url?>dashboard/index.php"
|
||||
class="dropdown-item rounded d-flex align-items-center gap-2 py-2 <?php echo $_sess_app === 'wms' ? 'active' : ''; ?>">
|
||||
<i class="ti ti-box"></i>
|
||||
<span>WMS</span>
|
||||
<?php if ($_sess_app === 'wms'): ?>
|
||||
<i class="ti ti-check ms-auto text-success"></i>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<a href="<?php echo $server_url?>ac_dashboard/index.php"
|
||||
class="dropdown-item rounded d-flex align-items-center gap-2 py-2 <?php echo $_sess_app === 'accounting' ? 'active' : ''; ?>">
|
||||
<i class="ti ti-calculator"></i>
|
||||
<span>Accounting</span>
|
||||
<?php if ($_sess_app === 'accounting'): ?>
|
||||
<i class="ti ti-check ms-auto text-success"></i>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- Bell icon -->
|
||||
<li>
|
||||
<a class="position-relative btn-icon btn-sm btn-light btn rounded-circle" data-bs-toggle="dropdown"
|
||||
|
||||
Reference in New Issue
Block a user