136 lines
5.6 KiB
HTML
136 lines
5.6 KiB
HTML
{% extends 'base.html' %}
|
|
|
|
{% block title %}图书库存管理{% endblock %}
|
|
|
|
{% block head %}
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/inventory-list.css') }}">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="inventory-container">
|
|
<div class="page-header">
|
|
<div class="header-content">
|
|
<h1><i class="fas fa-book-open header-icon"></i>图书库存管理</h1>
|
|
<p class="subtitle">优雅管理您的书籍资源</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="search-card">
|
|
<form method="GET" action="{{ url_for('inventory.inventory_list') }}" class="search-form">
|
|
<div class="search-input-group">
|
|
<div class="search-input-container">
|
|
<i class="fas fa-search search-icon"></i>
|
|
<input type="text" class="search-input" name="search" placeholder="搜索书名、作者或ISBN" value="{{ search }}">
|
|
</div>
|
|
<button class="search-button" type="submit">搜索</button>
|
|
</div>
|
|
<a href="{{ url_for('inventory.inventory_logs') }}" class="log-button">
|
|
<i class="fas fa-history"></i> 查看库存日志
|
|
</a>
|
|
</form>
|
|
</div>
|
|
|
|
<div class="table-container">
|
|
<table class="inventory-table">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>书名</th>
|
|
<th>作者</th>
|
|
<th>ISBN</th>
|
|
<th>当前库存</th>
|
|
<th>状态</th>
|
|
<th>操作</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for book in books %}
|
|
<tr>
|
|
<td>{{ book.id }}</td>
|
|
<td class="book-title">{{ book.title }}</td>
|
|
<td class="book-author">{{ book.author }}</td>
|
|
<td>{{ book.isbn }}</td>
|
|
<td>
|
|
<span class="stock-badge {{ 'stock-high' if book.stock > 5 else 'stock-medium' if book.stock > 0 else 'stock-low' }}">
|
|
{{ book.stock }}
|
|
</span>
|
|
</td>
|
|
<td>
|
|
<span class="status-badge {{ 'status-active' if book.status == 1 else 'status-inactive' }}">
|
|
{{ '正常' if book.status == 1 else '已下架' }}
|
|
</span>
|
|
</td>
|
|
<td class="action-buttons">
|
|
<a href="{{ url_for('inventory.adjust_inventory', book_id=book.id) }}" class="btn-adjust">
|
|
<i class="fas fa-edit"></i> 调整
|
|
</a>
|
|
<a href="{{ url_for('inventory.book_inventory_logs', book_id=book.id) }}" class="btn-view">
|
|
<i class="fas fa-list-alt"></i> 日志
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<!-- 分页 -->
|
|
<div class="pagination-wrapper">
|
|
<nav aria-label="Page navigation">
|
|
<ul class="pagination">
|
|
{% if pagination.has_prev %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('inventory.inventory_list', page=pagination.prev_num, search=search, sort=sort, order=order) }}">
|
|
<i class="fas fa-chevron-left"></i> 上一页
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<a class="page-link" href="#">
|
|
<i class="fas fa-chevron-left"></i> 上一页
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
|
|
{% for page_num in pagination.iter_pages(left_edge=1, right_edge=1, left_current=2, right_current=2) %}
|
|
{% if page_num %}
|
|
{% if page_num == pagination.page %}
|
|
<li class="page-item active">
|
|
<a class="page-link" href="#">{{ page_num }}</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('inventory.inventory_list', page=page_num, search=search, sort=sort, order=order) }}">{{ page_num }}</a>
|
|
</li>
|
|
{% endif %}
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<a class="page-link" href="#">...</a>
|
|
</li>
|
|
{% endif %}
|
|
{% endfor %}
|
|
|
|
{% if pagination.has_next %}
|
|
<li class="page-item">
|
|
<a class="page-link" href="{{ url_for('inventory.inventory_list', page=pagination.next_num, search=search, sort=sort, order=order) }}">
|
|
下一页 <i class="fas fa-chevron-right"></i>
|
|
</a>
|
|
</li>
|
|
{% else %}
|
|
<li class="page-item disabled">
|
|
<a class="page-link" href="#">
|
|
下一页 <i class="fas fa-chevron-right"></i>
|
|
</a>
|
|
</li>
|
|
{% endif %}
|
|
</ul>
|
|
</nav>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{{ url_for('static', filename='js/inventory-list.js') }}"></script>
|
|
{% endblock %}
|