diff --git a/app/Http/Controllers/Admin/InformationController.php b/app/Http/Controllers/Admin/InformationController.php index 432689d..f572507 100644 --- a/app/Http/Controllers/Admin/InformationController.php +++ b/app/Http/Controllers/Admin/InformationController.php @@ -10,35 +10,69 @@ class InformationController extends Controller { public function list(Request $request) { - // フィルター取得 - $period = $request->input('period', 'month'); // デフォルト: 最新1ヵ月 + // パラメータ + $period = $request->input('period', 'month'); // month | all + $type = $request->input('type', 'all'); // task(<99) | hard(>99) | all + $status = $request->input('status', 'untreated'); // untreated(=1) | inprogress(=2) | done(=3) | all - $query = DB::table('bat_job_log') - ->leftJoin('device', 'bat_job_log.device_id', '=', 'device.device_id') + $q = DB::table('operator_que as oq') + ->leftJoin('user as u', 'oq.user_id', '=', 'u.user_id') + ->leftJoin('park as p', 'oq.park_id', '=', 'p.park_id') + // オペレータマスタ(テーブル・カラム名は環境に合わせて調整) + ->leftJoin('ope as o', 'oq.operator_id', '=', 'o.ope_id') ->select( - 'bat_job_log.job_log_id', - 'bat_job_log.process_name', - 'bat_job_log.job_name', - 'bat_job_log.device_id', - 'device.park_id', - 'bat_job_log.status_comment', - 'bat_job_log.status', - 'bat_job_log.status_comment as comment', - 'bat_job_log.created_at', - 'bat_job_log.updated_at' + 'oq.que_id','oq.que_class','oq.user_id', + DB::raw('u.user_name as user_name'), + 'oq.contract_id','oq.park_id', + DB::raw('p.park_name as park_name'), + 'oq.que_comment','oq.que_status','oq.que_status_comment', + 'oq.work_instructions','oq.created_at','oq.updated_at','oq.operator_id', + DB::raw('o.ope_name as operator_name') ); - // 期間フィルター + // 期間: 登録日ベース(最新1ヵ月 or 全期間) if ($period === 'month') { - $query->where('bat_job_log.updated_at', '>=', now()->subMonth()); + $q->where('oq.created_at', '>=', now()->subMonth()); } - // 'all'の場合はフィルターなし - $jobs = $query->orderByDesc('bat_job_log.job_log_id')->limit(50)->get(); + // 種別: que_class + if ($type === 'task') { + $q->where('oq.que_class', '<', 99); + } elseif ($type === 'hard') { + $q->where('oq.que_class', '>', 99); + } // all は絞り込みなし - return view('admin.information.list', [ - 'jobs' => $jobs, - 'period' => $period, + // ステータス: que_status + if ($status === 'untreated') { + $q->where('oq.que_status', 1); + } elseif ($status === 'inprogress') { + $q->where('oq.que_status', 2); + } elseif ($status === 'done') { + $q->where('oq.que_status', 3); + } // all は絞り込みなし + + $jobs = $q->orderByDesc('oq.que_id')->paginate(50)->appends($request->query()); + + return view('admin.information.list', compact('jobs','period','type','status')); + } + + // ステータス一括更新(着手=2 / 対応完了=3) + public function updateStatus(Request $request) + { + $request->validate([ + 'ids' => 'required|array', + 'action' => 'required|in:inprogress,done', ]); + + $new = $request->action === 'inprogress' ? 2 : 3; + + DB::table('operator_que') + ->whereIn('que_id', $request->ids) + ->update([ + 'que_status' => $new, + 'updated_at' => now(), + ]); + + return back()->with('success', '選択したキューのステータスを更新しました。'); } } \ No newline at end of file diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 690cf8b..e10bbdd 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -8,6 +8,7 @@ use App\Services\ShjMailSendService; use App\Services\ShjNineService; use App\Services\ShjTenService; use App\Services\ShjSixService; +use Illuminate\Support\Facades\DB; class AppServiceProvider extends ServiceProvider { @@ -75,6 +76,42 @@ class AppServiceProvider extends ServiceProvider */ public function boot(): void { - // + view()->composer('layouts.app', function($view){ + + $stats = DB::table('operator_que') + ->selectRaw(" + SUM(CASE WHEN que_status IN (1,2) AND que_class < 100 THEN 1 ELSE 0 END) AS task_total, + MAX(CASE WHEN que_status IN (1,2) AND que_class < 100 THEN created_at END) AS task_latest, + SUM(CASE WHEN que_status IN (1,2) AND que_class > 99 THEN 1 ELSE 0 END) AS hard_total, + MAX(CASE WHEN que_status IN (1,2) AND que_class > 99 THEN created_at END) AS hard_latest + ") + ->first(); + + $taskCount = (int)($stats->task_total ?? 0); + $hardCount = (int)($stats->hard_total ?? 0); + $taskLatest = $stats->task_latest ?? null; + $hardLatest = $stats->hard_latest ?? null; + + // 最新5件 (未対応/作業中) + $latestTasks = DB::table('operator_que') + ->whereIn('que_status',[1,2]) + ->where('que_class','<',100) + ->orderByDesc('created_at') + ->limit(5) + ->get(); + + $latestHards = DB::table('operator_que') + ->whereIn('que_status',[1,2]) + ->where('que_class','>',99) + ->orderByDesc('created_at') + ->limit(5) + ->get(); + + $view->with(compact( + 'taskCount','taskLatest', + 'hardCount','hardLatest', + 'latestTasks','latestHards' + )); + }); } } diff --git a/resources/views/admin/information/list.blade.php b/resources/views/admin/information/list.blade.php index 8264b6e..9715d08 100644 --- a/resources/views/admin/information/list.blade.php +++ b/resources/views/admin/information/list.blade.php @@ -19,125 +19,95 @@
絞り込み
- + - + + - + + - + +
ステータス変更
- - 着手 - +
- - 対応完了 - +
@@ -147,82 +117,105 @@
- -
- - - - - - - - - - - - - - - - - - - - @foreach($jobs as $job) - - - - - - - - - - - - - - - - @endforeach - -
キューIDキュー種別利用者定期契約ID駐輪場キューコメントキューステータスコメント登録日時更新日時更新オペレータリンク
{{ $job->job_log_id }}{{ $job->process_name }}{{ $job->job_name }}{{ $job->device_id }}{{ $job->park_id }}{{ $job->status_comment }}{{ $job->status }}{{ $job->comment }}{{ $job->created_at }}{{ $job->updated_at }}-詳細
-
+ +
+ @csrf + +
+ @php + // キュー種別/ステータスの表示名マップ + $queueTypeMap = [ + 1=>'本人確認(社会人)', 2=>'本人確認(学生)', 3=>'タグ発送', + 4=>'予約告知通知', 5=>'定期更新通知', 6=>'返金処理', + 7=>'再発行リミット超過', 8=>'支払い催促', 9=>'シール発行催促', + 101=>'サーバーエラー', 102=>'プリンタエラー', 103=>'スキャナーエラー', 104=>'プリンタ用紙残少警告', + ]; + $statusMap = [1=>'キュー発生', 2=>'キュー作業中', 3=>'キュー作業済', 4=>'返金済']; + // 対応画面への遷移リンク(存在する画面のみ) + $queueLinkMap = [ + 1 => route('personal'), // 本人確認(社会人) + 2 => route('personal'), // 本人確認(学生) + 3 => route('tagissue'), // タグ発送 + 4 => route('reservation'), // 予約告知通知 + 5 => route('update_candidate'), // 定期更新通知 + 6 => route('settlement_transactions'),// 返金処理(関連一覧に遷移) + 7 => route('tagissue'), // 再発行関連 + 8 => route('settlement_transactions'),// 支払い催促(関連一覧) + 9 => route('seals'), // シール発行催促(履歴) + ]; + @endphp + + + + + + + + + + + + + + + + + + + + @foreach($jobs as $job) + + + + + + + + + + + + + + + + @endforeach + +
キューIDキュー種別利用者定期契約ID駐輪場キューコメントキューステータスコメント登録日時更新日時更新オペレータリンク
+ + {{ $job->que_id }}{{ $queueTypeMap[$job->que_class] ?? $job->que_class }}{{ $job->user_name ?? $job->user_id }}{{ $job->contract_id }}{{ $job->park_name ?? $job->park_id }}{{ $job->que_comment }}{{ $statusMap[$job->que_status] ?? $job->que_status }} + {{ $job->que_status_comment }} + @if(!empty($job->work_instructions)) +
{{ $job->work_instructions }} + @endif +
{{ $job->created_at }}{{ $job->updated_at }}{{ $job->operator_name ?? $job->operator_id ?? '-' }} + @if(isset($queueLinkMap[$job->que_class])) + 対応画面へ + @else + - + @endif +
+
+ + +
+ {{ $jobs->links() }} +
+
@push('scripts') @endpush @endsection \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 2b60daf..ad596f9 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -70,51 +70,74 @@