{% extends 'base.html' %}

{% block title %}日志详情{% endblock %}

{% block head %}
<link rel="stylesheet" href="{{ url_for('static', filename='css/log-detail.css') }}">
{% endblock %}

{% block content %}
<div class="content-header">
    <h1><i class="fas fa-file-alt"></i> 日志详情 #{{ log.id }}</h1>
    <div class="actions">
        <a href="{{ url_for('log.log_list') }}" class="btn btn-secondary">
            <i class="fas fa-arrow-left"></i> 返回列表
        </a>
    </div>
</div>

<div class="card">
    <div class="card-body">
        <div class="log-info">
            <div class="row">
                <div class="col-md-6">
                    <div class="info-item">
                        <div class="label">操作时间:</div>
                        <div class="value">{{ log.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</div>
                    </div>
                    <div class="info-item">
                        <div class="label">操作用户:</div>
                        <div class="value">
                            {% if log.user %}
                            {{ log.user.username }} (ID: {{ log.user_id }})
                            {% else %}
                            <span class="text-muted">未登录用户</span>
                            {% endif %}
                        </div>
                    </div>
                    <div class="info-item">
                        <div class="label">操作类型:</div>
                        <div class="value">{{ log.action }}</div>
                    </div>
                </div>
                <div class="col-md-6">
                    <div class="info-item">
                        <div class="label">目标类型:</div>
                        <div class="value">{{ log.target_type or '无' }}</div>
                    </div>
                    <div class="info-item">
                        <div class="label">目标ID:</div>
                        <div class="value">{{ log.target_id or '无' }}</div>
                    </div>
                    <div class="info-item">
                        <div class="label">IP地址:</div>
                        <div class="value">{{ log.ip_address or '未记录' }}</div>
                    </div>
                </div>
            </div>
            <div class="info-item description">
                <div class="label">详细描述:</div>
                <div class="value">{{ log.description or '无描述' }}</div>
            </div>
        </div>
    </div>
</div>
{% endblock %}
