업체·담당자·단가·지정판매소 관리 화면의 조회 및 표시를 개선한다.
관리 화면에서 유형별 조회와 순번 표기를 통일하고, 지정판매소 주소/구군 표시와 포장단위 이력 표현을 사용자 관점으로 정리한다. Made-with: Cursor
This commit is contained in:
@@ -9,6 +9,11 @@ class Company extends BaseController
|
||||
{
|
||||
private CompanyModel $model;
|
||||
|
||||
private function companyTypeOptions(): array
|
||||
{
|
||||
return ['협회', '제작업체', '회수업체'];
|
||||
}
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->model = model(CompanyModel::class);
|
||||
@@ -22,10 +27,33 @@ class Company extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$list = $this->model->where('cp_lg_idx', $lgIdx)->orderBy('cp_idx', 'DESC')->paginate(20);
|
||||
$companyType = trim((string) ($this->request->getGet('cp_type') ?? ''));
|
||||
$typeOptions = $this->companyTypeOptions();
|
||||
|
||||
$builder = $this->model->where('cp_lg_idx', $lgIdx);
|
||||
if ($companyType !== '' && in_array($companyType, $typeOptions, true)) {
|
||||
$builder->where('cp_type', $companyType);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('cp_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->model->pager;
|
||||
|
||||
return $this->renderWorkPage('업체 관리', 'admin/company/index', ['list' => $list, 'pager' => $pager]);
|
||||
$queryForPager = [];
|
||||
if ($companyType !== '' && in_array($companyType, $typeOptions, true)) {
|
||||
$queryForPager['cp_type'] = $companyType;
|
||||
}
|
||||
$pagerPath = mgmt_url('companies');
|
||||
if ($queryForPager !== []) {
|
||||
$pagerPath .= '?' . http_build_query($queryForPager);
|
||||
}
|
||||
$pager->setPath($pagerPath);
|
||||
|
||||
return $this->renderWorkPage('업체 관리', 'admin/company/index', [
|
||||
'list' => $list,
|
||||
'pager' => $pager,
|
||||
'cpType' => $companyType,
|
||||
'typeOptions' => $typeOptions,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
|
||||
Reference in New Issue
Block a user