494 lines
30 KiB
PHP
494 lines
30 KiB
PHP
@extends('layouts.app')
|
||
|
||
@section('title', '定期予約マスタ')
|
||
|
||
@section('content')
|
||
|
||
<!-- Content Header -->
|
||
<div class="content-header">
|
||
<div class="container-fluid">
|
||
<div class="row mb-2">
|
||
<div class="col-lg-6">
|
||
<h1 class="m-0 text-dark">定期予約マスタ</h1>
|
||
|
||
{{-- タイトル直下の注意文 --}}
|
||
<p class="text-muted text-sm mt-2 mb-0">
|
||
※この画面のデータは通常変更する必要はありません。
|
||
</p>
|
||
</div>
|
||
|
||
<div class="col-lg-6">
|
||
<ol class="breadcrumb float-sm-right text-sm">
|
||
<li class="breadcrumb-item">
|
||
<a href="{{ route('home') }}">ホーム</a>
|
||
</li>
|
||
<li class="breadcrumb-item active">定期予約マスタ</li>
|
||
</ol>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- /.content-header -->
|
||
|
||
|
||
<section class="content">
|
||
<div class="container-fluid">
|
||
|
||
{{-- 並び替え用 hidden(usertypes と同型:JS はここを submit) --}}
|
||
<form method="GET" action="{{ route('reserves.index') }}" id="list-form">
|
||
<input type="hidden" name="sort" id="sort" value="{{ $sort ?? '' }}">
|
||
<input type="hidden" name="sort_type" id="sort_type" value="{{ $sort_type ?? '' }}">
|
||
|
||
{{-- フィルタ条件(並び替え時に条件が消えないように hidden で保持) --}}
|
||
<input type="hidden" name="user_id" value="{{ request('user_id', $user_id ?? '') }}">
|
||
<input type="hidden" name="park_id" value="{{ request('park_id', $park_id ?? '') }}">
|
||
<input type="hidden" name="valid_flag" value="{{ request('valid_flag', $valid_flag ?? '') }}">
|
||
<input type="hidden" name="reserve_date_from" value="{{ request('reserve_date_from', $reserve_date_from ?? '') }}">
|
||
<input type="hidden" name="reserve_date_to" value="{{ request('reserve_date_to', $reserve_date_to ?? '') }}">
|
||
<input type="hidden" name="keyword" value="{{ request('keyword', $keyword ?? '') }}">
|
||
</form>
|
||
|
||
<!-- ▼ 絞り込みフィルター -->
|
||
<div class="col-lg-12 px-0">
|
||
<div class="card">
|
||
<div class="card-header">
|
||
<h3 class="card-title">絞り込みフィルター</h3>
|
||
</div>
|
||
|
||
<!-- ▼ 絞り込みフィルター -->
|
||
<div class="col-lg-12 px-0">
|
||
<div class="card-body">
|
||
<form action="{{ route('reserves.index') }}" method="GET" id="filter-form">
|
||
|
||
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||
|
||
<div class="row">
|
||
{{-- 左側 --}}
|
||
<div class="col-lg-6">
|
||
{{-- 利用者ID --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">利用者ID</label>
|
||
<div class="col-9">
|
||
<input type="text"
|
||
name="user_id"
|
||
class="form-control"
|
||
value="{{ request('user_id', $user_id ?? '') }}"
|
||
placeholder="123456">
|
||
</div>
|
||
</div>
|
||
|
||
{{-- 有効フラグ --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">有効フラグ</label>
|
||
<div class="col-9">
|
||
<select name="valid_flag" class="form-control">
|
||
<option value="">全て</option>
|
||
<option value="1" {{ (string)request('valid_flag', $valid_flag ?? '') === '1' ? 'selected' : '' }}>有効</option>
|
||
<option value="0" {{ (string)request('valid_flag', $valid_flag ?? '') === '0' ? 'selected' : '' }}>無効</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- メール送信日時(from〜to) --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">メール送信日時</label>
|
||
<div class="col-9">
|
||
<div class="d-flex align-items-center">
|
||
<input type="datetime-local"
|
||
name="mail_sent_from"
|
||
class="form-control"
|
||
value="{{ request('mail_sent_from', $mail_sent_from ?? '') }}">
|
||
|
||
<span class="mx-2">〜</span>
|
||
|
||
<input type="datetime-local"
|
||
name="mail_sent_to"
|
||
class="form-control"
|
||
value="{{ request('mail_sent_to', $mail_sent_to ?? '') }}">
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- 右側 --}}
|
||
<div class="col-lg-6">
|
||
{{-- 駐輪場 --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">駐輪場</label>
|
||
<div class="col-9">
|
||
<select name="park_id" class="form-control">
|
||
<option value="">全て</option>
|
||
@foreach(($parkOptions ?? []) as $pid => $pname)
|
||
<option value="{{ $pid }}"
|
||
{{ (string)request('park_id', $park_id ?? '') === (string)$pid ? 'selected' : '' }}>
|
||
{{ $pname }}
|
||
</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- ゾーンID --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">ゾーン名</label>
|
||
<div class="col-9">
|
||
<select name="zone_id" class="form-control">
|
||
<option value="">全て</option>
|
||
@foreach(($zoneOptions ?? []) as $zid => $zname)
|
||
<option value="{{ $zid }}"
|
||
{{ (string)request('zone_id', $zone_id ?? '') === (string)$zid ? 'selected' : '' }}>
|
||
{{ $zname }}
|
||
</option>
|
||
@endforeach
|
||
</select>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- 予約区分 --}}
|
||
<div class="form-group row">
|
||
<label class="col-3 col-form-label font-weight-bold">予約区分</label>
|
||
<div class="col-9">
|
||
@php
|
||
$reserveType = (string)request('reserve_type', $reserve_type ?? '');
|
||
@endphp
|
||
<select name="reserve_type" class="form-control">
|
||
<option value="">全て</option>
|
||
<option value="0" {{ $reserveType === '0' ? 'selected' : '' }}>通常予約</option>
|
||
<option value="1" {{ $reserveType === '1' ? 'selected' : '' }}>仮予約</option>
|
||
</select>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- ボタン(左寄せで同じ感じ) --}}
|
||
<div class="mt-2">
|
||
<button type="submit" class="btn btn-success mr-2">絞り込み</button>
|
||
<a href="{{ route('reserves.index') }}" class="btn btn-outline-secondary">解除</a>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<!-- ▲ 絞り込みフィルター -->
|
||
|
||
{{-- ▼ ボタンエリア(usertypes と同型) --}}
|
||
<div class="col-lg-12 mb-3 px-0">
|
||
<button type="button"
|
||
class="btn btn-sm btn-primary mr10"
|
||
onclick="location.href='{{ route('reserves.create') }}?back={{ urlencode(request()->fullUrl()) }}'">
|
||
新規
|
||
</button>
|
||
|
||
<button type="button" class="btn btn-sm btn-danger mr10" id="delete">削除</button>
|
||
|
||
{{-- CSV 出力が必要なら復活(reserves.export がある場合のみ) --}}
|
||
@if(\Illuminate\Support\Facades\Route::has('reserves.export'))
|
||
<button type="submit" class="btn btn-sm btn-outline-success mr10" form="form_export">
|
||
CSV出力
|
||
</button>
|
||
@endif
|
||
<button type="submit" class="btn btn-sm btn-outline-success mr10" form="form_import">
|
||
インポート
|
||
</button>
|
||
|
||
</div>
|
||
|
||
{{-- ▼ ページネーション --}}
|
||
<div class="col-lg-12 px-0">
|
||
<div class="d-flex flex-column align-items-end mb-2 text-sm">
|
||
<div class="text-dark text-sm mb-1">
|
||
@if ($list->total() > 0)
|
||
全 {{ $list->total() }} 件中 {{ $list->firstItem() }}〜{{ $list->lastItem() }} 件を表示
|
||
@else
|
||
全0件
|
||
@endif
|
||
</div>
|
||
|
||
<div>
|
||
{{ $list->appends([
|
||
'sort' => $sort ?? '',
|
||
'sort_type' => $sort_type ?? '',
|
||
] + request()->except('page'))->links('pagination') }}
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- ▼ フラッシュメッセージ --}}
|
||
<div class="form col-lg-12 px-0">
|
||
@if(Session::has('success'))
|
||
<div class="alert alert-success alert-dismissible">
|
||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||
{{ Session::get('success') }}
|
||
</div>
|
||
@elseif(Session::has('error'))
|
||
<div class="alert alert-danger alert-dismissible">
|
||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||
{!! Session::get('error') !!}
|
||
</div>
|
||
@elseif(isset($errorMsg))
|
||
<div class="alert alert-danger alert-dismissible">
|
||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||
{!! $errorMsg !!}
|
||
</div>
|
||
@endif
|
||
</div>
|
||
|
||
{{-- ▼ テーブル --}}
|
||
<div class="col-lg-12 mb20 px-0">
|
||
<div class="table-responsive">
|
||
<form id="form_delete" method="POST" action="{{ route('reserves.destroy') }}">
|
||
@csrf
|
||
|
||
<table class="table table-bordered dataTable text-nowrap">
|
||
<thead class="thead-light">
|
||
<tr>
|
||
<th style="width:140px;">
|
||
<input type="checkbox"
|
||
class="js-check-all"
|
||
onclick="$('input[name*=\'pk\']').prop('checked', this.checked);">
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_id' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_id">
|
||
<span>定期予約ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'contract_id' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="contract_id">
|
||
<span>定期契約ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'contract_created_at' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="contract_created_at">
|
||
<span>定期契約日時</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'user_categoryid' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="user_categoryid">
|
||
<span>利用者分類ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'user_id' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="user_id">
|
||
<span>利用者ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_date' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_date">
|
||
<span>予約日時</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'park_name' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="park_name">
|
||
<span>駐輪場ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'price_parkplaceid' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="price_parkplaceid">
|
||
<span>駐輪場所ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'psection_subject' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="psection_subject">
|
||
<span>車種区分ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'ptype_subject' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="ptype_subject">
|
||
<span>駐輪分類ID</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_reduction' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_reduction">
|
||
<span>減免措置</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_auto_remind' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_auto_remind">
|
||
<span>自動リマインド日</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_manual_remind' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_manual_remind">
|
||
<span>手動リマインド日</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'flag_800m' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="flag_800m">
|
||
<span>800M以内フラグ</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_cancelday' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_cancelday">
|
||
<span>解約日</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'valid_flag' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="valid_flag">
|
||
<span>有効フラグ</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'sent_date' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="sent_date">
|
||
<span>メール送信日時</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_manual' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_manual">
|
||
<span>手動通知</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_notice' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_notice">
|
||
<span>手動通知方法</span>
|
||
</th>
|
||
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_order' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_order">
|
||
<span>空き待ち順</span>
|
||
</th>
|
||
|
||
{{-- ★追加:予約区分 --}}
|
||
<th class="sorting {{ ($sort ?? '') === 'reserve_type' ? (($sort_type ?? '') === 'asc' ? 'sorting_asc' : 'sorting_desc') : '' }}"
|
||
sort="reserve_type">
|
||
<span>予約区分</span>
|
||
</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="bg-white">
|
||
@foreach ($list as $item)
|
||
@php
|
||
$subjects = array_values(array_filter([
|
||
$item->usertype_subject1 ?? '',
|
||
$item->usertype_subject2 ?? '',
|
||
$item->usertype_subject3 ?? '',
|
||
], static fn ($v): bool => $v !== ''));
|
||
|
||
$userTypeLabel = $subjects ? implode('/', $subjects) : '';
|
||
@endphp
|
||
|
||
<tr>
|
||
<td style="background-color:#faebd7;">
|
||
<div class="d-flex align-items-center">
|
||
<input type="checkbox" name="pk[]" value="{{ $item->reserve_id }}">
|
||
<a href="{{ route('reserves.edit', ['reserve_id' => $item->reserve_id]) }}?back={{ urlencode(request()->fullUrl()) }}"
|
||
class="btn btn-sm btn-outline-primary ml10">
|
||
編集
|
||
</a>
|
||
</div>
|
||
</td>
|
||
|
||
<td class="text-right">{{ $item->reserve_id }}</td> {{-- 定期予約ID --}}
|
||
<td class="text-right">{{ $item->contract_id ?? '' }}</td> {{-- 定期契約ID --}}
|
||
<td>{{ $item->contract_created_at ?? '' }}</td> {{-- 定期契約日時 --}}
|
||
|
||
<td class="text-right">{{ $item->user_categoryid ?? '' }}</td> {{-- 利用者分類ID --}}
|
||
<td>{{ trim(($item->user_id ?? '') . ' ' . ($item->user_name ?? '')) }}</td> {{-- 利用者ID --}}
|
||
<td>{{ $item->reserve_date ?? '' }}</td> {{-- 予約日時 --}}
|
||
|
||
<td>{{ $item->park_name ?? '' }}</td> {{-- 駐輪場ID --}}
|
||
<td>{{ $item->display_prine_name ?? '' }}</td> {{-- 駐輪場所ID --}}
|
||
<td>{{ $item->psection_subject ?? '' }}</td> {{-- 車種区分ID --}}
|
||
<td>{{ $item->ptype_subject ?? '' }}</td> {{-- 駐輪分類ID --}}
|
||
|
||
<td>
|
||
@if((string)($item->reserve_reduction ?? '') === '1')
|
||
あり
|
||
@elseif((string)($item->reserve_reduction ?? '') === '0')
|
||
なし
|
||
@else
|
||
{{ $item->reserve_reduction ?? '' }}
|
||
@endif
|
||
</td> {{-- 減免措置 --}}
|
||
|
||
<td>{{ $item->reserve_auto_remind ?? '' }}</td> {{-- 自動リマインド日 --}}
|
||
<td>{{ $item->reserve_manual_remind ?? '' }}</td> {{-- 手動リマインド日 --}}
|
||
|
||
<td>
|
||
@if((string)($item->flag_800m ?? '') === '1')
|
||
○
|
||
@elseif((string)($item->flag_800m ?? '') === '0')
|
||
×
|
||
@else
|
||
{{ $item->flag_800m ?? '' }}
|
||
@endif
|
||
</td> {{-- 800M以内フラグ --}}
|
||
|
||
<td>{{ $item->reserve_cancelday ?? '' }}</td> {{-- 解約日 --}}
|
||
|
||
<td>
|
||
@if((string)($item->valid_flag ?? '') === '1')
|
||
有効
|
||
@elseif((string)($item->valid_flag ?? '') === '0')
|
||
無効
|
||
@else
|
||
{{ $item->valid_flag ?? '' }}
|
||
@endif
|
||
</td> {{-- 有効フラグ --}}
|
||
|
||
<td>{{ $item->sent_date ?? '' }}</td> {{-- メール送信日時 --}}
|
||
|
||
<td>
|
||
@if((string)($item->reserve_manual ?? '') === '1')
|
||
手動
|
||
@elseif((string)($item->reserve_manual ?? '') === '0')
|
||
自動
|
||
@else
|
||
{{ $item->reserve_manual ?? '' }}
|
||
@endif
|
||
</td> {{-- 手動通知 --}}
|
||
|
||
<td>
|
||
@if((string)($item->reserve_notice ?? '') === 'tel')
|
||
電話
|
||
@elseif((string)($item->reserve_notice ?? '') === 'post')
|
||
郵送
|
||
@else
|
||
{{ $item->reserve_notice ?? '' }}
|
||
@endif
|
||
</td> {{-- 手動通知方法 --}}
|
||
|
||
<td class="text-right">{{ $item->reserve_order ?? '' }}</td> {{-- 空き待ち順 --}}
|
||
|
||
<td>
|
||
@if((string)($item->reserve_type ?? '') === '1')
|
||
仮予約
|
||
@elseif((string)($item->reserve_type ?? '') === '0')
|
||
通常予約
|
||
@else
|
||
{{ $item->reserve_type ?? '' }}
|
||
@endif
|
||
</td> {{-- ★予約区分 --}}
|
||
|
||
</tr>
|
||
@endforeach
|
||
</tbody>
|
||
</table>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
|
||
{{-- CSV(POST のまま:ルートがある場合のみ) --}}
|
||
@if(\Illuminate\Support\Facades\Route::has('reserves.export'))
|
||
<form action="{{ route('reserves.export') }}" method="POST" id="form_export">
|
||
@csrf
|
||
<input type="hidden" name="sort" value="{{ $sort ?? '' }}">
|
||
<input type="hidden" name="sort_type" value="{{ $sort_type ?? '' }}">
|
||
<input type="hidden" name="user_id" value="{{ request('user_id', $user_id ?? '') }}">
|
||
<input type="hidden" name="park_id" value="{{ request('park_id', $park_id ?? '') }}">
|
||
<input type="hidden" name="valid_flag" value="{{ request('valid_flag', $valid_flag ?? '') }}">
|
||
<input type="hidden" name="reserve_date_from" value="{{ request('reserve_date_from', $reserve_date_from ?? '') }}">
|
||
<input type="hidden" name="reserve_date_to" value="{{ request('reserve_date_to', $reserve_date_to ?? '') }}">
|
||
<input type="hidden" name="keyword" value="{{ request('keyword', $keyword ?? '') }}">
|
||
</form>
|
||
@endif
|
||
|
||
</div>
|
||
</section>
|
||
@endsection
|