Files

60 lines
2.5 KiB
PHP
Raw Permalink Normal View History

<div class="page-header">
<div>
<h1>出行方式管理</h1>
<p class="muted">管理家庭常用的交通方式。具体的车次、航班号在「活动节点」中填写</p>
</div>
<a href="<?= url('travel_modes/create') ?>" class="btn-primary">+ 新增出行方式</a>
</div>
<?php if (empty($modes)): ?>
<div class="empty">
<p>暂无出行方式</p>
<a href="<?= url('travel_modes/create') ?>" class="btn-primary">添加第一个</a>
</div>
<?php else: ?>
<table class="data-table">
<thead>
<tr>
<th style="width:60px;">ID</th>
<th style="width:140px;">类型</th>
<th>备注</th>
<th style="width:90px;">使用</th>
<th style="width:140px;">操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($modes as $m): ?>
<tr>
<td><?= (int)$m['id'] ?></td>
<td>
<span class="mode-tag mode-<?= e($m['mode_type']) ?>">
<?= e($modeLabels[$m['mode_type']] ?? $m['mode_type']) ?>
</span>
<?php if (!empty($m['plate_number'])): ?>
<div class="muted" style="font-size:12px; margin-top:4px;">
<?= e($m['plate_number'] . ' ' . $m['model_name']) ?>
</div>
<?php endif; ?>
</td>
<td>
<?php if (!empty($m['notes'])): ?>
<?= e($m['notes']) ?>
<?php else: ?>
<span class="muted">—</span>
<?php endif; ?>
</td>
<td class="muted"><?= (int)$m['node_count'] ?> 次</td>
<td>
<a href="<?= url('travel_modes/edit', ['id' => $m['id']]) ?>" class="btn-sm">编辑</a>
<form method="post" action="<?= url('travel_modes/destroy') ?>" style="display:inline"
onsubmit="return confirm('确定删除该出行方式?');">
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
<input type="hidden" name="id" value="<?= (int)$m['id'] ?>">
<button type="submit" class="btn-sm btn-danger">删除</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>