feat:코드그룹 DB기반 관리, 스코프 필터, 동기화 테넌트명 표시

- 공통코드/카테고리: 하드코딩 그룹 라벨 제거, DB description 기반으로 전환
- 코드그룹 신규 생성 기능 추가 (사이드바 + 모달, TenantSetting 저장)
- 글로벌/테넌트 스코프 분류 및 필터 버튼 (전체/글로벌/테넌트)
- 사이드바 컴팩트 레이아웃 (100+ 그룹 대응)
- 동기화 페이지 3종(메뉴/공통코드/카테고리) 테넌트 회사명 표시

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-30 22:25:05 +09:00
parent f0ea6c71de
commit a0ec103614
10 changed files with 559 additions and 75 deletions

View File

@@ -4,6 +4,7 @@
use App\Models\Category;
use App\Models\GlobalCategory;
use App\Models\Tenants\Tenant;
use App\Models\Tenants\TenantSetting;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
@@ -13,6 +14,8 @@
class CategorySyncController extends Controller
{
private ?string $remoteTenantName = null;
/**
* 현재 선택된 테넌트 ID
*/
@@ -52,12 +55,16 @@ public function index(Request $request): View|Response
$selectedEnv = $request->get('env', 'dev');
$selectedType = $request->get('type', 'global'); // global or tenant
// 로컬 테넌트 정보
$localTenant = Tenant::find($this->getTenantId());
// 로컬 카테고리 조회 (타입 필터 적용)
$localCategories = $this->getCategoryList($selectedType);
// 원격 카테고리 조회
$remoteCategories = [];
$remoteError = null;
$this->remoteTenantName = null;
if (! empty($environments[$selectedEnv]['url'])) {
try {
@@ -78,6 +85,8 @@ public function index(Request $request): View|Response
'remoteCategories' => $remoteCategories,
'remoteError' => $remoteError,
'diff' => $diff,
'localTenantName' => $localTenant?->company_name ?? '알 수 없음',
'remoteTenantName' => $this->remoteTenantName,
]);
}
@@ -97,9 +106,12 @@ public function export(Request $request): JsonResponse
$type = $request->get('type', 'all'); // global, tenant, or all
$categories = $this->getCategoryList($type);
$tenant = Tenant::find($this->getTenantId());
return response()->json([
'success' => true,
'environment' => config('app.env'),
'tenant_name' => $tenant?->company_name ?? '알 수 없음',
'exported_at' => now()->toIso8601String(),
'categories' => $categories,
]);
@@ -473,6 +485,8 @@ private function fetchRemoteCategories(array $env, string $type = 'all'): array
throw new \Exception('잘못된 응답 형식');
}
$this->remoteTenantName = $data['tenant_name'] ?? null;
return $data['categories'];
}
@@ -499,4 +513,4 @@ private function calculateDiff(array $localCategories, array $remoteCategories):
'both' => array_values(array_intersect($localKeys, $remoteKeys)),
];
}
}
}