feat: 활동 로그를 사람이 읽기 쉬운 문장으로 표시

- '내용' 컬럼: 대상명+작업(예: 업체 'OO' 수정), 변경 항목(라벨: 전→후) 인라인 표시
- 로그인(member housekeeping 수정)은 '로그인'으로 구분 표시
- 컬럼 한글 라벨(정확매칭+접미사 추정), 레코드 이름 자동 추출

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
taekyoungc
2026-06-26 09:46:54 +09:00
parent 7294c56c50
commit 264f190121
2 changed files with 150 additions and 8 deletions

View File

@@ -56,8 +56,7 @@ $actionBadge = static function (string $a): string {
<th class="text-left">일시</th>
<th class="text-left">사용자</th>
<th class="text-center">작업</th>
<th class="text-left">대상</th>
<th class="text-center">대상 번호</th>
<th class="text-left">내용</th>
<th class="text-center no-print">상세</th>
</tr>
</thead>
@@ -65,26 +64,43 @@ $actionBadge = static function (string $a): string {
<?php foreach ($list as $row): ?>
<?php
$act = (string) ($row->al_action ?? '');
$tbl = (string) ($row->al_table ?? '');
$isLogin = ! empty($row->isLogin);
$who = trim((string) ($row->mb_name ?? '') . (($row->mb_id ?? '') !== '' ? ' (' . $row->mb_id . ')' : ''));
$badgeText = $isLogin ? '로그인' : ($actionLabels[$act] ?? $act);
$badgeStyle = $isLogin ? 'background:#ede9fe;color:#5b21b6;' : $actionBadge($act);
$changeList = $row->changeList ?? [];
?>
<tr>
<td class="text-left pl-2 whitespace-nowrap"><?= esc((string) ($row->al_regdate ?? '')) ?></td>
<td class="text-left pl-2"><?= $who !== '' ? esc($who) : '<span class="text-gray-400">시스템</span>' ?></td>
<td class="text-center">
<span style="<?= $actionBadge($act) ?>display:inline-block;padding:1px 8px;border-radius:9999px;font-size:11px;font-weight:700;">
<?= esc($actionLabels[$act] ?? $act) ?>
<span style="<?= $badgeStyle ?>display:inline-block;padding:1px 8px;border-radius:9999px;font-size:11px;font-weight:700;white-space:nowrap;">
<?= esc($badgeText) ?>
</span>
</td>
<td class="text-left pl-2"><?= esc($tableLabels[$tbl] ?? $tbl) ?></td>
<td class="text-center"><?= (int) ($row->al_record_id ?? 0) ?: '-' ?></td>
<td class="text-left pl-2">
<span class="font-semibold text-gray-800"><?= esc((string) ($row->summaryText ?? '')) ?></span>
<?php if ($changeList !== []): ?>
<div class="text-xs text-gray-500 mt-0.5">
<?php foreach (array_slice($changeList, 0, 4) as $c): ?>
<span class="inline-block mr-2">
<span class="text-gray-600"><?= esc($c['label']) ?>:</span>
<span class="text-gray-400"><?= esc($c['from']) ?></span>
<span class="text-gray-700"><?= esc($c['to']) ?></span>
</span>
<?php endforeach; ?>
<?php if (count($changeList) > 4): ?><span class="text-gray-400">외 <?= count($changeList) - 4 ?>건</span><?php endif; ?>
</div>
<?php endif; ?>
</td>
<td class="text-center no-print">
<a href="<?= base_url('admin/access/activity-logs/' . (int) $row->al_idx) ?>" class="text-blue-700 hover:underline">보기</a>
</td>
</tr>
<?php endforeach; ?>
<?php if ($list === []): ?>
<tr><td colspan="6" class="text-center text-gray-400 py-6">조회된 로그가 없습니다.</td></tr>
<tr><td colspan="5" class="text-center text-gray-400 py-6">조회된 로그가 없습니다.</td></tr>
<?php endif; ?>
</tbody>
</table>