Files
Card-data-sorting/templates/expenses/store_master.html

75 lines
2.0 KiB
HTML

{% extends 'base.html' %}
{% block title %}店舗マスタ管理{% endblock %}
{% block content %}
<section>
<h2>店舗マスタ管理</h2>
{% if error_message %}
<p>{{ error_message }}</p>
{% endif %}
<h3>店舗を追加</h3>
<form method="post">
{% csrf_token %}
<label>
店舗名
<input type="text" name="name" required>
</label>
<label>
<input type="checkbox" name="is_active" value="1" checked>
有効
</label>
<button type="submit">追加</button>
</form>
<h3>一覧</h3>
<table>
<thead>
<tr>
<th>店舗名</th>
<th>有効</th>
<th>更新</th>
<th>削除</th>
</tr>
</thead>
<tbody>
{% for store in stores %}
<tr>
<form method="post">
{% csrf_token %}
<input type="hidden" name="store_id" value="{{ store.id }}">
<td>
<input type="text" name="name" value="{{ store.name }}" required>
</td>
<td>
<input
type="checkbox"
name="is_active"
value="1"
{% if store.is_active %}checked{% endif %}
>
</td>
<td>
<button type="submit">保存</button>
</td>
</form>
<td>
<form method="post">
{% csrf_token %}
<input type="hidden" name="store_id" value="{{ store.id }}">
<input type="hidden" name="action" value="deactivate">
<button type="submit" {% if not store.is_active %}disabled{% endif %}>
無効化
</button>
</form>
</td>
</tr>
{% empty %}
<tr>
<td colspan="4">店舗がありません。</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>
{% endblock %}