{# ── SIDEBAR NAV MACRO, used in both desktop sidebar and mobile offcanvas ── #}
{% macro sb_nav() %}
{% set role = session.get('role','') %}
{# ── DASHBOARD ─────────────────────────────────── #}
{% if role == 'ADMIN' %}
Pengaturan
{% endif %}
Dashboard
Dashboard
{% if can.sales_input or can.expense_input or can.pos_sales or can.manage_master_pos or role in ('ADMIN','FINANCE','OPERATOR','DEMO') %}
{% if can.sales_input %}
Pemasukan
{% endif %}
{% if can.expense_input %}
Pengeluaran
{% endif %}
{% if role in ('ADMIN','FINANCE','OPERATOR','DEMO') %}
{% if show_feature.transfer %}
Transfer Rekening
{% endif %}
{% if show_feature.retur_penjualan %}
Retur Penjualan
{% endif %}
{% if show_feature.retur_pembelian %}
Retur Pembelian
{% endif %}
{% if role in ('ADMIN','FINANCE','DEMO') %}
{% if show_feature.pendanaan %}
Pendanaan
{% endif %}
{% if show_feature.pelunasan %}
Pelunasan
{% endif %}
{% endif %}
{% if show_feature.invoice %}
Invoice
{% endif %}
{% if show_feature.po %}
Purchase Order
{% endif %}
{% if modul_aktif and modul_aktif.POS_KASIR and can.pos_sales %}
POS Kasir
{% endif %}
{% if modul_aktif and modul_aktif.POS_KASIR and can.manage_master_pos %}
Master POS
{% endif %}
{% endif %}
{# ── TRACKER ───────────────────────────────────── #}
{% endif %}
{% if role not in ('ADMIN','FINANCE','OPERATOR','DEMO') %}
{% if modul_aktif and modul_aktif.POS_KASIR and can.pos_sales %}
POS Kasir
{% endif %}
{% if modul_aktif and modul_aktif.POS_KASIR and can.manage_master_pos %}
Master POS
{% endif %}
{% endif %}
{% if can.show_journal or can.inventory_input or role in ('ADMIN','FINANCE','INVESTOR','OPERATOR','DEMO') %}
Tracker
{% if can.show_journal %}
Daftar Transaksi
{% endif %}
Piutang
Hutang
{% if can.inventory_input %}
Inventory
{% endif %}
{% if can.inventory_input and can.inventory_hpp and show_feature.produksi %}
Produksi
{% endif %}
{% if can.show_hpp_margin and role in ('ADMIN','FINANCE','INVESTOR','DEMO') and show_feature.hpp_kalkulator %}
Kalkulator HPP
{% endif %}
{# ── DATABASE ──────────────────────────────────── #}
{% endif %}
{% set _show_db = role in ('ADMIN','FINANCE','INVESTOR','DEMO') and show_feature.database %}
{% set _show_prj = role in ('ADMIN','FINANCE','DEMO') and show_feature.proyek %}
{% if _show_db or _show_prj %}
Database
{% if _show_db %}
Customer
Vendor
{% endif %}
{% if _show_prj %}
Proyek
{% endif %}
{% endif %}
{% if role in ('ADMIN','FINANCE','INVESTOR','DEMO') %}
Laporan
{% if show_feature.aset_tetap %}
Aset Tetap
{% endif %}
Laba Rugi
Arus Kas
{% if show_feature.grafik %}
Grafik
{% endif %}
{% if show_feature.performa_penjualan %}
Performa Penjualan
{% endif %}
Neraca
{% if show_feature.perubahan_ekuitas %}
Perubahan Ekuitas
{% endif %}
{% if show_feature.analisis_rasio %}
Analisis Rasio
{% endif %}
{% if show_feature.buku_besar %}
Buku Besar
{% endif %}
{% endif %}
{# ── LAINNYA ───────────────────────────────────── #}
{% if (can.show_journal and show_feature.jurnal) or (role in ('ADMIN','FINANCE','INVESTOR','DEMO') and show_feature.bagan_akun) %}
Lainnya
{% if can.show_journal and show_feature.jurnal %}
Jurnal
{% endif %}
{% if role in ('ADMIN','FINANCE','INVESTOR','DEMO') and show_feature.bagan_akun %}
Bagan Akun
{% endif %}
{% endif %}
{% if role in ('ADMIN','FINANCE') and show_feature.setup_saldo_awal %}
Setup Saldo Awal
{% endif %}
{% if role == 'ADMIN' and not ((request.endpoint or '') == 'pos_master' or (request.endpoint or '').startswith('pos_master_')) %}
Modul Lanjutan
{% if modul_aktif and modul_aktif.values()|select|list|length > 0 %}
{{ modul_aktif.values()|select|list|length }}
{% endif %}
{% endif %}
{% if role in ('ADMIN','FINANCE') %}
Log Aktivitas
{% endif %}
{# ── Modul Lanjutan: Pajak & Gaji ─────────────────── #}
{% if modul_aktif and modul_aktif.PAJAK_OTOMATIS and role in ('ADMIN','FINANCE') and show_feature.pajak %}
Data Karyawan
Proses Gaji
Riwayat Gaji
{% endif %}
{# ── Modul Lanjutan: Anggaran & Target ─────────────── #}
{% if modul_aktif and modul_aktif.ANGGARAN and role in ('ADMIN','FINANCE') and show_feature.anggaran %}
Modul Anggaran
Anggaran & Target
{% endif %}
{# ── BONUS ─────────────────────────────────────── #}
{# Role badge at bottom of sidebar #}
Role
{% if role == 'ADMIN' %}
Admin
{% elif role == 'FINANCE' %}
Finance
{% elif role == 'MANAJER' %}
Manajer POS
{% elif role == 'INVESTOR' %}
Investor
{% elif role == 'OPERATOR' %}
Operator
{% elif role == 'KASIR' %}
Kasir Only
{% elif role == 'DEMO' %}
Demo
Read-only
{% endif %}
{# Version label #}
VERSI 5.3 (15 JUNI 2026)
{% endmacro %}
{# ── MOBILE OFFCANVAS SIDEBAR ── #}