diff --git a/app/Http/Controllers/ReceiptController.php b/app/Http/Controllers/ReceiptController.php index dfe5fa4..6d939a1 100644 --- a/app/Http/Controllers/ReceiptController.php +++ b/app/Http/Controllers/ReceiptController.php @@ -19,6 +19,10 @@ class ReceiptController extends Controller } $user = DB::table('user')->where('user_id', $user_id)->first(); + \Log::info('領収書宛名入力画面にアクセス', [ + 'user_id' => $user_id, + ]); + return view('receipt.input', [ 'user_name' => $user ? $user->user_name : '', // ユーザー名(ヘッダー用) 'contract_id' => $contract_id @@ -43,6 +47,21 @@ class ReceiptController extends Controller return redirect()->back()->withInput()->withErrors(['contract_id' => 'この契約の領収書は既に発行されています。契約履歴から再発行を行ってください。']); } + // 4バイト文字(絵文字等)チェック + if (preg_match('/[\xF0-\xF7][\x80-\xBF]{3}/', $receipt_name)) { + return redirect()->back()->withInput()->withErrors(['contract_id' => '宛名に絵文字などの特殊文字は使用できません。']); + } + + // 文字数チェック + if (mb_strlen($receipt_name) > 30) { + return redirect()->back()->withInput()->withErrors(['contract_id' => '宛名は30文字以内で入力してください。']); + } + + // 敬称選択チェック + if (empty($keisho)) { + return redirect()->back()->withInput()->withErrors(['contract_id' => '敬称を選択してください。']); + } + // inv_publishテーブルに新規登録(insert) $inv_name = $receipt_name . $keisho; $now = date('Y-m-d H:i:s'); @@ -65,8 +84,6 @@ class ReceiptController extends Controller return $this->download($contract_id, $is_reissue); } - - public function download($contract_id, $is_reissue = true) { // 必要なデータを取得 @@ -106,7 +123,6 @@ class ReceiptController extends Controller 'default_font' => 'noto_sans_jp', ]); - $mpdf->WriteHTML($html); // PDFダウンロード diff --git a/app/Http/Controllers/RegularContractController.php b/app/Http/Controllers/RegularContractController.php index 50fa7c1..2c9412b 100644 --- a/app/Http/Controllers/RegularContractController.php +++ b/app/Http/Controllers/RegularContractController.php @@ -52,6 +52,11 @@ class RegularContractController extends Controller ) ->get(); + \Log::info('契約情報表示画面にアクセス', [ + 'user_id' => $user_id, + ]); + + return view('regular_contract.info', [ 'active_menu' => 'SWC-3-1', // マイページメニューの選択状態用 'user_name' => $user_name, // ユーザー名(ヘッダー用) @@ -126,7 +131,6 @@ class RegularContractController extends Controller ]); } - /** * 契約区分確認画面の「確認して進む」ボタン押下時の分岐処理 * 本人確認書類アップロード画面 or 利用期間選択画面へ遷移 diff --git a/app/Http/Controllers/UserEditConfirmController.php b/app/Http/Controllers/UserEditConfirmController.php index c875680..61e4f01 100644 --- a/app/Http/Controllers/UserEditConfirmController.php +++ b/app/Http/Controllers/UserEditConfirmController.php @@ -42,8 +42,6 @@ class UserEditConfirmController extends Controller ]); } - - // 入力内容確認画面から「変更を確定する」ボタン押下時 public function submit(Request $request) { @@ -59,6 +57,7 @@ class UserEditConfirmController extends Controller $token = Str::random(64); $changeData = $request->except(['_token']); $changeData['user_id'] = $user_id; + $changeData['user_seq'] = $user->user_seq; // 本人確認書類画像アップロード処理 if ($request->hasFile('photo_filename1') && $request->file('photo_filename1')->isValid()) { @@ -134,7 +133,7 @@ class UserEditConfirmController extends Controller $updateData['photo_filename2'] = $changeData['photo_filename2']; } if (!empty($changeData['user_pass'])) { - $updateData['user_pass'] = self::customPasswordHash($changeData['user_pass'], $changeData['user_id']); + $updateData['user_pass'] = self::customPasswordHash($changeData['user_pass'], $changeData['user_seq']); } DB::table('user') ->where('user_id', $changeData['user_id']) @@ -160,9 +159,9 @@ class UserEditConfirmController extends Controller /** * パスワードをSHA256→SALT連結→25回ストレッチでハッシュ化 */ - private static function customPasswordHash($password, $user_id) + private static function customPasswordHash($password, $user_seq) { - $salt = $user_id . 'SOMSALT'; + $salt = $user_seq . 'SOMSALT'; $hash = hash('sha256', $password); $hash .= $salt; for ($i = 0; $i < 25; $i++) { diff --git a/resources/views/regular_contract/info.blade.php b/resources/views/regular_contract/info.blade.php index da5d4db..17efdaf 100644 --- a/resources/views/regular_contract/info.blade.php +++ b/resources/views/regular_contract/info.blade.php @@ -39,13 +39,13 @@ return null; $btn_text = '更新する'; $btn_active = true; - // 契約終了月以外は「ご契約中」 - if ($periode_month && $periode_year && ($now->month != $periode_month || $now->year != $periode_year)) { + // 契約終了月より前は「ご契約中」 + if ($now->lt($contract_end_dt)) { $bg = 'bg-white'; $btn_text = 'ご契約中'; $btn_active = false; } else { - // 猶予期間のCarbon生成 + // 契約終了月より後は猶予期間判定 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); @@ -53,12 +53,10 @@ return null; $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'; @@ -68,25 +66,18 @@ return null; $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)) { + // 猶予期間判定 + if ($update_flag === 0) { $bg = 'bg-white'; - $btn_text = 'ご契約中'; + $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)) { + } 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; @@ -95,155 +86,207 @@ return null; $btn_text = '更新する'; $btn_active = true; } - } - } - elseif ($start_dt && $start_dt->gt($end_dt)) { - if ($now->lt($start_dt)) { + } else { $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 - @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 }}
車種{{ $contract->psection_subject ?? '' }}
階数{{ $contract->ptype_subject ?? '' }}
車室番号{{ $contract->pplace_no ?? '' }}
利用開始日{{ \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 +
定期契約ID{{ $contract->contract_id }}
駐輪場名{{ $contract->park_name }}
利用者区分{{ $contract->usertype_subject1 }}
車種{{ $contract->psection_subject ?? '' }}
階数{{ $contract->ptype_subject ?? '' }}
車室番号{{ $contract->pplace_no ?? '' }}
利用開始日{{ \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
- @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)