Files
kent 0d79aa3d37 fix: [api-explorer] 즐겨찾기 및 태그명 표시 개선
- 즐겨찾기 클릭 시 404 오류 수정 (selectEndpointByPath 함수 추가)
- 태그명 형식을 "한글명 (English)"로 변경
- 사용자 목록 조회 오류 수정 (user_tenants 피벗 테이블 사용)
- 즐겨찾기 토글 시 페이지 새로고침 없이 로컬 상태 업데이트

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 14:19:26 +09:00

185 lines
8.2 KiB
PHP

{{-- 즐겨찾기 섹션 --}}
@if($bookmarks->isNotEmpty())
<div class="border-b border-gray-200 pb-2 mb-2">
<div class="tag-header">
<span class="flex items-center gap-2">
<svg class="w-4 h-4 text-yellow-500" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
즐겨찾기 ({{ $bookmarks->count() }})
</span>
</div>
<div class="space-y-0.5">
@foreach($bookmarks as $bookmark)
<div class="endpoint-item" onclick="selectEndpointByPath('{{ $bookmark->endpoint }}', '{{ $bookmark->method }}', this)">
<span class="method-badge method-{{ strtolower($bookmark->method) }}">
{{ $bookmark->method }}
</span>
<span class="endpoint-path" title="{{ $bookmark->endpoint }}">
{{ $bookmark->display_name ?? $bookmark->endpoint }}
</span>
<button onclick="event.stopPropagation(); toggleBookmark('{{ $bookmark->endpoint }}', '{{ $bookmark->method }}', this)"
class="text-yellow-500 hover:text-yellow-600">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
</button>
</div>
@endforeach
</div>
</div>
@endif
@php
// 태그명 한글 매핑
$tagNameMap = [
// 인증/사용자
'Auth' => '인증',
'User' => '사용자',
'Admin-Users' => '관리자-사용자',
'UserInvitation' => '사용자 초대',
'UserRole' => '사용자 역할',
'Member' => '회원',
// 결재
'Approvals' => '결재',
'Approval Forms' => '결재 양식',
'Approval Lines' => '결재선',
// 조직
'Tenant' => '테넌트',
'Tenant.Fields' => '테넌트 필드',
'Tenant.Option Groups' => '테넌트 옵션그룹',
'Tenant.Option Values' => '테넌트 옵션값',
'Tenant.Profiles' => '테넌트 프로필',
'TenantStatField' => '테넌트 통계필드',
'Menu' => '메뉴',
'Role' => '역할',
'RolePermission' => '역할 권한',
'Permission' => '권한',
'Department' => '부서',
// 품목/제품
'Product' => '제품',
'Items' => '품목',
'Items BOM' => '품목 BOM',
'Items Files' => '품목 파일',
'ItemMaster' => '품목마스터',
'ItemMaster-Relationships' => '품목마스터 관계',
'Category' => '카테고리',
'Category-Fields' => '카테고리 필드',
'Category-Logs' => '카테고리 로그',
'Category-Templates' => '카테고리 템플릿',
'Classification' => '분류',
// 설계/BOM
'Model' => '모델',
'ModelVersion' => '모델 버전',
'BomTemplate' => 'BOM 템플릿',
'Design BOM' => '설계 BOM',
'Design Audit' => '설계 감사',
'BOM Calculation' => 'BOM 계산',
// 견적/주문
'Estimate' => '견적',
'Quote' => '견적서',
'Plans' => '플랜',
// 거래처
'Client' => '거래처',
'ClientGroup' => '거래처 그룹',
'Sites' => '현장',
// 재무/회계
'Account' => '계정',
'BankAccounts' => '계좌',
'Cards' => '카드',
'Deposits' => '입금',
'Withdrawals' => '출금',
'Sales' => '매출',
'Purchases' => '매입',
'Payments' => '결제',
'TaxInvoices' => '세금계산서',
'BadDebt' => '악성채권',
'Pricing' => '단가',
'Loans' => '대출',
// HR
'Employees' => '직원',
'Attendances' => '근태',
'Leaves' => '휴가',
'Payrolls' => '급여',
'WorkSettings' => '근무설정',
// 파일/게시판
'Files' => '파일',
'Folder' => '폴더',
'Board' => '게시판',
'Post' => '게시글',
'Popup' => '팝업',
// 설정
'Settings - Common Codes' => '설정 - 공통코드',
'Settings - Fields' => '설정 - 필드',
'NotificationSetting' => '알림설정',
'BarobillSettings' => '바로빌설정',
'Subscriptions' => '구독',
// 시스템
'Dashboard' => '대시보드',
'Reports' => '리포트',
'AI Reports' => 'AI 리포트',
'Push' => '푸시',
'Internal' => '내부',
'API Key 인증' => 'API Key 인증',
];
@endphp
{{-- 태그별 엔드포인트 그룹 --}}
@forelse($endpointsByTag as $tag => $endpoints)
@php
$koreanTag = $tagNameMap[$tag] ?? null;
$displayTag = $koreanTag && $koreanTag !== $tag ? "{$koreanTag} ({$tag})" : $tag;
@endphp
<div class="tag-group">
<div class="tag-header" onclick="toggleTagGroup('{{ Str::slug($tag) }}')">
<span class="flex items-center gap-2">
<svg class="w-4 h-4 text-gray-400 transition-transform" id="chevron-{{ Str::slug($tag) }}" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
</svg>
{{ $displayTag }}
</span>
<span class="text-xs text-gray-400">{{ $endpoints->count() }}</span>
</div>
<div id="tag-{{ Str::slug($tag) }}" class="space-y-0.5">
@foreach($endpoints as $endpoint)
@php
$isBookmarked = $bookmarks->where('endpoint', $endpoint['path'])->where('method', $endpoint['method'])->isNotEmpty();
@endphp
<div class="endpoint-item" data-operation-id="{{ $endpoint['operationId'] }}" onclick="selectEndpoint('{{ $endpoint['operationId'] }}', this)">
<span class="method-badge method-{{ strtolower($endpoint['method']) }}">
{{ $endpoint['method'] }}
</span>
<span class="endpoint-path" title="{{ $endpoint['summary'] ?: $endpoint['path'] }}">
{{ $endpoint['path'] }}
</span>
<button onclick="event.stopPropagation(); toggleBookmark('{{ $endpoint['path'] }}', '{{ $endpoint['method'] }}', this)"
class="{{ $isBookmarked ? 'text-yellow-500' : 'text-gray-400' }} hover:text-yellow-500">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
</button>
</div>
@endforeach
</div>
</div>
@empty
<div class="text-center text-gray-400 py-8">
<svg class="w-8 h-8 mx-auto mb-2" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<p class="text-sm">검색 결과가 없습니다</p>
</div>
@endforelse