feat: 사용자 의견(피드백) 전체보기 — 한 페이지 스크롤로 전체 확인/처리

- /admin/feedback/all: 모든 의견을 상세 클릭 없이 전체 내용+첨부이미지로
  세로 나열, 상단 빠른이동 앵커(#fb-{id})로 특정 건 바로 스크롤
- 각 항목에 상태·메모 인라인 저장 폼 포함(저장 후 같은 위치로 복귀)
- 목록형(index) 화면에 "전체보기(스크롤)" 링크 추가
This commit is contained in:
taekyoungc
2026-07-02 12:32:02 +09:00
parent 5ef50344af
commit f0182f75c2
4 changed files with 165 additions and 8 deletions

View File

@@ -54,6 +54,48 @@ class Feedback extends BaseController
]);
}
/**
* 전체 의견을 한 페이지에서 스크롤로 훑어볼 수 있는 화면(상세 클릭 없이 내용 전체 표시).
*/
public function all(): string
{
$model = model(FeedbackModel::class);
$builder = $model->orderBy('fb_idx', 'DESC');
$scope = $this->scopeLgIdx();
if ($scope !== null) {
$builder->where('fb_lg_idx', $scope);
}
$status = (string) ($this->request->getGet('status') ?? '');
if (in_array($status, FeedbackModel::STATUSES, true)) {
$builder->where('fb_status', $status);
}
$list = $builder->findAll();
$ids = array_map(static fn ($r): int => (int) $r->fb_idx, $list);
$filesByFb = [];
if ($ids !== []) {
$files = model(FeedbackFileModel::class)
->whereIn('ff_fb_idx', $ids)
->orderBy('ff_idx', 'ASC')
->findAll();
foreach ($files as $f) {
$filesByFb[(int) $f->ff_fb_idx][] = $f;
}
}
return view('admin/layout', [
'title' => '사용자 의견 · 전체보기',
'content' => view('admin/feedback/all', [
'list' => $list,
'filesByFb' => $filesByFb,
'status' => $status,
]),
]);
}
public function show(int $id): string|ResponseInterface
{
$model = model(FeedbackModel::class);
@@ -91,6 +133,12 @@ class Feedback extends BaseController
}
$model->update($id, $update);
// 전체보기 화면에서 저장한 경우 스크롤 위치(#fb-{id})를 유지한 채 그 화면으로 되돌아간다.
$returnTo = (string) $this->request->getPost('return_to');
if ($returnTo === 'all') {
return redirect()->to(site_url('admin/feedback/all') . '#fb-' . $id)->with('success', '처리 상태를 저장했습니다.');
}
return redirect()->to(site_url('admin/feedback/' . $id))->with('success', '처리 상태를 저장했습니다.');
}