From 1b48a9a13988aa56ec449d2908f74d22a8345e0b Mon Sep 17 00:00:00 2001 From: Yuka Higashide Date: Fri, 5 Sep 2025 21:12:30 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A5=91=E7=B4=84=E6=9B=B4=E6=96=B0=E9=96=A2?= =?UTF-8?q?=E9=80=A3=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/RegularContractController.php | 305 +++++++++++++++-- .../views/partials/mypage_menu.blade.php | 14 +- .../views/partials/mypagefootermenu.blade.php | 6 +- .../confirm_category.blade.php | 85 +++++ .../identity_checking.blade.php | 23 ++ .../regular_contract/select_period.blade.php | 81 +++++ .../views/regular_contract/update.blade.php | 321 ++++++++++++++++++ .../upload_identity.blade.php | 40 +++ routes/web.php | 21 +- 9 files changed, 854 insertions(+), 42 deletions(-) create mode 100644 resources/views/regular_contract/confirm_category.blade.php create mode 100644 resources/views/regular_contract/identity_checking.blade.php create mode 100644 resources/views/regular_contract/select_period.blade.php create mode 100644 resources/views/regular_contract/update.blade.php create mode 100644 resources/views/regular_contract/upload_identity.blade.php diff --git a/app/Http/Controllers/RegularContractController.php b/app/Http/Controllers/RegularContractController.php index 2c9412b..d294bf6 100644 --- a/app/Http/Controllers/RegularContractController.php +++ b/app/Http/Controllers/RegularContractController.php @@ -4,10 +4,11 @@ namespace App\Http\Controllers; use Illuminate\Support\Facades\DB; use Illuminate\Http\Request; +use Carbon\Carbon; class RegularContractController extends Controller { - public function showInfo() + public function showInfo(Request $request) { $user_id = session('user_id'); if (!$user_id) { @@ -52,13 +53,24 @@ class RegularContractController extends Controller ) ->get(); - \Log::info('契約情報表示画面にアクセス', [ - 'user_id' => $user_id, - ]); + if ($request->route()->getName() === 'regular_contract.info') { + // 契約情報表示画面の処理 + \Log::info('契約情報表示画面にアクセス', [ + 'user_id' => $user_id, + ]); + $view = 'regular_contract.info'; + $active_menu = 'SWC-3-1'; + } else { + // 契約更新画面の処理 + \Log::info('契約更新画面にアクセス', [ + 'user_id' => $user_id, + ]); + $view = 'regular_contract.update'; + $active_menu = 'SWC-4-1'; + } - - return view('regular_contract.info', [ - 'active_menu' => 'SWC-3-1', // マイページメニューの選択状態用 + return view($view, [ + 'active_menu' => $active_menu, // マイページメニューの選択状態用 'user_name' => $user_name, // ユーザー名(ヘッダー用) 'contracts' => $contracts, ]); @@ -90,6 +102,7 @@ class RegularContractController extends Controller 'contract_cancel_flag' => 0, '800m_flag' => 0, 'psection_id' => $old_contract->psection_id, + 'ptype_id' => $old_contract->ptype_id, 'zone_id' => $old_contract->zone_id, 'pplace_no' => $old_contract->pplace_no ]); @@ -124,7 +137,7 @@ class RegularContractController extends Controller ->first(); return view('regular_contract.confirm_category', [ - 'active_menu' => 'SWC-4-3', // マイページメニューの選択状態用 + 'active_menu' => 'SWC-4-1', // マイページメニューの選択状態用 'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用) 'user' => $user, 'contract' => $contract @@ -134,15 +147,6 @@ class RegularContractController extends Controller /** * 契約区分確認画面の「確認して進む」ボタン押下時の分岐処理 * 本人確認書類アップロード画面 or 利用期間選択画面へ遷移 - * - * 分岐条件は下記の通り: - * 1. 利用者分類(一般/学生):user.user_categoryid=usertype.user_categoryidのusertype_subject1で判別 - * 2. 利用者分類(減免/減免でない):regular_contract.contract_reduction=1なら減免 - * 3. 駐輪場マスタの設定(減免確認種別):reduction_confirm.reduction_confirm_type(0=確認しない,1=年1回,2=毎更新時) - * 4. 駐輪場マスタの設定(年度跨ぎ):park.overyear_flag(0/NULL=年跨ぎなし,1=年跨ぎあり) - * 5. 駐輪場マスタの設定(学生証確認種別):park.student_id_confirm_type(0=確認しない,1=年1回,2=毎更新時) - * 6. 契約期間に4/1が含まれる場合は年度跨ぎ判定に利用 - * 7. ユーザー区分が「学生」の場合のみ、契約終了日が卒業年月日を超える場合も本人確認書類アップロード画面へ */ public function confirmCategoryNext($contract_id) { @@ -170,39 +174,56 @@ class RegularContractController extends Controller // 分岐条件 $reduction_confirm_type = isset($reduction_confirm) ? $reduction_confirm->reduction_confirm_type : 0; $student_id_confirm_type = isset($park) ? $park->student_id_confirm_type : 0; - $overyear_flag = isset($park) ? $park->overyear_flag : 0; + // $overyear_flag = isset($park) ? $park->overyear_flag : 0; // 契約期間に4/1が含まれるか判定 - $contract_start = new \DateTime($contract->contract_periods); - $contract_end = new \DateTime($contract->contract_periode); + // $contract_start = new \DateTime($contract->contract_periods); + // $contract_end = new \DateTime($contract->contract_periode); // 4/1の年は契約開始年 - $april_first = new \DateTime($contract_start->format('Y') . '-04-01'); + // $april_first = new \DateTime($contract_start->format('Y') . '-04-01'); // 契約終了日が4/1より前なら翌年の4/1も考慮 - if ($contract_end < $april_first) { + /**if ($contract_end < $april_first) { $april_first->modify('+1 year'); } - $includes_april_first = ($contract_start <= $april_first && $contract_end >= $april_first); + $includes_april_first = ($contract_start <= $april_first && $contract_end >= $april_first);*/ // ユーザー区分が「学生」の場合のみ卒業年月日判定 - $exceeds_graduation = false; + /**$exceeds_graduation = false; if (isset($usertype) && $usertype->usertype_subject1 === '学生') { $graduation_date = isset($user) ? $user->user_graduate : null; if ($graduation_date) { $graduation_dt = new \DateTime($graduation_date); $exceeds_graduation = ($contract_end > $graduation_dt); } - } + }*/ // 本人確認書類アップロード画面へ遷移する条件 // 1. reduction_confirm_typeが1(年1回)または2(毎更新時) // 2. student_id_confirm_typeが1(年1回)または2(毎更新時) // 3. 年度跨ぎ(overyear_flag=1以外)かつ契約期間に4/1が含まれる場合 - if ( - in_array($reduction_confirm_type, [1, 2]) || - in_array($student_id_confirm_type, [1, 2]) || - ($overyear_flag != 1 && $includes_april_first) || - $exceeds_graduation - ) { + $need_identity = false; + // 減免確認種別:reduction_confirm_type=1は年度跨ぎのみ、2は無条件で本人確認 + /**if ($reduction_confirm_type == 1 && $includes_april_first) { + $need_identity = true; + }*/ + /**if ($reduction_confirm_type == 2) {*/ + if (in_array($reduction_confirm_type, [1, 2])) { + $need_identity = true; + } + // 学生証確認種別:学生の場合かつ減免でない場合のみ判定 + if (isset($usertype) && $usertype->usertype_subject1 === '学生' && in_array($student_id_confirm_type, [1, 2]) && $contract->contract_reduction == 0) { + $need_identity = true; + } + // 年度跨ぎ判定 + /**if ($overyear_flag != 1 && $includes_april_first) { + $need_identity = true; + }*/ + // 卒業年月日超過判定 + /**if ($exceeds_graduation) { + $need_identity = true; + }*/ + + if ($need_identity) { // 本人確認書類アップロード画面へ return redirect()->route('regular_contract.upload_identity', ['contract_id' => $contract_id]); } else { @@ -210,4 +231,226 @@ class RegularContractController extends Controller return redirect()->route('regular_contract.select_period', ['contract_id' => $contract_id]); } } + + public function uploadIdentity($contract_id) + { + $user_id = session('user_id'); + if (!$user_id) { + return redirect('/login'); + } + $user_name = DB::table('user')->where('user_id', $user_id)->value('user_name'); + + \Log::info('契約更新用本人確認書類アップロード画面にアクセス', [ + 'user_id' => $user_id, + ]); + + return view('regular_contract.upload_identity', [ + 'active_menu' => 'SWC-4-1', // マイページメニューの選択状態用 + 'user_name' => $user_name, // ユーザー名(ヘッダー用) + 'contract_id' => $contract_id, + ]); + } + + public function uploadIdentitySubmit(Request $request, $contract_id) + { + $user_id = session('user_id'); + if (!$user_id) { + return redirect('/login'); + } + + // バリデーション + $rules = [ + 'user_idcard' => 'required|file|mimes:jpeg,png,jpg,gif,webp', + 'user_idcard2' => 'nullable|file|mimes:jpeg,png,jpg,gif,webp', + ]; + $messages = [ + 'user_idcard.required' => '本人確認書類をアップロードしてください。', + 'user_idcard.file' => '本人確認書類(おもて)はファイルで指定してください。', + 'user_idcard.mimes' => '本人確認書類(おもて)は画像ファイルで指定してください。', + 'user_idcard2.file' => '本人確認書類(ウラ)はファイルで指定してください。', + 'user_idcard2.mimes' => '本人確認書類(ウラ)は画像ファイルで指定してください。', + ]; + + $validator = \Validator::make($request->all(), $rules, $messages); + + if ($validator->fails()) { + return redirect()->route('regular_contract.upload_identity', ['contract_id' => $contract_id]) + ->withErrors($validator) + ->withInput(); + } + + // おもて画像保存 + $front = $request->file('user_idcard'); + $filename_front = uniqid('photo1_') . '.' . $front->getClientOriginalExtension(); + $front->storeAs('photo', $filename_front, 'public'); + // userテーブルに保存 本人確認書類チェック済フラグや更新日時も更新項目に追加 + $updateData = [ + 'photo_filename1' => $filename_front, + 'user_idcard_chk_flag' => 1, + 'user_chk_day' => null, + 'user_chk_opeid' => null, + 'updated_at' => now(), + ]; + // ウラ画像がある場合保存し更新項目に追加 + if ($request->hasFile('user_idcard2')) { + $back = $request->file('user_idcard2'); + $filename_back = uniqid('photo2_') . '.' . $back->getClientOriginalExtension(); + $back->storeAs('photo', $filename_back, 'public'); + $updateData['photo_filename2'] = $filename_back; + } + DB::table('user')->where('user_id', $user_id)->update($updateData); + + // 更新対象の旧契約を検索 + $old_contract_id = DB::table('regular_contract')->where('contract_id', $contract_id)->value('old_contract_id'); + + // 旧契約を契約更新済に更新 + DB::table('regular_contract')->where('contract_id', $old_contract_id)->update(['contract_renewal' => 0]); + + // 利用者マスタから学校とユーザー名、定期契約マスタから駐輪場IDを取得 + $user = DB::table('user')->where('user_id', $user_id)->first(); + $park_id = DB::table('regular_contract')->where('contract_id', $contract_id)->value('park_id'); + + // que_classの分岐 + $que_class = is_null($user->user_school) ? 1 : 2; + + // オペレーターキュー発行 + DB::table('operator_que')->insert([ + 'que_class' => $que_class, + 'user_id' => $user_id, + 'contract_id' => $contract_id, + 'park_id' => $park_id, + 'que_status' => 1, + 'que_status_comment' => '本人確認手動処理を行ってください', + 'created_at' => now(), + ]); + + \Log::info('本人確認書類確認中画面にアクセス', [ + 'user_id' => $user_id, + ]); + + // 本人確認書類確認中画面へ遷移 + return view('regular_contract.identity_checking', [ + 'active_menu' => 'SWC-4-1', // マイページメニューの選択状態用 + 'user_name' => $user->user_name // ユーザー名(ヘッダー用) + ]); + } + + public function selectPeriod($contract_id) + { + $user_id = session('user_id'); + if (!$user_id) { + return redirect('/login'); + } + + // 必要な各マスタ情報を取得 + $user = DB::table('user')->where('user_id', $user_id)->first(); + $contract = DB::table('regular_contract')->where('contract_id', $contract_id)->first(); + // $city_id = DB::table('park')->where('park_id', $contract->park_id)->value('city_id'); + //$city_name = DB::table('city')->where('city_id', $city_id)->value('city_name'); + $park = DB::table('park')->where('park_id', $contract->park_id)->first(); + $city = DB::table('city')->where('city_id', $park->city_id)->first(); + $regular_type = DB::table('regular_type')->where('city_id', $city->city_id)->first(); + $usertype = DB::table('usertype')->where('user_categoryid', $contract->user_categoryid)->first(); + + // 2重化しているマスタのため現在のテーブル名を取得 + $master_setting = DB::table('setting')->value('web_master'); + $tableName = 'price' . $master_setting; + + // 利用者区分に応じた逆利用フラグを取得 + $inverse_use_flag_column = ($usertype->usertype_subject1 == '一般') ? 'inverse_use_flag1' : 'inverse_use_flag2'; + $inverse_use_flag = $park->$inverse_use_flag_column; + + if ($inverse_use_flag == 0) { + // regident_cityまたはrelate_cityが一致するか + $is_same = ( + strpos($user->user_regident_city, $city->city_name) !== false || + strpos($user->user_relate_city, $city->city_name) !== false + ); + } else { + // regident_cityのみ一致するか + $is_same = (strpos($user->user_regident_city, $city->city_name) !== false); + } + + $target_subject2 = $is_same ? '区民' : '区民外'; + $user_categoryid = DB::table('usertype') + ->where('usertype_subject1', $usertype->usertype_subject1) + ->where('usertype_subject2', $target_subject2) + ->where('usertype_subject3', $usertype->usertype_subject3) + ->value('user_categoryid'); + + // 駐輪場所マスタから料金を取得 + $prices = DB::table($tableName) + ->where('park_id', $contract->park_id) + ->where('psection_id', $contract->psection_id) + ->where('ptype_id', $contract->ptype_id) + ->where('user_categoryid', $user_categoryid) + ->get(); + + \Log::info('契約区分取得', [ + 'user_categoryid' => $user_categoryid, + 'target_subject2' => $target_subject2, + 'park_id' => $contract->park_id, + 'psection_id' => $contract->psection_id, + 'ptype_id' => $contract->ptype_id, + 'prices' => $prices->toArray(), + ]); + + \Log::info('利用期間選択画面にアクセス', [ + 'user_id' => $user_id, + ]); + + // 利用期間選択画面へ遷移 + return view('regular_contract.select_period', [ + 'active_menu' => 'SWC-4-1', // マイページメニューの選択状態用 + 'user_name' => $user->user_name, // ユーザー名(ヘッダー用) + 'contract_id' => $contract_id, + 'regular_type' => $regular_type, + 'prices' => $prices, + ]); + } + + public function updatePeriod(Request $request) + { + $user_id = session('user_id'); + if (!$user_id) { + return redirect('/login'); + } + + // 期間選択チェック + $request->validate([ + 'month' => 'required', + ], [ + 'month.required' => '契約期間が選択されていません。', + ]); + + $contract_id = $request->input('contract_id'); + $month = $request->input('month'); + $price = $request->input('price_' . $month); + + \Log::info('契約期間更新処理', [ + 'month' => $month, + 'price' => $price, + ]); + $today = now(); + $day = $today->day; + if ($day <= 19) { + // 今月の1日 + $contract_periods = $today->copy()->startOfMonth()->format('Y-m-d'); + } else { + // 翌月の1日 + $contract_periods = $today->copy()->addMonth()->startOfMonth()->format('Y-m-d'); + } + $contract_periode = Carbon::parse($contract_periods)->addMonths($month - 1)->endOfMonth()->format('Y-m-d'); + // 契約更新 + DB::table('regular_contract')->where('contract_id', $contract_id)->update([ + 'enable_months' => $month, + 'billing_amount' => $price, + 'contract_periods' => $contract_periods, + 'contract_periode' => $contract_periode, + 'updated_at' => now(), + ]); + + // 完了後はウェルネット決済画面(仮)へリダイレクト + return redirect()->route('wellnet.payment'); + } } diff --git a/resources/views/partials/mypage_menu.blade.php b/resources/views/partials/mypage_menu.blade.php index 19b086d..8fad281 100644 --- a/resources/views/partials/mypage_menu.blade.php +++ b/resources/views/partials/mypage_menu.blade.php @@ -2,6 +2,14 @@ if (!isset($active_menu)) $active_menu = ''; @endphp
+
- +

空き待ち状況の確認

diff --git a/resources/views/regular_contract/confirm_category.blade.php b/resources/views/regular_contract/confirm_category.blade.php new file mode 100644 index 0000000..e094c1d --- /dev/null +++ b/resources/views/regular_contract/confirm_category.blade.php @@ -0,0 +1,85 @@ +@extends('layouts.app') + +@section('content') +
+
+

契約更新 > 定期契約を更新する

+
+
+
+

現在の契約区分をご確認ください。

+
+ +
+ @if(isset($contract) && isset($contract->securityreg_display_flag) && $contract->securityreg_display_flag == 1) +

登録している防犯登録番号:{{ $contract->user_securitynum }}

+ @endif + @php + $usertype = isset($user) && isset($user->user_categoryid) ? DB::table('usertype')->where('user_categoryid', $user->user_categoryid)->first() : null; + @endphp + usertype_subject1 == '一般') checked @endif disabled> + + usertype_subject1 == '学生') checked @endif disabled> + +
+ +
+ + + + + + +
+
+ contract_reduction == 1) checked @endif disabled> + +
+
+ contract_reduction != 1) checked @endif disabled> + +
+
+
+ +
+

ご登録の区分・減免について変更がある場合は、お手数ですが以下の
電話番号までお問い合わせください。

+

電話:03-5856-4720
毎日14時~21時(年末年始休)

+
+ + +
+
+@endsection \ No newline at end of file diff --git a/resources/views/regular_contract/identity_checking.blade.php b/resources/views/regular_contract/identity_checking.blade.php new file mode 100644 index 0000000..f866967 --- /dev/null +++ b/resources/views/regular_contract/identity_checking.blade.php @@ -0,0 +1,23 @@ +@extends('layouts.app') +@section('content') +
+
+

契約更新 >本人確認書類確認中

+
+
+
+

ただいま書類確認中です。

+
+
+

+ ご利用者本人確認に最大3営業日お時間を頂戴したく存じます。
+ 完了次第、メールにてご連絡いたしますので、しばらくお待ちください。

+

+
+ + +
+
+@endsection \ No newline at end of file diff --git a/resources/views/regular_contract/select_period.blade.php b/resources/views/regular_contract/select_period.blade.php new file mode 100644 index 0000000..bf7869d --- /dev/null +++ b/resources/views/regular_contract/select_period.blade.php @@ -0,0 +1,81 @@ +@extends('layouts.app') +@section('content') +
+
+

契約更新 > 定期契約を更新する

+
+
+ @if ($errors->has('month')) +
+ {{ $errors->first('month') }} +
+ @endif +
+ @csrf + +
+

契約期間を選択してください。

+
+ @if ($regular_type->regular_class_1 == 1) +
+ + + + + {{ optional($prices->where('price_month', 1)->first())->price ? number_format(optional($prices->where('price_month', 1)->first())->price) . '円' : '価格未設定' }} + +
+ @endif + @if ($regular_type->regular_class_2 == 1) +
+ + + + + {{ optional($prices->where('price_month', 2)->first())->price ? number_format(optional($prices->where('price_month', 2)->first())->price) . '円' : '価格未設定' }} + +
+ @endif + @if ($regular_type->regular_class_3 == 1) +
+ + + + + {{ optional($prices->where('price_month', 3)->first())->price ? number_format(optional($prices->where('price_month', 3)->first())->price) . '円' : '価格未設定' }} + +
+ @endif + @if ($regular_type->regular_class_6 == 1) +
+ + + + + {{ optional($prices->where('price_month', 6)->first())->price ? number_format(optional($prices->where('price_month', 6)->first())->price) . '円' : '価格未設定' }} + +
+ @endif + @if ($regular_type->regular_class_12 == 1) +
+ + + + + {{ optional($prices->where('price_month', 12)->first())->price ? number_format(optional($prices->where('price_month', 12)->first())->price) . '円' : '価格未設定' }} + +
+ @endif +
+
+
+ +
+ + +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/regular_contract/update.blade.php b/resources/views/regular_contract/update.blade.php new file mode 100644 index 0000000..2b499e1 --- /dev/null +++ b/resources/views/regular_contract/update.blade.php @@ -0,0 +1,321 @@ +@extends('layouts.app') +@section('content') +@php +function safeCarbonFromDDHM($dd, $hm = '00:00') { +$now = \Carbon\Carbon::now(); +if (!$dd || !preg_match('/^\d{1,2}$/', $dd)) return null; +if (!$hm || !preg_match('/^\d{2}:\d{2}$/', $hm)) $hm = '00:00'; +$date = $now->format('Y-m-') . str_pad($dd, 2, '0', STR_PAD_LEFT); +$time = $hm . ':00'; +try { +return \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $date . ' ' . $time); +} catch (Exception $e) { +return null; +} +} +@endphp +
+
+

定期契約情報 > 定期契約情報を確認する

+
+
+ @if(count($contracts) > 0) + @foreach($contracts as $i => $contract) + @if($i % 2 == 0) +
+ @endif +
+ @php + $now = \Carbon\Carbon::now(); + $update_flag = $contract->contract_renewal; + $start_dd = $contract->update_grace_period_start_date; + $start_hm = $contract->update_grace_period_start_time; + $end_dd = $contract->update_grace_period_end_date; + $end_hm = $contract->update_grace_period_end_time; + $contract_end_dt = $contract->contract_periode ? \Carbon\Carbon::parse($contract->contract_periode) : null; + $periode_month = $contract_end_dt ? $contract_end_dt->month : null; + $periode_year = $contract_end_dt ? $contract_end_dt->year : null; + $bg = 'alert-warning'; + $btn_text = '更新する'; + $btn_active = true; + + // 契約終了月より前は「ご契約中」 + if ($now->lt($contract_end_dt)) { + $bg = 'bg-white'; + $btn_text = 'ご契約中'; + $btn_active = false; + } else { + // 契約終了月より後は猶予期間判定 + if (is_numeric($start_dd) && is_numeric($end_dd)) { + // 開始日 + $start_date = $contract_end_dt->format('Y-m-') . str_pad($start_dd, 2, '0', STR_PAD_LEFT); + $start_time = ($start_hm && preg_match('/^\d{2}:\d{2}$/', $start_hm)) ? $start_hm : '00:00'; + $start_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $start_date . ' ' . $start_time . ':00'); + // 終了日 + if ($start_dd < $end_dd) { + $end_date=$contract_end_dt->format('Y-m-') . str_pad($end_dd, 2, '0', STR_PAD_LEFT); + $end_time = ($end_hm && preg_match('/^\d{2}:\d{2}$/', $end_hm)) ? $end_hm : '23:59'; + $end_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $end_date . ' ' . $end_time . ':00'); + } else { + $next_month_dt = $contract_end_dt->copy()->addMonth(); + $end_date = $next_month_dt->format('Y-m-') . str_pad($end_dd, 2, '0', STR_PAD_LEFT); + $end_time = ($end_hm && preg_match('/^\d{2}:\d{2}$/', $end_hm)) ? $end_hm : '23:59'; + $end_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $end_date . ' ' . $end_time . ':00'); + } + } else { + $start_dt = null; + $end_dt = null; + } + // 猶予期間判定 + if ($update_flag === 0) { + $bg = 'bg-white'; + $btn_text = '手続き中'; + $btn_active = false; + } elseif ($update_flag === 1) { + $bg = 'bg-white'; + $btn_text = '更新済'; + $btn_active = false; + } elseif ($start_dt && $end_dt && $now->between($start_dt, $end_dt)) { + // 猶予期間内 + if ($contract_end_dt && $now->gt($contract_end_dt)) { + $bg = 'alert-danger'; + $btn_text = '更新する'; + $btn_active = true; + } else { + $bg = 'alert-warning'; + $btn_text = '更新する'; + $btn_active = true; + } + } else { + $bg = 'bg-white'; + $btn_text = 'ご契約中'; + $btn_active = false; + } + } + // 契約終了月の場合(既存ロジック) + if (is_numeric($start_dd) && is_numeric($end_dd)) { + // 開始日 + $start_date = $contract_end_dt->format('Y-m-') . str_pad($start_dd, 2, '0', STR_PAD_LEFT); + $start_time = ($start_hm && preg_match('/^\d{2}:\d{2}$/', $start_hm)) ? $start_hm : '00:00'; + $start_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $start_date . ' ' . $start_time . ':00'); + // 終了日 + if ($start_dd < $end_dd) { + $end_date=$contract_end_dt->format('Y-m-') . str_pad($end_dd, 2, '0', STR_PAD_LEFT); + $end_time = ($end_hm && preg_match('/^\d{2}:\d{2}$/', $end_hm)) ? $end_hm : '23:59'; + $end_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $end_date . ' ' . $end_time . ':00'); + } else { + $next_month_dt = $contract_end_dt->copy()->addMonth(); + $end_date = $next_month_dt->format('Y-m-') . str_pad($end_dd, 2, '0', STR_PAD_LEFT); + $end_time = ($end_hm && preg_match('/^\d{2}:\d{2}$/', $end_hm)) ? $end_hm : '23:59'; + $end_dt = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $end_date . ' ' . $end_time . ':00'); + } + } else { + $start_dt = null; + $end_dt = null; + } + // 以降は既存のボタン・背景色判定ロジック + if ($update_flag===0) { + $bg='bg-white'; + $btn_text='手続き中'; + $btn_active=false; + } + elseif ($update_flag===1) { + $bg='bg-white'; + $btn_text='更新済'; + $btn_active=false; + } + elseif (!is_null($end_dt) && $end_dt->gt($start_dt)) { + if ($start_dt && $now->lt($start_dt)) { + $bg = 'bg-white'; + $btn_text = 'ご契約中'; + $btn_active = false; + } else { + // 契約終了日を過ぎていて、更新可能期間内は赤背景 + if ($contract_end_dt && $now->gt($contract_end_dt) && $start_dt && $end_dt && $now->between($start_dt, $end_dt)) { + $bg = 'alert-danger'; + $btn_text = '更新する'; + $btn_active = true; + } else { + $bg = 'alert-warning'; + $btn_text = '更新する'; + $btn_active = true; + } + } + } + elseif ($start_dt && $start_dt->gt($end_dt)) { + if ($now->lt($start_dt)) { + $bg = 'bg-white'; + $btn_text = 'ご契約中'; + $btn_active = false; + } elseif ($now->gte($start_dt) && $now->lte($contract_end_dt->copy()->endOfMonth())) { + $bg = 'alert-warning'; + $btn_text = '更新する'; + $btn_active = true; + } else { + $bg = 'alert-danger'; + $btn_text = '更新する'; + $btn_active = true; + } + } + @endphp + @if($bg == 'bg-white') +
+ @elseif($bg == 'alert-warning') +
+ @elseif($bg == 'alert-danger') +
+ @else +
+ @endif + + + + + + + + + + + + + + + + + + + + + + + + + +
定期契約ID{{ $contract->contract_id }}
駐輪場名{{ $contract->park_name }}
利用者区分{{ $contract->usertype_subject1 }}
利用開始日{{ \Carbon\Carbon::parse($contract->contract_periods)->format('Y/m/d') }}
契約月数{{ $contract->enable_months }}ヶ月
+
+
+ @if($bg == 'alert-warning' && $btn_active) + {{ $btn_text }} + @elseif($bg == 'alert-danger' && $btn_active) + {{ $btn_text }} + @else + + @endif + @if($bg == 'alert-warning') + + @elseif($bg == 'alert-danger') + + @else + + @endif +
+ @php + $has_receipt = DB::table('inv_publish')->where('contract_id', $contract->contract_id)->exists(); + @endphp + @if($has_receipt) + @if($bg == 'alert-warning') + 領収書再発行 + @elseif($bg == 'alert-danger') + 領収書再発行 + @else + 領収書再発行 + @endif + @else + @if($bg == 'alert-warning') + 領収書発行 + @elseif($bg == 'alert-danger') + 領収書発行 + @else + 領収書発行 + @endif + @endif +
+
+
+
+ @if($i % 2 == 1 || $i == count($contracts) - 1) +
+ @endif + @endforeach + @else +
+

定期契約情報はありません。

+
+ @endif + {{-- modal moved to end of file to avoid clipping issues --}} +
+ +
+
+
+ +@endsection + + + + \ No newline at end of file diff --git a/resources/views/regular_contract/upload_identity.blade.php b/resources/views/regular_contract/upload_identity.blade.php new file mode 100644 index 0000000..974abb8 --- /dev/null +++ b/resources/views/regular_contract/upload_identity.blade.php @@ -0,0 +1,40 @@ +@extends('layouts.app') +@section('content') +
+
+

契約更新 >本人確認書類のアップロード

+
+ @if ($errors->has('user_idcard')) +
{{ $errors->first('user_idcard') }}
+ @endif +
+
+ @csrf +
+

本人確認書類をアップロードしてください。

+
+
+

+ 本人確認書類のアップロードが必要な契約更新です。
+ 証明書類のアップロードをお願いします。

+ また卒業などで料金区分が変わる方はコールセンターまでお問い合わせ下さい。

+ So-Manager コールセンター
+ TEL:03-5856-4720(毎日12時~22時) +

+
+
+ おもて* +
+ ウ ラ* + +
+
+ 戻る +
+
+ +
+
+
+
+@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index e519b9a..e5939e6 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,3 +1,4 @@ + name('swo7_ Route::post('/swo7_3',[InquiryConfirmController::class, 'complete'])->name('swo7_3'); Route::post('/swo8_3', [PasswordReminderController::class, 'sendMail'])->name('swo8_3'); +//マイページ(仮) Route::get('/mypage', function () { - // 仮の表示(コントローラー未作成の場合) return 'マイページ(仮)'; })->name('mypage'); @@ -65,7 +66,6 @@ Route::get('/mypage', function () { Route::get('/user/info', [UserInfoController::class, 'show']) ->name('user.info'); - // ユーザー情報編集画面(GET: 編集フォーム表示) Route::get('/user/edit', [UserEditController::class, 'show']) ->name('user.edit'); @@ -109,6 +109,8 @@ Route::get('regular_contract/create', [RegularContractCreateController::class, ' ->name('regular_contract.create'); // 定期契約更新 +Route::get('regular_contract/update', [RegularContractController::class, 'showInfo']) + ->name('regular_contract.update'); Route::get('regular_contract/update/{contract_id}', [RegularContractController::class, 'update']); // 契約区分確認 Route::get('regular_contract/confirm_category/{contract_id}', [RegularContractController::class, 'confirmCategory']) @@ -118,14 +120,19 @@ Route::get('regular_contract/confirm_category_next/{contract_id}', [RegularContr // 本人確認書類アップロード Route::get('regular_contract/upload_identity/{contract_id}', [RegularContractController::class, 'uploadIdentity']) ->name('regular_contract.upload_identity'); +// 本人確認書類確認中 +Route::post('regular_contract/upload_identity/{contract_id}', [RegularContractController::class, 'uploadIdentitySubmit']) + ->name('regular_contract.upload_identity_submit'); // 利用期間選択 Route::get('regular_contract/select_period/{contract_id}', [RegularContractController::class, 'selectPeriod']) ->name('regular_contract.select_period'); - +Route::post('regular_contract/update_period', [App\Http\Controllers\RegularContractController::class, 'updatePeriod']) + ->name('regular_contract.update_period'); // 空き待ち状況確認画面 Route::get('park_waitlist', [ParkWaitlistController::class, 'index']) ->name('park_waitlist.index'); +// ログイン画面(仮) Route::get('/login', function () { return '
@@ -136,9 +143,13 @@ Route::get('/login', function () { '; })->name('login'); - Route::post('/login', function (Request $request) { $user_id = $request->input('user_id'); Session::put('user_id', $user_id); // 入力されたIDをそのまま保存 return redirect('/user/info'); // 認証なしでリダイレクト -}); \ No newline at end of file +}); + +// ウェルネット決済画面(仮) +Route::get('/wellnet/payment', function (): mixed { + return '

ウェルネット決済画面

'; +})->name('wellnet.payment'); -- 2.47.3