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

141 lines
7.1 KiB

@extends("admin.layouts.layout")
@section("content")
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<!-- <div class="mb-3">
<a class="btn btn-primary" href="{{url($urlPrefix . '/create')}}">
@lang("icons.action_create") @lang('actions.create'){{$modelName}}
</a>
</div> -->
<!-- 搜索表单 -->
<div class="mb-3">
<form method="GET" action="{{url($urlPrefix)}}" class="form-inline">
<div class="form-group mr-2">
<input type="text" name="order_serial" class="form-control" placeholder="订单编号"
value="{{request('order_serial')}}">
</div>
<div class="form-group mr-2">
<input type="text" name="customer_mobile" class="form-control" placeholder="客户手机号"
value="{{request('customer_mobile')}}">
</div>
<div class="form-group mr-2">
<input type="text" name="paramedic_name" class="form-control" placeholder="护工姓名"
value="{{request('paramedic_name')}}">
</div>
<button type="submit" class="btn btn-info mr-2">搜索</button>
<a href="{{url($urlPrefix)}}" class="btn btn-secondary">重置</a>
</form>
</div>
<table class="table table-bordered" id="data-table">
<thead>
<tr>
<th>ID</th>
<th>订单编号</th>
<th>护工姓名</th>
<th>客户手机号</th>
<th>护工签名</th>
<th>客户签名</th>
<th>协议文件</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach ($data as $row)
<tr data-id="{{$row->id}}">
<td>{{ $row->id }}</td>
<td>
@if($row->order)
{{ $row->order->serial }}
@else
-
@endif
</td>
<td>
@if($row->paramedic)
{{ $row->paramedic->name }}
@else
-
@endif
</td>
<td>
@if($row->customer)
{{ $row->customer->mobile }}
@else
-
@endif
</td>
<td>
@if($row->paramedicSign)
<a href="{{Storage::url($row->paramedicSign->folder . '/' . $row->paramedicSign->name)}}"
target="_blank">查看</a>
@else
-
@endif
</td>
<td>
@if($row->customerSign)
<a href="{{Storage::url($row->customerSign->folder . '/' . $row->customerSign->name)}}"
target="_blank">查看</a>
@else
-
@endif
</td>
<td>
@if($row->html)
<a href="javascript:void(0);" onclick="showHtml(this)"
data-html="{{base64_encode($row->html)}}">查看</a>
@else
-
@endif
</td>
<td>{{ $row->created_at->format('Y-m-d H:i:s') }}</td>
<td>
<!-- <a class="btn btn-sm btn-primary"
href="{{url("{$urlPrefix}/edit?id={$row['id']}")}}">@lang("icons.action_edit")
@lang("actions.edit")</a> -->
<a class="btn btn-sm btn-danger btn-delete" data-id="{{$row['id']}}"
href="javascript:;">@lang("icons.action_delete") @lang("actions.delete")</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@include("public._pages")
</div>
</div>
</div>
</div>
@include("public._delete")
@endsection
@push("footer")
<script>
function showHtml(element) {
// 获取base64编码的HTML内容
var encodedHtml = element.getAttribute('data-html');
// 解码HTML内容并正确处理UTF-8字符
var binaryString = atob(encodedHtml);
var bytes = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
var htmlContent = new TextDecoder('utf-8').decode(bytes);
// 使用Blob和URL创建正确编码的HTML文档
var blob = new Blob([htmlContent], { type: 'text/html; charset=utf-8' });
var url = URL.createObjectURL(blob);
// 打开新窗口
window.open(url, '_blank');
}
</script>
@endpush