You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.9 KiB
PHTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>记录查询</title>
<link href="{{ asset('css/bootstrap.min.css') }}" rel="stylesheet">
<script src="{{ asset('js/bootstrap.min.js') }}"></script>
</head>
<body>
<div class="container mt-5">
<h2 class="text-center mb-4">记录查询</h2>
@if(session('error'))
<div class="alert alert-danger">
{{ session('error') }}
</div>
@endif
<form action="{{ route('record.query') }}" method="POST" class="mb-5">
@csrf
<div class="row g-3">
<div class="col-md-4">
<label for="start_date" class="form-label">开始日期</label>
<input type="datetime-local" class="form-control" id="start_date" name="start_date" value="{{ $startDate ?? '' }}" required>
</div>
<div class="col-md-4">
<label for="end_date" class="form-label">结束日期</label>
<input type="datetime-local" class="form-control" id="end_date" name="end_date" value="{{ $endDate ?? '' }}" required>
</div>
<div class="col-md-4">
<label for="type" class="form-label">记录类型</label>
<select class="form-select" id="type" name="type" required>
<option value="" {{ empty($type ?? '') ? 'selected' : '' }}>请选择类型</option>
<option value="1" {{ ($type ?? '') == 1 ? 'selected' : '' }}>预约</option>
<option value="2" {{ ($type ?? '') == 2 ? 'selected' : '' }}>登记</option>
</select>
</div>
</div>
<div class="mt-4 text-center">
<button type="submit" class="btn btn-primary btn-lg">查询</button>
</div>
</form>
@if(isset($records))
<div class="mt-5">
<h3>查询结果</h3>
<p>共 {{ count($records) }} 条记录</p>
<!-- 导出CSV按钮 -->
<form action="{{ route('record.export') }}" method="POST" style="display: inline;">
@csrf
<input type="hidden" name="start_date" value="{{ $startDate }}">
<input type="hidden" name="end_date" value="{{ $endDate }}">
<input type="hidden" name="type" value="{{ $type }}">
<button type="submit" class="btn btn-success mb-3">导出CSV</button>
</form>
<div class="table-responsive">
<table class="table table-bordered table-hover">
<thead class="table-dark">
<tr>
<th>姓名</th>
<th>电话</th>
<th>身份证号</th>
<th>创建时间</th>
<th>机构名称</th>
</tr>
</thead>
<tbody>
@foreach($records as $record)
<tr>
<td>{{ $record->name ?? '空' }}</td>
<td>{{ $record->tel ?? '空' }}</td>
<td>{{ $record->id_card_num ?? '空' }}</td>
<td>{{ $record->created_at ?? '空' }}</td>
<td>{{ $record->org_name ?? '空' }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endif
</div>
</body>
</html>