{% extends '@admin/default_frame.twig' %}
{% block title %}カスタムフォーム一覧{% endblock %}
{% block sub_title %}カスタムフォーム管理{% endblock %}
{% block main %}
<div class="c-contentsArea__cols">
<div class="c-contentsArea__primaryCol">
<div class="c-primaryCol">
<div class="card rounded border-0 mb-4">
<div class="card-header d-flex justify-content-between align-items-center">
<span class="card-title">フォーム一覧</span>
<a href="{{ url('nzcustomplugin_admin_new') }}" class="btn btn-ec-conversion btn-sm">
<i class="fa fa-plus"></i> 新規作成
</a>
</div>
<div class="card-body p-0">
{% if forms|length > 0 %}
<table class="table mb-0">
<thead>
<tr>
<th>ID</th>
<th>フォーム名</th>
<th>フォームキー</th>
<th>状態</th>
<th>更新日時</th>
<th style="width: 350px;">操作</th>
</tr>
</thead>
<tbody>
{% for form in forms %}
<tr>
<td>{{ form.id }}</td>
<td>{{ form.name }}</td>
<td><code>{{ form.formKey }}</code></td>
<td>
{% if form.isActive %}
<span class="badge badge-success">有効</span>
{% else %}
<span class="badge badge-secondary">無効</span>
{% endif %}
</td>
<td>{{ form.updateDate|date('Y/m/d H:i') }}</td>
<td>
<a href="{{ url('nzcustomplugin_form_display', {'key': form.formKey}) }}"
class="btn btn-sm btn-outline-primary"
target="_blank"
title="プレビュー">
<i class="fa fa-eye"></i>
</a>
<a href="{{ url('nzcustomplugin_admin_edit', {'id': form.id}) }}"
class="btn btn-sm btn-primary"
style="color: white; margin-left: 5px;"
title="編集">
編集
</a>
<a href="{{ url('nzcustomplugin_admin_submissions', {'form_id': form.id}) }}"
class="btn btn-sm btn-info"
style="color: white; margin-left: 5px;"
title="送信データ">
送信データ
</a>
<form method="post" action="{{ url('nzcustomplugin_admin_duplicate', {'id': form.id}) }}" style="display:inline; margin-left: 5px;">
<input type="hidden" name="_token" value="{{ csrf_token('duplicate' ~ form.id) }}">
<button type="submit" class="btn btn-sm btn-success" style="color: white;" title="複製">
<i class="fa fa-copy"></i> 複製
</button>
</form>
<form method="post" action="{{ url('nzcustomplugin_admin_delete', {'id': form.id}) }}" style="display:inline; margin-left: 5px;" onsubmit="return confirm('このフォームを削除してもよろしいですか?');">
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ form.id) }}">
<button type="submit" class="btn btn-sm btn-danger" style="color: white;" title="削除">削除</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<div class="text-center p-5 text-muted">
フォームが登録されていません
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endblock %}