From 84026f8072a918d95533b8fc6b66f13c1ba62da9 Mon Sep 17 00:00:00 2001 From: taekyoungc Date: Wed, 8 Apr 2026 11:59:00 +0900 Subject: [PATCH] feat: add sales agency list search filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 판매 대행소 관리 목록에 번호·구분·코드·명 조회 조건을 추가하고 페이징에서도 검색 조건이 유지되도록 반영한다. Made-with: Cursor --- app/Controllers/Admin/SalesAgency.php | 43 ++++++++++++++++++++++++-- app/Views/admin/sales_agency/index.php | 24 ++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Admin/SalesAgency.php b/app/Controllers/Admin/SalesAgency.php index ed75380..ef8f5f5 100644 --- a/app/Controllers/Admin/SalesAgency.php +++ b/app/Controllers/Admin/SalesAgency.php @@ -26,10 +26,49 @@ class SalesAgency extends BaseController return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.'); } - $list = $this->model->where('sa_lg_idx', $lgIdx)->orderForDisplay()->paginate(20); + $saKind = trim((string) ($this->request->getGet('sa_kind') ?? '')); + $saCode = trim((string) ($this->request->getGet('sa_code') ?? '')); + $saName = trim((string) ($this->request->getGet('sa_name') ?? '')); + $saIdx = trim((string) ($this->request->getGet('sa_idx') ?? '')); + + $builder = $this->model->where('sa_lg_idx', $lgIdx); + if ($saKind !== '') { + $builder->like('sa_kind', $saKind); + } + if ($saCode !== '') { + $builder->like('sa_code', $saCode); + } + if ($saName !== '') { + $builder->like('sa_name', $saName); + } + if ($saIdx !== '' && ctype_digit($saIdx)) { + $builder->where('sa_idx', (int) $saIdx); + } + + $list = $builder->orderForDisplay()->paginate(20); $pager = $this->model->pager; - return $this->renderWorkPage('판매 대행소 관리', 'admin/sales_agency/index', ['list' => $list, 'pager' => $pager]); + $queryForPager = [ + 'sa_kind' => $saKind, + 'sa_code' => $saCode, + 'sa_name' => $saName, + 'sa_idx' => $saIdx, + ]; + $queryForPager = array_filter($queryForPager, static fn ($v) => $v !== null && $v !== ''); + $pagerPath = mgmt_url('sales-agencies'); + if ($queryForPager !== []) { + $pagerPath .= '?' . http_build_query($queryForPager); + } + $pager->setPath($pagerPath); + + return $this->renderWorkPage('판매 대행소 관리', 'admin/sales_agency/index', [ + 'list' => $list, + 'pager' => $pager, + 'sa_kind' => $saKind, + 'sa_code' => $saCode, + 'sa_name' => $saName, + 'sa_idx' => $saIdx, + ]); } public function create() diff --git a/app/Views/admin/sales_agency/index.php b/app/Views/admin/sales_agency/index.php index c428c2b..1c9aac3 100644 --- a/app/Views/admin/sales_agency/index.php +++ b/app/Views/admin/sales_agency/index.php @@ -8,6 +8,30 @@ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + 초기화 +
+
+