Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m39s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m45s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m50s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m51s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 10m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 10m8s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m52s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m55s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m33s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
82 lines
3.4 KiB
PHP
82 lines
3.4 KiB
PHP
<?php
|
|
|
|
namespace Inhaus\Plugins\Stellen;
|
|
|
|
use App\Models\User;
|
|
use Inhaus\Plugins\Stellen\Models\JobApplication;
|
|
use Inhaus\Plugins\Stellen\Models\JobPosting;
|
|
|
|
/**
|
|
* Daten der Stellen für das Portal.
|
|
*/
|
|
class Presenter
|
|
{
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public static function card(JobPosting $posting): array
|
|
{
|
|
return [
|
|
'id' => $posting->id,
|
|
'title' => $posting->title,
|
|
'department' => $posting->department,
|
|
'location' => $posting->location,
|
|
'employment' => $posting->employment,
|
|
'employment_label' => JobPosting::EMPLOYMENT[$posting->employment] ?? null,
|
|
'summary' => $posting->summary(),
|
|
'deadline' => $posting->deadline?->toDateString(),
|
|
'published_at' => $posting->published_at?->toIso8601String(),
|
|
'status' => $posting->status(),
|
|
'url' => route('jobs.show', $posting),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public static function detail(JobPosting $posting, User $viewer): array
|
|
{
|
|
$contact = $posting->contact?->is_active ? $posting->contact : null;
|
|
|
|
return [
|
|
...self::card($posting),
|
|
'hours' => $posting->hours,
|
|
'contract' => $posting->contract,
|
|
'contract_label' => JobPosting::CONTRACT[$posting->contract] ?? null,
|
|
'contract_note' => $posting->contract_note,
|
|
'pay_grade' => $posting->pay_grade,
|
|
'start' => $posting->start,
|
|
'description' => $posting->description,
|
|
'pdf' => $posting->pdf_path ? ['name' => $posting->pdf_name, 'url' => route('jobs.pdf', $posting)] : null,
|
|
'apply_mode' => $posting->apply_mode,
|
|
'apply_url' => $posting->apply_mode === 'link' ? $posting->apply_url : null,
|
|
'apply_email' => $posting->apply_mode === 'email' ? $posting->apply_email : null,
|
|
'contact' => $contact ? [
|
|
'id' => $contact->id, 'name' => $contact->name, 'initials' => $contact->initials, 'job_title' => $contact->job_title,
|
|
'email' => $contact->email, 'phone' => $contact->phone, 'avatar_url' => $contact->avatarUrl(96),
|
|
] : null,
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @return array<string, mixed>
|
|
*/
|
|
public static function application(JobApplication $application, bool $withPerson = false): array
|
|
{
|
|
return [
|
|
'id' => $application->id,
|
|
'status' => $application->status,
|
|
'status_label' => JobApplication::STATUSES[$application->status] ?? $application->status,
|
|
'message' => $application->message,
|
|
'file' => $application->file_path ? ['name' => $application->file_name, 'url' => route('jobs.applications.file', $application)] : null,
|
|
'created_at' => $application->created_at?->toIso8601String(),
|
|
'updated_at' => $application->updated_at?->toIso8601String(),
|
|
'note' => $withPerson ? $application->note : null,
|
|
'person' => $withPerson && $application->user ? [
|
|
'id' => $application->user->id, 'name' => $application->user->name, 'initials' => $application->user->initials,
|
|
'job_title' => $application->user->job_title, 'department' => $application->user->department,
|
|
'email' => $application->user->email, 'avatar_url' => $application->user->avatarUrl(96),
|
|
] : null,
|
|
];
|
|
}
|
|
}
|