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', '지자체를 선택해 주세요.');
|
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;
|
$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()
|
public function create()
|
||||||
|
|||||||
@@ -8,6 +8,30 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
<section class="no-print border border-gray-300 bg-white p-2 mt-2">
|
||||||
|
<form method="GET" action="<?= mgmt_url('sales-agencies') ?>" class="flex flex-wrap items-end gap-2">
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">번호</label>
|
||||||
|
<input type="text" name="sa_idx" value="<?= esc($sa_idx ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm w-24" placeholder="예: 12">
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">대행소 구분</label>
|
||||||
|
<input type="text" name="sa_kind" value="<?= esc($sa_kind ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]" placeholder="구분 입력">
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">대행소 코드</label>
|
||||||
|
<input type="text" name="sa_code" value="<?= esc($sa_code ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[10rem]" placeholder="코드 입력">
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-col gap-0.5">
|
||||||
|
<label class="text-xs text-gray-500">대행소 명</label>
|
||||||
|
<input type="text" name="sa_name" value="<?= esc($sa_name ?? '') ?>" class="border border-gray-300 rounded px-2 py-1.5 text-sm min-w-[14rem]" placeholder="대행소 명 입력">
|
||||||
|
</div>
|
||||||
|
<div class="flex items-center gap-2 pb-0.5">
|
||||||
|
<button type="submit" class="bg-btn-search text-white px-4 py-1.5 rounded-sm text-sm">조회</button>
|
||||||
|
<a href="<?= mgmt_url('sales-agencies') ?>" class="text-sm text-gray-500 hover:underline">초기화</a>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
<div class="border border-gray-300 overflow-auto mt-2">
|
<div class="border border-gray-300 overflow-auto mt-2">
|
||||||
<table class="w-full data-table">
|
<table class="w-full data-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user