This commit is contained in:
parent
7913f58d19
commit
277631c23a
@ -10,14 +10,61 @@ class SealsController extends Controller
|
||||
{
|
||||
public function list(Request $request)
|
||||
{
|
||||
// ソート用パラメータを取得(デフォルト値を設定)
|
||||
$sort = $request->input('sort', 'seal_issueid');
|
||||
$sort_type = $request->input('sort_type', 'desc');
|
||||
// ソート用パラメータ取得(指定がなければnull)
|
||||
$sort = $request->input('sort');
|
||||
$sort_type = $request->input('sort_type', 'asc');
|
||||
|
||||
// sealテーブルを参照し、ソート
|
||||
$list = DB::table('seal')
|
||||
->orderBy($sort, $sort_type)
|
||||
->paginate(20);
|
||||
// sealテーブルを参照し、フィルター
|
||||
$query = DB::table('seal');
|
||||
|
||||
// フィルター:発行日
|
||||
$periodType = $request->input('period_type');
|
||||
$recentPeriod = $request->input('recent_period');
|
||||
$sealDayFrom = $request->input('seal_day_from');
|
||||
$sealDayTo = $request->input('seal_day_to');
|
||||
|
||||
if ($periodType === 'range' && $sealDayFrom && $sealDayTo) {
|
||||
$query->whereBetween('seal_day', [$sealDayFrom, $sealDayTo]);
|
||||
} elseif ($periodType === 'recent' && $recentPeriod) {
|
||||
$now = date('Y-m-d');
|
||||
switch ($recentPeriod) {
|
||||
case '12m':
|
||||
$from = date('Y-m-d', strtotime('-12 months', strtotime($now)));
|
||||
break;
|
||||
case '6m':
|
||||
$from = date('Y-m-d', strtotime('-6 months', strtotime($now)));
|
||||
break;
|
||||
case '3m':
|
||||
$from = date('Y-m-d', strtotime('-3 months', strtotime($now)));
|
||||
break;
|
||||
case '2m':
|
||||
$from = date('Y-m-d', strtotime('-2 months', strtotime($now)));
|
||||
break;
|
||||
case '1m':
|
||||
$from = date('Y-m-d', strtotime('-1 months', strtotime($now)));
|
||||
break;
|
||||
case '1w':
|
||||
$from = date('Y-m-d', strtotime('-1 week', strtotime($now)));
|
||||
break;
|
||||
default:
|
||||
$from = null;
|
||||
}
|
||||
if (isset($from)) {
|
||||
$query->where('seal_day', '>=', $from);
|
||||
}
|
||||
} else {
|
||||
// デフォルト:直近3ヶ月
|
||||
$now = date('Y-m-d');
|
||||
$from = date('Y-m-d', strtotime('-3 months', strtotime($now)));
|
||||
$query->where('seal_day', '>=', $from);
|
||||
}
|
||||
|
||||
// ソート指定があればorderBy、なければDB物理順
|
||||
if ($sort) {
|
||||
$list = $query->orderBy($sort, $sort_type)->paginate(20);
|
||||
} else {
|
||||
$list = $query->paginate(20);
|
||||
}
|
||||
|
||||
return view('admin.seals.list', [
|
||||
'list' => $list,
|
||||
|
||||
@ -22,10 +22,10 @@ class TagissueController extends Controller
|
||||
->select('user_name', 'user_regident_zip', 'user_regident_pre')
|
||||
->get();
|
||||
|
||||
// PDF生成(Laravel-dompdf使用例)
|
||||
$pdfHtml = view('admin.tag_issue.pdf_labels', ['users' => $users])->render();
|
||||
$pdf = \PDF::loadHTML($pdfHtml);
|
||||
return $pdf->download('tag_labels.pdf');
|
||||
// PDF生成(Laravel-dompdf使用例)
|
||||
$pdfHtml = view('admin.tag_issue.pdf_labels', ['users' => $users])->render();
|
||||
$pdf = Pdf::setOptions(['isRemoteEnabled' => true])->loadHTML($pdfHtml);
|
||||
return $pdf->download('tag_labels.pdf');
|
||||
}
|
||||
public function list(Request $request)
|
||||
{
|
||||
|
||||
@ -83,12 +83,47 @@
|
||||
<table class="table table-bordered table-hover table-sm">
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
<th>シール発行履歴ID</th>
|
||||
<th>シール発行駐輪場</th>
|
||||
<th>定期契約ID</th>
|
||||
<th>
|
||||
<a href="{{ route('seals', array_merge(request()->all(), ['sort' => 'seal_issueid', 'sort_type' => ($sort === 'seal_issueid' && $sort_type === 'asc') ? 'desc' : 'asc'])) }}">
|
||||
シール発行履歴ID
|
||||
@if($sort === 'seal_issueid')
|
||||
<i class="fa fa-sort-{{ $sort_type }}"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('seals', array_merge(request()->all(), ['sort' => 'park_id', 'sort_type' => ($sort === 'park_id' && $sort_type === 'asc') ? 'desc' : 'asc'])) }}">
|
||||
シール発行駐輪場
|
||||
@if($sort === 'park_id')
|
||||
<i class="fa fa-sort-{{ $sort_type }}"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('seals', array_merge(request()->all(), ['sort' => 'contract_id', 'sort_type' => ($sort === 'contract_id' && $sort_type === 'asc') ? 'desc' : 'asc'])) }}">
|
||||
定期契約ID
|
||||
@if($sort === 'contract_id')
|
||||
<i class="fa fa-sort-{{ $sort_type }}"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>車種区分ID</th>
|
||||
<th>発行日</th>
|
||||
<th>発行回数</th>
|
||||
<th>
|
||||
<a href="{{ route('seals', array_merge(request()->all(), ['sort' => 'seal_day', 'sort_type' => ($sort === 'seal_day' && $sort_type === 'asc') ? 'desc' : 'asc'])) }}">
|
||||
発行日
|
||||
@if($sort === 'seal_day')
|
||||
<i class="fa fa-sort-{{ $sort_type }}"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>
|
||||
<a href="{{ route('seals', array_merge(request()->all(), ['sort' => 'contract_seal_issue', 'sort_type' => ($sort === 'contract_seal_issue' && $sort_type === 'asc') ? 'desc' : 'asc'])) }}">
|
||||
発行回数
|
||||
@if($sort === 'contract_seal_issue')
|
||||
<i class="fa fa-sort-{{ $sort_type }}"></i>
|
||||
@endif
|
||||
</a>
|
||||
</th>
|
||||
<th>理由</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@ -3,6 +3,16 @@
|
||||
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
@if(session('success'))
|
||||
<div class="alert alert-success" style="margin-top:10px;">
|
||||
{{ session('success') }}
|
||||
</div>
|
||||
@endif
|
||||
@if(session('error'))
|
||||
<div class="alert alert-danger" style="margin-top:10px;">
|
||||
{{ session('error') }}
|
||||
</div>
|
||||
@endif
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h3 class="m-0 text-dark">タグ発行キュー処理、履歴表示</h3>
|
||||
<nav aria-label="breadcrumb" class="mb-0" style="background: transparent;">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user