feat:E-Sign 작성자 서명/도장 선택 기능 (자동서명 제거)
- 작성자 자동서명 로직 제거 → 양쪽 모두 서명 과정 필수 - 서명 화면에서 '직접 서명' / '법인도장' 선택 UI 추가 - 도장 선택 시 기존 stamp 이미지로 바로 제출 - getContract API에 has_stamp 필드 추가 - submitSignature에 use_stamp 플래그 처리 추가 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,6 +84,7 @@ public function getContract(string $token): JsonResponse
|
||||
'email' => $signer->email,
|
||||
'role' => $signer->role,
|
||||
'status' => $signer->status,
|
||||
'has_stamp' => (bool) $signer->signature_image_path,
|
||||
],
|
||||
],
|
||||
]);
|
||||
@@ -204,19 +205,31 @@ public function submitSignature(Request $request, string $token): JsonResponse
|
||||
return response()->json(['success' => false, 'message' => '서명할 수 없는 계약 상태입니다.'], 400);
|
||||
}
|
||||
|
||||
$signatureImage = $request->input('signature_image');
|
||||
if (! $signatureImage) {
|
||||
return response()->json(['success' => false, 'message' => '서명 이미지가 필요합니다.'], 422);
|
||||
}
|
||||
$useStamp = $request->boolean('use_stamp');
|
||||
|
||||
// 서명 이미지 저장
|
||||
$imageData = base64_decode($signatureImage);
|
||||
$imagePath = "esign/{$contract->tenant_id}/signatures/{$contract->id}_{$signer->id}_" . time() . '.png';
|
||||
Storage::disk('local')->put($imagePath, $imageData);
|
||||
if ($useStamp) {
|
||||
// 도장 사용: 이미 저장된 stamp 이미지를 그대로 사용
|
||||
if (!$signer->signature_image_path) {
|
||||
return response()->json(['success' => false, 'message' => '등록된 도장 이미지가 없습니다.'], 422);
|
||||
}
|
||||
// 기존 signature_image_path 유지, 새 이미지 저장 안 함
|
||||
} else {
|
||||
// 직접 서명: signature_image 필수
|
||||
$signatureImage = $request->input('signature_image');
|
||||
if (!$signatureImage) {
|
||||
return response()->json(['success' => false, 'message' => '서명 이미지가 필요합니다.'], 422);
|
||||
}
|
||||
|
||||
// 서명 이미지 저장
|
||||
$imageData = base64_decode($signatureImage);
|
||||
$imagePath = "esign/{$contract->tenant_id}/signatures/{$contract->id}_{$signer->id}_" . time() . '.png';
|
||||
Storage::disk('local')->put($imagePath, $imageData);
|
||||
|
||||
$signer->update(['signature_image_path' => $imagePath]);
|
||||
}
|
||||
|
||||
// 서명자 상태 업데이트
|
||||
$signer->update([
|
||||
'signature_image_path' => $imagePath,
|
||||
'signed_at' => now(),
|
||||
'consent_agreed_at' => now(),
|
||||
'sign_ip_address' => $request->ip(),
|
||||
|
||||
Reference in New Issue
Block a user