업체·담당자·단가·지정판매소 관리 화면의 조회 및 표시를 개선한다.
관리 화면에서 유형별 조회와 순번 표기를 통일하고, 지정판매소 주소/구군 표시와 포장단위 이력 표현을 사용자 관점으로 정리한다. Made-with: Cursor
This commit is contained in:
@@ -25,6 +25,15 @@ class Manager extends BaseController
|
||||
return $kind ? model(CodeDetailModel::class)->getByKind((int) $kind->ck_idx, true, $lgIdx) : [];
|
||||
}
|
||||
|
||||
private function managerCategoryOptions(): array
|
||||
{
|
||||
return [
|
||||
'company' => '제작업체',
|
||||
'district' => '구·군',
|
||||
'agency' => '대행소',
|
||||
];
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
helper('admin');
|
||||
@@ -35,16 +44,29 @@ class Manager extends BaseController
|
||||
return redirect()->to(work_area_home_url())->with('error', '지자체를 선택해 주세요.');
|
||||
}
|
||||
|
||||
$list = $this->model->where('mg_lg_idx', $lgIdx)->orderBy('mg_idx', 'DESC')->paginate(20);
|
||||
$category = (string) ($this->request->getGet('category') ?? '');
|
||||
$categories = $this->managerCategoryOptions();
|
||||
|
||||
$builder = $this->model->where('mg_lg_idx', $lgIdx);
|
||||
if ($category !== '' && isset($categories[$category])) {
|
||||
$builder->where('mg_dept_code', $category);
|
||||
}
|
||||
|
||||
$list = $builder->orderBy('mg_idx', 'DESC')->paginate(20);
|
||||
$pager = $this->model->pager;
|
||||
|
||||
return $this->renderWorkPage('담당자 관리', 'admin/manager/index', ['list' => $list, 'pager' => $pager]);
|
||||
return $this->renderWorkPage('담당자 관리', 'admin/manager/index', [
|
||||
'list' => $list,
|
||||
'pager' => $pager,
|
||||
'categories' => $categories,
|
||||
'category' => $category,
|
||||
]);
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
return $this->renderWorkPage('담당자 등록', 'admin/manager/create', [
|
||||
'deptCodes' => $this->getCodeOptions('S'),
|
||||
'categories' => $this->managerCategoryOptions(),
|
||||
'positionCodes' => $this->getCodeOptions('T'),
|
||||
]);
|
||||
}
|
||||
@@ -54,6 +76,7 @@ class Manager extends BaseController
|
||||
helper(['admin', 'url']);
|
||||
$rules = [
|
||||
'mg_name' => 'required|max_length[50]',
|
||||
'mg_category' => 'required|in_list[company,district,agency]',
|
||||
'mg_tel' => 'permit_empty|max_length[20]',
|
||||
'mg_phone' => 'permit_empty|max_length[20]',
|
||||
'mg_email' => 'permit_empty|valid_email|max_length[100]',
|
||||
@@ -65,7 +88,7 @@ class Manager extends BaseController
|
||||
$this->model->insert([
|
||||
'mg_lg_idx' => admin_effective_lg_idx(),
|
||||
'mg_name' => $this->request->getPost('mg_name'),
|
||||
'mg_dept_code' => $this->request->getPost('mg_dept_code') ?? '',
|
||||
'mg_dept_code' => (string) ($this->request->getPost('mg_category') ?? ''),
|
||||
'mg_position_code' => $this->request->getPost('mg_position_code') ?? '',
|
||||
'mg_tel' => $this->request->getPost('mg_tel') ?? '',
|
||||
'mg_phone' => $this->request->getPost('mg_phone') ?? '',
|
||||
@@ -87,7 +110,7 @@ class Manager extends BaseController
|
||||
|
||||
return $this->renderWorkPage('담당자 수정', 'admin/manager/edit', [
|
||||
'item' => $item,
|
||||
'deptCodes' => $this->getCodeOptions('S'),
|
||||
'categories' => $this->managerCategoryOptions(),
|
||||
'positionCodes' => $this->getCodeOptions('T'),
|
||||
]);
|
||||
}
|
||||
@@ -102,6 +125,7 @@ class Manager extends BaseController
|
||||
|
||||
$rules = [
|
||||
'mg_name' => 'required|max_length[50]',
|
||||
'mg_category' => 'required|in_list[company,district,agency]',
|
||||
'mg_state' => 'required|in_list[0,1]',
|
||||
];
|
||||
if (! $this->validate($rules)) {
|
||||
@@ -110,7 +134,7 @@ class Manager extends BaseController
|
||||
|
||||
$this->model->update($id, [
|
||||
'mg_name' => $this->request->getPost('mg_name'),
|
||||
'mg_dept_code' => $this->request->getPost('mg_dept_code') ?? '',
|
||||
'mg_dept_code' => (string) ($this->request->getPost('mg_category') ?? ''),
|
||||
'mg_position_code' => $this->request->getPost('mg_position_code') ?? '',
|
||||
'mg_tel' => $this->request->getPost('mg_tel') ?? '',
|
||||
'mg_phone' => $this->request->getPost('mg_phone') ?? '',
|
||||
|
||||
Reference in New Issue
Block a user