From 984ddb403e47cc69d72ecc826b11e6dd9f0bbec2 Mon Sep 17 00:00:00 2001 From: taekyoungc Date: Wed, 8 Apr 2026 00:19:00 +0900 Subject: [PATCH] feat: improve admin master data management --- app/Controllers/Admin/CodeDetail.php | 73 +++++++++++- app/Controllers/Admin/CodeKind.php | 16 +-- app/Controllers/Admin/Company.php | 40 +++---- app/Controllers/Admin/DesignatedShop.php | 95 +++++++--------- app/Controllers/Admin/FreeRecipient.php | 57 +++++----- app/Controllers/Admin/Manager.php | 57 +++++----- app/Controllers/Admin/SalesAgency.php | 114 +++++++++++-------- app/Controllers/Admin/User.php | 6 +- app/Models/CodeDetailModel.php | 52 ++++++++- app/Models/SalesAgencyModel.php | 33 +++++- app/Views/admin/code_detail/create.php | 33 ++++++ app/Views/admin/company/create.php | 4 +- app/Views/admin/company/edit.php | 4 +- app/Views/admin/company/index.php | 6 +- app/Views/admin/designated_shop/create.php | 4 +- app/Views/admin/designated_shop/edit.php | 4 +- app/Views/admin/designated_shop/index.php | 12 +- app/Views/admin/designated_shop/map.php | 2 +- app/Views/admin/designated_shop/status.php | 2 +- app/Views/admin/free_recipient/create.php | 4 +- app/Views/admin/free_recipient/edit.php | 4 +- app/Views/admin/free_recipient/index.php | 13 ++- app/Views/admin/manager/create.php | 4 +- app/Views/admin/manager/edit.php | 4 +- app/Views/admin/manager/index.php | 6 +- app/Views/admin/menu/index.php | 39 ++++++- app/Views/admin/sales_agency/create.php | 26 ++--- app/Views/admin/sales_agency/edit.php | 34 ++---- app/Views/admin/sales_agency/index.php | 24 ++-- app/Views/auth/register.php | 13 +-- writable/database/code_master_init_daegu.sql | 6 +- writable/database/company_tables.sql | 2 + writable/database/manager_tables.sql | 3 + writable/database/menu_tables.sql | 2 +- writable/database/sales_agency_tables.sql | 12 +- 35 files changed, 490 insertions(+), 320 deletions(-) diff --git a/app/Controllers/Admin/CodeDetail.php b/app/Controllers/Admin/CodeDetail.php index 919c5d0..d0ec40a 100644 --- a/app/Controllers/Admin/CodeDetail.php +++ b/app/Controllers/Admin/CodeDetail.php @@ -7,6 +7,7 @@ namespace App\Controllers\Admin; use App\Controllers\BaseController; use App\Models\CodeKindModel; use App\Models\CodeDetailModel; +use App\Models\LocalGovernmentModel; use CodeIgniter\HTTP\RedirectResponse; use Config\Roles; @@ -47,9 +48,22 @@ class CodeDetail extends BaseController return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.'); } + $level = (int) session()->get('mb_level'); + $canPlatformScope = Roles::isSuperAdminEquivalent($level); + $govs = $canPlatformScope + ? model(LocalGovernmentModel::class)->where('lg_state', 1)->orderBy('lg_name', 'ASC')->findAll() + : []; + + helper('admin'); + return view('admin/layout', [ 'title' => '세부코드 등록 — ' . $kind->ck_name, - 'content' => view('admin/code_detail/create', ['kind' => $kind]), + 'content' => view('admin/code_detail/create', [ + 'kind' => $kind, + 'canPlatformScope' => $canPlatformScope, + 'localGovernments' => $govs, + 'effectiveLgIdx' => admin_effective_lg_idx(), + ]), ]); } @@ -71,10 +85,50 @@ class CodeDetail extends BaseController } $ckIdx = (int) $this->request->getPost('cd_ck_idx'); + $kind = $this->kindModel->find($ckIdx); + if ($kind === null) { + return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류를 찾을 수 없습니다.'); + } + + helper('admin'); + $level = (int) session()->get('mb_level'); + + if (Roles::isSuperAdminEquivalent($level)) { + $scope = $this->request->getPost('cd_scope') === 'local' ? 'local' : 'platform'; + if ($scope === 'platform') { + $cdSource = 'platform'; + $cdLgIdx = 0; + } else { + $cdLgIdx = (int) $this->request->getPost('cd_lg_idx'); + if ($cdLgIdx < 1) { + return redirect()->back()->withInput()->with('error', '지자체 전용인 경우 소속 지자체를 선택해 주세요.'); + } + $gov = model(LocalGovernmentModel::class)->find($cdLgIdx); + if ($gov === null) { + return redirect()->back()->withInput()->with('error', '유효하지 않은 지자체입니다.'); + } + $cdSource = 'local'; + } + } else { + $lg = admin_effective_lg_idx(); + if ($lg === null || (int) $lg < 1) { + return redirect()->to(site_url('bag/code-kinds'))->with('error', '지자체를 선택한 뒤 등록해 주세요.'); + } + $cdSource = 'local'; + $cdLgIdx = (int) $lg; + } + + $cdCode = (string) $this->request->getPost('cd_code'); + $dup = $this->detailModel->where('cd_ck_idx', $ckIdx)->where('cd_code', $cdCode)->where('cd_lg_idx', $cdLgIdx)->first(); + if ($dup !== null) { + return redirect()->back()->withInput()->with('error', '같은 종류·코드값·소속 범위에 이미 등록된 행이 있습니다.'); + } $this->detailModel->insert([ 'cd_ck_idx' => $ckIdx, - 'cd_code' => $this->request->getPost('cd_code'), + 'cd_source' => $cdSource, + 'cd_lg_idx' => $cdLgIdx, + 'cd_code' => $cdCode, 'cd_name' => $this->request->getPost('cd_name'), 'cd_sort' => (int) ($this->request->getPost('cd_sort') ?: 0), 'cd_state' => 1, @@ -95,6 +149,11 @@ class CodeDetail extends BaseController return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.'); } + helper('admin'); + if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) { + return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 수정할 권한이 없습니다.'); + } + $kind = $this->kindModel->find($item->cd_ck_idx); return view('admin/layout', [ @@ -117,6 +176,11 @@ class CodeDetail extends BaseController return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.'); } + helper('admin'); + if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) { + return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 수정할 권한이 없습니다.'); + } + $rules = [ 'cd_name' => 'required|max_length[100]', 'cd_sort' => 'permit_empty|is_natural', @@ -147,6 +211,11 @@ class CodeDetail extends BaseController return redirect()->to(site_url('bag/code-kinds'))->with('error', '세부코드를 찾을 수 없습니다.'); } + helper('admin'); + if (! Roles::canEditCodeDetailRow((int) session()->get('mb_level'), $item, admin_effective_lg_idx())) { + return redirect()->to(site_url('bag/code-details/' . $item->cd_ck_idx))->with('error', '이 세부코드를 삭제할 권한이 없습니다.'); + } + $ckIdx = $item->cd_ck_idx; $this->detailModel->delete($id); diff --git a/app/Controllers/Admin/CodeKind.php b/app/Controllers/Admin/CodeKind.php index 5a128a8..d3577a2 100644 --- a/app/Controllers/Admin/CodeKind.php +++ b/app/Controllers/Admin/CodeKind.php @@ -19,10 +19,10 @@ class CodeKind extends BaseController $this->kindModel = model(CodeKindModel::class); } - private function redirectIfCannotManageCodeMaster(): ?RedirectResponse + private function redirectIfCannotManageCodeKindMaster(): ?RedirectResponse { - if (! Roles::canManageCodeMaster((int) session()->get('mb_level'))) { - return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 관리 권한이 없습니다.'); + if (! Roles::canManageCodeKindMaster((int) session()->get('mb_level'))) { + return redirect()->to(site_url('bag/code-kinds'))->with('error', '코드 종류는 super admin·본부 관리자만 관리할 수 있습니다.'); } return null; @@ -30,7 +30,7 @@ class CodeKind extends BaseController public function create() { - if ($r = $this->redirectIfCannotManageCodeMaster()) { + if ($r = $this->redirectIfCannotManageCodeKindMaster()) { return $r; } @@ -42,7 +42,7 @@ class CodeKind extends BaseController public function store() { - if ($r = $this->redirectIfCannotManageCodeMaster()) { + if ($r = $this->redirectIfCannotManageCodeKindMaster()) { return $r; } @@ -67,7 +67,7 @@ class CodeKind extends BaseController public function edit(int $id) { - if ($r = $this->redirectIfCannotManageCodeMaster()) { + if ($r = $this->redirectIfCannotManageCodeKindMaster()) { return $r; } @@ -84,7 +84,7 @@ class CodeKind extends BaseController public function update(int $id) { - if ($r = $this->redirectIfCannotManageCodeMaster()) { + if ($r = $this->redirectIfCannotManageCodeKindMaster()) { return $r; } @@ -112,7 +112,7 @@ class CodeKind extends BaseController public function delete(int $id) { - if ($r = $this->redirectIfCannotManageCodeMaster()) { + if ($r = $this->redirectIfCannotManageCodeKindMaster()) { return $r; } diff --git a/app/Controllers/Admin/Company.php b/app/Controllers/Admin/Company.php index 36d22ee..8492574 100644 --- a/app/Controllers/Admin/Company.php +++ b/app/Controllers/Admin/Company.php @@ -18,25 +18,19 @@ class Company extends BaseController { helper('admin'); $lgIdx = admin_effective_lg_idx(); - if (!$lgIdx) { - return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + if (! $lgIdx) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } - $list = $this->model->where('cp_lg_idx', $lgIdx)->orderBy('cp_idx', 'DESC')->paginate(20); + $list = $this->model->where('cp_lg_idx', $lgIdx)->orderBy('cp_idx', 'DESC')->paginate(20); $pager = $this->model->pager; - return view('admin/layout', [ - 'title' => '업체 관리', - 'content' => view('admin/company/index', ['list' => $list, 'pager' => $pager]), - ]); + return $this->renderWorkPage('업체 관리', 'admin/company/index', ['list' => $list, 'pager' => $pager]); } public function create() { - return view('admin/layout', [ - 'title' => '업체 등록', - 'content' => view('admin/company/create'), - ]); + return $this->renderWorkPage('업체 등록', 'admin/company/create'); } public function store() @@ -66,29 +60,26 @@ class Company extends BaseController 'cp_regdate' => date('Y-m-d H:i:s'), ]); - return redirect()->to(site_url('admin/companies'))->with('success', '업체가 등록되었습니다.'); + return redirect()->to(mgmt_url('companies'))->with('success', '업체가 등록되었습니다.'); } public function edit(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.'); + if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.'); } - return view('admin/layout', [ - 'title' => '업체 수정', - 'content' => view('admin/company/edit', ['item' => $item]), - ]); + return $this->renderWorkPage('업체 수정', 'admin/company/edit', ['item' => $item]); } public function update(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.'); + if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.'); } $rules = [ @@ -110,18 +101,19 @@ class Company extends BaseController 'cp_state' => (int) $this->request->getPost('cp_state'), ]); - return redirect()->to(site_url('admin/companies'))->with('success', '업체가 수정되었습니다.'); + return redirect()->to(mgmt_url('companies'))->with('success', '업체가 수정되었습니다.'); } public function delete(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/companies'))->with('error', '업체를 찾을 수 없습니다.'); + if (! $item || (int) $item->cp_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('companies'))->with('error', '업체를 찾을 수 없습니다.'); } $this->model->delete($id); - return redirect()->to(site_url('admin/companies'))->with('success', '업체가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('companies'))->with('success', '업체가 삭제되었습니다.'); } } diff --git a/app/Controllers/Admin/DesignatedShop.php b/app/Controllers/Admin/DesignatedShop.php index 32c3649..d29d8ba 100644 --- a/app/Controllers/Admin/DesignatedShop.php +++ b/app/Controllers/Admin/DesignatedShop.php @@ -39,7 +39,7 @@ class DesignatedShop extends BaseController $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin')) + return redirect()->to(work_area_home_url()) ->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.'); } @@ -73,17 +73,14 @@ class DesignatedShop extends BaseController $db = \Config\Database::connect(); $gugunCodes = $db->query("SELECT DISTINCT ds_gugun_code FROM designated_shop WHERE ds_lg_idx = ? AND ds_gugun_code != '' ORDER BY ds_gugun_code", [$lgIdx])->getResult(); - return view('admin/layout', [ - 'title' => '지정판매소 관리', - 'content' => view('admin/designated_shop/index', [ - 'list' => $list, - 'lgMap' => $lgMap, - 'pager' => $pager, - 'dsName' => $dsName ?? '', - 'dsGugunCode' => $dsGugunCode ?? '', - 'dsState' => $dsState ?? '', - 'gugunCodes' => $gugunCodes, - ]), + return $this->renderWorkPage('지정판매소 관리', 'admin/designated_shop/index', [ + 'list' => $list, + 'lgMap' => $lgMap, + 'pager' => $pager, + 'dsName' => $dsName ?? '', + 'dsGugunCode' => $dsGugunCode ?? '', + 'dsState' => $dsState ?? '', + 'gugunCodes' => $gugunCodes, ]); } @@ -92,7 +89,7 @@ class DesignatedShop extends BaseController helper(['admin', 'export']); $lgIdx = admin_effective_lg_idx(); if (!$lgIdx) { - return redirect()->to(site_url('admin/designated-shops'))->with('error', '지자체를 선택해 주세요.'); + return redirect()->to(mgmt_url('designated-shops'))->with('error', '지자체를 선택해 주세요.'); } $list = $this->shopModel->where('ds_lg_idx', $lgIdx)->orderBy('ds_idx', 'DESC')->findAll(); @@ -129,22 +126,19 @@ class DesignatedShop extends BaseController helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '작업할 지자체가 선택되지 않았습니다. 지자체를 선택해 주세요.'); } $currentLg = $this->lgModel->find($lgIdx); if ($currentLg === null) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '선택한 지자체 정보를 찾을 수 없습니다.'); } - return view('admin/layout', [ - 'title' => '지정판매소 등록', - 'content' => view('admin/designated_shop/create', [ - 'localGovs' => [], - 'currentLg' => $currentLg, - ]), + return $this->renderWorkPage('지정판매소 등록', 'admin/designated_shop/create', [ + 'localGovs' => [], + 'currentLg' => $currentLg, ]); } @@ -154,7 +148,7 @@ class DesignatedShop extends BaseController public function store() { if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '지정판매소 등록은 관리자만 가능합니다.'); } @@ -211,7 +205,7 @@ class DesignatedShop extends BaseController $this->shopModel->insert($data); - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('success', '지정판매소가 등록되었습니다.'); } @@ -222,31 +216,28 @@ class DesignatedShop extends BaseController public function edit(int $id) { if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '권한이 없습니다.'); } helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '작업할 지자체가 선택되지 않았습니다.'); } $shop = $this->shopModel->find($id); if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.'); } $currentLg = $this->lgModel->find($lgIdx); - return view('admin/layout', [ - 'title' => '지정판매소 수정', - 'content' => view('admin/designated_shop/edit', [ - 'shop' => $shop, - 'currentLg' => $currentLg, - ]), + return $this->renderWorkPage('지정판매소 수정', 'admin/designated_shop/edit', [ + 'shop' => $shop, + 'currentLg' => $currentLg, ]); } @@ -256,20 +247,20 @@ class DesignatedShop extends BaseController public function update(int $id) { if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '권한이 없습니다.'); } helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '작업할 지자체가 선택되지 않았습니다.'); } $shop = $this->shopModel->find($id); if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '해당 지정판매소를 찾을 수 없거나 수정할 수 없습니다.'); } @@ -305,7 +296,7 @@ class DesignatedShop extends BaseController $this->shopModel->update($id, $data); - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('success', '지정판매소 정보가 수정되었습니다.'); } @@ -316,26 +307,26 @@ class DesignatedShop extends BaseController public function delete(int $id) { if (! $this->isSuperAdmin() && ! $this->isLocalAdmin()) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '권한이 없습니다.'); } helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '작업할 지자체가 선택되지 않았습니다.'); } $shop = $this->shopModel->find($id); if ($shop === null || (int) $shop->ds_lg_idx !== $lgIdx) { - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('error', '해당 지정판매소를 찾을 수 없거나 삭제할 수 없습니다.'); } $this->shopModel->delete($id); - return redirect()->to(site_url('admin/designated-shops')) + return redirect()->to(mgmt_url('designated-shops')) ->with('success', '지정판매소가 삭제되었습니다.'); } @@ -347,7 +338,7 @@ class DesignatedShop extends BaseController helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin')) + return redirect()->to(work_area_home_url()) ->with('error', '작업할 지자체가 선택되지 않았습니다.'); } @@ -356,11 +347,8 @@ class DesignatedShop extends BaseController ->where('ds_state', 1) ->findAll(); - return view('admin/layout', [ - 'title' => '지정판매소 지도', - 'content' => view('admin/designated_shop/map', [ - 'shops' => $shops, - ]), + return $this->renderWorkPage('지정판매소 지도', 'admin/designated_shop/map', [ + 'shops' => $shops, ]); } @@ -372,7 +360,7 @@ class DesignatedShop extends BaseController helper('admin'); $lgIdx = admin_effective_lg_idx(); if ($lgIdx === null || $lgIdx <= 0) { - return redirect()->to(site_url('admin')) + return redirect()->to(work_area_home_url()) ->with('error', '작업할 지자체가 선택되지 않았습니다.'); } @@ -400,14 +388,11 @@ class DesignatedShop extends BaseController $totalActive = $this->shopModel->where('ds_lg_idx', $lgIdx)->where('ds_state', 1)->countAllResults(false); $totalInactive = $this->shopModel->where('ds_lg_idx', $lgIdx)->where('ds_state !=', 1)->countAllResults(false); - return view('admin/layout', [ - 'title' => '지정판매소 현황', - 'content' => view('admin/designated_shop/status', [ - 'newByYear' => $newByYear, - 'cancelByYear' => $cancelByYear, - 'totalActive' => $totalActive, - 'totalInactive' => $totalInactive, - ]), + return $this->renderWorkPage('지정판매소 현황', 'admin/designated_shop/status', [ + 'newByYear' => $newByYear, + 'cancelByYear' => $cancelByYear, + 'totalActive' => $totalActive, + 'totalInactive' => $totalInactive, ]); } diff --git a/app/Controllers/Admin/FreeRecipient.php b/app/Controllers/Admin/FreeRecipient.php index 79448ce..dd8da1b 100644 --- a/app/Controllers/Admin/FreeRecipient.php +++ b/app/Controllers/Admin/FreeRecipient.php @@ -18,35 +18,32 @@ class FreeRecipient extends BaseController private function getCodeOptions(string $ckCode): array { - $kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first(); - return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : []; + helper('admin'); + $lgIdx = admin_effective_lg_idx(); + $kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first(); + + return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : []; } public function index() { helper('admin'); $lgIdx = admin_effective_lg_idx(); - if (!$lgIdx) { - return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + if (! $lgIdx) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } - $list = $this->model->where('fr_lg_idx', $lgIdx)->orderBy('fr_idx', 'DESC')->paginate(20); + $list = $this->model->where('fr_lg_idx', $lgIdx)->orderBy('fr_idx', 'DESC')->paginate(20); $pager = $this->model->pager; - return view('admin/layout', [ - 'title' => '무료용 대상자 관리', - 'content' => view('admin/free_recipient/index', ['list' => $list, 'pager' => $pager]), - ]); + return $this->renderWorkPage('무료용 대상자 관리', 'admin/free_recipient/index', ['list' => $list, 'pager' => $pager]); } public function create() { - return view('admin/layout', [ - 'title' => '무료용 대상자 등록', - 'content' => view('admin/free_recipient/create', [ - 'typeCodes' => $this->getCodeOptions('H'), - 'dongCodes' => $this->getCodeOptions('D'), - ]), + return $this->renderWorkPage('무료용 대상자 등록', 'admin/free_recipient/create', [ + 'typeCodes' => $this->getCodeOptions('H'), + 'dongCodes' => $this->getCodeOptions('D'), ]); } @@ -75,24 +72,21 @@ class FreeRecipient extends BaseController 'fr_regdate' => date('Y-m-d H:i:s'), ]); - return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 등록되었습니다.'); + return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 등록되었습니다.'); } public function edit(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); + if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); } - return view('admin/layout', [ - 'title' => '무료용 대상자 수정', - 'content' => view('admin/free_recipient/edit', [ - 'item' => $item, - 'typeCodes' => $this->getCodeOptions('H'), - 'dongCodes' => $this->getCodeOptions('D'), - ]), + return $this->renderWorkPage('무료용 대상자 수정', 'admin/free_recipient/edit', [ + 'item' => $item, + 'typeCodes' => $this->getCodeOptions('H'), + 'dongCodes' => $this->getCodeOptions('D'), ]); } @@ -100,8 +94,8 @@ class FreeRecipient extends BaseController { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); + if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); } $rules = [ @@ -123,18 +117,19 @@ class FreeRecipient extends BaseController 'fr_state' => (int) $this->request->getPost('fr_state'), ]); - return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 수정되었습니다.'); + return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 수정되었습니다.'); } public function delete(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); + if (! $item || (int) $item->fr_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('free-recipients'))->with('error', '대상자를 찾을 수 없습니다.'); } $this->model->delete($id); - return redirect()->to(site_url('admin/free-recipients'))->with('success', '무료용 대상자가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('free-recipients'))->with('success', '무료용 대상자가 삭제되었습니다.'); } } diff --git a/app/Controllers/Admin/Manager.php b/app/Controllers/Admin/Manager.php index c3bce32..4e2b7ab 100644 --- a/app/Controllers/Admin/Manager.php +++ b/app/Controllers/Admin/Manager.php @@ -18,8 +18,11 @@ class Manager extends BaseController private function getCodeOptions(string $ckCode): array { - $kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first(); - return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true) : []; + helper('admin'); + $lgIdx = admin_effective_lg_idx(); + $kind = model(CodeKindModel::class)->where('ck_code', $ckCode)->first(); + + return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : []; } public function index() @@ -27,32 +30,28 @@ class Manager extends BaseController helper('admin'); $lgIdx = admin_effective_lg_idx(); if (!$lgIdx) { - return redirect()->to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + helper('admin'); + + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } $list = $this->model->where('mg_lg_idx', $lgIdx)->orderBy('mg_idx', 'DESC')->paginate(20); $pager = $this->model->pager; - return view('admin/layout', [ - 'title' => '담당자 관리', - 'content' => view('admin/manager/index', ['list' => $list, 'pager' => $pager]), - ]); + return $this->renderWorkPage('담당자 관리', 'admin/manager/index', ['list' => $list, 'pager' => $pager]); } public function create() { - return view('admin/layout', [ - 'title' => '담당자 등록', - 'content' => view('admin/manager/create', [ - 'deptCodes' => $this->getCodeOptions('S'), - 'positionCodes' => $this->getCodeOptions('T'), - ]), + return $this->renderWorkPage('담당자 등록', 'admin/manager/create', [ + 'deptCodes' => $this->getCodeOptions('S'), + 'positionCodes' => $this->getCodeOptions('T'), ]); } public function store() { - helper('admin'); + helper(['admin', 'url']); $rules = [ 'mg_name' => 'required|max_length[50]', 'mg_tel' => 'permit_empty|max_length[20]', @@ -75,33 +74,30 @@ class Manager extends BaseController 'mg_regdate' => date('Y-m-d H:i:s'), ]); - return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 등록되었습니다.'); + return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 등록되었습니다.'); } public function edit(int $id) { - helper('admin'); + helper(['admin', 'url']); $item = $this->model->find($id); if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.'); + return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.'); } - return view('admin/layout', [ - 'title' => '담당자 수정', - 'content' => view('admin/manager/edit', [ - 'item' => $item, - 'deptCodes' => $this->getCodeOptions('S'), - 'positionCodes' => $this->getCodeOptions('T'), - ]), + return $this->renderWorkPage('담당자 수정', 'admin/manager/edit', [ + 'item' => $item, + 'deptCodes' => $this->getCodeOptions('S'), + 'positionCodes' => $this->getCodeOptions('T'), ]); } public function update(int $id) { - helper('admin'); + helper(['admin', 'url']); $item = $this->model->find($id); if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.'); + return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.'); } $rules = [ @@ -122,18 +118,19 @@ class Manager extends BaseController 'mg_state' => (int) $this->request->getPost('mg_state'), ]); - return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 수정되었습니다.'); + return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 수정되었습니다.'); } public function delete(int $id) { - helper('admin'); + helper(['admin', 'url']); $item = $this->model->find($id); if (!$item || (int) $item->mg_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/managers'))->with('error', '담당자를 찾을 수 없습니다.'); + return redirect()->to(mgmt_url('managers'))->with('error', '담당자를 찾을 수 없습니다.'); } $this->model->delete($id); - return redirect()->to(site_url('admin/managers'))->with('success', '담당자가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('managers'))->with('success', '담당자가 삭제되었습니다.'); } } diff --git a/app/Controllers/Admin/SalesAgency.php b/app/Controllers/Admin/SalesAgency.php index 08befa7..ed75380 100644 --- a/app/Controllers/Admin/SalesAgency.php +++ b/app/Controllers/Admin/SalesAgency.php @@ -1,5 +1,7 @@ to(site_url('admin'))->with('error', '지자체를 선택해 주세요.'); + if (! $lgIdx) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } - $list = $this->model->where('sa_lg_idx', $lgIdx)->orderBy('sa_idx', 'DESC')->paginate(20); + $list = $this->model->where('sa_lg_idx', $lgIdx)->orderForDisplay()->paginate(20); $pager = $this->model->pager; - return view('admin/layout', [ - 'title' => '판매 대행소 관리', - 'content' => view('admin/sales_agency/index', ['list' => $list, 'pager' => $pager]), - ]); + return $this->renderWorkPage('판매 대행소 관리', 'admin/sales_agency/index', ['list' => $list, 'pager' => $pager]); } public function create() { - return view('admin/layout', [ - 'title' => '판매 대행소 등록', - 'content' => view('admin/sales_agency/create'), - ]); + helper('admin'); + if (! admin_effective_lg_idx()) { + return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); + } + + return $this->renderWorkPage('판매 대행소 등록', 'admin/sales_agency/create'); } public function store() { helper('admin'); + $lgIdx = admin_effective_lg_idx(); + if (! $lgIdx) { + return redirect()->to(mgmt_url('sales-agencies'))->with('error', '지자체를 선택해 주세요.'); + } + + if (! $this->model->hasKindCodeColumns()) { + return redirect()->back()->withInput()->with('error', self::SCHEMA_ERROR); + } + $rules = [ - 'sa_name' => 'required|max_length[100]', - 'sa_biz_no' => 'permit_empty|max_length[20]', - 'sa_rep_name' => 'permit_empty|max_length[50]', - 'sa_tel' => 'permit_empty|max_length[20]', - 'sa_addr' => 'permit_empty|max_length[255]', + 'sa_kind' => 'required|max_length[50]', + 'sa_code' => 'required|max_length[50]', + 'sa_name' => 'required|max_length[100]', ]; if (! $this->validate($rules)) { return redirect()->back()->withInput()->with('errors', $this->validator->getErrors()); } + $code = trim((string) $this->request->getPost('sa_code')); + if ($this->model->where('sa_lg_idx', $lgIdx)->where('sa_code', $code)->first() !== null) { + return redirect()->back()->withInput()->with('error', '동일 지자체에 같은 대행소 코드가 이미 있습니다.'); + } + $this->model->insert([ - 'sa_lg_idx' => admin_effective_lg_idx(), - 'sa_name' => $this->request->getPost('sa_name'), - 'sa_biz_no' => $this->request->getPost('sa_biz_no') ?? '', - 'sa_rep_name' => $this->request->getPost('sa_rep_name') ?? '', - 'sa_tel' => $this->request->getPost('sa_tel') ?? '', - 'sa_addr' => $this->request->getPost('sa_addr') ?? '', - 'sa_state' => 1, - 'sa_regdate' => date('Y-m-d H:i:s'), + 'sa_lg_idx' => $lgIdx, + 'sa_kind' => trim((string) $this->request->getPost('sa_kind')), + 'sa_code' => $code, + 'sa_name' => trim((string) $this->request->getPost('sa_name')), + 'sa_regdate' => date('Y-m-d H:i:s'), ]); - return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 등록되었습니다.'); + return redirect()->to(mgmt_url('sales-agencies'))->with('success', '판매 대행소가 등록되었습니다.'); } public function edit(int $id) { helper('admin'); $item = $this->model->find($id); - if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); + if (! $item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) { + return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); } - return view('admin/layout', [ - 'title' => '판매 대행소 수정', - 'content' => view('admin/sales_agency/edit', ['item' => $item]), - ]); + return $this->renderWorkPage('판매 대행소 수정', 'admin/sales_agency/edit', ['item' => $item]); } public function update(int $id) { helper('admin'); - $item = $this->model->find($id); - if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); + $lgIdx = admin_effective_lg_idx(); + $item = $this->model->find($id); + if (! $item || ! $lgIdx || (int) $item->sa_lg_idx !== $lgIdx) { + return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); + } + + if (! $this->model->hasKindCodeColumns()) { + return redirect()->back()->withInput()->with('error', self::SCHEMA_ERROR); } $rules = [ - 'sa_name' => 'required|max_length[100]', - 'sa_state' => 'required|in_list[0,1]', + 'sa_kind' => 'required|max_length[50]', + 'sa_code' => 'required|max_length[50]', + 'sa_name' => 'required|max_length[100]', ]; if (! $this->validate($rules)) { return redirect()->back()->withInput()->with('errors', $this->validator->getErrors()); } + $code = trim((string) $this->request->getPost('sa_code')); + $dup = $this->model->where('sa_lg_idx', $lgIdx)->where('sa_code', $code)->where('sa_idx !=', $id)->first(); + if ($dup !== null) { + return redirect()->back()->withInput()->with('error', '동일 지자체에 같은 대행소 코드가 이미 있습니다.'); + } + $this->model->update($id, [ - 'sa_name' => $this->request->getPost('sa_name'), - 'sa_biz_no' => $this->request->getPost('sa_biz_no') ?? '', - 'sa_rep_name' => $this->request->getPost('sa_rep_name') ?? '', - 'sa_tel' => $this->request->getPost('sa_tel') ?? '', - 'sa_addr' => $this->request->getPost('sa_addr') ?? '', - 'sa_state' => (int) $this->request->getPost('sa_state'), + 'sa_kind' => trim((string) $this->request->getPost('sa_kind')), + 'sa_code' => $code, + 'sa_name' => trim((string) $this->request->getPost('sa_name')), ]); - return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 수정되었습니다.'); + return redirect()->to(mgmt_url('sales-agencies'))->with('success', '판매 대행소가 수정되었습니다.'); } public function delete(int $id) { helper('admin'); - $item = $this->model->find($id); - if (!$item || (int) $item->sa_lg_idx !== admin_effective_lg_idx()) { - return redirect()->to(site_url('admin/sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); + $lgIdx = admin_effective_lg_idx(); + $item = $this->model->find($id); + if (! $item || ! $lgIdx || (int) $item->sa_lg_idx !== $lgIdx) { + return redirect()->to(mgmt_url('sales-agencies'))->with('error', '대행소를 찾을 수 없습니다.'); } $this->model->delete($id); - return redirect()->to(site_url('admin/sales-agencies'))->with('success', '판매 대행소가 삭제되었습니다.'); + + return redirect()->to(mgmt_url('sales-agencies'))->with('success', '삭제되었습니다.'); } } diff --git a/app/Controllers/Admin/User.php b/app/Controllers/Admin/User.php index 87db294..3e5e450 100644 --- a/app/Controllers/Admin/User.php +++ b/app/Controllers/Admin/User.php @@ -121,8 +121,10 @@ class User extends BaseController if (! $member) { return redirect()->to(site_url('admin/users'))->with('error', '회원을 찾을 수 없습니다.'); } - $member->mb_email = pii_decrypt($member->mb_email ?? ''); - $member->mb_phone = pii_decrypt($member->mb_phone ?? ''); + $email = pii_decrypt($member->mb_email ?? ''); + $phone = pii_decrypt($member->mb_phone ?? ''); + $member->mb_email = $email; + $member->mb_phone = $phone; return view('admin/layout', [ 'title' => '회원 수정', 'content' => view('admin/user/edit', [ diff --git a/app/Models/CodeDetailModel.php b/app/Models/CodeDetailModel.php index 268069c..76ebe11 100644 --- a/app/Models/CodeDetailModel.php +++ b/app/Models/CodeDetailModel.php @@ -1,5 +1,7 @@ where('cd_ck_idx', $ckIdx); - if ($activeOnly) { - $builder->where('cd_state', 1); + if ($effectiveLgIdx === null || $effectiveLgIdx < 1) { + return $this->where('cd_lg_idx', 0); } - return $builder->orderBy('cd_sort', 'ASC')->findAll(); + + return $this->groupStart() + ->where('cd_lg_idx', 0) + ->orWhere('cd_lg_idx', $effectiveLgIdx) + ->groupEnd(); + } + + /** + * 특정 코드 종류의 세부코드 목록 + * + * @param int|null $effectiveLgIdx 테넌트 범위 (null=플랫폼만) + */ + public function getByKind(int $ckIdx, bool $activeOnly = false, ?int $effectiveLgIdx = null): array + { + $this->where('cd_ck_idx', $ckIdx); + $this->filterByTenantScope($effectiveLgIdx); + if ($activeOnly) { + $this->where('cd_state', 1); + } + + return $this->orderBy('cd_sort', 'ASC')->orderBy('cd_idx', 'ASC')->findAll(); + } + + /** + * 동일 세부코드값: 지자체 전용이 있으면 우선, 없으면 플랫폼 + */ + public function findResolvedByKindAndCode(int $ckIdx, string $code, ?int $effectiveLgIdx): ?object + { + if ($effectiveLgIdx !== null && $effectiveLgIdx > 0) { + $local = $this->where('cd_ck_idx', $ckIdx)->where('cd_code', $code)->where('cd_lg_idx', $effectiveLgIdx)->first(); + if ($local !== null) { + return $local; + } + } + + return $this->where('cd_ck_idx', $ckIdx)->where('cd_code', $code)->where('cd_lg_idx', 0)->first(); } } diff --git a/app/Models/SalesAgencyModel.php b/app/Models/SalesAgencyModel.php index 8707266..2c9b54b 100644 --- a/app/Models/SalesAgencyModel.php +++ b/app/Models/SalesAgencyModel.php @@ -1,5 +1,7 @@ getFieldNames($this->table); + $cache = in_array('sa_kind', $cols, true) && in_array('sa_code', $cols, true); + } + + return $cache; + } + + /** + * 신규 스키마면 구분·코드 순, 아니면 명·PK 순(옛 DB 호환). + * + * @return $this + */ + public function orderForDisplay() + { + return $this->hasKindCodeColumns() + ? $this->orderBy('sa_kind', 'ASC')->orderBy('sa_code', 'ASC') + : $this->orderBy('sa_name', 'ASC')->orderBy('sa_idx', 'ASC'); + } } diff --git a/app/Views/admin/code_detail/create.php b/app/Views/admin/code_detail/create.php index 20b035c..5f653fb 100644 --- a/app/Views/admin/code_detail/create.php +++ b/app/Views/admin/code_detail/create.php @@ -30,6 +30,39 @@ + +
+

등록 범위

+ + +
+ + +
+
+ + +
취소 diff --git a/app/Views/admin/company/create.php b/app/Views/admin/company/create.php index 7f9da1d..eabab8a 100644 --- a/app/Views/admin/company/create.php +++ b/app/Views/admin/company/create.php @@ -2,7 +2,7 @@ 업체 등록
-
+
@@ -42,7 +42,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/company/edit.php b/app/Views/admin/company/edit.php index 94f2e7e..2b1cbe3 100644 --- a/app/Views/admin/company/edit.php +++ b/app/Views/admin/company/edit.php @@ -2,7 +2,7 @@ 업체 수정
-
+
@@ -50,7 +50,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/company/index.php b/app/Views/admin/company/index.php index 3c3b1b3..8a78e7c 100644 --- a/app/Views/admin/company/index.php +++ b/app/Views/admin/company/index.php @@ -4,7 +4,7 @@ 업체 관리
@@ -35,8 +35,8 @@ cp_addr) ?> cp_state === 1 ? '사용' : '미사용' ?> - 수정 -
+ 수정 +
diff --git a/app/Views/admin/designated_shop/create.php b/app/Views/admin/designated_shop/create.php index 4687f24..1dcd33d 100644 --- a/app/Views/admin/designated_shop/create.php +++ b/app/Views/admin/designated_shop/create.php @@ -2,7 +2,7 @@ 지정판매소 등록
-
+ @@ -95,7 +95,7 @@
- 목록 + 목록
diff --git a/app/Views/admin/designated_shop/edit.php b/app/Views/admin/designated_shop/edit.php index 46aac31..b93a954 100644 --- a/app/Views/admin/designated_shop/edit.php +++ b/app/Views/admin/designated_shop/edit.php @@ -10,7 +10,7 @@ $v = fn ($key, $default = '') => old($key) !== null && old($key) !== '' ? old($k 지정판매소 수정
-
+ @@ -99,7 +99,7 @@ $v = fn ($key, $default = '') => old($key) !== null && old($key) !== '' ? old($k
- 목록 + 목록
diff --git a/app/Views/admin/designated_shop/index.php b/app/Views/admin/designated_shop/index.php index ca5e08f..1bb609f 100644 --- a/app/Views/admin/designated_shop/index.php +++ b/app/Views/admin/designated_shop/index.php @@ -3,15 +3,15 @@
-
+ @@ -29,7 +29,7 @@ - 초기화 + 초기화
@@ -61,8 +61,8 @@ ds_state === 1 ? '정상' : ((int) $row->ds_state === 2 ? '폐업' : '직권해지') ?> ds_regdate ?? '') ?> - 수정 -
+ 수정 +
diff --git a/app/Views/admin/designated_shop/map.php b/app/Views/admin/designated_shop/map.php index 50906da..8dcea39 100644 --- a/app/Views/admin/designated_shop/map.php +++ b/app/Views/admin/designated_shop/map.php @@ -2,7 +2,7 @@
지정판매소 지도 - 목록으로 + 목록으로
diff --git a/app/Views/admin/designated_shop/status.php b/app/Views/admin/designated_shop/status.php index ef7308c..947b523 100644 --- a/app/Views/admin/designated_shop/status.php +++ b/app/Views/admin/designated_shop/status.php @@ -4,7 +4,7 @@ 지정판매소 현황 (신규/취소)
diff --git a/app/Views/admin/free_recipient/create.php b/app/Views/admin/free_recipient/create.php index 227e2af..19028cf 100644 --- a/app/Views/admin/free_recipient/create.php +++ b/app/Views/admin/free_recipient/create.php @@ -2,7 +2,7 @@ 대상자 등록
-
+
@@ -56,7 +56,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/free_recipient/edit.php b/app/Views/admin/free_recipient/edit.php index 4154ba0..7b3663c 100644 --- a/app/Views/admin/free_recipient/edit.php +++ b/app/Views/admin/free_recipient/edit.php @@ -2,7 +2,7 @@ 대상자 수정
-
+
@@ -64,7 +64,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/free_recipient/index.php b/app/Views/admin/free_recipient/index.php index 1a2bf8f..281549d 100644 --- a/app/Views/admin/free_recipient/index.php +++ b/app/Views/admin/free_recipient/index.php @@ -4,7 +4,7 @@ 무료용 대상자 관리
@@ -37,8 +37,8 @@ fr_end_date) ?> fr_state === 1 ? '사용' : '미사용' ?> - 수정 -
+ 수정 +
@@ -46,7 +46,12 @@ - 등록된 데이터가 없습니다. + + +

등록된 데이터가 없습니다.

+

다른 지자체를 선택 중이면 해당 지자체 기준으로만 조회됩니다. Super Admin 은 상단에서 작업 지자체를 바꿔 보세요.

+ + diff --git a/app/Views/admin/manager/create.php b/app/Views/admin/manager/create.php index ab6ef6e..f0805bb 100644 --- a/app/Views/admin/manager/create.php +++ b/app/Views/admin/manager/create.php @@ -2,7 +2,7 @@ 담당자 등록
-
+
@@ -51,7 +51,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/manager/edit.php b/app/Views/admin/manager/edit.php index f0f3e0f..349609e 100644 --- a/app/Views/admin/manager/edit.php +++ b/app/Views/admin/manager/edit.php @@ -2,7 +2,7 @@ 담당자 수정
-
+
@@ -59,7 +59,7 @@
- 취소 + 취소
diff --git a/app/Views/admin/manager/index.php b/app/Views/admin/manager/index.php index 3c5fe73..6301e60 100644 --- a/app/Views/admin/manager/index.php +++ b/app/Views/admin/manager/index.php @@ -4,7 +4,7 @@ 담당자 관리
@@ -35,8 +35,8 @@ mg_email) ?> mg_state === 1 ? '사용' : '미사용' ?> - 수정 -
+ 수정 +
diff --git a/app/Views/admin/menu/index.php b/app/Views/admin/menu/index.php index f0941fc..2cf8426 100644 --- a/app/Views/admin/menu/index.php +++ b/app/Views/admin/menu/index.php @@ -4,6 +4,27 @@ $list = $list ?? []; $mtIdx = (int) ($mtIdx ?? 0); $mtCode = (string) ($mtCode ?? ''); $levelNames = $levelNames ?? []; +helper('admin'); +$adminMenusNavPath = current_nav_request_path(); + +/** + * 메뉴 관리 목록용: 저장된 mm_link → 실제 href (외부 http(s) 또는 base_url). + */ +$adminMenuListResolveHref = static function (string $rawLink) use ($adminMenusNavPath): string { + $rawLink = trim($rawLink); + if ($rawLink === '') { + return ''; + } + if (preg_match('#^https?://#i', $rawLink)) { + return $rawLink; + } + $pathSeg = menu_link_preferred_href_path($rawLink, $adminMenusNavPath); + if ($pathSeg === '') { + $pathSeg = normalize_menu_link_for_url($rawLink); + } + + return $pathSeg !== '' ? base_url($pathSeg) : ''; +}; ?>
@@ -48,6 +69,10 @@ $levelNames = $levelNames ?? []; $row): ?> + mm_link); + $listItemHref = $rawLink !== '' ? $adminMenuListResolveHref($rawLink) : ''; + ?> @@ -67,9 +92,21 @@ $levelNames = $levelNames ?? []; └─ + + mm_name) ?> + mm_name) ?> + + + + + + + + + + - mm_link) ?> mm_level === '') { diff --git a/app/Views/admin/sales_agency/create.php b/app/Views/admin/sales_agency/create.php index b0b7640..e93a6e0 100644 --- a/app/Views/admin/sales_agency/create.php +++ b/app/Views/admin/sales_agency/create.php @@ -2,37 +2,27 @@ 대행소 등록
-
+
- - + +
- - + +
- - -
- -
- - -
- -
- - + +
- 취소 + 취소
diff --git a/app/Views/admin/sales_agency/edit.php b/app/Views/admin/sales_agency/edit.php index 2c15a80..b5a87a4 100644 --- a/app/Views/admin/sales_agency/edit.php +++ b/app/Views/admin/sales_agency/edit.php @@ -2,45 +2,27 @@ 대행소 수정
-
+
- - + +
- - + +
- - -
- -
- - -
- -
- - -
- -
- - + +
- 취소 + 취소
diff --git a/app/Views/admin/sales_agency/index.php b/app/Views/admin/sales_agency/index.php index 54cab40..c428c2b 100644 --- a/app/Views/admin/sales_agency/index.php +++ b/app/Views/admin/sales_agency/index.php @@ -4,7 +4,7 @@ 판매 대행소 관리
@@ -13,12 +13,9 @@ 번호 - 대행소명 - 사업자번호 - 대표자 - 전화 - 주소 - 상태 + 대행소 구분 + 대행소 코드 + 대행소 명 작업 @@ -26,15 +23,12 @@ sa_idx) ?> + sa_kind ?? '') ?> + sa_code ?? '') ?> sa_name) ?> - sa_biz_no) ?> - sa_rep_name) ?> - sa_tel) ?> - sa_addr) ?> - sa_state === 1 ? '정상' : '미사용' ?> - 수정 -
+ 수정 +
@@ -42,7 +36,7 @@ - 등록된 데이터가 없습니다. + 등록된 데이터가 없습니다. diff --git a/app/Views/auth/register.php b/app/Views/auth/register.php index 6386297..1089823 100644 --- a/app/Views/auth/register.php +++ b/app/Views/auth/register.php @@ -3,7 +3,7 @@ -회원가입 - 쓰레기봉투 물류시스템 +회원가입 - 종량제 시스템