master
parent
9aef20f75b
commit
9cd8c85df7
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: weizongsong
|
||||
* Date: 2025-10-23
|
||||
* Time: 21:00
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Forms\OrderAgreementForm;
|
||||
use App\Models\OrderAgreement;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class OrderAgreementController extends CommonController
|
||||
{
|
||||
public $bladePath = "admin.order-agreement";
|
||||
public $urlPrefix = "admin/order-agreement";
|
||||
public $modelName = "订单协议";
|
||||
public $modelClass = OrderAgreement::class;
|
||||
public $formClass = OrderAgreementForm::class;
|
||||
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = $this->model->with(['order', 'paramedicSign', 'customerSign', 'companySign', 'file']);
|
||||
|
||||
// 搜索功能
|
||||
if ($request->order_id) {
|
||||
$query->where('order_id', $request->order_id);
|
||||
}
|
||||
|
||||
if ($request->customer_id) {
|
||||
$query->where('customer_id', $request->customer_id);
|
||||
}
|
||||
|
||||
if ($request->paramedic_id) {
|
||||
$query->where('paramedic_id', $request->paramedic_id);
|
||||
}
|
||||
|
||||
$data = $query->orderBy('id', 'desc')->paginate(10);
|
||||
return view($this->bladePath . ".index", compact("data"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
@extends("admin.layouts.layout")
|
||||
|
||||
@php
|
||||
$pageTitle = __("actions." . last(explode("/", request()->url()))) . $modelName;
|
||||
@endphp
|
||||
|
||||
@section("content")
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
@include("public._form")
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@ -0,0 +1,120 @@
|
||||
@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="number" name="order_id" class="form-control" placeholder="订单ID"
|
||||
value="{{request('order_id')}}">
|
||||
</div>
|
||||
<div class="form-group mr-2">
|
||||
<input type="number" name="customer_id" class="form-control" placeholder="客户ID"
|
||||
value="{{request('customer_id')}}">
|
||||
</div>
|
||||
<div class="form-group mr-2">
|
||||
<input type="number" name="paramedic_id" class="form-control" placeholder="护工ID"
|
||||
value="{{request('paramedic_id')}}">
|
||||
</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>订单ID</th>
|
||||
<th>护工ID</th>
|
||||
<th>客户ID</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_id }}
|
||||
@else
|
||||
{{ $row->order_id ?: '-' }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $row->paramedic_id ?: '-' }}</td>
|
||||
<td>{{ $row->customer_id ?: '-' }}</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->companySign)
|
||||
<a href="{{Storage::url($row->companySign->folder . '/' . $row->companySign->name)}}"
|
||||
target="_blank">查看</a>
|
||||
@else
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($row->file)
|
||||
<a href="{{Storage::url($row->file->folder . '/' . $row->file->name)}}"
|
||||
target="_blank">下载</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>
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
Loading…
Reference in new issue