110 lines
3.7 KiB
PHP
110 lines
3.7 KiB
PHP
<?php
|
|
$cp = $_SERVER['PHP_SELF'];
|
|
function master_active(...$frags) {
|
|
global $cp;
|
|
foreach ($frags as $f) { if (str_contains($cp, $f)) return 'active'; }
|
|
return '';
|
|
}
|
|
$master_role = $_SESSION['login_role'] ?? 'viewer';
|
|
$master_can_admin = in_array($master_role, ['owner', 'admin'], true);
|
|
$master_app_access = $_SESSION['login_app_access'] ?? 'wms';
|
|
$master_show_accounting = in_array($master_app_access, ['all', 'accounting']);
|
|
$master_back_url = ($_SESSION['login_current_app'] ?? 'wms') === 'accounting'
|
|
? $server_url . 'ac_dashboard/index.php'
|
|
: $server_url . 'dashboard/index.php';
|
|
$master_back_label = ($_SESSION['login_current_app'] ?? 'wms') === 'accounting'
|
|
? 'Back to Accounting'
|
|
: 'Back to WMS';
|
|
?>
|
|
|
|
<!-- SIDEBAR -->
|
|
<aside id="sidebar" class="sidebar overflow-y-auto d-flex flex-column">
|
|
<div class="logo-area">
|
|
<a href="<?php echo $server_url?>index.php" class="d-inline-flex">
|
|
<img src="<?php echo $server_url?>assets/images/favicon.png" alt="" width="40"/>
|
|
<span class="logo-text ms-2">
|
|
<img src="<?php echo $server_url?>assets/images/logo.png" alt="" height="40" style="padding: 5px 0;"/>
|
|
</span>
|
|
</a>
|
|
</div>
|
|
|
|
<ul class="nav flex-column">
|
|
|
|
<!-- Master Data -->
|
|
<li class="nav-text-space">
|
|
<small class="nav-text text-muted">Master Data</small>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/inventory/product', '/inventory/manage_product', '/inventory/manage_category'); ?>"
|
|
href="<?php echo $server_url?>inventory/product.php">
|
|
<i class="ti ti-category"></i>
|
|
<span class="nav-text">Products</span>
|
|
</a>
|
|
</li>
|
|
|
|
<?php if ($master_can_admin): ?>
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/inventory/warehouse', '/inventory/manage_warehouse', '/inventory/manage_storage'); ?>"
|
|
href="<?php echo $server_url?>inventory/warehouse.php">
|
|
<i class="ti ti-map-pin"></i>
|
|
<span class="nav-text">Warehouse Location</span>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/contact/'); ?>"
|
|
href="<?php echo $server_url?>contact/contact.php">
|
|
<i class="ti ti-users"></i>
|
|
<span class="nav-text">Contact</span>
|
|
</a>
|
|
</li>
|
|
|
|
<!-- Accounting -->
|
|
<?php if ($master_show_accounting): ?>
|
|
<li class="nav-text-space mt-2">
|
|
<small class="nav-text text-muted">Accounting</small>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/accounting/chart_of_accounts', '/accounting/manage_account'); ?>"
|
|
href="<?php echo $server_url?>accounting/chart_of_accounts.php">
|
|
<i class="ti ti-list-tree"></i>
|
|
<span class="nav-text">Chart of Accounts</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/accounting/departments', '/accounting/manage_department'); ?>"
|
|
href="<?php echo $server_url?>accounting/departments.php">
|
|
<i class="ti ti-building"></i>
|
|
<span class="nav-text">Departments</span>
|
|
</a>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="nav-link <?php echo master_active('/accounting/periods'); ?>"
|
|
href="<?php echo $server_url?>accounting/periods.php">
|
|
<i class="ti ti-calendar"></i>
|
|
<span class="nav-text">Accounting Periods</span>
|
|
</a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<!-- Navigation -->
|
|
<li class="nav-text-space mt-2">
|
|
<small class="nav-text text-muted">Navigation</small>
|
|
</li>
|
|
|
|
<li>
|
|
<a class="nav-link" href="<?php echo $master_back_url; ?>">
|
|
<i class="ti ti-arrow-left"></i>
|
|
<span class="nav-text"><?php echo $master_back_label; ?></span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</aside>
|