67 lines
3.0 KiB
PHP
67 lines
3.0 KiB
PHP
<div class="page-header">
|
|||
|
|
<div>
|
||
|
|
<h1>车辆管理</h1>
|
||
|
|
<p class="muted">管理家庭的自有车和租用车辆,供出行方式引用</p>
|
||
|
|
</div>
|
||
|
|
<a href="<?= url('vehicles/create') ?>" class="btn-primary">+ 新增车辆</a>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
<?php if (empty($vehicles)): ?>
|
||
|
|
<div class="empty">
|
||
|
|
<p>暂无车辆</p>
|
||
|
|
<a href="<?= url('vehicles/create') ?>" class="btn-primary">添加第一辆</a>
|
||
|
|
</div>
|
||
|
|
<?php else: ?>
|
||
|
|
<table class="data-table">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th style="width:60px;">ID</th>
|
||
|
|
<th style="width:130px;">车牌号</th>
|
||
|
|
<th>车型</th>
|
||
|
|
<th style="width:100px;">类型</th>
|
||
|
|
<th style="width:130px;">租车信息</th>
|
||
|
|
<th style="width:90px;">使用</th>
|
||
|
|
<th style="width:140px;">操作</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
<?php foreach ($vehicles as $v): ?>
|
||
|
|
<tr>
|
||
|
|
<td><?= (int)$v['id'] ?></td>
|
||
|
|
<td>
|
||
|
|
<strong style="letter-spacing:0.5px;"><?= e($v['plate_number']) ?></strong>
|
||
|
|
<?php if (!empty($v['is_default']) && $v['vehicle_type'] === 'own'): ?>
|
||
|
|
<span class="tag-default" title="默认自有车">默认</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</td>
|
||
|
|
<td><?= e($v['model_name']) ?></td>
|
||
|
|
<td>
|
||
|
|
<span class="veh-tag veh-<?= e($v['vehicle_type']) ?>">
|
||
|
|
<?= e($typeLabels[$v['vehicle_type']] ?? $v['vehicle_type']) ?>
|
||
|
|
</span>
|
||
|
|
</td>
|
||
|
|
<td>
|
||
|
|
<?php if ($v['vehicle_type'] === 'rental' && !empty($v['rental_company'])): ?>
|
||
|
|
<div><?= e($v['rental_company']) ?></div>
|
||
|
|
<?php if (!empty($v['rental_order_no'])): ?>
|
||
|
|
<div class="muted" style="font-size:12px;"><?= e($v['rental_order_no']) ?></div>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php else: ?>
|
||
|
|
<span class="muted">—</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</td>
|
||
|
|
<td class="muted"><?= (int)$v['mode_count'] ?> 次</td>
|
||
|
|
<td>
|
||
|
|
<a href="<?= url('vehicles/edit', ['id' => $v['id']]) ?>" class="btn-sm">编辑</a>
|
||
|
|
<form method="post" action="<?= url('vehicles/destroy') ?>" style="display:inline"
|
||
|
|
onsubmit="return confirm('确定删除车辆「<?= e($v['plate_number']) ?>」?');">
|
||
|
|
<input type="hidden" name="_csrf" value="<?= e(csrf_token()) ?>">
|
||
|
|
<input type="hidden" name="id" value="<?= (int)$v['id'] ?>">
|
||
|
|
<button type="submit" class="btn-sm btn-danger">删除</button>
|
||
|
|
</form>
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</tbody>
|
||
|
|
</table>
|
||
|
|
<?php endif; ?>
|