From 22e278b5ad6699a9d7598bbe55733bf162c0700b Mon Sep 17 00:00:00 2001 From: "kin.rinzen" Date: Thu, 21 Aug 2025 19:46:22 +0900 Subject: [PATCH 01/11] =?UTF-8?q?=E5=AE=9A=E6=9C=9F=E7=A8=AE=E5=88=A5?= =?UTF-8?q?=E3=83=9E=E3=82=B9=E3=82=BF=E3=81=AE=E3=83=AB=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=81=A8=E3=82=B3=E3=83=B3=E3=83=88=E3=83=AD=E3=83=BC=E3=83=A9?= =?UTF-8?q?=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=80=81=E9=96=A2?= =?UTF-8?q?=E9=80=A3=E3=81=99=E3=82=8B=E3=83=93=E3=83=A5=E3=83=BC=E3=82=92?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/RegularTypeController.php | 172 ++++++++++++++++++ app/Models/RegularType.php | 77 ++++++++ resources/views/layouts/app.blade.php | 12 +- routes/web.php | 151 +++++++++++++++ 4 files changed, 406 insertions(+), 6 deletions(-) create mode 100644 app/Http/Controllers/Admin/RegularTypeController.php create mode 100644 app/Models/RegularType.php 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/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/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index f2b0e84..426c250 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -486,12 +486,12 @@ {{--

{{__("オペレータキュー")}}

--}} {{----}} {{----}} - {{----}} + {{----}} - {{----}} + + {{----}} + + + + + + + + + From 2a25c45bf03956f4025335b6e8077d7886d45514 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 22 Aug 2025 23:50:52 +0900 Subject: [PATCH 07/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.env b/.env index b01098b..e4130e3 100644 --- a/.env +++ b/.env @@ -2,8 +2,7 @@ APP_NAME=so-manager APP_ENV=local APP_KEY=base64:ejLwJbt2bEXY9emPUmsurG+X1hzkjTxQQvq2/FO14RY= APP_DEBUG=true -APP_URL=https://main-kin.so-manager-dev.com/ - +APP_URL=https://main-sou.so-manager-dev.com/ APP_LOCALE=ja APP_FALLBACK_LOCALE=ja APP_FAKER_LOCALE=ja_JP From f4a29e23d1171b06d707afb7942786bb731fea80 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 22 Aug 2025 23:51:10 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E5=88=A0=E9=99=A4=20.gitea/workflows/dep?= =?UTF-8?q?loy-preview.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/deploy-preview.yml | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 .gitea/workflows/deploy-preview.yml diff --git a/.gitea/workflows/deploy-preview.yml b/.gitea/workflows/deploy-preview.yml deleted file mode 100644 index 6af5828..0000000 --- a/.gitea/workflows/deploy-preview.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Deploy preview (main_kin) - -on: - push: - branches: ["main_kin"] - workflow_dispatch: - -concurrency: - group: deploy-main_kin - cancel-in-progress: true - -jobs: - deploy: - runs-on: ["native"] - steps: - - uses: actions/checkout@v4 - - name: Deploy to preview (main_kin) - env: - BRANCH: main_kin - run: /usr/local/bin/deploy_branch_simple.sh \ No newline at end of file From 9dce4d23f6c394995f1f14ce39d34ebecd075b60 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 22 Aug 2025 23:52:30 +0900 Subject: [PATCH 09/11] revert f4a29e23d1171b06d707afb7942786bb731fea80 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit revert 删除 .gitea/workflows/deploy-preview.yml --- .gitea/workflows/deploy-preview.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .gitea/workflows/deploy-preview.yml diff --git a/.gitea/workflows/deploy-preview.yml b/.gitea/workflows/deploy-preview.yml new file mode 100644 index 0000000..6af5828 --- /dev/null +++ b/.gitea/workflows/deploy-preview.yml @@ -0,0 +1,20 @@ +name: Deploy preview (main_kin) + +on: + push: + branches: ["main_kin"] + workflow_dispatch: + +concurrency: + group: deploy-main_kin + cancel-in-progress: true + +jobs: + deploy: + runs-on: ["native"] + steps: + - uses: actions/checkout@v4 + - name: Deploy to preview (main_kin) + env: + BRANCH: main_kin + run: /usr/local/bin/deploy_branch_simple.sh \ No newline at end of file From 851a8e51a01e7023de71e73e116d7b3a392f9eb3 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 22 Aug 2025 23:55:59 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20.gitignore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cbb9b9e..7fa5c91 100644 --- a/.gitignore +++ b/.gitignore @@ -21,5 +21,6 @@ yarn-error.log /.nova /.vscode /.zed +/docs # Backup files -*.bak +*.bak \ No newline at end of file From c80f964a8525ce6f3c80a37bee41fada8167e178 Mon Sep 17 00:00:00 2001 From: gitadmin Date: Fri, 22 Aug 2025 23:56:26 +0900 Subject: [PATCH 11/11] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20public/index.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.php | 1 - 1 file changed, 1 deletion(-) diff --git a/public/index.php b/public/index.php index f1f1c82..249163f 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,5 @@