feat:코드그룹 DB기반 관리, 스코프 필터, 동기화 테넌트명 표시
- 공통코드/카테고리: 하드코딩 그룹 라벨 제거, DB description 기반으로 전환 - 코드그룹 신규 생성 기능 추가 (사이드바 + 모달, TenantSetting 저장) - 글로벌/테넌트 스코프 분류 및 필터 버튼 (전체/글로벌/테넌트) - 사이드바 컴팩트 레이아웃 (100+ 그룹 대응) - 동기화 페이지 3종(메뉴/공통코드/카테고리) 테넌트 회사명 표시 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Products\CommonCode;
|
||||
use App\Models\Tenants\Tenant;
|
||||
use App\Models\Tenants\TenantSetting;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -12,6 +13,8 @@
|
||||
|
||||
class CommonCodeSyncController extends Controller
|
||||
{
|
||||
private ?string $remoteTenantName = null;
|
||||
|
||||
/**
|
||||
* 현재 선택된 테넌트 ID
|
||||
*/
|
||||
@@ -51,12 +54,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());
|
||||
|
||||
// 로컬 코드 조회 (타입 필터 적용)
|
||||
$localCodes = $this->getCodeList($selectedType);
|
||||
|
||||
// 원격 코드 조회
|
||||
$remoteCodes = [];
|
||||
$remoteError = null;
|
||||
$this->remoteTenantName = null;
|
||||
|
||||
if (! empty($environments[$selectedEnv]['url'])) {
|
||||
try {
|
||||
@@ -77,6 +84,8 @@ public function index(Request $request): View|Response
|
||||
'remoteCodes' => $remoteCodes,
|
||||
'remoteError' => $remoteError,
|
||||
'diff' => $diff,
|
||||
'localTenantName' => $localTenant?->company_name ?? '알 수 없음',
|
||||
'remoteTenantName' => $this->remoteTenantName,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -96,9 +105,12 @@ public function export(Request $request): JsonResponse
|
||||
$type = $request->get('type', 'all'); // global, tenant, or all
|
||||
$codes = $this->getCodeList($type);
|
||||
|
||||
$tenant = Tenant::find($this->getTenantId());
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'environment' => config('app.env'),
|
||||
'tenant_name' => $tenant?->company_name ?? '알 수 없음',
|
||||
'exported_at' => now()->toIso8601String(),
|
||||
'codes' => $codes,
|
||||
]);
|
||||
@@ -370,6 +382,8 @@ private function fetchRemoteCodes(array $env, string $type = 'all'): array
|
||||
throw new \Exception('잘못된 응답 형식');
|
||||
}
|
||||
|
||||
$this->remoteTenantName = $data['tenant_name'] ?? null;
|
||||
|
||||
return $data['codes'];
|
||||
}
|
||||
|
||||
@@ -396,4 +410,4 @@ private function calculateDiff(array $localCodes, array $remoteCodes): array
|
||||
'both' => array_values(array_intersect($localKeys, $remoteKeys)),
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user