feat: [tenant] 테넌트 편집에 인쇄용 회사 표시명 필드 추가
- 테넌트 편집 페이지에 '인쇄용 회사명' 입력 필드 추가 - 저장 시 tenant_settings 테이블에 display_company_name 저장 - 재직증명서 등 문서에서 표시명 우선 적용
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\StoreTenantRequest;
|
||||
use App\Http\Requests\UpdateTenantRequest;
|
||||
use App\Models\Tenants\TenantSetting;
|
||||
use App\Services\TenantService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -104,6 +105,22 @@ public function update(UpdateTenantRequest $request, int $id): JsonResponse
|
||||
{
|
||||
$this->tenantService->updateTenant($id, $request->validated());
|
||||
|
||||
// 인쇄용 회사 표시명 저장 (tenant_settings)
|
||||
if ($request->has('display_company_name')) {
|
||||
TenantSetting::withoutGlobalScopes()->updateOrCreate(
|
||||
[
|
||||
'tenant_id' => $id,
|
||||
'setting_group' => 'company',
|
||||
'setting_key' => 'display_company_name',
|
||||
],
|
||||
[
|
||||
'setting_value' => trim($request->input('display_company_name', '')),
|
||||
'description' => '문서에 인쇄되는 회사 표시명',
|
||||
'updated_by' => auth()->id(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
// HTMX 요청 시 성공 메시지와 리다이렉트 헤더 반환
|
||||
if ($request->header('HX-Request')) {
|
||||
return response()->json([
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Tenants\TenantSetting;
|
||||
use App\Services\TenantService;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
@@ -45,7 +46,13 @@ public function edit(int $id): View
|
||||
abort(404, '테넌트를 찾을 수 없습니다.');
|
||||
}
|
||||
|
||||
return view('tenants.edit', compact('tenant'));
|
||||
$displayCompanyName = TenantSetting::withoutGlobalScopes()
|
||||
->where('tenant_id', $id)
|
||||
->where('setting_group', 'company')
|
||||
->where('setting_key', 'display_company_name')
|
||||
->first()?->setting_value ?? '';
|
||||
|
||||
return view('tenants.edit', compact('tenant', 'displayCompanyName'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -34,6 +34,16 @@
|
||||
<input type="text" name="company_name" value="{{ old('company_name', $tenant->company_name) }}" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||
인쇄용 회사명
|
||||
<span class="text-xs text-gray-400 font-normal ml-1">재직증명서 등 문서에 사용</span>
|
||||
</label>
|
||||
<input type="text" name="display_company_name" value="{{ old('display_company_name', $displayCompanyName ?? '') }}"
|
||||
placeholder="{{ $tenant->company_name }}"
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
|
||||
<p class="mt-1 text-xs text-gray-400">비워두면 회사명이 그대로 사용됩니다.</p>
|
||||
</div>
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">
|
||||
테넌트 코드 <span class="text-red-500">*</span>
|
||||
|
||||
Reference in New Issue
Block a user