fix:서명 완료 후 다음 서명자 자동 알림 발송 추가

- submitSignature: 첫 번째 서명자 완료 시 다음 서명자에게 자동 이메일 발송
- send: sign_order_type이 parallel이면 모든 서명자에게 동시 발송

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
김보곤
2026-02-12 16:46:57 +09:00
parent 405bc1db3e
commit 4f25e0e4a1
2 changed files with 39 additions and 5 deletions

View File

@@ -258,11 +258,20 @@ public function send(Request $request, int $id): JsonResponse
'updated_by' => auth()->id(),
]);
// 첫 번째 서명자 상태 변경 + 메일 발송
$nextSigner = $contract->signers()->orderBy('sign_order')->first();
if ($nextSigner) {
$nextSigner->update(['status' => 'notified']);
Mail::to($nextSigner->email)->send(new EsignRequestMail($contract, $nextSigner));
// 서명 순서 유형에 따라 알림 발송
if ($contract->sign_order_type === 'parallel') {
// 동시 서명: 모든 서명자에게 발송
foreach ($contract->signers as $s) {
$s->update(['status' => 'notified']);
Mail::to($s->email)->send(new EsignRequestMail($contract, $s));
}
} else {
// 순차 서명: 첫 번째 서명자에게만 발송
$nextSigner = $contract->signers()->orderBy('sign_order')->first();
if ($nextSigner) {
$nextSigner->update(['status' => 'notified']);
Mail::to($nextSigner->email)->send(new EsignRequestMail($contract, $nextSigner));
}
}
EsignAuditLog::create([