- Add resume file upload to schedule drawer with instant preview and validation - Create resume lightbox modal viewer with background scroll lock and CV SVG icon - Integrate CV tab into inspector panel with enlarge action and state - Attach candidate resume to panelist notification emails when - Fix Outlook RFC 5546 iTIP element mismatch and add table credentials copy button
64 lines
2.3 KiB
PHP
64 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Actions\Interview;
|
|
|
|
use App\DTOs\Interview\ScheduleInterviewDto;
|
|
use App\Models\Interview;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Str;
|
|
|
|
class ScheduleInterviewAction
|
|
{
|
|
public function __construct(
|
|
protected SendInterviewInvitationsAction $sendInvitationsAction
|
|
) {}
|
|
|
|
/**
|
|
* Provision and schedule an interview assessment session, then trigger calendar invitations.
|
|
*/
|
|
public function execute(ScheduleInterviewDto $dto, ?int $creatorId = null): Interview
|
|
{
|
|
$tempPassword = 'Pass-'.rand(100000, 999999);
|
|
$cleanPhone = preg_replace('/[^0-9]/', '', $dto->candidatePhone);
|
|
$cleanName = Str::slug($dto->candidateName);
|
|
$submissionUniqueId = $cleanName.'_'.$cleanPhone.'_'.time();
|
|
|
|
$scheduledAt = $dto->scheduledAt ? Carbon::parse($dto->scheduledAt) : now();
|
|
$expiresAt = $scheduledAt->copy()->addHours($dto->validHours);
|
|
|
|
$resumePath = null;
|
|
if ($dto->resume) {
|
|
$resumePath = $dto->resume->store('interview_resumes', 'public');
|
|
} elseif ($dto->resumePath) {
|
|
$resumePath = $dto->resumePath;
|
|
}
|
|
|
|
$interview = DB::transaction(function () use ($dto, $tempPassword, $submissionUniqueId, $scheduledAt, $expiresAt, $creatorId, $resumePath) {
|
|
return Interview::create([
|
|
'candidate_name' => $dto->candidateName,
|
|
'candidate_email' => $dto->candidateEmail,
|
|
'candidate_phone' => $dto->candidatePhone,
|
|
'job_title' => $dto->jobTitle,
|
|
'round' => $dto->round,
|
|
'description' => $dto->description,
|
|
'resume_path' => $resumePath,
|
|
'temp_password' => $tempPassword,
|
|
'scheduled_at' => $scheduledAt,
|
|
'expires_at' => $expiresAt,
|
|
'language' => $dto->language,
|
|
'status' => 'scheduled',
|
|
'assigned_interviewers' => $dto->assignedInterviewers,
|
|
'proctor_logs' => [],
|
|
'submission_unique_id' => $submissionUniqueId,
|
|
'created_by' => $creatorId,
|
|
]);
|
|
});
|
|
|
|
// Trigger iCalendar generation & queued emails
|
|
$this->sendInvitationsAction->execute($interview);
|
|
|
|
return $interview;
|
|
}
|
|
}
|