{% load i18n admin_static %}<!DOCTYPE html>
{% get_current_language as LANGUAGE_CODE %}{% get_current_language_bidi as LANGUAGE_BIDI %}
<html lang="{{ LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI %}dir="rtl"{% endif %}>
<head>
<title>{% block title %}{% endblock %}</title>
<link rel="stylesheet" type="text/css" href="{% block stylesheet %}{% static "admin/css/base.css" %}{% endblock %}" />
<link rel="stylesheet" type="text/css" href="{% static "css/modern_ui.css" %}" />
{% block extrastyle %}{% endblock %}
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="{% block stylesheet_ie %}{% static "admin/css/ie.css" %}{% endblock %}" /><![endif]-->
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}" />{% endif %}
<script type="text/javascript">window.__admin_media_prefix__ = "{% filter escapejs %}{% static "admin/" %}{% endfilter %}";</script>
<script type="text/javascript">window.__admin_utc_offset__ = "{% filter escapejs %}{% now "Z" %}{% endfilter %}";</script>
{% block extrahead %}{% endblock %}
{% block blockbots %}<meta name="robots" content="NONE,NOARCHIVE" />{% endblock %}
</head>
{% load i18n %}

<body class="{% if is_popup %}popup {% endif %}{% block bodyclass %}{% endblock %}">

<!-- Container -->
<div id="container">

    {% if not is_popup %}
    <!-- Header (Sidebar) -->
    <div id="header">
        <div class="brand-section">
            <div class="brand-logo">⚡</div>
            <div class="brand-text">
                <h1>智捷ERP</h1>
                <span>SmartJet ERP</span>
            </div>
        </div>

        <div class="sidebar-nav">
            <a href="/admin/" class="nav-item active"><i>🏠</i> 控制面板</a>
            
            <div class="nav-group-label">核心业务</div>
            <a href="/admin/sale/saleorder/" class="nav-item"><i>📁</i> 销售管理 <span class="arrow">v</span></a>
            <a href="/admin/purchase/purchaseorder/" class="nav-item"><i>🛒</i> 采购管理 <span class="arrow">v</span></a>
            <a href="/admin/invent/inventory/" class="nav-item"><i>📦</i> 库存管理 <span class="arrow">v</span></a>
            
            <div class="nav-group-label">组织人力</div>
            <a href="/admin/organ/organization/" class="nav-item"><i>🏢</i> 组织架构</a>
            <a href="/admin/basedata/employee/" class="nav-item"><i>👥</i> 员工档案</a>
            
            <div class="nav-group-label">流程协同</div>
            <a href="/admin/workflow/instance/" class="nav-item"><i>🛡️</i> 审批中心</a>
        </div>

        <div class="sidebar-footer">
            <a href="/admin/syscfg/site/" class="nav-item"><i>⚙️</i> 设置</a>
            <button type="button" id="sidebarCollapseBtn" class="nav-item nav-item-btn"><i>←</i> 收起菜单</button>
        </div>

        {% block usertools %}{% endblock %}
    </div>
    {% endif %}

    <div id="main" {% if is_popup %}style="margin-left: 0; width: 100%;"{% endif %}>
        {% if not is_popup %}
        <div class="topbar">
            <div class="topbar-left">
                <button type="button" class="icon-btn" id="topbarMenuBtn" title="切换菜单">☰</button>
                <div class="breadcrumb-new">首页 > <span>控制面板</span></div>
            </div>
            <div class="topbar-right">
                <button type="button" class="icon-btn" id="topbarNotifyBtn" title="待办任务">🔔</button>
                <div class="user-menu-wrap">
                    <button type="button" class="user-profile" id="userProfileToggle" title="用户菜单">
                        <div class="avatar" style="background: url('https://ui-avatars.com/api/?name={{ user.get_short_name|default:"管理员" }}&background=6366f1&color=fff') no-repeat center center; background-size: cover;"></div>
                        <div class="user-info">
                            <span class="user-name">{{ user.get_short_name|default:"管理员" }}</span>
                            <span class="user-role">系统管理员</span>
                        </div>
                        <span class="user-caret">▾</span>
                    </button>
                    <div class="user-dropdown" id="userDropdown">
                        <a href="{% url 'admin:password_change' %}">修改密码</a>
                        <a href="{% url 'admin:logout' %}">退出登录</a>
                    </div>
                </div>
            </div>
        </div>
        {% endif %}

        {% block messages %}
            {% if messages %}
            <ul class="messagelist">{% for message in messages %}
              <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message|capfirst }}</li>
            {% endfor %}</ul>
            {% endif %}
        {% endblock messages %}

        <!-- Content -->
        <div id="content" class="{% block coltype %}colM{% endblock %}">
            {% block pretitle %}{% endblock %}
            {% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
            {% block content %}
            {% block object-tools %}{% endblock %}
            {{ content }}
            {% endblock %}
            {% block sidebar %}{% endblock %}
            <br class="clear" />
        </div>
        <!-- END Content -->

        {% if not is_popup %}
        {% block footer %}
        <div id="footer">
            <div style="text-align: center; padding: 10px;">
                <a href="http://code.xinmi.cloud/" target="_blank" style="color: #666; text-decoration: none;">智捷ERP - 新觅源码库</a>
            </div>
        </div>
        {% endblock %}
        {% endif %}
    </div>
</div>
<!-- END Container -->

<script type="text/javascript" src="{% static "js/modern_ui.js" %}"></script>
</body>
</html>
