@@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class PeopleWorkdesk
|
||||
{
|
||||
public const STATES = ['draft', 'open', 'assessment', 'selection_review', 'selected', 'contract_draft'];
|
||||
public const STATES = ['draft', 'open', 'assessment', 'selection_review', 'selected', 'contract_draft', 'contract_formalized'];
|
||||
|
||||
/** @param Builder<PeopleProcess> $query
|
||||
* @return array<string,mixed>
|
||||
@@ -29,14 +29,18 @@ class PeopleWorkdesk
|
||||
foreach ((clone $query)->orderBy('id')->lazyById(100) as $record) {
|
||||
$total++;
|
||||
// Preparing a draft does not close a hiring process or prove a signed contract.
|
||||
$active++;
|
||||
$active += $record->status === 'contract_formalized' ? 0 : 1;
|
||||
$contractDrafts += $record->status === 'contract_draft' ? 1 : 0;
|
||||
$scopes = $access->scopes($actor, $record);
|
||||
$prepare = ! $maintenance && in_array('prepare', $scopes, true) && $workflow->allowed($actor, $record->kind, 'prepare');
|
||||
$review = ! $maintenance && in_array('review', $scopes, true) && $workflow->allowed($actor, $record->kind, 'review');
|
||||
$approve = ! $maintenance && in_array('approve', $scopes, true) && $workflow->allowed($actor, $record->kind, 'review');
|
||||
$approve = ! $maintenance && $workflow->canConfirm($actor, $record);
|
||||
$contract = ! $maintenance && in_array('contract', $scopes, true) && $workflow->allowed($actor, $record->kind, 'prepare');
|
||||
$base = ['process_id' => $record->id, 'reference' => 'PES-'.$record->id, 'title' => $record->title, 'kind' => $record->kind, 'status' => $record->status];
|
||||
$title = $record->title;
|
||||
if (app(ThirdPartyHiring::class)->isClientProcess($record) && isset($record->rules['client']['name'])) {
|
||||
$title .= ' · Cliente: '.$record->rules['client']['name'];
|
||||
}
|
||||
$base = ['process_id' => $record->id, 'reference' => 'PES-'.$record->id, 'title' => $title, 'kind' => $record->kind, 'status' => $record->status];
|
||||
$pendingTriage = in_array($record->status, ['open', 'assessment'], true) ? app(CandidateTriage::class)->pending($record) : 0;
|
||||
$item = fn (string $action, string $label, ?string $due = null, ?int $application = null) => [...$base,
|
||||
'id' => $record->id.':'.$action.($application === null ? '' : ':'.$application), 'action' => $action, 'label' => $label, 'due_on' => $due,
|
||||
|
||||
Reference in New Issue
Block a user