Compare commits
No commits in common. "fd0bdfff511c4f476fd2689dd2faa6d61c6901ad" and "179a5ca27c0eddc17f2439af15d3447f999a0371" have entirely different histories.
fd0bdfff51
...
179a5ca27c
@ -76,57 +76,6 @@ class RegularContractController extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
public function showHistory(Request $request)
|
||||
{
|
||||
$user_id = session('user_id');
|
||||
if (!$user_id) {
|
||||
return redirect('/login');
|
||||
}
|
||||
$user_name = DB::table('user')->where('user_id', $user_id)->value('user_name');
|
||||
|
||||
// 定期契約情報を取得(ページネーション付き)
|
||||
$contracts_query = DB::table('regular_contract')
|
||||
->join('park', 'regular_contract.park_id', '=', 'park.park_id')
|
||||
->join('usertype', 'regular_contract.user_categoryid', '=', 'usertype.user_categoryid')
|
||||
->leftJoin('city', 'park.city_id', '=', 'city.city_id')
|
||||
->where('regular_contract.user_id', $user_id)
|
||||
->whereNotNull('regular_contract.contract_periods')
|
||||
->select(
|
||||
'regular_contract.contract_id',
|
||||
'park.park_name',
|
||||
'usertype.usertype_subject1',
|
||||
'regular_contract.contract_periods',
|
||||
'regular_contract.contract_periode',
|
||||
'regular_contract.enable_months',
|
||||
'regular_contract.park_id',
|
||||
'city.update_grace_period_start_date',
|
||||
)
|
||||
->orderBy('regular_contract.contract_id', 'desc');
|
||||
|
||||
// ページネーション(4件ずつ)
|
||||
$contracts = $contracts_query->paginate(4);
|
||||
|
||||
// grace日付加工
|
||||
$contracts->getCollection()->transform(function ($contract) {
|
||||
$periode = $contract->contract_periode;
|
||||
$grace_day = $contract->update_grace_period_start_date;
|
||||
$ym = date('Y/m', strtotime($periode));
|
||||
$day = str_pad($grace_day, 2, '0', STR_PAD_LEFT);
|
||||
$contract->periode_with_grace = $ym . '/' . $day;
|
||||
return $contract;
|
||||
});
|
||||
|
||||
\Log::info('契約履歴表示画面にアクセス', [
|
||||
'user_id' => $user_id,
|
||||
]);
|
||||
|
||||
return view('regular_contract.history', [
|
||||
'active_menu' => 'SWC-6-1', // マイページメニューの選択状態用
|
||||
'user_name' => $user_name, // ユーザー名(ヘッダー用)
|
||||
'contracts' => $contracts,
|
||||
]);
|
||||
}
|
||||
|
||||
public function update($contract_id)
|
||||
{
|
||||
$user_id = session('user_id');
|
||||
|
||||
@ -1,92 +0,0 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<main>
|
||||
<header class="alert alert-success">
|
||||
<h4 class="container">契約履歴 > 定期契約履歴を見る</h4>
|
||||
</header>
|
||||
<section class="container mt30 mb50">
|
||||
@if(count($contracts) > 0)
|
||||
@foreach($contracts as $i => $contract)
|
||||
@if($i % 2 == 0)
|
||||
<div class="row">
|
||||
@endif
|
||||
<article class="col-12 col-lg-6 mb20">
|
||||
<div class="card border-success">
|
||||
<table class="table text-center table-no-margin bg-white border-white">
|
||||
<tr>
|
||||
<th>定期契約ID</th>
|
||||
<td>{{ $contract->contract_id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>駐輪場名</th>
|
||||
<td>{{ $contract->park_name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>利用者区分</th>
|
||||
<td>{{ $contract->usertype_subject1 }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>開始日</th>
|
||||
<td>{{ \Carbon\Carbon::parse($contract->contract_periods)->format('Y/m/d') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>月数</th>
|
||||
<td>{{ $contract->enable_months }}ヶ月</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>更新時期</th>
|
||||
<td>{{ $contract->periode_with_grace }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" class="text-center">
|
||||
@php
|
||||
$has_receipt = DB::table('inv_publish')->where('contract_id', $contract->contract_id)->exists();
|
||||
@endphp
|
||||
@if($has_receipt)
|
||||
<a href="{{ url('receipt/download/' . $contract->contract_id) }}" class="btn btn-outline-secondary badge-pill custom-rounded-btn" style="background: transparent;">領収書再発行</a>
|
||||
@else
|
||||
<a href="{{ url('receipt/input/' . $contract->contract_id) }}" class="btn btn-outline-secondary badge-pill custom-rounded-btn" style="background: transparent;">領収書発行</a>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</article>
|
||||
@if($i % 2 == 1 || $i == count($contracts) - 1)
|
||||
</div>
|
||||
@endif
|
||||
@endforeach
|
||||
<div class="d-flex justify-content-center mt-4">
|
||||
{{ $contracts->links('partials.paging') }}
|
||||
</div>
|
||||
@else
|
||||
<div class="col-12 col-lg-12 mb20">
|
||||
<p>定期契約情報はありません。</p>
|
||||
</div>
|
||||
@endif
|
||||
<form class="row form">
|
||||
<div class="col-12 col-md-4 offset-0 offset-md-4 mt50 mb50">
|
||||
<a href="{{ url('mypage') }}" class="btn btn-lg btn-block btn-outline-success">マイページへ戻る</a>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@endsection
|
||||
<style>
|
||||
.custom-rounded-btn {
|
||||
border-radius: 2rem !important;
|
||||
padding-left: 2rem !important;
|
||||
padding-right: 2rem !important;
|
||||
font-weight: 500;
|
||||
min-width: 140px;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
|
||||
}
|
||||
|
||||
.table.text-center {
|
||||
border-radius: 0.25rem !important;
|
||||
border-collapse: separate !important;
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
@ -128,11 +128,6 @@ Route::get('regular_contract/select_period/{contract_id}', [RegularContractContr
|
||||
->name('regular_contract.select_period');
|
||||
Route::post('regular_contract/update_period', [App\Http\Controllers\RegularContractController::class, 'updatePeriod'])
|
||||
->name('regular_contract.update_period');
|
||||
|
||||
// 定期契約履歴
|
||||
Route::get('regular_contract/history', [RegularContractController::class, 'showHistory'])
|
||||
->name('regular_contract.history');
|
||||
|
||||
// 空き待ち状況確認画面
|
||||
Route::get('park_waitlist', [ParkWaitlistController::class, 'index'])
|
||||
->name('park_waitlist.index');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user