fix:E-Sign PDF 폰트 크기 2배 확대, 왼쪽 정렬 기본값, 서명자 매핑 수정

- PdfSignatureService: 자동 폰트 크기 공식 2배(h*0.7→h*1.4), 기본 정렬 C→L
- text_align 필드 추가 (L/C/R 정렬 선택 가능)
- store()/buildVariableMap(): sign_order→role 기반 매핑으로 변경
  (signer_order 1=creator/갑/회사, 2=counterpart/을/파트너)
- template-fields: 가로 정렬 버튼 UI 추가

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-13 18:07:31 +09:00
parent d5283099c4
commit 843e898f5f
5 changed files with 41 additions and 14 deletions

View File

@@ -337,9 +337,11 @@ public function store(Request $request): JsonResponse
if ($template && $template->items->isNotEmpty()) {
$contract->loadMissing('signers');
// 템플릿 signer_order를 역할(role)로 매핑: 1=creator(갑/회사), 2=counterpart(을/파트너)
$signerMap = [];
foreach ($contract->signers as $signer) {
$signerMap[$signer->sign_order] = $signer->id;
$templateOrder = $signer->role === 'creator' ? 1 : 2;
$signerMap[$templateOrder] = $signer->id;
}
$variableValues = $this->buildVariableMap($contract, $template);
@@ -366,6 +368,7 @@ public function store(Request $request): JsonResponse
'field_label' => $item->field_label,
'field_variable' => $item->field_variable,
'font_size' => $item->font_size,
'text_align' => $item->text_align ?? 'L',
'field_value' => $fieldValue,
'is_required' => $item->is_required,
'sort_order' => $item->sort_order,
@@ -837,6 +840,7 @@ public function storeTemplate(Request $request): JsonResponse
'items.*.field_label' => 'nullable|string|max:100',
'items.*.field_variable' => 'nullable|string|max:50',
'items.*.font_size' => 'nullable|integer|min:6|max:72',
'items.*.text_align' => 'nullable|string|in:L,C,R',
'items.*.is_required' => 'nullable|boolean',
]);
@@ -900,6 +904,7 @@ public function storeTemplate(Request $request): JsonResponse
'field_label' => $item['field_label'] ?? null,
'field_variable' => $item['field_variable'] ?? null,
'font_size' => $item['font_size'] ?? null,
'text_align' => $item['text_align'] ?? 'L',
'is_required' => $item['is_required'] ?? true,
'sort_order' => $i,
]);
@@ -1067,6 +1072,7 @@ public function updateTemplateItems(Request $request, int $templateId): JsonResp
'items.*.field_label' => 'nullable|string|max:100',
'items.*.field_variable' => 'nullable|string|max:50',
'items.*.font_size' => 'nullable|integer|min:6|max:72',
'items.*.text_align' => 'nullable|string|in:L,C,R',
'items.*.is_required' => 'nullable|boolean',
]);
@@ -1093,6 +1099,7 @@ public function updateTemplateItems(Request $request, int $templateId): JsonResp
'field_label' => $itemData['field_label'] ?? '',
'field_variable' => $itemData['field_variable'] ?? null,
'font_size' => $itemData['font_size'] ?? null,
'text_align' => $itemData['text_align'] ?? 'L',
'is_required' => $itemData['is_required'] ?? true,
'sort_order' => $i,
]);
@@ -1340,8 +1347,8 @@ private function buildVariableMap(EsignContract $contract, EsignFieldTemplate $t
{
$map = [];
// 시스템 변수: 서명자 정보
$signers = $contract->signers->sortBy('sign_order');
// 시스템 변수: 서명자 정보 (역할 기반: 1=creator/갑/회사, 2=counterpart/을/파트너)
$signers = $contract->signers->sortBy(fn($s) => $s->role === 'creator' ? 1 : 2);
$idx = 1;
foreach ($signers as $signer) {
$map["signer{$idx}_name"] = $signer->name;