feat: add sales agency list search filters
판매 대행소 관리 목록에 번호·구분·코드·명 조회 조건을 추가하고 페이징에서도 검색 조건이 유지되도록 반영한다. Made-with: Cursor
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user