diff --git a/.gitea/workflows/deploy-main.yml b/.gitea/workflows/deploy-main.yml deleted file mode 100644 index daca08f..0000000 --- a/.gitea/workflows/deploy-main.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Deploy main - -on: - push: - branches: ["main"] - workflow_dispatch: - -concurrency: - group: deploy-${{ github.ref }} - cancel-in-progress: true - -jobs: - deploy: - runs-on: ["native"] - steps: - - uses: actions/checkout@v4 - - name: Deploy main to server - run: /usr/local/bin/deploy_krgm.sh diff --git a/app/Http/Controllers/Admin/ContractAllowableCityController.php b/app/Http/Controllers/Admin/ContractAllowableCityController.php new file mode 100644 index 0000000..eab1a7e --- /dev/null +++ b/app/Http/Controllers/Admin/ContractAllowableCityController.php @@ -0,0 +1,191 @@ +all(); + $inputs['isMethodPost'] = $request->isMethod('post'); + + // 解除処理 + if ($request->isMethod('post') && $request->input('action') === 'unlink') { + $query = ContractAllowableCity::query(); + + if ($request->filled('contract_allowable_city_id')) { + $query->where('contract_allowable_city_id', $request->contract_allowable_city_id); + } + if ($request->filled('city_id')) { + $query->where('city_id', $request->city_id); + } + if ($request->filled('contract_allowable_city_name')) { + $query->where('contract_allowable_city_name', 'like', '%' . $request->contract_allowable_city_name . '%'); + } + if ($request->filled('park_id')) { + $query->where('park_id', $request->park_id); + } + + $records = $query->get(); + foreach ($records as $record) { + $record->delete(); + } + + return redirect()->route('contract_allowable_cities')->with('success', '解除しました'); + } + + // 通常の絞り込み処理 + $list = ContractAllowableCity::search($inputs); + + return view('admin.contract_allowable_cities.list', [ + 'list' => $list, + 'inputs' => $inputs, + 'sort' => $inputs['sort'] ?? '', + 'sort_type' => $inputs['sort_type'] ?? '', + 'cityList' => City::getList(), + 'parkList' => Park::getList(), + ]); +} + + + /** + * 新規登録 + */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + $request->validate([ + 'city_id' => 'required|integer', + 'contract_allowable_city_name' => 'required|string|max:20', + 'park_id' => 'required|integer', + 'same_district_flag' => 'required|integer', + ]); + + $data = $request->all(); + $data['operator_id'] = Auth::user()->ope_id; + + ContractAllowableCity::create($data); + + return redirect()->route('contract_allowable_cities')->with('success', '登録しました'); + } + + return view('admin.contract_allowable_cities.add', [ + 'record' => null, + 'cityList' => City::getList(), + 'parkList' => Park::getList(), + 'contractAllowableCityList' => ContractAllowableCity::getList(), + 'mode' => 'add' + ]); + } + + /** + * 編集 + */ + public function edit(Request $request, $id) + { + $record = ContractAllowableCity::getByPk($id); + if (!$record) { + return redirect()->route('contract_allowable_cities')->with('error', 'データが存在しません'); + } + + if ($request->isMethod('post')) { + $request->validate([ + 'city_id' => 'required|integer', + 'contract_allowable_city_name' => 'required|string|max:20', + 'park_id' => 'required|integer', + 'same_district_flag' => 'required|integer', + ]); + + $record->fill($request->all()); + $record->operator_id = Auth::user()->ope_id; + $record->save(); + + return redirect()->route('contract_allowable_cities')->with('success', '更新しました'); + } + + return view('admin.contract_allowable_cities.edit', [ + 'record' => $record, + 'cities' => City::getList(), + 'parks' => Park::getList(), + 'mode' => 'edit' + ]); + } + + /** + * 詳細参照(表示のみ) + */ + public function info($id) + { + $record = ContractAllowableCity::getByPk($id); + if (!$record) { + return redirect()->route('contract_allowable_cities')->with('error', 'データが存在しません'); + } + + return view('admin.contract_allowable_cities.edit', [ + 'record' => $record, + 'cityList' => City::getList(), + 'parkList' => Park::getList(), + 'mode' => 'info' + ]); + } + + /** + * 一括削除 + */ + public function delete(Request $request) + { + if ($request->has('id')) { + ContractAllowableCity::deleteByPk($request->id); + return redirect()->route('contract_allowable_cities')->with('success', '削除しました'); + } + + return redirect()->route('contract_allowable_cities')->with('error', '削除対象が見つかりません'); + } + + /** + * CSVエクスポート + */ + public function export(Request $request) + { + $filename = 'contract_allowable_cities_' . now()->format('Ymd_His') . '.csv'; + + $list = ContractAllowableCity::search($request->all()); + + $headers = [ + 'Content-Type' => 'text/csv', + 'Content-Disposition' => "attachment; filename=\"$filename\"", + ]; + + return new StreamedResponse(function () use ($list) { + $handle = fopen('php://output', 'w'); + + // ヘッダー + fputcsv($handle, ['契約許容市区ID', '市区ID', '許容市区名', '駐輪場ID', '隣接区フラグ']); + + foreach ($list as $item) { + fputcsv($handle, [ + $item->contract_allowable_city_id, + $item->city_id, + $item->contract_allowable_city_name, + $item->park_id, + $item->same_district_flag == 0 ? '隣接市' : 'その他' + ]); + } + + fclose($handle); + }, 200, $headers); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/DeviceController.php b/app/Http/Controllers/Admin/DeviceController.php new file mode 100644 index 0000000..e6b9ed1 --- /dev/null +++ b/app/Http/Controllers/Admin/DeviceController.php @@ -0,0 +1,142 @@ +orderBy('device_id', 'desc') + ->paginate($perPage); + + return view('admin.devices.list', [ + 'list' => $list, + 'sort' => 'device_id', + 'sort_type' => 'desc', + ]); + } + + + /** + * 新規追加: /device/add + */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + $v = Validator::make($request->all(), $this->rules()); + if ($v->fails()) return back()->withErrors($v)->withInput(); + + DB::transaction(function () use ($request) { + Device::create($request->only([ + 'park_id','device_type','device_subject','device_identifier', + 'device_work','device_workstart','device_replace','device_remarks','operator_id', + ])); + }); + + return redirect()->route('devices')->with('success', 'デバイスを登録しました。'); + } + + return view('admin.devices.add', [ + 'device' => new Device(), + 'isInfo' => false, + 'isEdit' => false, + ]); + } + + + /** + * 編集: /device/edit/{id} + */ + public function edit(Request $request, int $id) + { + $device = Device::findOrFail($id); + + if ($request->isMethod('post')) { + $v = Validator::make($request->all(), $this->rules($id)); + if ($v->fails()) return back()->withErrors($v)->withInput(); + + DB::transaction(function () use ($request, $device) { + $device->update($request->only([ + 'park_id','device_type','device_subject','device_identifier', + 'device_work','device_workstart','device_replace','device_remarks','operator_id', + ])); + }); + + return redirect()->route('devices')->with('success', 'デバイスを更新しました。'); + } + + return view('admin.devices.edit', [ + 'device' => $device, + 'isInfo' => false, + 'isEdit' => true, + ]); + } + + /** + * 詳細: /device/info/{id} + */ + public function info(int $id) + { + $device = Device::with('park')->findOrFail($id); + + return view('admin.devices.info', [ + 'device' => $device, + 'isInfo' => true, + 'isEdit' => false, + ]); + } + + /** + * 削除: /device/delete + */ + public function delete(Request $request) + { + $ids = $request->input('ids'); + $id = $request->input('id'); + + if ($id) $ids = [$id]; + if (!is_array($ids) || empty($ids)) { + return back()->with('error', '削除対象が指定されていません。'); + } + + DB::transaction(function () use ($ids) { + Device::whereIn('device_id', $ids)->delete(); + }); + + return redirect()->route('devices')->with('success', 'デバイスを削除しました。'); + } + + + + /** バリデーションルール */ + private function rules(?int $id = null): array + { + return [ + 'park_id' => ['nullable','integer'], + 'device_type' => ['required','string','max:255'], + 'device_subject' => ['required','string','max:255'], + 'device_identifier' => ['nullable','string','max:255'], + 'device_work' => ['nullable','string','max:255'], + 'device_workstart' => ['nullable','date'], + 'device_replace' => ['nullable','date'], + 'device_remarks' => ['nullable','string','max:255'], + 'operator_id' => ['nullable','integer'], + ]; + } + + +} diff --git a/app/Http/Controllers/Admin/JurisdictionParkingController.php b/app/Http/Controllers/Admin/JurisdictionParkingController.php new file mode 100644 index 0000000..0b42a5e --- /dev/null +++ b/app/Http/Controllers/Admin/JurisdictionParkingController.php @@ -0,0 +1,91 @@ +paginate(20); + return view('admin.jurisdiction_parkings.list', compact('list')); + } + + public function add(Request $request) + { + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'jurisdiction_parking_name' => 'required|string|max:255', + 'operator_id' => 'nullable|integer', + 'park_id' => 'nullable|integer', + ]); + + JurisdictionParking::create($validated); + return redirect()->route('jurisdiction_parkings')->with('success', '登録しました'); + } + + $parks = Park::pluck('park_name', 'park_id'); + $operators = Ope::pluck('ope_name', 'ope_id'); + + return view('admin.jurisdiction_parkings.add', compact('parks', 'operators')); + } + + + public function edit(Request $request, $jurisdiction_parking_id) + { + $record = JurisdictionParking::findOrFail($jurisdiction_parking_id); + + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'jurisdiction_parking_name' => 'required|string|max:255', + 'ope_id' => 'nullable|integer', + 'park_id' => 'nullable|integer', + 'operator_id' => 'nullable|integer', + ]); + + $record->update($validated); + return redirect()->route('jurisdiction_parkings')->with('success', '更新しました'); + } + + $parks = Park::pluck('park_name', 'park_id'); + $opes = Ope::pluck('ope_name', 'ope_id'); + + return view('admin.jurisdiction_parkings.edit', compact('record', 'parks', 'opes')); + } + + public function delete(Request $request) + { + if ($request->has('pk')) { + JurisdictionParking::destroy($request->input('pk')); + return redirect()->route('jurisdiction_parkings')->with('success', '削除しました'); + } + + return redirect()->route('jurisdiction_parkings')->with('error', '削除対象が見つかりません'); + } + + public function info(Request $request, $jurisdiction_parking_id) + { + $record = JurisdictionParking::findOrFail($jurisdiction_parking_id); + return view('admin.jurisdiction_parkings.info', compact('record')); + } + + public function import(Request $request) + { + // CSVインポート処理仮 + return redirect()->route('jurisdiction_parkings')->with('success', 'CSVインポート処理(未実装)'); + } + + public function export(Request $request) + { + // CSVエクスポート処理仮 + return response()->streamDownload(function () { + echo 'CSVエクスポートデータ(未実装)'; + }, 'jurisdiction_parkings.csv'); + } +} diff --git a/app/Http/Controllers/Admin/ManagerController.php b/app/Http/Controllers/Admin/ManagerController.php new file mode 100644 index 0000000..fbaa639 --- /dev/null +++ b/app/Http/Controllers/Admin/ManagerController.php @@ -0,0 +1,233 @@ +input('sort', 'manager_id'); + $sort_type = $request->input('sort_type', 'asc'); + if (!in_array($sort, $sortable)) $sort = 'manager_id'; + if (!in_array(strtolower($sort_type), ['asc','desc'])) $sort_type = 'asc'; + + $list = Manager::with(['park','device1','device2']) + ->orderBy($sort, $sort_type) + ->paginate(20); + + return view('admin.managers.list', compact('list','sort','sort_type')); + } + + /** 新規(GET:画面表示 / POST:登録) */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + $data = $this->validated($request); + + $manager = Manager::create($data); + return redirect() + ->route('managers_info', ['manager_id' => $manager->manager_id]) + ->with('success', '登録しました。'); + } + + // 画面に渡す初期値 + $view = $this->viewVars(); + return view('admin.managers.add', $view); + } + + /** 編集(GET:画面表示 / POST:更新) */ + public function edit(Request $request, $manager_id) + { + $manager = Manager::findOrFail($manager_id); + + if ($request->isMethod('post')) { + $data = $this->validated($request); + $manager->fill($data)->save(); + + return redirect() + ->route('managers_info', ['manager_id' => $manager->manager_id]) + ->with('success', '更新しました。'); + } + + $view = $this->viewVars($manager); + return view('admin.managers.edit', $view); + } + + /** 詳細(閲覧) */ + public function info($manager_id) + { + $manager = Manager::with(['park','device1','device2'])->findOrFail($manager_id); + $view = $this->viewVars($manager); + return view('admin.managers.info', $view); + } + + /** 一括削除(一覧・詳細・編集共通で pk[] を受ける) */ + public function delete(Request $request) + { + $ids = (array) $request->input('pk', []); + if (!$ids) return back()->with('error', '削除対象が選択されていません。'); + + DB::transaction(fn() => Manager::whereIn('manager_id', $ids)->delete()); + + return back()->with('success', '削除しました。'); + } + + /** CSV出力 */ + public function export(): StreamedResponse + { + $headers = [ + 'Content-Type' => 'text/csv; charset=UTF-8', + 'Content-Disposition' => 'attachment; filename=managers.csv', + ]; + + $columns = [ + 'manager_id','manager_name','manager_type','manager_parkid', + 'manager_device1','manager_device2','manager_mail','manager_tel', + 'manager_alert1','manager_alert2','manager_quit_flag','manager_quitday' + ]; + + return response()->stream(function () use ($columns) { + $out = fopen('php://output', 'w'); + fwrite($out, "\xEF\xBB\xBF"); // BOM + fputcsv($out, $columns); + + Manager::chunk(500, function ($rows) use ($out, $columns) { + foreach ($rows as $r) { + fputcsv($out, array_map(fn($c) => data_get($r, $c), $columns)); + } + }); + + fclose($out); + }, 200, $headers); + } + + /** CSVインポート(input name="file") */ + public function import(Request $request) + { + if (!$request->hasFile('file')) { + return back()->with('error', 'CSVファイルを選択してください。'); + } + $fp = fopen($request->file('file')->getRealPath(), 'r'); + if (!$fp) return back()->with('error', 'CSVを読み込めませんでした。'); + + $header = fgetcsv($fp); + if (!$header) { fclose($fp); return back()->with('error', 'ヘッダ行が読み取れません。'); } + + $required = [ + 'manager_id','manager_name','manager_type','manager_parkid', + 'manager_device1','manager_device2','manager_mail','manager_tel', + 'manager_alert1','manager_alert2','manager_quit_flag','manager_quitday' + ]; + foreach ($required as $c) { + if (!in_array($c, $header)) { fclose($fp); return back()->with('error', "CSVに {$c} がありません。"); } + } + + DB::beginTransaction(); + try { + while (($row = fgetcsv($fp)) !== false) { + $data = array_combine($header, $row); if (!$data) continue; + + Manager::updateOrCreate( + ['manager_id' => $data['manager_id']], + [ + 'manager_name' => $data['manager_name'] ?? null, + 'manager_type' => $data['manager_type'] ?? null, + 'manager_parkid' => $data['manager_parkid'] ?: null, + 'manager_device1' => $data['manager_device1'] ?: null, + 'manager_device2' => $data['manager_device2'] ?: null, + 'manager_mail' => $data['manager_mail'] ?? null, + 'manager_tel' => $data['manager_tel'] ?? null, + 'manager_alert1' => (int)($data['manager_alert1'] ?? 0), + 'manager_alert2' => (int)($data['manager_alert2'] ?? 0), + 'manager_quit_flag' => (int)($data['manager_quit_flag'] ?? 0), + 'manager_quitday' => $data['manager_quitday'] ?: null, + ] + ); + } + fclose($fp); + DB::commit(); + return back()->with('success', 'インポートが完了しました。'); + } catch (\Throwable $e) { + if (is_resource($fp)) fclose($fp); + DB::rollBack(); + return back()->with('error', 'インポートに失敗しました:'.$e->getMessage()); + } + } + + /* ======================== private helpers ======================== */ + + /** バリデーション */ + private function validated(Request $request): array + { + return $request->validate([ + 'manager_name' => ['required','string','max:255'], + 'manager_type' => ['nullable','string','max:255'], + 'manager_parkid' => ['nullable','integer','exists:park,park_id'], // テーブル名に合わせて + 'manager_device1' => ['nullable','integer','exists:device,device_id'], + 'manager_device2' => ['nullable','integer','exists:device,device_id'], + 'manager_mail' => ['nullable','email','max:255'], + 'manager_tel' => ['nullable','string','max:255'], + 'manager_alert1' => ['nullable','boolean'], + 'manager_alert2' => ['nullable','boolean'], + 'manager_quit_flag' => ['nullable','boolean'], + 'manager_quitday' => ['nullable','date'], + ], [], [ + 'manager_name' => '駐輪場管理者名', + 'manager_type' => '種別', + 'manager_parkid' => '所属駐輪場ID', + 'manager_device1' => '管理デバイス1', + 'manager_device2' => '管理デバイス2', + 'manager_mail' => 'メールアドレス', + 'manager_tel' => '電話番号', + 'manager_alert1' => 'アラート1送信', + 'manager_alert2' => 'アラート2送信', + 'manager_quit_flag' => '退職フラグ', + 'manager_quitday' => '退職日', + ]); + } + + /** 画面に渡す変数を作る(_form.blade.php が個別変数を参照するため) */ + private function viewVars(?Manager $m = null): array + { + $parks = Park::orderBy('park_name')->pluck('park_name','park_id')->toArray(); + $devices = Device::orderBy('device_subject')->pluck('device_subject','device_id')->toArray(); + + return [ + // _form が参照する個別変数 + 'manager_id' => $m->manager_id ?? null, + 'manager_name' => $m->manager_name ?? null, + 'manager_type' => $m->manager_type ?? null, + 'manager_parkid' => $m->manager_parkid ?? null, + 'manager_device1' => $m->manager_device1 ?? null, + 'manager_device2' => $m->manager_device2 ?? null, + 'manager_mail' => $m->manager_mail ?? null, + 'manager_tel' => $m->manager_tel ?? null, + 'manager_alert1' => (int)($m->manager_alert1 ?? 0), + 'manager_alert2' => (int)($m->manager_alert2 ?? 0), + 'manager_quit_flag' => isset($m) ? (int)$m->manager_quit_flag : 0, + 'manager_quitday' => isset($m) && $m->manager_quitday ? $m->manager_quitday->format('Y-m-d') : null, + + // セレクトの候補 + 'parks' => $parks, + 'devices' => $devices, + + // _form で必要なフラグ(各ビューで上書きしてもOK) + 'isEdit' => isset($m), + 'isInfo' => false, + 'record' => $m, // 互換用(あなた的 edit.blade.php で参照しているなら) + ]; + } +} diff --git a/app/Http/Controllers/Admin/NeighborStationController.php b/app/Http/Controllers/Admin/NeighborStationController.php new file mode 100644 index 0000000..b40b104 --- /dev/null +++ b/app/Http/Controllers/Admin/NeighborStationController.php @@ -0,0 +1,119 @@ +input('sort', 'station_id'); + $sort_type = $request->input('sort_type', 'asc'); + + $allowedSorts = ['station_id', 'park_id', 'station_neighbor_station', 'station_name_ruby', 'station_route_name']; + if (!in_array($sort, $allowedSorts)) { + $sort = 'station_id'; + } + + if (!in_array($sort_type, ['asc', 'desc'])) { + $sort_type = 'asc'; + } + + $stations = NeighborStation::select([ + 'station_id', + 'station_neighbor_station', + 'station_name_ruby', + 'station_route_name', + // 'station_latitude', + // 'station_longitude', + 'park_id' + ])->orderBy($sort, $sort_type)->paginate(20); + + return view('admin.neighbor_stations.list', compact('stations', 'sort', 'sort_type')); +} + + + // 新規登録画面と登録処理 + public function add(Request $request) + { + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'station_neighbor_station' => 'required|string|max:255', + 'station_name_ruby' => 'nullable|string|max:255', + 'station_route_name' => 'nullable|string|max:255', + 'park_id' => 'nullable|integer', + 'operator_id' => 'nullable|integer', + ]); + + NeighborStation::create($validated); + return redirect()->route('neighbor_stations')->with('success', '近傍駅が登録されました'); + } + + return view('admin.neighbor_stations.add'); + } + + // 編集画面・更新処理 + public function edit(Request $request, $id) + { + $station = NeighborStation::findOrFail($id); + + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'station_neighbor_station' => 'required|string|max:255', + 'station_name_ruby' => 'nullable|string|max:255', + 'station_route_name' => 'nullable|string|max:255', + 'park_id' => 'nullable|integer', + 'operator_id' => 'nullable|integer', + ]); + + $station->update($validated); + return redirect()->route('neighbor_stations')->with('success', '更新しました'); + } + + return view('admin.neighbor_stations.edit', compact('station')); + } + + // 詳細表示 + public function info($id) + { + $station = NeighborStation::findOrFail($id); + return view('admin.neighbor_stations.info', compact('station')); + } + + // 削除処理 + public function delete(Request $request) + { + $ids = $request->input('pk'); // ← 接收复数 checkbox 名称 pk[] + + if (!empty($ids)) { + NeighborStation::destroy($ids); // 一次性删除多个 + return redirect()->route('neighbor_stations')->with('success', '削除しました'); + } + + return redirect()->route('neighbor_stations')->with('error', '削除対象が見つかりません'); + } + + + // CSVインポート(仮) + public function import(Request $request) + { + // TODO: 実装 + return redirect()->route('neighbor_stations')->with('info', 'CSVインポートは未実装です'); + } + + // CSVエクスポート(仮) + public function export() + { + // TODO: 実装 + return response()->streamDownload(function () { + echo "id,station_neighbor_station,station_name_ruby,station_route_name,park_id,operator_id\n"; + foreach (NeighborStation::all() as $station) { + echo "{$station->id},{$station->station_neighbor_station},{$station->station_name_ruby},{$station->station_route_name},{$station->park_id},{$station->operator_id}\n"; + } + }, 'neighbor_stations.csv'); + } +} diff --git a/app/Http/Controllers/Admin/OpeController.php b/app/Http/Controllers/Admin/OpeController.php new file mode 100644 index 0000000..0637078 --- /dev/null +++ b/app/Http/Controllers/Admin/OpeController.php @@ -0,0 +1,224 @@ + $request->isMethod('post'), + 'sort' => $request->input('sort', 'ope_id'), + 'sort_type' => $request->input('sort_type', 'desc'), + 'isExport' => false, + ]; + + // Blade 側は $list / $sort / $sort_type を参照 + $list = Ope::search($inputs); + $sort = $inputs['sort']; + $sort_type = $inputs['sort_type']; + + + return view('admin.opes.list', compact('list', 'sort', 'sort_type')); + } + + /** + * 新規登録(GET 画面 / POST 保存) + */ + public function add(Request $request) + { + if ($request->isMethod('get')) { + // add.blade.php は include する _form が期待する変数名を使う + return view('admin.opes.add', [ + 'isEdit' => 0, + 'isInfo' => 0, + // 初期値(存在しなくてもOKだが、Notice 防止のために入れておく) + 'ope_id' => null, + 'ope_name' => '', + 'ope_type' => '', + 'ope_mail' => '', + 'ope_phone'=> '', + // 以下はフォームで参照される可能性のあるキーを空で用意 + 'ope_sendalart_que1' => 0, 'ope_sendalart_que2' => 0, 'ope_sendalart_que3' => 0, + 'ope_sendalart_que4' => 0, 'ope_sendalart_que5' => 0, 'ope_sendalart_que6' => 0, + 'ope_sendalart_que7' => 0, 'ope_sendalart_que8' => 0, 'ope_sendalart_que9' => 0, + 'ope_sendalart_que10'=> 0, 'ope_sendalart_que11'=> 0, 'ope_sendalart_que12'=> 0, + 'ope_sendalart_que13'=> 0, + 'ope_auth1' => '', 'ope_auth2' => '', 'ope_auth3' => '', 'ope_auth4' => '', + 'ope_quit_flag' => 0, 'ope_quitday' => '', + ]); + } + + $rules = [ + 'ope_name' => 'required|string|max:255', + 'ope_type' => 'required|string|max:50', + 'ope_mail' => 'nullable|email|max:255', + 'ope_phone' => 'nullable|string|max:50', + ]; + $this->validate($request, $rules); + + $ope = new Ope(); + $ope->fill($request->only($ope->getFillable())); + $ope->save(); + + return redirect()->route('opes')->with('success', 'オペレータを登録しました。'); + } + + /** + * 編集(GET 画面 / POST 更新) + */ + public function edit($id, Request $request) + { + $ope = Ope::getByPk($id); + if (!$ope) abort(404); + + if ($request->isMethod('get')) { + // edit.blade.php が参照する変数名に合わせて渡す + return view('admin.opes.edit', array_merge( + [ + 'isEdit' => 1, + 'isInfo' => 0, + 'ope_id' => $ope->ope_id, + ], + $ope->toArray() + )); + } + + $rules = [ + 'ope_name' => 'required|string|max:255', + 'ope_type' => 'required|string|max:50', + 'ope_mail' => 'nullable|email|max:255', + 'ope_phone' => 'nullable|string|max:50', + ]; + $this->validate($request, $rules); + + $ope->fill($request->only($ope->getFillable())); + $ope->save(); + + return redirect()->route('opes')->with('success', 'オペレータを更新しました。'); + } + + /** + * 詳細 + */ + public function info($id) + { + $ope = Ope::getByPk($id); + if (!$ope) abort(404); + + // info.blade.php が参照する変数に合わせてセット + return view('admin.opes.info', array_merge( + [ + 'isEdit' => 0, + 'isInfo' => 1, + 'ope_id' => $ope->ope_id, + ], + $ope->toArray() + )); + } + + /** + * 削除(単体 / 複数) + */ + public function delete(Request $request) + { + $ids = []; + if ($request->filled('id')) { + $ids[] = (int) $request->input('id'); + } + if ($request->filled('ids') && is_array($request->input('ids'))) { + $ids = array_merge($ids, array_map('intval', $request->input('ids'))); + } + $ids = array_values(array_unique($ids)); + + if (!$ids) { + return back()->with('error', '削除対象が選択されていません。'); + } + + Ope::deleteByPk($ids); + + return redirect()->route('opes')->with('success', '削除しました。'); + } + + /** + * CSVインポート + */ + public function import(Request $request) + { + $validator = Validator::make($request->all(), [ + 'file' => 'required|file|mimes:csv,txt|max:20480', + ]); + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + $file = $request->file('file')->getRealPath(); + $handle = fopen($file, 'r'); + if (!$handle) return back()->with('error', 'CSVを読み取れません。'); + + $header = fgetcsv($handle); + $header = array_map(fn($h) => trim(ltrim($h ?? '', "\xEF\xBB\xBF")), $header); + + $fillable = (new Ope())->getFillable(); + $rows = []; + + while (($row = fgetcsv($handle)) !== false) { + $assoc = []; + foreach ($header as $i => $key) { + if (in_array($key, $fillable, true)) { + $assoc[$key] = $row[$i] ?? null; + } + } + if ($assoc) $rows[] = $assoc; + } + fclose($handle); + + DB::transaction(function () use ($rows) { + foreach ($rows as $data) { + Ope::create($data); + } + }); + + return redirect()->route('opes')->with('success', count($rows) . '件をインポートしました。'); + } + + /** + * CSVエクスポート + */ + public function export(): StreamedResponse + { + $filename = 'ope_' . now()->format('Ymd_His') . '.csv'; + $fillable = (new Ope())->getFillable(); + + $response = new StreamedResponse(function () use ($fillable) { + $out = fopen('php://output', 'w'); + fprintf($out, chr(0xEF) . chr(0xBB) . chr(0xBF)); // BOM + fputcsv($out, $fillable); + + Ope::orderBy('ope_id')->chunk(500, function ($chunk) use ($out, $fillable) { + foreach ($chunk as $row) { + $line = []; + foreach ($fillable as $f) { + $line[] = $row->$f ?? ''; + } + fputcsv($out, $line); + } + }); + fclose($out); + }); + + $response->headers->set('Content-Type', 'text/csv; charset=UTF-8'); + $response->headers->set('Content-Disposition', "attachment; filename={$filename}"); + + return $response; + } +} diff --git a/app/Http/Controllers/Admin/OperatorQueController.php b/app/Http/Controllers/Admin/OperatorQueController.php new file mode 100644 index 0000000..36daf1c --- /dev/null +++ b/app/Http/Controllers/Admin/OperatorQueController.php @@ -0,0 +1,268 @@ +input('sort', 'que_id'); + $sort_type = $request->input('sort_type', 'desc'); + + $query = OperatorQue::query(); + + if ($request->filled('que_status')) { + $query->where('que_status', $request->input('que_status')); + } + + $list = $query->orderBy($sort, $sort_type) + ->paginate(\App\Utils::item_per_page ?? 20); + + $que_status = $request->input('que_status'); + + return view('admin.operator_ques.list', compact('list', 'sort', 'sort_type')); + } + + /** + * 新規登録(画面/処理) + */ + public function add(Request $request) + { + if ($request->isMethod('get')) { + // 新規時は空の値でフォーム描画 + return view('admin.operator_ques.add', $this->formPayload()); + } + + $data = $this->validateRequest($request); + + OperatorQue::create($data); + + return redirect()->route('operator_ques')->with('success', 'オペレーターキューを登録しました。'); + } + + /** + * 編集(画面/処理) + */ + public function edit($id, Request $request) + { + $que = OperatorQue::findOrFail($id); + + if ($request->isMethod('get')) { + return view('admin.operator_ques.edit', array_merge( + $this->formPayload($que), + ['que_id' => $que->que_id] + )); + } + + $data = $this->validateRequest($request, $que->que_id); + + $que->fill($data)->save(); + + return redirect()->route('operator_ques')->with('success', 'オペレーターキューを更新しました。'); + } + + /** + * 詳細(参照) + */ + public function info($id) + { + $que = OperatorQue::findOrFail($id); + + return view('admin.operator_ques.info', array_merge( + $this->formPayload($que), + ['que_id' => $que->que_id] + )); + } + + /** + * 削除(複数可) + */ + public function delete(Request $request) + { + $ids = []; + if ($request->filled('id')) { + $ids[] = (int) $request->input('id'); + } + if (is_array($request->input('pk'))) { + $ids = array_merge($ids, $request->input('pk')); + } + $ids = array_values(array_unique(array_map('intval', $ids))); + + if (!$ids) { + return back()->with('error', '削除対象が選択されていません。'); + } + + OperatorQue::whereIn('que_id', $ids)->delete(); + + return redirect()->route('operator_ques')->with('success', '削除しました。'); + } + + /** + * CSV インポート + */ + public function import(Request $request) + { + $validator = Validator::make($request->all(), [ + 'file' => 'required|file|mimes:csv,txt|max:20480', + ]); + if ($validator->fails()) { + return back()->withErrors($validator)->withInput(); + } + + $file = $request->file('file')->getRealPath(); + if (!$handle = fopen($file, 'r')) { + return back()->with('error', 'CSVを読み取れません。'); + } + + $header = fgetcsv($handle) ?: []; + $header = array_map(fn($h) => trim(ltrim($h ?? '', "\xEF\xBB\xBF")), $header); + + $fillable = (new OperatorQue())->getFillable(); + $rows = []; + + while (($row = fgetcsv($handle)) !== false) { + $assoc = []; + foreach ($header as $i => $key) { + if (in_array($key, $fillable, true)) { + $assoc[$key] = $row[$i] ?? null; + } + } + if ($assoc) { + $rows[] = $assoc; + } + } + fclose($handle); + + DB::transaction(function () use ($rows) { + foreach ($rows as $data) { + OperatorQue::create($data); + } + }); + + return redirect()->route('operator_ques')->with('success', count($rows) . '件をインポートしました。'); + } + + /** + * CSV エクスポート + */ + public function export(): StreamedResponse + { + $filename = 'operator_que_' . now()->format('Ymd_His') . '.csv'; + $fillable = (new OperatorQue())->getFillable(); // 見出しは fillable を流用 + + $response = new StreamedResponse(function () use ($fillable) { + $out = fopen('php://output', 'w'); + // UTF-8 BOM + fprintf($out, chr(0xEF) . chr(0xBB) . chr(0xBF)); + + fputcsv($out, $fillable); + + OperatorQue::orderBy('que_id')->chunk(500, function ($chunk) use ($out, $fillable) { + foreach ($chunk as $row) { + $line = []; + foreach ($fillable as $f) { + $line[] = $row->$f ?? ''; + } + fputcsv($out, $line); + } + }); + fclose($out); + }); + + $response->headers->set('Content-Type', 'text/csv; charset=UTF-8'); + $response->headers->set('Content-Disposition', "attachment; filename={$filename}"); + + return $response; + } + + /** + * フォームに渡す値/候補 + */ + private function formPayload(?OperatorQue $que = null): array + { + // 値 + $payload = [ + 'que_id' => $que->que_id ?? '', + 'user_id' => $que->user_id ?? '', + 'contract_id' => $que->contract_id ?? '', + 'park_id' => $que->park_id ?? '', + 'que_class' => $que->que_class ?? '', + 'que_comment' => $que->que_comment ?? '', + 'que_status' => $que->que_status ?? '', + 'que_status_comment' => $que->que_status_comment?? '', + 'work_instructions' => $que->work_instructions ?? '', + ]; + + // 候補 + $payload['users'] = $this->fetchUsers(); + $payload['parks'] = $this->fetchParks(); + + return $payload; + } + + /** + * バリデーション + * ※ 実テーブルの型に合わせて必要に応じて調整 + */ + private function validateRequest(Request $request, $queId = null): array + { + $rules = [ + 'user_id' => 'required|integer', + 'contract_id' => 'nullable|integer', + 'park_id' => 'required|integer', + 'que_class' => 'required|integer', + 'que_comment' => 'nullable|string|max:2000', + 'que_status' => 'required|integer', + 'que_status_comment' => 'nullable|string|max:2000', + 'work_instructions' => 'nullable|string|max:2000', + // 'operator_id' => 'nullable|integer', // ログインユーザIDを使うなら不要 + ]; + + return $request->validate($rules); + } + + /** + * 利用者候補(user_seq, user_name, user_mobile, user_homephone) + * Blade 側では $users をそのまま @foreach + */ + private function fetchUsers() + { + try { + return User::select('user_seq', 'user_name', 'user_mobile', 'user_homephone') + ->orderBy('user_name') + ->get(); + } catch (\Throwable $e) { + return DB::table('users') + ->select(['user_seq', 'user_name', 'user_mobile', 'user_homephone']) + ->orderBy('user_name') + ->get(); + } + } + + /** + * 駐輪場候補(park_id => park_name) + */ + private function fetchParks() + { + try { + return Park::orderBy('park_name')->pluck('park_name', 'park_id'); + } catch (\Throwable $e) { + return DB::table('parks')->orderBy('park_name')->pluck('park_name', 'park_id'); + } + } +} diff --git a/app/Http/Controllers/Admin/PaymentController.php b/app/Http/Controllers/Admin/PaymentController.php new file mode 100644 index 0000000..79d7bba --- /dev/null +++ b/app/Http/Controllers/Admin/PaymentController.php @@ -0,0 +1,135 @@ +input('sort', 'payment_id'); + $sort_type = $request->input('sort_type', 'asc'); + + $query = Payment::query(); + + $query->orderBy($sort, $sort_type); + + $payments = $query->paginate(20); + + return view('admin.payments.list', compact('payments', 'sort', 'sort_type')); +} + + /** + * 新規登録画面表示&登録処理 + */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + // バリデーション + $request->validate([ + 'payment_companyname' => 'required|string|max:255', + 'payment_add' => 'nullable|string|max:255', + 'payment_detail' => 'nullable|string|max:255', + 'payment_space1' => 'nullable|string|max:255', + 'payment_space2' => 'nullable|string|max:255', + 'payment_title' => 'nullable|string|max:255', + 'payment_guide' => 'nullable|string|max:255', + 'payment_inquiryname' => 'nullable|string|max:255', + 'payment_inquirytel' => 'nullable|string|max:255', + 'payment_time' => 'nullable|string|max:255', + ]); + + // 登録データ作成 + $data = $request->all(); + $data['operator_id'] = Auth::user()->ope_id; + + Payment::create($data); + + return redirect()->route('payments')->with('success', '登録しました'); + } + + return view('admin.payments.add', [ + 'record' => null, + 'mode' => 'add' + ]); + } + + /** + * 編集画面表示&更新処理 + */ + public function edit(Request $request, $payment_id) +{ + $payment = Payment::findOrFail($payment_id); + + if ($request->isMethod('post')) { + // バリデーション + $request->validate([ + 'payment_companyname' => 'required|string|max:255', + // 其他字段... + ]); + + $data = $request->all(); + $data['operator_id'] = Auth::user()->ope_id; + + $payment->update($data); + + return redirect()->route('payments')->with('success', '更新しました'); + } + + return view('admin.payments.edit', [ + 'payment' => $payment, + 'isEdit' => true, + 'isInfo' => false + ]); +} + + /** + * 詳細画面表示 + */ + public function info($payment_id) + { + $payment = Payment::findOrFail($payment_id); + + return view('admin.payments.info', [ + 'record' => $payment, + 'mode' => 'info' + ]); + } + + /** + * 削除処理 + */ + public function delete(Request $request) + { + if ($request->has('ids')) { + Payment::whereIn('payment_id', $request->ids)->delete(); + return redirect()->route('payments')->with('success', '削除しました'); + } + return redirect()->route('payments')->with('error', '削除対象が選択されていません'); + } + + /** + * インポート処理 + */ + public function import(Request $request) + { + // TODO: CSVなどのインポート処理を実装 + return redirect()->route('payments')->with('success', 'インポート処理は未実装です'); + } + + /** + * エクスポート処理 + */ + public function export() + { + // TODO: エクスポート処理を実装 + return redirect()->route('payments')->with('success', 'エクスポート処理は未実装です'); + } +} diff --git a/app/Http/Controllers/Admin/PrintAreaController.php b/app/Http/Controllers/Admin/PrintAreaController.php new file mode 100644 index 0000000..98a48ee --- /dev/null +++ b/app/Http/Controllers/Admin/PrintAreaController.php @@ -0,0 +1,113 @@ +input('sort', 'print_area_id'); + $sort_type = $request->input('sort_type', 'asc'); + + $list = PrintArea::orderBy($sort, $sort_type)->paginate(20); + + return view('admin.print_areas.list', [ + 'list' => $list, + 'sort' => $sort, + 'sort_type' => $sort_type, + ]); + } + + // 新規登録 + public function add(Request $request) + { + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'print_area_name' => 'required|string|max:32', + 'park_id' => 'required|integer', + ]); + + $validated['operator_id'] = auth()->id(); // 現在のログインユーザーを記録 + PrintArea::create($validated); + + return redirect()->route('print_areas')->with('success', '登録しました'); + } + + $parks = Park::pluck('park_name', 'park_id'); + return view('admin.print_areas.add', compact('parks')); + } + + // 編集 + public function edit(Request $request, $print_area_id) + { + $record = PrintArea::findOrFail($print_area_id); + + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'print_area_name' => 'required|string|max:32', + 'park_id' => 'required|integer', + ]); + + $validated['operator_id'] = auth()->id(); // 更新者を記録 + $record->update($validated); + + return redirect()->route('print_areas')->with('success', '更新しました'); + } + + $parks = Park::pluck('park_name', 'park_id'); + return view('admin.print_areas.edit', compact('record', 'parks')); + } + + // 詳細 + public function info(Request $request, $print_area_id) + { + $record = PrintArea::with('park')->findOrFail($print_area_id); + return view('admin.print_areas.info', compact('record')); + } + + // 削除(複数可) + public function delete(Request $request) + { + if ($request->has('pk')) { + PrintArea::destroy($request->input('pk')); + return redirect()->route('print_areas')->with('success', '削除しました'); + } + + return redirect()->route('print_areas')->with('error', '削除対象が見つかりません'); + } + + // CSVエクスポート + public function export(Request $request) + { + $filename = 'print_areas_' . now()->format('Ymd_His') . '.csv'; + $data = PrintArea::with('park')->get(); + + $csv = implode(",", ['印刷範囲ID', '印刷範囲名', '駐輪場ID', '駐輪場名']) . "\n"; + foreach ($data as $item) { + $csv .= implode(",", [ + $item->print_area_id, + $item->print_area_name, + $item->park_id, + optional($item->park)->park_name, + ]) . "\n"; + } + + return response($csv) + ->header('Content-Type', 'text/csv') + ->header('Content-Disposition', "attachment; filename=$filename"); + } + + // CSVインポート(仮) + public function import(Request $request) + { + // 実装未 + return redirect()->route('print_areas')->with('success', 'CSVインポート処理(未実装)'); + } +} diff --git a/app/Http/Controllers/Admin/RegularTypeController.php b/app/Http/Controllers/Admin/RegularTypeController.php new file mode 100644 index 0000000..c610a15 --- /dev/null +++ b/app/Http/Controllers/Admin/RegularTypeController.php @@ -0,0 +1,172 @@ + 0, + 'isExport' => 0, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + 'page' => $request->get('page', 1), + + ]; + $inputs['isMethodPost'] = $request->isMethod('post'); + $inputs['list'] = RegularType::search($inputs); + if ($inputs['list']->total() > 0 && $inputs['page'] > $inputs['list']->lastPage()) { + return redirect()->route('regular_types'); + } + return view('admin.regular_types.list', $inputs); + } + + public function add(Request $request) + { + $inputs = [ + 'regular_type_id' => $request->input('regular_type_id'), // 定期種別ID + 'city_id' => $request->input('city_name', ''), // 市区名 + 'regular_class_1' => $request->input('regular_class_1'), // 定期種別1 + 'regular_class_2' => $request->input('regular_class_2'), // 定期種別2 + 'regular_class_3' => $request->input('regular_class_3'), // 定期種別3 + 'regular_class_6' => $request->input('regular_class_6'), // 定期種別6 + 'regular_class_12' => $request->input('regular_class_12'), // 定期種別12 + 'memo' => $request->input('memo'), // 備考 + ]; + $dataList = $this->getDataDropList(); + $inputs = array_merge($inputs, $dataList); + if ($request->isMethod('POST')) { + $type = false; + $validation = new RegularTypeRequest(); + $rules = $validation->rules(); + $validator = Validator::make($request->all(), $rules, $validation->messages()); + if (!$validator->fails()) { + \DB::transaction(function () use ($inputs, &$type) { + $new = new RegularType(); + $new->fill($inputs); + if ($new->save()) { + $type = true; + } + + }); + if ($type) { + $request->session()->flash('success', __('新しい成功を創造する。')); + return redirect()->route('regular_types'); + } else { + $request->session()->flash('error', __('新しい作成に失敗しました')); + } + } else { + $inputs['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + + return view('admin.regular_types.add', $inputs); + } + + public function edit(Request $request, $pk, $view = '') + { + $regular_type = RegularType::getByPk($pk); + if (empty($pk) || empty($regular_type)) { + abort('404'); + } + $data = $regular_type->getAttributes(); + $dataList = $this->getDataDropList(); + $data = array_merge($data, $dataList); + if ($request->isMethod('POST')) { + $type = false; + $validation = new RegularTypeRequest(); + $rules = $validation->rules(); + $validator = Validator::make($request->all(), $rules, $validation->messages()); + $requestAll = $request->all(); + $requestAll['city_id'] = $request->input('city_name'); + $data = array_merge($data, $requestAll); + if (!$validator->fails()) { + + \DB::transaction(function () use ($data, &$type, $regular_type) { + $regular_type->fill($data); + $regular_type->save(); + $type = true; + }); + if ($type) { + $request->session()->flash('success', __('更新に成功しました')); + return redirect()->route('regular_types'); + } else { + $request->session()->flash('error', __('更新に失敗しました')); + } + } else { + $data['errorMsg'] = $this->__buildErrorMessasges($validator); + } + } + if ($view != '') { + return view($view, $data); + } + return view('admin.regular_types.edit', $data); + } + + public function delete(Request $request) + { + $arr_pk = $request->get('pk'); + if ($arr_pk) { + if (RegularType::deleteByPk($arr_pk)) { + return redirect()->route('regular_types')->with('success', __("削除が完了しました。")); + } else { + return redirect()->route('regular_types')->with('error', __('削除に失敗しました。')); + } + } + return redirect()->route('regular_types')->with('error', __('削除するユーザーを選択してください。')); + } + + public function export(Request $request) + { + + $headers = array( + "Content-type" => "text/csv;charset=UTF-8", + 'Content-Encoding: UTF-8', + "Content-Disposition" => "attachment; filename=file.csv", + "Pragma" => "no-cache", + "Cache-Control" => "must-revalidate, post-check=0, pre-check=0", + "Expires" => "0" + ); + $inputs = [ + 'isMethodPost' => 0, + 'isExport' => 1, + 'sort' => $request->input('sort', ''), + 'sort_type' => $request->input('sort_type', ''), + + ]; + $dataExport = RegularType::search($inputs); + $columns = array('user_seq', 'user_id'); + $filename = "UserMaster.csv"; + $file = fopen($filename, 'w+'); + fputcsv($file, $columns); + foreach ($dataExport as $item) { + fputcsv($file, array($item->user_seq, $item->user_id)); + } + fclose($file); + return Response::download($filename, $filename, $headers); + } + + public function info(Request $request, $id) + { + return $this->edit($request, $id, 'admin.regular_types.info'); + } + + public function getDataDropList() + { + $data['cities'] = City::getList(); + return $data; + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/SettingController.php b/app/Http/Controllers/Admin/SettingController.php new file mode 100644 index 0000000..454f128 --- /dev/null +++ b/app/Http/Controllers/Admin/SettingController.php @@ -0,0 +1,161 @@ +paginate($perPage); + + return view('admin.settings.list', [ + 'list' => $list, + 'sort' => 'setting_id', + 'sort_type' => 'desc', + ]); + } + + /** + * 追加(GET: 画面 / POST: 登録): /settings/add + */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + $v = Validator::make($request->all(), $this->rules()); + if ($v->fails()) return back()->withErrors($v)->withInput(); + + // チェックボックス(未送信時は 0) + $data = $this->onlyFillable($request); + $data['printable_alert_flag'] = $request->boolean('printable_alert_flag'); + + DB::transaction(function () use ($data) { + Setting::create($data); + }); + + return redirect()->route('settings')->with('success', '設定を登録しました。'); + } + + return view('admin.settings.add', [ + 'setting' => new Setting(), // フォーム初期化用 + 'isInfo' => false, + 'isEdit' => false, + ]); + } + + /** + * 編集(GET: 画面 / POST: 更新): /settings/edit/{id} + */ + public function edit(Request $request, int $id) + { + $setting = Setting::findOrFail($id); + + if ($request->isMethod('post')) { + $v = Validator::make($request->all(), $this->rules($id)); + if ($v->fails()) return back()->withErrors($v)->withInput(); + + $data = $this->onlyFillable($request); + $data['printable_alert_flag'] = $request->boolean('printable_alert_flag'); + + DB::transaction(function () use ($setting, $data) { + $setting->update($data); + }); + + return redirect()->route('settings')->with('success', '設定を更新しました。'); + } + + return view('admin.settings.edit', [ + 'setting' => $setting, + 'isInfo' => false, + 'isEdit' => true, + ]); + } + + /** + * 詳細表示: /settings/info/{id} + */ + public function info(int $id) + { + $setting = Setting::findOrFail($id); + + return view('admin.settings.info', [ + 'setting' => $setting, + 'isInfo' => true, + 'isEdit' => false, + ]); + } + + /** + * 削除(単体/複数対応): /settings/delete + */ + public function delete(Request $request) + { + $ids = $request->input('ids'); + $id = $request->input('id'); + if ($id) $ids = [$id]; + + if (!is_array($ids) || empty($ids)) { + return back()->with('error', '削除対象が指定されていません。'); + } + + DB::transaction(function () use ($ids) { + Setting::whereIn('setting_id', $ids)->delete(); + }); + + return redirect()->route('settings')->with('success', '設定を削除しました。'); + } + + // ===== バリデーション・ユーティリティ ===== + + /** + * バリデーションルール + */ + private function rules(?int $id = null): array + { + return [ + 'edit_master' => ['nullable','string','max:255'], + 'web_master' => ['nullable','string','max:255'], + 'auto_change_date' => ['nullable','date'], + 'auto_chage_master' => ['nullable','string','max:255'], // ※カラム名は仕様通り + 're_issue_alert_number' => ['nullable','integer','min:0'], + 'image_base_url1' => ['nullable','string','max:255'], + 'image_base_url2' => ['nullable','string','max:255'], + 'printable_alert_flag' => ['nullable','boolean'], + 'printable_number' => ['nullable','integer','min:0'], + 'printable_alert_number' => ['nullable','integer','min:0'], + 'printer_keep_alive' => ['nullable','integer','min:0'], + 'operator_id' => ['nullable','integer','min:0'], + ]; + } + + /** + * フォームから fillable のみ抽出 + */ + private function onlyFillable(Request $request): array + { + return $request->only([ + 'edit_master', + 'web_master', + 'auto_change_date', + 'auto_chage_master', + 're_issue_alert_number', + 'image_base_url1', + 'image_base_url2', + 'printable_number', + 'printable_alert_number', + 'printer_keep_alive', + 'operator_id', + 'printable_alert_flag', + + ]); + } +} diff --git a/app/Http/Controllers/Admin/SettlementTransactionController.php b/app/Http/Controllers/Admin/SettlementTransactionController.php new file mode 100644 index 0000000..93ae8ed --- /dev/null +++ b/app/Http/Controllers/Admin/SettlementTransactionController.php @@ -0,0 +1,283 @@ +input('contract_id'); + $status = trim((string)$request->input('status', '')); + $from = $request->input('from'); // 支払日時 from + $to = $request->input('to'); // 支払日時 to + + if ($contractId !== null && $contractId !== '') { + $q->where('contract_id', (int)$contractId); + } + if ($status !== '') { + $q->where('status', 'like', "%{$status}%"); + } + if ($from) { + $q->whereDate('pay_date', '>=', $from); + } + if ($to) { + $q->whereDate('pay_date', '<=', $to); + } + + // --- ソート(既定:created_at desc) + $sort = $request->input('sort', 'created_at'); + $type = strtolower($request->input('sort_type', 'desc')); + $allow = [ + 'settlement_transaction_id', 'created_at', 'updated_at', + 'contract_id', 'status', 'pay_date', 'settlement_amount', + ]; + if (!in_array($sort, $allow, true)) $sort = 'created_at'; + if (!in_array($type, ['asc', 'desc'], true)) $type = 'desc'; + $q->orderBy($sort, $type); + + return view('admin.settlement_transactions.list', [ + 'transactions' => $q->paginate(20)->appends($request->except('page')), + 'contract_id' => $contractId, + 'status' => $status, + 'from' => $from, + 'to' => $to, + 'sort' => $sort, + 'sort_type' => $type, + ]); + } + + /** + * 新規 + * ルート: settlement_transactions_add + */ + public function add(Request $request) + { + if ($request->isMethod('post')) { + $data = $this->validatePayload($request); + SettlementTransaction::create($data); + return redirect()->route('settlement_transactions')->with('success', '登録しました'); + } + + return view('admin.settlement_transactions.add', [ + 'transaction' => null, + 'isEdit' => false, + 'isInfo' => false, + ]); + } + + /** + * 編集 + * ルート: settlement_transactions_edit + */ + public function edit(int $settlement_transaction_id, Request $request) + { + $transaction = SettlementTransaction::findOrFail($settlement_transaction_id); + + if ($request->isMethod('post')) { + $data = $this->validatePayload($request); + $transaction->update($data); + return redirect()->route('settlement_transactions')->with('success', '更新しました'); + } + + return view('admin.settlement_transactions.edit', [ + 'transaction' => $transaction, + 'isEdit' => true, + 'isInfo' => false, + ]); + } + + /** + * 詳細 + * ルート: settlement_transactions_info + */ + public function info(int $settlement_transaction_id) + { + $transaction = SettlementTransaction::findOrFail($settlement_transaction_id); + + return view('admin.settlement_transactions.info', [ + 'transaction' => $transaction, + 'isEdit' => false, + 'isInfo' => true, + ]); + } + + /** + * 一括削除(一覧のチェック name="ids[]") + * ルート: settlement_transactions_delete + */ + public function delete(Request $request) + { + $ids = (array) $request->input('ids', []); + $ids = array_values(array_filter($ids, fn($v) => preg_match('/^\d+$/', (string)$v))); + + if (!$ids) { + return redirect()->route('settlement_transactions')->with('error', '削除対象が選択されていません。'); + } + + SettlementTransaction::whereIn('settlement_transaction_id', $ids)->delete(); + + return redirect()->route('settlement_transactions')->with('success', '削除しました'); + } + + /** + * CSVインポート(簡易) + * ルート: settlement_transactions_import + * + * 想定カラム順: + * contract_id,status,pay_code,contract_payment_number,corp_code, + * mms_date,cvs_code,shop_code,pay_date,settlement_amount,stamp_flag,md5_string + * 1行目ヘッダ可 + */ + public function import(Request $request) + { + $request->validate([ + 'file' => ['required', 'file', 'mimetypes:text/plain,text/csv,text/tsv', 'max:4096'], + ]); + + $path = $request->file('file')->getRealPath(); + + $created = 0; + $updated = 0; + $skipped = 0; + + DB::beginTransaction(); + try { + if (($fp = fopen($path, 'r')) !== false) { + $line = 0; + while (($row = fgetcsv($fp)) !== false) { + $line++; + + // ヘッダ行をスキップ + if ($line === 1) { + $joined = strtolower(implode(',', $row)); + if (str_contains($joined, 'contract_id') || str_contains($joined, 'status')) { + continue; + } + } + + // 入力列を安全に展開 + [$contract_id,$status,$pay_code,$contract_payment_number,$corp_code,$mms_date,$cvs_code,$shop_code,$pay_date,$settlement_amount,$stamp_flag,$md5_string] = array_pad($row, 12, null); + + // 正規化 + $payload = [ + 'contract_id' => ($contract_id === '' || $contract_id === null) ? null : (int)$contract_id, + 'status' => $status !== null ? trim($status) : null, + 'pay_code' => $pay_code !== null ? trim($pay_code) : null, + 'contract_payment_number' => $contract_payment_number !== null ? trim($contract_payment_number) : null, + 'corp_code' => $corp_code !== null ? trim($corp_code) : null, + 'mms_date' => $mms_date !== null ? trim($mms_date) : null, + 'cvs_code' => $cvs_code !== null ? trim($cvs_code) : null, + 'shop_code' => $shop_code !== null ? trim($shop_code) : null, + 'pay_date' => $pay_date ? date('Y-m-d H:i:s', strtotime($pay_date)) : null, + 'settlement_amount' => ($settlement_amount === '' || $settlement_amount === null) ? null : (float)preg_replace('/[^\d.]/','',$settlement_amount), + 'stamp_flag' => $stamp_flag !== null ? trim($stamp_flag) : null, + 'md5_string' => $md5_string !== null ? trim($md5_string) : null, + ]; + + // upsert キー(優先: md5_string、なければ contract_id+pay_date) + $ex = null; + if (!empty($payload['md5_string'])) { + $ex = SettlementTransaction::where('md5_string', $payload['md5_string'])->first(); + } elseif (!empty($payload['contract_id']) && !empty($payload['pay_date'])) { + $ex = SettlementTransaction::where('contract_id', $payload['contract_id']) + ->where('pay_date', $payload['pay_date'])->first(); + } + + if ($ex) { $ex->update($payload); $updated++; } + else { SettlementTransaction::create($payload); $created++; } + } + fclose($fp); + } + + DB::commit(); + return redirect()->route('settlement_transactions') + ->with('success', "インポート完了:新規 {$created} 件、更新 {$updated} 件、スキップ {$skipped} 件"); + } catch (\Throwable $e) { + DB::rollBack(); + return redirect()->route('settlement_transactions') + ->with('error', 'インポートに失敗しました:' . $e->getMessage()); + } + } + + /** + * CSVエクスポート + * ルート: settlement_transactions_export + */ + public function export(Request $request): StreamedResponse + { + $q = SettlementTransaction::query(); + + // 一覧と同じソートを適用(任意で絞り込みも追加可能) + $sort = $request->input('sort', 'created_at'); + $type = strtolower($request->input('sort_type', 'desc')); + if (!in_array($type, ['asc','desc'], true)) $type = 'desc'; + $q->orderBy($sort, $type); + + $filename = 'settlement_transactions_' . now()->format('Ymd_His') . '.csv'; + + return response()->streamDownload(function () use ($q) { + $out = fopen('php://output', 'w'); + fputcsv($out, [ + 'ID','契約ID','ステータス','支払コード','契約課金番号','企業コード', + 'MMS日付','CVSコード','店舗コード','支払日時','金額','スタンプ','MD5', + '登録日時','更新日時' + ]); + $q->chunk(500, function ($rows) use ($out) { + foreach ($rows as $r) { + fputcsv($out, [ + $r->settlement_transaction_id, + $r->contract_id, + $r->status, + $r->pay_code, + $r->contract_payment_number, + $r->corp_code, + $r->mms_date, + $r->cvs_code, + $r->shop_code, + optional($r->pay_date)->format('Y-m-d H:i:s'), + $r->settlement_amount, + $r->stamp_flag, + $r->md5_string, + optional($r->created_at)->format('Y-m-d H:i:s'), + optional($r->updated_at)->format('Y-m-d H:i:s'), + ]); + } + }); + fclose($out); + }, $filename, ['Content-Type' => 'text/csv; charset=UTF-8']); + } + + /** + * 共通バリデーション + */ + private function validatePayload(Request $request): array + { + return $request->validate([ + 'contract_id' => ['nullable','integer'], + 'status' => ['nullable','string','max:255'], + 'pay_code' => ['nullable','string','max:255'], + 'contract_payment_number' => ['nullable','string','max:255'], + 'corp_code' => ['nullable','string','max:255'], + 'mms_date' => ['nullable','string','max:255'], + 'cvs_code' => ['nullable','string','max:255'], + 'shop_code' => ['nullable','string','max:255'], + 'pay_date' => ['nullable','date'], + 'settlement_amount' => ['nullable','numeric'], // DB は decimal(10,0) + 'stamp_flag' => ['nullable','string','max:255'], + 'md5_string' => ['nullable','string','max:255'], + ]); + } +} diff --git a/app/Http/Controllers/Admin/TaxController.php b/app/Http/Controllers/Admin/TaxController.php new file mode 100644 index 0000000..ff1b639 --- /dev/null +++ b/app/Http/Controllers/Admin/TaxController.php @@ -0,0 +1,284 @@ +input('kw')); + if ($keyword !== '') { + // 数値型でも互換のため部分一致を残す + $query->where('tax_percent', 'like', "%{$keyword}%"); + } + $from = $request->input('from'); + $to = $request->input('to'); + if ($from) { + $query->whereDate('tax_day', '>=', $from); + } + if ($to) { + $query->whereDate('tax_day', '<=', $to); + } + + // ソート(既定:適用日 降順) + $sort = $request->input('sort', 'tax_day'); + $type = strtolower($request->input('sort_type', 'desc')); + $allow = ['tax_day', 'tax_percent', 'updated_at', 'created_at', 'tax_id']; + if (!in_array($sort, $allow, true)) { + $sort = 'tax_day'; + } + if (!in_array($type, ['asc', 'desc'], true)) { + $type = 'desc'; + } + $query->orderBy($sort, $type); + + $list = $query->paginate(20)->appends($request->except('page')); + + return view('admin.tax.list', [ + 'taxes' => $list, + 'kw' => $keyword, + 'from' => $from, + 'to' => $to, + 'sort' => $sort, + 'sort_type' => $type, + ]); + } + + public function add(Request $request) +{ + if ($request->isMethod('post')) { + $data = $request->validate([ + 'tax_percent' => ['required', 'numeric', 'min:0', 'max:1000'], + 'tax_day' => ['required', 'date', 'unique:tax,tax_day'], + ]); + $data['operator_id'] = optional(\Auth::user())->ope_id ?? null; + $data['tax_percent'] = number_format((float)$data['tax_percent'], 2, '.', ''); + \App\Models\Tax::create($data); + + return redirect()->route('tax')->with('success', '登録しました'); + } + + return view('admin.tax.add', [ + 'tax' => null, + 'isEdit' => false, + 'isInfo' => false, + ]); +} + +public function edit(int $tax_id, Request $request) +{ + $tax = \App\Models\Tax::findOrFail($tax_id); + + if ($request->isMethod('post')) { + $data = $request->validate([ + 'tax_percent' => ['required', 'numeric', 'min:0', 'max:1000'], + 'tax_day' => ['required', 'date', 'unique:tax,tax_day,' . $tax->tax_id . ',tax_id'], + ]); + $data['operator_id'] = optional(\Auth::user())->ope_id ?? null; + $data['tax_percent'] = number_format((float)$data['tax_percent'], 2, '.', ''); + $tax->update($data); + + return redirect()->route('tax')->with('success', '更新しました'); + } + + return view('admin.tax.edit', [ + 'tax' => $tax, + 'isEdit' => true, + 'isInfo' => false, + ]); +} + +public function info(int $tax_id) +{ + $tax = \App\Models\Tax::findOrFail($tax_id); + + return view('admin.tax.info', [ + 'tax' => $tax, + 'isEdit' => false, + 'isInfo' => true, + ]); +} + + + /** + * 一括削除(一覧のチェックボックスで送られてくる想定) + * フォーム側 name="ids[]" の配列を POST + */ + public function delete(Request $request) + { + $ids = (array) $request->input('ids', []); + $ids = array_values(array_filter($ids, fn($v) => preg_match('/^\d+$/', (string) $v))); + + if (empty($ids)) { + return redirect()->route('tax')->with('error', '削除対象が選択されていません。'); + } + + Tax::whereIn('tax_id', $ids)->delete(); + + return redirect()->route('tax')->with('success', '削除しました'); + } + + /** + * CSVインポート + * カラム想定: tax_percent, tax_day + * - 1行目はヘッダ可 + * - tax_day をキーとして「存在すれば更新 / 無ければ作成」 + */ + public function import(Request $request) + { + $request->validate([ + 'file' => ['required', 'file', 'mimetypes:text/plain,text/csv,text/tsv', 'max:2048'], + ]); + + $path = $request->file('file')->getRealPath(); + if (!$path || !is_readable($path)) { + return redirect()->route('tax')->with('error', 'ファイルを読み込めません。'); + } + + $created = 0; + $updated = 0; + $skipped = 0; + + DB::beginTransaction(); + try { + if (($fp = fopen($path, 'r')) !== false) { + $line = 0; + while (($row = fgetcsv($fp)) !== false) { + $line++; + + // 空行スキップ + if (count($row) === 1 && trim((string) $row[0]) === '') { + continue; + } + + // ヘッダ行っぽい場合(1行目に 'tax_percent' を含む) + if ($line === 1) { + $joined = strtolower(implode(',', $row)); + if (str_contains($joined, 'tax_percent') && str_contains($joined, 'tax_day')) { + continue; // ヘッダスキップ + } + } + + // 取り出し(列数が足りない場合スキップ) + $percent = $row[0] ?? null; + $day = $row[1] ?? null; + if ($percent === null || $day === null) { + $skipped++; + continue; + } + + // 正規化 & 検証 + $percent = trim((string) $percent); + $percent = rtrim($percent, '%'); + $percent = preg_replace('/[^\d.]/', '', $percent) ?? '0'; + $percentF = (float) $percent; + if ($percentF < 0) { + $skipped++; + continue; + } + $percentF = (float) number_format($percentF, 2, '.', ''); + + $day = date('Y-m-d', strtotime((string) $day)); + if (!$day) { + $skipped++; + continue; + } + + // upsert: 適用日ユニーク運用 + $existing = Tax::whereDate('tax_day', $day)->first(); + $payload = [ + 'tax_percent' => $percentF, + 'tax_day' => $day, + 'operator_id' => optional(Auth::user())->ope_id ?? null, + ]; + + if ($existing) { + $existing->update($payload); + $updated++; + } else { + Tax::create($payload); + $created++; + } + } + fclose($fp); + } + + DB::commit(); + return redirect()->route('tax')->with('success', "インポート完了:新規 {$created} 件、更新 {$updated} 件、スキップ {$skipped} 件"); + } catch (\Throwable $e) { + DB::rollBack(); + return redirect()->route('tax')->with('error', 'インポートに失敗しました:' . $e->getMessage()); + } + } + + /** + * CSVエクスポート:現在の絞り込み/ソート条件を反映 + */ + public function export(Request $request): StreamedResponse + { + $query = Tax::query(); + + $keyword = trim((string) $request->input('kw')); + if ($keyword !== '') { + $query->where('tax_percent', 'like', "%{$keyword}%"); + } + $from = $request->input('from'); + $to = $request->input('to'); + if ($from) { + $query->whereDate('tax_day', '>=', $from); + } + if ($to) { + $query->whereDate('tax_day', '<=', $to); + } + + $sort = $request->input('sort', 'tax_day'); + $type = strtolower($request->input('sort_type', 'desc')); + $allow = ['tax_day', 'tax_percent', 'updated_at', 'created_at', 'tax_id']; + if (!in_array($sort, $allow, true)) { + $sort = 'tax_day'; + } + if (!in_array($type, ['asc', 'desc'], true)) { + $type = 'desc'; + } + $query->orderBy($sort, $type); + + $filename = 'tax_' . now()->format('Ymd_His') . '.csv'; + + return response()->streamDownload(function () use ($query) { + $out = fopen('php://output', 'w'); + // Header(設計書の主要カラム) + fputcsv($out, ['消費税ID', '消費税率', '適用日', '登録日時', '更新日時', '更新オペレータID']); + $query->chunk(500, function ($rows) use ($out) { + foreach ($rows as $r) { + fputcsv($out, [ + $r->tax_id, + // 画面仕様に合わせたい場合は getDisplayTaxPercentAttribute() に置換可 + is_numeric($r->tax_percent) + ? number_format((float) $r->tax_percent, 2, '.', '') + : (string) $r->tax_percent, + optional($r->tax_day)->format('Y-m-d'), + optional($r->created_at)->format('Y-m-d H:i:s'), + optional($r->updated_at)->format('Y-m-d H:i:s'), + $r->operator_id, + ]); + } + }); + fclose($out); + }, $filename, [ + 'Content-Type' => 'text/csv; charset=UTF-8', + ]); + } +} diff --git a/app/Http/Controllers/Admin/TermsController.php b/app/Http/Controllers/Admin/TermsController.php new file mode 100644 index 0000000..6d20d39 --- /dev/null +++ b/app/Http/Controllers/Admin/TermsController.php @@ -0,0 +1,137 @@ +input('sort', 'terms_id'); + $sort_type = $request->input('sort_type', 'asc'); + + $allowedSorts = ['terms_id', 'terms_revision', 'start_date', 'use_flag']; + if (!in_array($sort, $allowedSorts)) { + $sort = 'terms_id'; + } + + if (!in_array($sort_type, ['asc', 'desc'])) { + $sort_type = 'asc'; + } + + $terms = Term::select([ + 'terms_id', + 'terms_revision', + 'terms_text', + 'start_date', + 'use_flag', + 'memo', + 'city_id', + 'operator_id' + ])->orderBy($sort, $sort_type)->paginate(20); + + return view('admin.terms.list', compact('terms', 'sort', 'sort_type')); + } + + // 新規登録画面・登録処理 + public function add(Request $request) + { + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'terms_revision' => 'required|string|max:255', + 'terms_text' => 'required|string', + 'start_date' => 'nullable|date', + 'use_flag' => 'required|in:0,1', + 'memo' => 'nullable|string|max:255', + 'city_id' => 'nullable|integer', + 'operator_id' => 'nullable|integer', + ]); + + Term::create($validated); + return redirect()->route('terms')->with('success', '利用規約が登録されました'); + } + // 都市の選択肢を取得 + $cities = City::pluck('city_name', 'city_id'); + + return view('admin.terms.add', compact('cities')); + } + + + // 編集画面・更新処理 + public function edit(Request $request, $id) + { + $term = Term::findOrFail($id); + $cities = City::pluck('city_name', 'city_id'); + + if ($request->isMethod('post')) { + $validated = $request->validate([ + 'terms_revision' => 'required|string|max:255', + 'terms_text' => 'required|string', + 'start_date' => 'nullable|date', + 'use_flag' => 'required|in:0,1', + 'memo' => 'nullable|string|max:255', + 'city_id' => 'nullable|integer', + 'operator_id' => 'nullable|integer', + ]); + + $term->update($validated); + return redirect()->route('terms')->with('success', '利用規約が更新されました'); + } + + + return view('admin.terms.edit', compact('term', 'cities')); + } + + + // 詳細表示 + public function info($id) + { + $term = Term::findOrFail($id); + return view('admin.terms.info', compact('term')); + } + + // 削除処理(複数) + public function delete(Request $request) + { + $ids = $request->input('id', []); // 修正点:'pk' → 'id' + + if (!empty($ids)) { + Term::destroy($ids); + return redirect()->route('terms')->with('success', '削除しました'); + } + + return redirect()->route('terms')->with('error', '削除対象が見つかりません'); + } + + // CSVインポート(仮) + public function import(Request $request) + { + return redirect()->route('terms')->with('info', 'CSVインポートは未実装です'); + } + + // CSVエクスポート(fputcsv使用) + public function export() + { + return response()->streamDownload(function () { + $handle = fopen('php://output', 'w'); + fputcsv($handle, ['terms_id', 'terms_revision', 'terms_text', 'start_date', 'use_flag']); + + foreach (Term::all() as $term) { + fputcsv($handle, [ + $term->terms_id, + $term->terms_revision, + $term->terms_text, + $term->start_date, + $term->use_flag, + ]); + } + + fclose($handle); + }, 'terms.csv'); + } +} diff --git a/app/Models/ContractAllowableCity.php b/app/Models/ContractAllowableCity.php new file mode 100644 index 0000000..03ef707 --- /dev/null +++ b/app/Models/ContractAllowableCity.php @@ -0,0 +1,83 @@ +where('contract_allowable_city_id', $inputs['contract_allowable_city_id']); + } + if (!empty($inputs['city_id'])) { + $list->where('city_id', $inputs['city_id']); + } + if (!empty($inputs['contract_allowable_city_name'])) { + $list->where('contract_allowable_city_name', 'like', '%' . $inputs['contract_allowable_city_name'] . '%'); + } + if (!empty($inputs['park_id'])) { + $list->where('park_id', $inputs['park_id']); + } + } + + // 並び順 + if (!empty($inputs['sort'])) { + $list->orderBy($inputs['sort'], $inputs['sort_type'] ?? 'asc'); + } + + if ($inputs['isExport'] ?? false) { + return $list->get(); + } else { + return $list->paginate(Utils::item_per_page); + } + } + + /** + * 主キーで取得 + */ + public static function getByPk($pk) + { + return self::find($pk); + } + + /** + * 主キー配列で一括削除 + */ + public static function deleteByPk($arr) + { + return self::whereIn('contract_allowable_city_id', $arr)->delete(); + } + + /** + * 選択リスト取得用(フォーム等) + */ + public static function getList() + { + return self::pluck('contract_allowable_city_name', 'contract_allowable_city_id'); + } +} diff --git a/app/Models/Device.php b/app/Models/Device.php index 63cd392..0bc9983 100644 --- a/app/Models/Device.php +++ b/app/Models/Device.php @@ -4,80 +4,41 @@ namespace App\Models; use Illuminate\Database\Eloquent\Model; -/** - * デバイスモデル - deviceテーブル - * - * ハードウェアデバイス(印刷機等)の情報を管理するモデル - * batch_logテーブルとの関連でバッチ処理ログに使用される - */ class Device extends Model { - protected $table = 'device'; + protected $table = 'device'; protected $primaryKey = 'device_id'; - public $timestamps = true; - - const CREATED_AT = 'created_at'; - const UPDATED_AT = 'updated_at'; - + public $incrementing = true; + protected $keyType = 'int'; + + protected $fillable = [ - 'park_id', // 駐輪場ID - 'device_type', // デバイスタイプ - 'device_subject', // デバイス件名 - 'device_identifier', // デバイス識別子 - 'device_work', // デバイス作業 - 'device_workstart', // 作業開始日 - 'device_replace', // 交換日 - 'device_remarks', // 備考 - 'operator_id' // オペレータID + 'park_id', + 'device_type', + 'device_subject', + 'device_identifier', + 'device_work', + 'device_workstart', + 'device_replace', + 'device_remarks', + 'operator_id', ]; protected $casts = [ + 'park_id' => 'integer', 'device_workstart' => 'date', - 'device_replace' => 'date', + 'device_replace' => 'date', + 'operator_id' => 'integer', ]; - /** - * 駐輪場との関連付け - * - * @return \Illuminate\Database\Eloquent\Relations\BelongsTo - */ public function park() { - // UsingStatus系は廃止。正式モデル Park を使用。 return $this->belongsTo(Park::class, 'park_id', 'park_id'); } - /** - * バッチログとの関連付け(batch_logテーブル) - * 統一BatchLogで管理される - * - * @return \Illuminate\Database\Query\Builder - */ - public function batchLogs() - { - return \DB::table('batch_log') - ->where('parameters->device_id', $this->device_id); - } - /** - * デバイスIDの存在確認 - * - * @param int $deviceId デバイスID - * @return bool 存在するかどうか - */ - public static function exists(int $deviceId): bool + public static function getList(): array { - return self::where('device_id', $deviceId)->exists(); + return static::orderBy('device_subject')->pluck('device_subject', 'device_id')->toArray(); } - - /** - * デバイス情報を取得 - * - * @param int $deviceId デバイスID - * @return Device|null デバイス情報 - */ - public static function findByDeviceId(int $deviceId): ?Device - { - return self::where('device_id', $deviceId)->first(); - } -} \ No newline at end of file +} diff --git a/app/Models/JurisdictionParking.php b/app/Models/JurisdictionParking.php new file mode 100644 index 0000000..f761b67 --- /dev/null +++ b/app/Models/JurisdictionParking.php @@ -0,0 +1,40 @@ +belongsTo(User::class, 'operator_id'); + } + + public function park() + { + return $this->belongsTo(Park::class, 'park_id'); + } + + public function ope() + { + return $this->belongsTo(Ope::class, 'ope_id'); + } +} diff --git a/app/Models/Manager.php b/app/Models/Manager.php new file mode 100644 index 0000000..0a99a66 --- /dev/null +++ b/app/Models/Manager.php @@ -0,0 +1,60 @@ + 'integer', + 'manager_device1' => 'integer', + 'manager_device2' => 'integer', + 'manager_alert1' => 'boolean', + 'manager_alert2' => 'boolean', + 'manager_quit_flag' => 'boolean', + 'manager_quitday' => 'date', + 'operator_id' => 'integer', + ]; + + // --- リレーション(テーブル名は既存に合わせて調整してください) + public function park() { return $this->belongsTo(Park::class, 'manager_parkid', 'park_id'); } + public function device1() { return $this->belongsTo(Device::class, 'manager_device1', 'device_id'); } + public function device2() { return $this->belongsTo(Device::class, 'manager_device2', 'device_id'); } + + // Blade 互換のヘルパ(list.blade.php で getXxx() を呼んでいるため) + public function getPark() { return $this->park; } + public function getDevice1() { return $this->device1; } + public function getDevice2() { return $this->device2; } + + public function getManagerQuitFlagDisplay() + { + return $this->manager_quit_flag ? '退職' : '在職'; + } + public function getManagerQuitFlagDisplayAttribute() + { + return $this->getManagerQuitFlagDisplay(); + } +} diff --git a/app/Models/NeighborStation.php b/app/Models/NeighborStation.php new file mode 100644 index 0000000..914312e --- /dev/null +++ b/app/Models/NeighborStation.php @@ -0,0 +1,25 @@ + 'integer', + 'operator_id' => 'integer', + 'created_at' => 'datetime', + 'updated_at' => 'datetime', + ]; +} diff --git a/app/Models/PrintArea.php b/app/Models/PrintArea.php new file mode 100644 index 0000000..486bac1 --- /dev/null +++ b/app/Models/PrintArea.php @@ -0,0 +1,30 @@ +belongsTo(Park::class, 'park_id'); + } +} diff --git a/app/Models/RegularType.php b/app/Models/RegularType.php new file mode 100644 index 0000000..d8fd0d6 --- /dev/null +++ b/app/Models/RegularType.php @@ -0,0 +1,77 @@ +operator_id = Auth::user()->ope_id; + }); + } + + public static function search($inputs) + { + $list = self::query(); + + if ($inputs['isMethodPost']) { + // 検索条件 + } + + if ($inputs['sort']) { + $list->orderBy($inputs['sort'], $inputs['sort_type']); + } + + if ($inputs['isExport']) { + $list = $list->get(); + } else { + $list = $list->paginate(Utils::item_per_page); + } + + return $list; + } + + public static function getByPk($pk) + { + return self::find($pk); + } + + public static function deleteByPk($arr) + { + return self::whereIn('regular_type_id', $arr)->delete(); + } + + public function getCity() + { + return $this->belongsTo(City::class, 'city_id', 'city_id')->first(); + } +} diff --git a/app/Models/Setting.php b/app/Models/Setting.php new file mode 100644 index 0000000..6a17bda --- /dev/null +++ b/app/Models/Setting.php @@ -0,0 +1,49 @@ + 'datetime', // 日時 + 're_issue_alert_number' => 'integer', // 整数 + 'printable_alert_flag' => 'boolean', // 真偽値 + 'printable_number' => 'integer', // 整数 + 'printable_alert_number' => 'integer', // 整数 + 'printer_keep_alive' => 'integer', // 整数 + 'operator_id' => 'integer', // 整数 + 'created_at' => 'datetime', // 作成日時 + 'updated_at' => 'datetime', // 更新日時 + ]; +} diff --git a/app/Models/SettlementTransaction.php b/app/Models/SettlementTransaction.php new file mode 100644 index 0000000..d615b18 --- /dev/null +++ b/app/Models/SettlementTransaction.php @@ -0,0 +1,27 @@ + 'date', + ]; +} diff --git a/app/Models/Term.php b/app/Models/Term.php new file mode 100644 index 0000000..ba3037e --- /dev/null +++ b/app/Models/Term.php @@ -0,0 +1,37 @@ + 'date', + 'use_flag' => 'boolean', + ]; + + /** + * 利用規約のリストを取得 + */ + public static function getList() + { + return self::all(); + } +} diff --git a/resources/views/admin/contract_allowable_cities/_form.blade.php b/resources/views/admin/contract_allowable_cities/_form.blade.php new file mode 100644 index 0000000..bf04c40 --- /dev/null +++ b/resources/views/admin/contract_allowable_cities/_form.blade.php @@ -0,0 +1,94 @@ +@php + $isEdit = $mode === 'edit'; + $isInfo = $mode === 'info'; +@endphp + +@if($isEdit || $isInfo) + +
+ +
+
+ +
+@endif + + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ +@if($isInfo) + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+@endif diff --git a/resources/views/admin/contract_allowable_cities/add.blade.php b/resources/views/admin/contract_allowable_cities/add.blade.php new file mode 100644 index 0000000..a42a3e4 --- /dev/null +++ b/resources/views/admin/contract_allowable_cities/add.blade.php @@ -0,0 +1,103 @@ +@extends('layouts.app') +@section('title', '契約許容市区マスタ(新規)') + +@section('content') +
+
+
+
+

新規

+
+ +
+
+
+ +
+
+
+ @csrf +
+ + {{-- 上部登録ボタン --}} +
+ +
+ +
+ + {{-- 契約許容市区マスタID --}} +
+ +
+ +
+
+ + {{-- 市区ID --}} +
+ +
+ +
+
+ + {{-- 許容市区名 --}} +
+ +
+ +
+
+ + {{-- 駐輪場ID --}} +
+ +
+ +
+
+ + {{-- 隣接区フラグ --}} +
+ +
+ +
+
+ + {{-- 下部登録ボタン --}} +
+ +
+ +
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/admin/contract_allowable_cities/edit.blade.php b/resources/views/admin/contract_allowable_cities/edit.blade.php new file mode 100644 index 0000000..98af0a0 --- /dev/null +++ b/resources/views/admin/contract_allowable_cities/edit.blade.php @@ -0,0 +1,90 @@ +@extends('layouts.app') +@section('title', '契約許容市区マスタ - 編集') + +@section('content') +
+
+
+
+

編集

+
+ +
+
+
+ +
+
+
+ @csrf +
+ {{-- 契約許容市区マスタID --}} +
+ +
+ +
+
+ + {{-- 市区ID --}} +
+ +
+ +
+
+ + {{-- 許容市区名 --}} +
+ +
+ +
+
+ + {{-- 駐輪場 --}} +
+ +
+ +
+
+ + {{-- 隣接区フラグ --}} +
+ +
+ +
+
+ + {{-- ボタンエリア --}} +
+ + 戻る +
+
+ +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/admin/contract_allowable_cities/info.blade.php b/resources/views/admin/contract_allowable_cities/info.blade.php new file mode 100644 index 0000000..4224800 --- /dev/null +++ b/resources/views/admin/contract_allowable_cities/info.blade.php @@ -0,0 +1,36 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 契約許容市区マスタ(詳細)') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 契約許容市区マスタ(詳細)

+
+ +
+
+
+ + +
+ @php + $isEdit = false; + $isInfo = true; + @endphp + @include('admin.contract_allowable_cities._form') +
+ + +
+ 戻る +
+@endsection diff --git a/resources/views/admin/contract_allowable_cities/list.blade.php b/resources/views/admin/contract_allowable_cities/list.blade.php new file mode 100644 index 0000000..ce2d959 --- /dev/null +++ b/resources/views/admin/contract_allowable_cities/list.blade.php @@ -0,0 +1,191 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 契約許容市区マスタ') + +@section('content') +
+
+
+
+

契約許容市区マスタ

+
+
+ +
+
+
+
+ +
+
+
+ +
+
+

絞り込み

+
+
+ @csrf + + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+
+
+
+
+ + +
+ + + + {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }} +
+ + +
+ +
+
+ @csrf + + + + + + + + @foreach($list as $item) + + + + @endforeach + +
+
+ +
+ 編集 +
+
+
+
+
+ + +
+
+ + + + + + + + + + + + @foreach($list as $item) + + + + + + + + @endforeach + +
+ 契約許容市区ID + 市区ID許容市区名駐輪場ID隣接区フラグ
{{ $item->contract_allowable_city_id }}{{ $item->city_id }}{{ $item->contract_allowable_city_name }}{{ $item->park_id }}{{ $item->same_district_flag == 0 ? '隣接市' : 'その他' }}
+
+
+
+
+
+
+ + +@endsection diff --git a/resources/views/admin/devices/_form.blade.php b/resources/views/admin/devices/_form.blade.php new file mode 100644 index 0000000..eddf819 --- /dev/null +++ b/resources/views/admin/devices/_form.blade.php @@ -0,0 +1,181 @@ +{{-- アラート --}} +@if(Session::has('success')) + +@elseif(Session::has('error')) +
+ +

{{ __('誤差') }}:

+ {!! Session::get('error') !!} +
+@elseif(isset($errorMsg)) +
+ +

{{ __('誤差') }}:

+ {!! $errorMsg !!} +
+@endif + +{{-- ===== ボタン区(上部) ===== --}} +
+ @if(!empty($isInfo) && !empty($device?->device_id)) + {{ __('登録') }} + {{ __('編集') }} + @else + + @endif +
+ +
+
+ + @if(!empty($isInfo) || !empty($isEdit)) + {{-- デバイスID --}} +
+ +
+
+
+ +
+
+ @endif + + {{-- 駐輪場ID --}} +
+ +
+
+
+ +
+
+ + {{-- デバイス種別 --}} +
+ +
+
+
+ +
+
+ + {{-- デバイス名 --}} +
+ +
+
+
+ +
+
+ + {{-- 識別子 --}} +
+ +
+
+
+ +
+
+ + {{-- 稼働/停止 --}} +
+ +
+
+
+ @php $work = old('device_work', $device->device_work ?? ''); @endphp +
+ + +
+
+ + +
+
+
+ + {{-- 稼働開始日 --}} +
+ +
+
+
+ +
+
+ + {{-- リプレース予約日 --}} +
+ +
+
+
+ +
+
+ + {{-- 備考 --}} +
+ +
+
+
+ +
+
+ +
+
+ +{{-- ===== ボタン区(下部) ===== --}} +
+ @if(!empty($isInfo) && !empty($device?->device_id)) + {{ __('登録') }} + {{ __('編集') }} + @else + + @endif +
diff --git a/resources/views/admin/devices/add.blade.php b/resources/views/admin/devices/add.blade.php new file mode 100644 index 0000000..3e603fd --- /dev/null +++ b/resources/views/admin/devices/add.blade.php @@ -0,0 +1,37 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] デバイス管理マスタ') + +@section('content') +
+
+
+
+

新規

+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ @csrf + @include('admin.devices._form', ['isEdit' => 0, 'isInfo' => 0, 'device' => $device]) +
+
+
+
+
+
+@endsection diff --git a/resources/views/admin/devices/edit.blade.php b/resources/views/admin/devices/edit.blade.php new file mode 100644 index 0000000..8e6a9f3 --- /dev/null +++ b/resources/views/admin/devices/edit.blade.php @@ -0,0 +1,38 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] デバイス管理マスタ') + +@section('content') +
+
+
+
+

編集

+
+
+ +
+
+
+
+ +
+
+
+
+
+
+ @csrf + {{-- 編集モード --}} + @include('admin.devices._form', ['isEdit' => 1, 'isInfo' => 0, 'device' => $device]) +
+
+
+
+
+
+@endsection diff --git a/resources/views/admin/devices/info.blade.php b/resources/views/admin/devices/info.blade.php new file mode 100644 index 0000000..fa22a9e --- /dev/null +++ b/resources/views/admin/devices/info.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] デバイス管理マスタ') + +@section('content') +
+
+
+
+

詳細

+
+
+ +
+
+
+
+ +
+
+
+
+
+ {{-- 詳細モード --}} + @include('admin.devices._form', ['isEdit' => 0, 'isInfo' => 1, 'device' => $device]) +
+
+
+
+
+@endsection diff --git a/resources/views/admin/devices/list.blade.php b/resources/views/admin/devices/list.blade.php new file mode 100644 index 0000000..4769cd1 --- /dev/null +++ b/resources/views/admin/devices/list.blade.php @@ -0,0 +1,218 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] デバイス管理マスタ') + +@section('content') +
+
+
+

{{ __('デバイス管理マスタ') }}

+
+ +
+
+
+
+ +
+
+ + {{-- ソート用フォーム --}} +
+ @csrf + + +
+ +
+ + + + {{ $list->appends(['sort'=>$sort,'sort_type'=>$sort_type])->links('pagination') }} +
+ + {{-- フラッシュ --}} +
+ @if(Session::has('success')) + + @elseif(Session::has('error')) +
+ +

{{ __('誤差') }}:

+ {!! Session::get('error') !!} +
+ @elseif(isset($errorMsg)) +
+ +

{{ __('誤差') }}:

+ {!! $errorMsg !!} +
+ @endif +
+ +
+ {{-- 左:チェック列+編集ボタン --}} +
+
+ @csrf + + + + + + @foreach($list as $item) + + + + @endforeach + +
+ + +
+
+ +
@csrf
+
+ + {{-- 右:本体 --}} +
+
+ @php + $TYPE = [1=>'サーバー',2=>'プリンタ',3=>'その他']; + $WORK = ['1'=>'稼働','0'=>'停止',1=>'稼働',0=>'停止']; + @endphp + + + + {{-- 1 デバイスID--}} + + + {{-- 2 駐輪場ID --}} + + + {{-- 3 デバイス種別--}} + + + {{-- 4 デバイス名 --}} + + + {{-- 5 識別子 --}} + + + {{-- 6 稼働/停止 --}} + + + {{-- 7 稼働開始日--}} + + + {{-- 8 リプレース予約日 --}} + + + {{-- 9 備考 --}} + + + + + + @foreach($list as $item) + + {{-- 1 デバイスID) --}} + + + {{-- 2 駐輪場ID:駐輪場名 --}} + + + {{-- 3 デバイス種別 --}} + + + {{-- 4 デバイス名 --}} + + + {{-- 5 識別子--}} + + + {{-- 6 稼働/停止--}} + + + {{-- 7 稼働開始日 --}} + + + {{-- 8 リプレース予約日) --}} + + + {{-- 9 備考 --}} + + + @endforeach + +
{{ __('デバイスID') }}{{ __('駐輪場ID') }}{{ __('デバイス種別') }}{{ __('デバイス名') }}{{ __('識別子') }}{{ __('稼働/停止') }}{{ __('稼働開始日') }}{{ __('リプレース予約日') }}{{ __('備考') }}
+ {{ mb_substr($item->device_id, 0, 10) }} + + + {{ mb_substr($item->park_id, 0, 10) }} + @if($item->relationLoaded('park') && $item->park) + : {{ mb_substr($item->park->park_name ?? '', 0, 10) }} + @endif + + + {{ mb_substr($TYPE[$item->device_type] ?? (string)$item->device_type, 0, 10) }} + + {{ mb_substr($item->device_subject, 0, 10) }} + + {{ mb_substr($item->device_identifier, 0, 10) }} + + {{ $WORK[$item->device_work] ?? $item->device_work }} + + @php + $ws = $item->device_workstart instanceof \Carbon\Carbon ? $item->device_workstart->format('Y/m/d') : ($item->device_workstart ? \Carbon\Carbon::parse($item->device_workstart)->format('Y/m/d') : ''); + @endphp + {{ $ws }} + + @php + $rp = $item->device_replace instanceof \Carbon\Carbon ? $item->device_replace->format('Y/m/d') : ($item->device_replace ? \Carbon\Carbon::parse($item->device_replace)->format('Y/m/d') : ''); + @endphp + {{ $rp }} + + {{ mb_substr($item->device_remarks, 0, 10) }} +
+
+
+
+ +
+
+ +@push('scripts') + +@endpush +@endsection diff --git a/resources/views/admin/jurisdiction_parkings/_form.blade.php b/resources/views/admin/jurisdiction_parkings/_form.blade.php index 0b0343c..652aa31 100644 --- a/resources/views/admin/jurisdiction_parkings/_form.blade.php +++ b/resources/views/admin/jurisdiction_parkings/_form.blade.php @@ -1,95 +1,79 @@ -@if(Session::has('success')) - + +
+
+
+ @csrf + + +
+ +
+ + + + {{ $list->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }} +
+ +
+ @if(session('success')) +
{{ session('success') }}
+ @elseif(session('error')) +
{{ session('error') }}
+ @endif +
+ +
+ +
+
+ @csrf + + + + + + + + @foreach($list as $item) + + + + @endforeach + +
+ +
+ 編集 +
+
+
+
+ + +
+
+ + + + + + + + + + + @foreach($list as $item) + + + + + + + @endforeach + +
管轄駐輪場ID管轄名オペレーター(エリアマネージャ)駐車場
{{ $item->jurisdiction_parking_id }}{{ $item->jurisdiction_parking_name }}{{ $item->ope->ope_name ?? '' }}{{ $item->park->park_name ?? '' }}
+
+
+
+
+
+ +
@endsection \ No newline at end of file diff --git a/resources/views/admin/managers/_form.blade.php b/resources/views/admin/managers/_form.blade.php index bb59f67..e2edd9a 100644 --- a/resources/views/admin/managers/_form.blade.php +++ b/resources/views/admin/managers/_form.blade.php @@ -6,197 +6,238 @@ @elseif(Session::has('error'))
-

{{__('誤差')}}:

+

{{ __('誤差') }}:

{!! Session::get('error') !!}
@elseif(isset($errorMsg))
-

{{__('誤差')}}:

+

{{ __('誤差') }}:

{!! $errorMsg !!}
@endif + +@php + $isAddPage = request()->routeIs('managers_add'); // 新規ページなら true +@endphp + +{{-- 上部ボタン --}} +
+
@if($isInfo) - {{__('登録')}} - {{__('編集')}} + {{ __('登録') }} + {{ __('編集') }} @else - - @endIf + + {{ __('戻る') }} + @endif +
+ +
-
- @if($isInfo || $isEdit) - -
- -
-
-
- -
-
- @endif - - -
- -
-
-
- -
-
+
- -
- + @if($isInfo || $isEdit) + {{-- 駐車場管理者ID(表示のみ) --}} +
+ +
+
+
+
-
-
- -
-
- +
+ @endif - -
- -
-
- -
- - -
- -
-
- -
- - - -
- -
-
- -
- - - -
- -
-
-
- -
-
- - - -
- -
-
-
- -
-
- - - -
- -
-
-
- -
-
- - - -
- -
-
-
- -
-
- - - -
- -
-
-
-
- - -
-
- - -
-
-
- - - -
- -
-
-
- -
-
- + {{-- 駐車場管理者名 --}} +
+ +
+
+
+ +
- @if($isInfo) - {{__('登録')}} - {{__('編集')}} - @else - - @endIf -
+ {{-- 種別 --}} +
+ +
+
+
+ +
+
+ + {{-- 所属駐輪場 --}} +
+ +
+
+ +
+ + {{-- 管理デバイス1 --}} +
+ +
+
+ +
+ + {{-- 管理デバイス2 --}} +
+ +
+
+ +
+ + {{-- メールアドレス --}} +
+ +
+
+
+ +
+
+ + {{-- 電話番号 --}} +
+ +
+
+
+ +
+
+ + {{-- アラート1送信(checkbox + hidden 0) --}} +
+ +
+
+
+ @if(!$isInfo)@endif + +
+
+ + {{-- アラート2送信(checkbox + hidden 0) --}} +
+ +
+
+
+ @if(!$isInfo)@endif + +
+
+ + {{-- 退職フラグ --}} +
+ +
+
+
+
+ + +
+
+ + +
+
+
+ + {{-- 退職日 --}} +
+ +
+
+
+ +
+
+ +
+ + {{-- 下部ボタン --}} + diff --git a/resources/views/admin/managers/add.blade.php b/resources/views/admin/managers/add.blade.php index 14123c7..cb83531 100644 --- a/resources/views/admin/managers/add.blade.php +++ b/resources/views/admin/managers/add.blade.php @@ -1,53 +1,54 @@ - @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] 駐輪場管理者マスタ') @section('content') - -
-
-
-
-

[東京都|〇〇駐輪場] 駐輪場管理者マスタ

-
-
- -
-
-
-
- - - -
-
- - -
-
-
-
- - - - @include('admin.managers._form',['isEdit'=>0,'isInfo'=>0]) -
-
-
-
- -
- - - -
+
+
+
+
+

新規

-
- + +
+
+ +
+
+ + @if ($errors->any()) +
+
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
+
+ @endif + @if(Session::has('success')) +
{{ Session::get('success') }}
+ @elseif(Session::has('error')) +
{!! Session::get('error') !!}
+ @endif + +
+
+
+ + {{-- 新規登録フォーム --}} +
+ @csrf + @include('admin.managers._form', ['isEdit' => 0, 'isInfo' => 0]) + +
+ +
+
+
+ +
+
@endsection diff --git a/resources/views/admin/managers/edit.blade.php b/resources/views/admin/managers/edit.blade.php index 3fd92fe..ae528a0 100644 --- a/resources/views/admin/managers/edit.blade.php +++ b/resources/views/admin/managers/edit.blade.php @@ -1,53 +1,64 @@ - @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] 駐輪場管理者マスタ') @section('content') - -
-
-
-
-

[東京都|〇〇駐輪場] 駐輪場管理者マスタ

-
-
- -
-
-
-
- + @php + $mid = $record->manager_id ?? ($manager_id ?? null); + @endphp - -
-
- - -
-
-
-
- - - - @include('admin.managers._form',['isEdit'=>1,'isInfo'=>0]) -
-
-
-
- -
- - - -
+
+
+
+
+

編集

-
- +
+ +
+ + + +
+
+ + @if ($errors->any()) +
+
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
+
+ @endif + @if(Session::has('success')) +
{{ Session::get('success') }}
+ @elseif(Session::has('error')) +
{!! Session::get('error') !!}
+ @endif + +
+
+
+ + {{-- 更新用フォーム --}} +
+ @csrf + @include('admin.managers._form', ['isEdit' => 1, 'isInfo' => 0]) + +
+ + {{-- 削除用フォーム(独立・POST /managers/delete) --}} +
+ @csrf + +
+ +
+
+
+ +
+
@endsection diff --git a/resources/views/admin/managers/info.blade.php b/resources/views/admin/managers/info.blade.php index cd57dda..62cff04 100644 --- a/resources/views/admin/managers/info.blade.php +++ b/resources/views/admin/managers/info.blade.php @@ -1,53 +1,63 @@ - @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] 駐輪場管理者マスタ') @section('content') - -
-
-
-
-

[東京都|〇〇駐輪場] 駐輪場管理者マスタ

-
-
- -
-
-
-
- + @php + // 兼容控制器传参:$record 或 $manager_id + $mid = $record->manager_id ?? ($manager_id ?? null); + @endphp - -
-
- - -
-
-
-
- - - - @include('admin.managers._form',['isEdit'=>0,'isInfo'=>1]) -
-
-
-
- -
- - - -
+ +
+
+
+
+

駐輪場管理者マスタ

-
- +
+ +
+ + + + +
+
+ + @if ($errors->any()) +
+
    @foreach ($errors->all() as $e)
  • {{ $e }}
  • @endforeach
+
+ @endif + @if(Session::has('success')) +
{{ Session::get('success') }}
+ @elseif(Session::has('error')) +
{!! Session::get('error') !!}
+ @endif + +
+
+
+ + {{-- 閲覧用:不必要な外層フォームは置かない --}} + @include('admin.managers._form', ['isEdit' => 0, 'isInfo' => 1]) + + {{-- 削除用の独立フォーム(ネスト回避) --}} +
+ @csrf + +
+ +
+
+
+ +
+
@endsection diff --git a/resources/views/admin/managers/list.blade.php b/resources/views/admin/managers/list.blade.php index dc46a93..a1461ea 100644 --- a/resources/views/admin/managers/list.blade.php +++ b/resources/views/admin/managers/list.blade.php @@ -1,44 +1,48 @@ @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] 駐輪場管理者マスタ') + @section('content')
-

{{__('駐輪場管理者マスタ')}}

-
+

{{ __('駐輪場管理者マスタ') }}

+
-
-
-
+ + + - -
- -
-
- - - + {{-- 並び替え用 --}} + + @csrf + +
- - - - {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }} + {{-- 新規 --}} + + {{ __('新規') }} + + {{-- 削除(左侧勾选后提交下方 form_delete) --}} + + + {{ $list->appends(['sort' => $sort, 'sort_type' => $sort_type])->links('pagination') }}
+
@if(Session::has('success')) +
+ {{-- 左:チェック&操作 --}}
-
- + + @csrf @@ -76,142 +82,130 @@ - @endforeach
+ value="{{ $item->manager_id }}" name="pk[]">
- {{--詳細--}} - {{__('編集')}} + {{-- 詳細 --}} + {{ __('編集') }}
+ + {{-- 右:一覧テーブル --}}
+ {{-- 駐車場管理者ID --}} + - - + {{-- 駐車場管理者名 --}} + - - - - + {{-- 種別 --}} + - - - - - - - - - - - - - - - - - - + {{-- 所属駐車場ID --}} + + + {{-- 管理デバイス1/2 --}} + + + + {{-- メール --}} + + + {{-- 電話 --}} + + + {{-- アラート1(★sort 修正済) --}} + + + {{-- アラート2 --}} + + + {{-- 退職フラグ --}} + + + {{-- 退職日 --}} + + @foreach($list as $item) - - - - - - - - - - - + - - - - - - - + - - + {{ mb_substr($item->manager_mail, 0, 20) }} + - + {{ mb_substr($item->manager_tel, 0, 20) }} + + + + @endforeach +
{{ __('validation.attributes.manager_id') }}{{__('validation.attributes.manager_id')}} - {{ __('validation.attributes.manager_name') }}{{__('validation.attributes.manager_name')}} - {{__('validation.attributes.manager_type')}} - {{ __('validation.attributes.manager_type') }} - {{__('validation.attributes.manager_parkid')}} - - {{__('validation.attributes.manager_device1')}} - - {{__('validation.attributes.manager_device2')}} - {{__('validation.attributes.manager_mail')}} - {{__('validation.attributes.manager_tel')}} - {{__('validation.attributes.manager_alert1')}} - - {{__('validation.attributes.manager_alert2')}} - - {{__('validation.attributes.manager_quit_flag')}} - - {{__('validation.attributes.manager_quitday')}} - {{ __('validation.attributes.manager_parkid') }}{{ __('validation.attributes.manager_device1') }}{{ __('validation.attributes.manager_device2') }}{{ __('validation.attributes.manager_mail') }}{{ __('validation.attributes.manager_tel') }}{{ __('validation.attributes.manager_alert1') }}{{ __('validation.attributes.manager_alert2') }}{{ __('validation.attributes.manager_quit_flag') }}{{ __('validation.attributes.manager_quitday') }}
- {{mb_substr($item->manager_id, 0, 10)}} - {{mb_substr($item->manager_name, 0, 10)}} - {{mb_substr($item->manager_type, 0, 10)}} - {{mb_substr(!empty($item->getPark())? $item->getPark()->park_name :"" , 0, 10)}} + {{ mb_substr($item->manager_id, 0, 10) }} - {{mb_substr(!empty($item->getDevice1())?$item->getDevice1()->device_subject:"", 0, 10)}} + {{ mb_substr($item->manager_name, 0, 10) }} + + {{ mb_substr($item->manager_type, 0, 10) }} - {{mb_substr(!empty($item->getDevice2())?$item->getDevice2()->device_subject:"", 0, 10)}} + {{ mb_substr(!empty($item->getPark()) ? $item->getPark()->park_name : "", 0, 10) }} - {{mb_substr($item->manager_mail, 0, 20)}} - {{mb_substr($item->manager_tel, 0, 20)}} - {{mb_substr($item->manager_alert1, 0, 20)}} + + {{ mb_substr(!empty($item->getDevice1()) ? $item->getDevice1()->device_subject : "", 0, 10) }} + + {{ mb_substr(!empty($item->getDevice2()) ? $item->getDevice2()->device_subject : "", 0, 10) }} - {{mb_substr($item->manager_alert2, 0, 20)}} - {{$item->getManagerQuitFlagDisplay()}} + {{ mb_substr($item->manager_alert1, 0, 20) }} + + {{ mb_substr($item->manager_alert2, 0, 20) }} + + {{ $item->getManagerQuitFlagDisplay() }} + @if($item->manager_quitday) - {{mb_substr($item->manager_quitday, 0, 10)}} + {{ mb_substr($item->manager_quitday, 0, 10) }} @endif
- -
+
- -@endsection \ No newline at end of file + +@endsection diff --git a/resources/views/admin/neighbor_stations/_form.blade.php b/resources/views/admin/neighbor_stations/_form.blade.php new file mode 100644 index 0000000..7018159 --- /dev/null +++ b/resources/views/admin/neighbor_stations/_form.blade.php @@ -0,0 +1,74 @@ +@if(Session::has('success')) + +@elseif(Session::has('error')) +
+ +

{{__('誤差')}}:

+ {!! Session::get('error') !!} +
+@endif + +
+ 戻る +
+ +
+
+ {{-- 近傍駅名 --}} +
+ +
+
+ +
+ + {{-- フリガナ --}} +
+ +
+
+ +
+ + {{-- 路線名 --}} +
+ +
+
+ +
+ + {{-- park_id --}} +
+ +
+
+ +
+ + {{-- operator_id --}} +
+ +
+
+ +
+
+ +
+ +
+
diff --git a/resources/views/admin/neighbor_stations/add.blade.php b/resources/views/admin/neighbor_stations/add.blade.php new file mode 100644 index 0000000..09b488b --- /dev/null +++ b/resources/views/admin/neighbor_stations/add.blade.php @@ -0,0 +1,145 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 近傍駅マスタ') + +@section('content') +
+
+
+
+

[東京都|〇〇駐輪場] 近傍駅マスタ

+
+
+ +
+
+
+
+ +
+
+
+
+
+ @csrf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
近傍駅ID + +
駐車場ID + +
近傍駅 + +
近傍駅ふりがな + +
路線名 + +
近傍駅座標(緯度) + +
近傍駅座標(経度) + +
+ +
+ + + + + + @csrf + + +
+ + + +
+
+
+
+@endsection + +@section('scripts') + +@endsection + + diff --git a/resources/views/admin/neighbor_stations/edit.blade.php b/resources/views/admin/neighbor_stations/edit.blade.php new file mode 100644 index 0000000..23ab854 --- /dev/null +++ b/resources/views/admin/neighbor_stations/edit.blade.php @@ -0,0 +1,39 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 近傍駅マスタ') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 近傍駅マスタ

+
+
+ +
+
+
+
+ + +
+
+
+
+
+
+ @csrf + @include('admin.neighbor_stations._form', ['isEdit' => 1, 'isInfo' => 0, 'station' => $station]) +
+
+
+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/admin/neighbor_stations/import.blade.php b/resources/views/admin/neighbor_stations/import.blade.php new file mode 100644 index 0000000..70b0591 --- /dev/null +++ b/resources/views/admin/neighbor_stations/import.blade.php @@ -0,0 +1,17 @@ +{{-- resources/views/admin/neighbor_stations/import.blade.php --}} +@extends('layouts.admin') + +@section('content') +

近傍駅 インポート

+ +
+ @csrf +
+ + +
+ +
+ +戻る +@endsection diff --git a/resources/views/admin/neighbor_stations/info.blade.php b/resources/views/admin/neighbor_stations/info.blade.php new file mode 100644 index 0000000..e9571ec --- /dev/null +++ b/resources/views/admin/neighbor_stations/info.blade.php @@ -0,0 +1,25 @@ +{{-- resources/views/admin/neighbor_stations/info.blade.php --}} +@extends('layouts.admin') + +@section('content') +

近傍駅 詳細

+ +
+ +

{{ $station->station_neighbor_station }}

+ + +

{{ $station->station_name_ruby }}

+ + +

{{ $station->station_route_name }}

+ + +

{{ $station->park_id }}

+ + +

{{ $station->operator_id }}

+
+ +戻る +@endsection diff --git a/resources/views/admin/neighbor_stations/list.blade.php b/resources/views/admin/neighbor_stations/list.blade.php new file mode 100644 index 0000000..b56d0aa --- /dev/null +++ b/resources/views/admin/neighbor_stations/list.blade.php @@ -0,0 +1,122 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 近傍駅マスタ') + +@section('content') + +
+
+
+
+

近傍駅マスタ

+
+
+ +
+
+
+
+ + +
+
+
+ @csrf + + +
+ +
+ + + + {{ $stations->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }} +
+ + +
+ @if(session('success')) +
{{ session('success') }}
+ @elseif(session('error')) +
{{ session('error') }}
+ @endif +
+ +
+ +
+
+ @csrf + + + + + + + + @foreach($stations as $station) + + + + + @endforeach + +
+ + +
+
+
+ + +
+
+ + + + + + + + + + + + + + @foreach($stations as $station) + + + + + + + + + + @endforeach + +
+ 近傍駅ID + + 駐車場ID + + 近傍駅 + + 近傍駅ふりがな + + 路線名 + 近傍駅座標(緯度)近傍駅座標(経度)
{{ $station->station_id }}{{ $station->park_id }}{{ $station->station_neighbor_station }}{{ $station->station_name_ruby }}{{ $station->station_route_name }}{{ $station->station_latitude }}{{ $station->station_longitude }}
+
+
+
+
+
+ +
+@endsection \ No newline at end of file diff --git a/resources/views/admin/operator_ques/_form.blade.php b/resources/views/admin/operator_ques/_form.blade.php index 7bb94d2..17c9e65 100644 --- a/resources/views/admin/operator_ques/_form.blade.php +++ b/resources/views/admin/operator_ques/_form.blade.php @@ -18,8 +18,8 @@ @endif
@if($isInfo) - {{__('登録')}} - {{__('編集')}} + {{__('登録')}} + {{__('編集')}} @else @endIf @@ -90,17 +90,22 @@
- +
+
@@ -116,13 +121,17 @@
- +
@@ -141,8 +150,8 @@
@if($isInfo) - {{__('登録')}} - {{__('編集')}} + {{__('登録')}} + {{__('編集')}} @else @endIf diff --git a/resources/views/admin/operator_ques/add.blade.php b/resources/views/admin/operator_ques/add.blade.php index 787e9c6..410c6be 100644 --- a/resources/views/admin/operator_ques/add.blade.php +++ b/resources/views/admin/operator_ques/add.blade.php @@ -31,7 +31,7 @@
-
+ diff --git a/resources/views/admin/operator_ques/edit.blade.php b/resources/views/admin/operator_ques/edit.blade.php index 672034b..1640c4d 100644 --- a/resources/views/admin/operator_ques/edit.blade.php +++ b/resources/views/admin/operator_ques/edit.blade.php @@ -31,7 +31,7 @@
- + diff --git a/resources/views/admin/operator_ques/info.blade.php b/resources/views/admin/operator_ques/info.blade.php index 05f19d6..d6fe63e 100644 --- a/resources/views/admin/operator_ques/info.blade.php +++ b/resources/views/admin/operator_ques/info.blade.php @@ -31,7 +31,7 @@
- + diff --git a/resources/views/admin/operator_ques/list.blade.php b/resources/views/admin/operator_ques/list.blade.php index 739c520..f1b0ed8 100644 --- a/resources/views/admin/operator_ques/list.blade.php +++ b/resources/views/admin/operator_ques/list.blade.php @@ -21,6 +21,47 @@
+ +
+
+

絞り込みフィルター

+
+ + @csrf + + + +
+
+ + +
+
+ +
+ + +
+ +
+
+
+ + + + + + + +
@@ -76,14 +117,18 @@ + value="{{ $item->que_id }}" name="pk[]">
- {{--詳細--}} - {{__('編集')}} + {{-- 詳細 --}} + {{-- 詳細 --}} + + {{-- 編集 --}} + {{ __('編集') }}
+ @endforeach @@ -154,16 +199,20 @@ {{mb_substr(!empty($item->getPark())?$item->getPark()->park_name:"", 0, 10)}} - + - {{mb_substr(__(\App\OperatorQue::QueClass[$item->que_class]), 0, 10)}} + {{ mb_substr($item->getQueClassLabel(), 0, 10) }} + + - {{mb_substr($item->que_comment, 0, 20)}} + {{ mb_substr($item->que_comment, 0, 20) }} + - {{mb_substr(__(\App\OperatorQue::QueStatus[$item->que_status]), 0, 10)}} + {{ mb_substr($item->getQueStatusLabel(), 0, 10) }} + diff --git a/resources/views/admin/opes/_form.blade.php b/resources/views/admin/opes/_form.blade.php index 5b8a564..e706760 100644 --- a/resources/views/admin/opes/_form.blade.php +++ b/resources/views/admin/opes/_form.blade.php @@ -16,14 +16,16 @@ {!! $errorMsg !!}
@endif +
@if($isInfo) - {{__('登録')}} - {{__('編集')}} + {{__('登録')}} + {{__('編集')}} @else - - @endIf + + @endif
+
@if($isInfo || $isEdit) @@ -33,57 +35,60 @@
-
@endif +
- + class="form-control form-control-lg" + @if($isInfo) readonly @else placeholder="{{__('validation.attributes.ope_name')}}" @endif/>
@if(!$isInfo)
- +
+ placeholder="{{__('validation.attributes.password')}}">
- +
+ placeholder="{{__('validation.attributes.password_confirmation')}}">
- @endif + @endif - +
- + + @foreach(\App\Models\Ope::OPE_TYPE as $key => $item) + @endforeach +
@@ -94,9 +99,10 @@
- + class="form-control form-control-lg" + @if($isInfo) readonly @else placeholder="{{__('validation.attributes.ope_mail')}}" @endif/>
@@ -107,29 +113,26 @@
- + class="form-control form-control-lg" + @if($isInfo) readonly @else placeholder="{{__('validation.attributes.ope_phone')}}" @endif/>
- +
- +
- +
@@ -143,15 +146,11 @@
- +
- +
@@ -165,15 +164,11 @@
- +
- +
@@ -187,15 +182,11 @@
- +
- +
@@ -209,15 +200,11 @@
- +
- +
@@ -231,15 +218,11 @@
- +
- +
@@ -253,15 +236,11 @@
- +
- +
@@ -275,15 +254,11 @@
- +
- +
@@ -296,15 +271,11 @@
- +
- +
@@ -317,15 +288,11 @@
- +
- +
@@ -338,15 +305,11 @@
- +
- +
@@ -359,15 +322,11 @@
- +
- +
@@ -380,15 +339,11 @@
- +
- +
@@ -401,15 +356,11 @@
- +
- +
@@ -422,15 +373,11 @@
- +
- +
@@ -443,15 +390,11 @@
- +
- +
@@ -464,15 +407,11 @@
- +
- +
@@ -485,15 +424,11 @@
- +
- +
@@ -506,18 +441,18 @@
- +
+
+ @if($isInfo) - {{__('登録')}} - {{__('編集')}} + {{__('登録')}} + {{__('編集')}} @else - + @endIf
diff --git a/resources/views/admin/opes/add.blade.php b/resources/views/admin/opes/add.blade.php index 24fa5eb..c231385 100644 --- a/resources/views/admin/opes/add.blade.php +++ b/resources/views/admin/opes/add.blade.php @@ -1,4 +1,3 @@ - @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] オペレータマスタ') @@ -8,7 +7,7 @@
-

[東京都|〇〇駐輪場] オペレータマスタ

+

新規

+
- -
-
- - - - @include('admin.settlement_transactions._form',['isEdit'=>0,'isInfo'=>0]) + + @csrf + @include('admin.settlement_transactions._form', [ + 'transaction' => null, + 'isEdit' => false, + 'isInfo' => false, + ])
- -
- - - -
- @endsection diff --git a/resources/views/admin/settlement_transactions/edit.blade.php b/resources/views/admin/settlement_transactions/edit.blade.php index 3918573..c9559cd 100644 --- a/resources/views/admin/settlement_transactions/edit.blade.php +++ b/resources/views/admin/settlement_transactions/edit.blade.php @@ -1,6 +1,5 @@ - @extends('layouts.app') -@section('title', '[東京都|〇〇駐輪場] 決済トランザクション') +@section('title', '[東京都|〇〇駐輪場] 決済トランザクション - 編集') @section('content') @@ -8,46 +7,39 @@
-

[東京都|〇〇駐輪場] 決済トランザクション

-
+

編集

+
-
-
+
+
+
- -
-
- - - - @include('admin.settlement_transactions._form',['isEdit'=>1,'isInfo'=>0]) + + @csrf + @include('admin.settlement_transactions._form', [ + 'transaction' => $transaction, + 'isEdit' => true, + 'isInfo' => false, + ])
- -
- - - -
- @endsection diff --git a/resources/views/admin/settlement_transactions/info.blade.php b/resources/views/admin/settlement_transactions/info.blade.php index 51557ed..495eb7b 100644 --- a/resources/views/admin/settlement_transactions/info.blade.php +++ b/resources/views/admin/settlement_transactions/info.blade.php @@ -1,6 +1,5 @@ - @extends('layouts.app') -@section('title', '[東京都|〇〇駐輪場] 決済トランザクション') +@section('title', '[東京都|〇〇駐輪場] 決済トランザクション - 詳細') @section('content') @@ -8,46 +7,39 @@
-

[東京都|〇〇駐輪場] 決済トランザクション

-
+

[東京都|〇〇駐輪場] 決済トランザクション - 詳細

+
-
-
+
+
+
- -
-
- - - - @include('admin.settlement_transactions._form',['isEdit'=>0,'isInfo'=>1]) + + + @include('admin.settlement_transactions._form', [ + 'transaction' => $transaction, + 'isEdit' => false, + 'isInfo' => true, + ])
- -
- - - -
- @endsection diff --git a/resources/views/admin/settlement_transactions/list.blade.php b/resources/views/admin/settlement_transactions/list.blade.php index 5089134..e1d4afb 100644 --- a/resources/views/admin/settlement_transactions/list.blade.php +++ b/resources/views/admin/settlement_transactions/list.blade.php @@ -1,43 +1,65 @@ @extends('layouts.app') @section('title', '[東京都|〇〇駐輪場] 決済トランザクション') + @section('content')
-

{{__('決済トランザクション')}}

-
+

{{ __('決済トランザクション') }}

+
-
-
-
+
+
+
-
+ +
+
+

絞り込みフィルター

+
+
+ @csrf + + + +
+
+ + +
+
+ +
+ + +
+
+
+
+
- - - +
-
- - - + {{-- ソート保持用 --}} + + @csrf + +
- - - - {{ $list->appends(['sort' => $sort,'sort_type'=>$sort_type])->links('pagination') }} + {{ $transactions->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }}
+
@if(Session::has('success')) +
+ {{-- 左:チェック&操作 --}}
-
- + + @csrf @@ -71,130 +95,135 @@ - @foreach($list as $item) + @foreach($transactions as $item) - @endforeach
+ value="{{ $item->settlement_transaction_id }}" name="ids[]">
+ + {{-- 右:データ一覧 --}}
- - - - - - - - + + - - - - - - - - - - - - - - - - - - + + + - @foreach($list as $item) + @foreach($transactions as $item) - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + @endforeach
- {{__('validation.attributes.settlement_transaction_id')}} + + {{ __('validation.attributes.settlement_transaction_id') }} {{__('validation.attributes.contract_id')}} + + {{ __('validation.attributes.contract_id') }} {{__('validation.attributes.status')}} + + {{ __('validation.attributes.status') }} {{__('validation.attributes.pay_code')}} + {{ __('validation.attributes.pay_code') }}{{ __('validation.attributes.contract_payment_number') }} + {{ __('validation.attributes.corp_code') }} {{__('validation.attributes.contract_payment_number')}} + + {{ __('validation.attributes.mms_date') }} {{__('validation.attributes.corp_code')}} + + {{ __('validation.attributes.cvs_code') }} {{__('validation.attributes.mms_date')}} + + {{ __('validation.attributes.shop_code') }} {{__('validation.attributes.cvs_code')}} + + {{ __('validation.attributes.pay_date') }} {{__('validation.attributes.shop_code')}} - {{__('validation.attributes.pay_date')}} - {{__('validation.attributes.settlement_amount')}}{{__('validation.attributes.stamp_flag')}}{{__('validation.attributes.md5_string')}}{{ __('validation.attributes.settlement_amount') }}{{ __('validation.attributes.stamp_flag') }}{{ __('validation.attributes.md5_string') }}
- {{mb_substr($item->settlement_transaction_id, 0, 10)}} - {{mb_substr($item->contract_id, 0, 10)}}{{mb_substr($item->status, 0, 10)}} - - {{mb_substr($item->pay_code, 0, 10)}} - {{mb_substr($item->contract_payment_number, 0, 10)}} - {{mb_substr($item->corp_code, 0, 10)}} - {{mb_substr($item->mms_date, 0, 10)}}{{mb_substr($item->cvs_code, 0, 10)}} - - {{mb_substr($item->shop_code, 0, 10)}} - {{mb_substr($item->pay_date, 0, 10)}} - {{mb_substr($item->settlement_amount, 0, 10)}} - {{mb_substr($item->stamp_flag, 0, 10)}} - {{mb_substr($item->md5_string, 0, 10)}}{{ $item->settlement_transaction_id }}{{ $item->contract_id }}{{ $item->status }}{{ $item->pay_code }}{{ $item->contract_payment_number }}{{ $item->corp_code }}{{ $item->mms_date }}{{ $item->cvs_code }}{{ $item->shop_code }}{{ optional($item->pay_date)->format('Y-m-d H:i') }}{{ $item->settlement_amount }}{{ $item->stamp_flag }}{{ $item->md5_string }}
+
-
- -
-
- -@endsection \ No newline at end of file +
+ + + + @push('scripts') + + @endpush +@endsection diff --git a/resources/views/admin/tax/_form.blade.php b/resources/views/admin/tax/_form.blade.php new file mode 100644 index 0000000..40455ea --- /dev/null +++ b/resources/views/admin/tax/_form.blade.php @@ -0,0 +1,80 @@ +@if(Session::has('success')) +
{{ Session::get('success') }}
+@elseif(Session::has('error')) +
{{ Session::get('error') }}
+@endif + +
+ + {{-- 登録・削除 ボタン(上部) --}} +
+ @if($isInfo) + 編集 + @else + + @if($isEdit) + 削除 + @endif + @endif +
+ +
+ + {{-- 消費税ID(編集/参照のみ表示、システム自動入力) --}} + @if($isEdit || $isInfo) +
+ +
+ +
+
+ @endif + + {{-- 消費税率(必須・数値・負数不可) --}} +
+ +
+ + @error('tax_percent')
{{ $message }}
@enderror + 数値(半角)で入力してください。例:10.00 ※負数不可 +
+
+ + {{-- 適用日(必須・日付型) --}} +
+ +
+ + @error('tax_day')
{{ $message }}
@enderror +
+
+ +
+ + {{-- 登録・削除 ボタン(下部重ね) --}} +
+ @if($isInfo) + 編集 + @else + + @if($isEdit) + 削除 + @endif + @endif +
+ +
diff --git a/resources/views/admin/tax/add.blade.php b/resources/views/admin/tax/add.blade.php new file mode 100644 index 0000000..2890a18 --- /dev/null +++ b/resources/views/admin/tax/add.blade.php @@ -0,0 +1,34 @@ +@extends('layouts.app') +@section('title', '新規') + +@section('content') +
+
+
+
+

新規

+
+
+ +
+
+
+
+ +
+
+
+ @csrf + @include('admin.tax._form', [ + 'tax' => null, + 'isEdit' => false, + 'isInfo' => false + ]) +
+
+
+@endsection diff --git a/resources/views/admin/tax/edit.blade.php b/resources/views/admin/tax/edit.blade.php new file mode 100644 index 0000000..04d5c00 --- /dev/null +++ b/resources/views/admin/tax/edit.blade.php @@ -0,0 +1,34 @@ +@extends('layouts.app') +@section('title', '消費税 編集') + +@section('content') +
+
+
+
+

編集

+
+
+ +
+
+
+
+ +
+
+
+ @csrf + @include('admin.tax._form', [ + 'tax' => $tax, + 'isEdit' => true, + 'isInfo' => false + ]) +
+
+
+@endsection diff --git a/resources/views/admin/tax/info.blade.php b/resources/views/admin/tax/info.blade.php new file mode 100644 index 0000000..4f42f98 --- /dev/null +++ b/resources/views/admin/tax/info.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 消費税マスタ - 詳細') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 消費税マスタ - 詳細

+
+ +
+
+
+ +
+
+
+ @include('admin.tax._form', [ + 'tax' => $tax, + 'isEdit' => false, + 'isInfo' => true + ]) +
+
+
+@endsection diff --git a/resources/views/admin/tax/list.blade.php b/resources/views/admin/tax/list.blade.php new file mode 100644 index 0000000..1b463b4 --- /dev/null +++ b/resources/views/admin/tax/list.blade.php @@ -0,0 +1,155 @@ +@extends('layouts.app') +@section('title', '消費税マスタ') + +@section('content') + +
+
+
+
+

消費税マスタ

+
+
+ +
+
+
+
+ + +
+
+ {{-- 一覧のソート用(既存規約踏襲) --}} +
+ @csrf + + +
+ +
+ + + {{ $taxes->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }} +
+ +
+ @if(session('success')) +
{{ session('success') }}
+ @elseif(session('error')) +
{{ session('error') }}
+ @endif +
+ +
+ +
+
+ @csrf + + + + + + + + @foreach($taxes as $tax) + + + + @endforeach + +
+ +
+ 編集 +
+
+
+
+ + +
+
+ + + + + + + + + + @foreach($taxes as $tax) + + + + + + @endforeach + +
+ 消費税ID + + 消費税率 + + 適用日 +
{{ $tax->tax_id }} + @php + + $val = is_numeric($tax->tax_percent) + ? number_format((float)$tax->tax_percent, 2, '.', '') + : (string)$tax->tax_percent; + @endphp + {{ $val }}% + {{ optional($tax->tax_day)->format('Y-m-d') }}
+
+
+
+
+
+ +
+ +{{-- 一括削除 & ソートのJS(既存規約に合わせ最小限) --}} +@push('scripts') + +@endpush +@endsection diff --git a/resources/views/admin/terms/_form.blade.php b/resources/views/admin/terms/_form.blade.php new file mode 100644 index 0000000..efed430 --- /dev/null +++ b/resources/views/admin/terms/_form.blade.php @@ -0,0 +1,112 @@ +@if(Session::has('success')) +
{{ Session::get('success') }}
+@elseif(Session::has('error')) +
{{ Session::get('error') }}
+@endif + +
+ + {{-- 登録・削除 ボタン --}} +
+ @if($isInfo) + 編集 + @else + + @if($isEdit) + 削除 + @endif + @endif +
+ +
+ {{-- 利用契約ID --}} + @if($isEdit || $isInfo) +
+ +
+ +
+
+ @endif + + {{-- 市区ID --}} +
+ +
+ +
+
+ + {{-- 使用中 --}} +
+ +
+
+ use_flag ?? '') == 1) checked @endif @if($isInfo) disabled @endif> + +
+
+ use_flag ?? '') == 0) checked @endif @if($isInfo) disabled @endif> + +
+
+
+ + {{-- リビジョン --}} +
+ +
+ +
+
+ + {{-- 契約内容 --}} +
+ +
+ +
+
+ + {{-- 備考 --}} +
+ +
+ +
+
+ + {{-- 使用開始日 --}} +
+ +
+ +
+
+ + {{-- 登録・削除 ボタン --}} +
+ @if($isInfo) + 編集 + @else + + @if($isEdit) + 削除 + @endif + @endif +
+ +
\ No newline at end of file diff --git a/resources/views/admin/terms/add.blade.php b/resources/views/admin/terms/add.blade.php new file mode 100644 index 0000000..982dd7b --- /dev/null +++ b/resources/views/admin/terms/add.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.app') +@section('title', '新規') + +@section('content') +
+
+
+
+

新規

+
+
+ +
+
+
+
+ +
+
+
+ @csrf + @include('admin.terms._form', [ + 'term' => null, + 'cities' => $cities, + 'isEdit' => false, + 'isInfo' => false + ]) +
+
+
+@endsection diff --git a/resources/views/admin/terms/edit.blade.php b/resources/views/admin/terms/edit.blade.php new file mode 100644 index 0000000..7024395 --- /dev/null +++ b/resources/views/admin/terms/edit.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.app') +@section('title', '利用契約 編集') + +@section('content') +
+
+
+
+

利用契約 編集

+
+
+ +
+
+
+
+ +
+
+
+ @csrf + @include('admin.terms._form', [ + 'term' => $term, + 'cities' => $cities, + 'isEdit' => true, + 'isInfo' => false + ]) +
+
+
+@endsection diff --git a/resources/views/admin/terms/info.blade.php b/resources/views/admin/terms/info.blade.php new file mode 100644 index 0000000..7c8d482 --- /dev/null +++ b/resources/views/admin/terms/info.blade.php @@ -0,0 +1,36 @@ +@extends('layouts.app') +@section('title', '[東京都|〇〇駐輪場] 利用契約マスタ - 詳細') + +@section('content') + +
+
+
+
+

[東京都|〇〇駐輪場] 利用契約マスタ - 詳細

+
+ +
+
+
+ +
+
+
+ @include('admin.terms._form', [ + 'term' => $term, + 'cities' => $cities, + 'isEdit' => false, + 'isInfo' => true + ]) +
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/admin/terms/list.blade.php b/resources/views/admin/terms/list.blade.php new file mode 100644 index 0000000..57de62a --- /dev/null +++ b/resources/views/admin/terms/list.blade.php @@ -0,0 +1,117 @@ +@extends('layouts.app') +@section('title', '利用契約マスタ') + +@section('content') + +
+
+
+
+

利用契約マスタ

+
+
+ +
+
+
+
+ + +
+
+
+ @csrf + + +
+ +
+ + + + {{ $terms->appends(['sort' => $sort ?? '', 'sort_type' => $sort_type ?? ''])->links('pagination') }} +
+ +
+ @if(session('success')) +
{{ session('success') }}
+ @elseif(session('error')) +
{{ session('error') }}
+ @endif +
+ +
+ +
+
+ @csrf + + + + + + + + @foreach($terms as $term) + + + + @endforeach + +
+ +
+ 編集 +
+
+
+
+ + +
+
+ + + + + + + + + + + + + + + @foreach($terms as $term) + + + + + + + + + + @endforeach + +
+ 利用契約ID + + 市区ID + 使用中リビジョン契約内容備考 + 使用開始日 +
{{ $term->terms_id }}{{ $term->city_id }}{{ $term->use_flag ? '○' : '' }}{{ $term->terms_revision }}{{ $term->terms_text }}{{ $term->memo }}{{ \Carbon\Carbon::parse($term->start_date)->format('Y-m-d') }}
+
+
+
+
+
+ +
+@endsection \ No newline at end of file diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index 34b2ea7..525d002 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -408,12 +408,13 @@ {{--

{{__('利用者分類マスタ')}}

--}} {{----}} {{----}} - {{----}} + + {{----}} - {{----}} + {{----}} + + + + + + + + +