| 15457 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace LeadersLinked\Form;
|
|
|
6 |
|
|
|
7 |
use Laminas\Form\Form;
|
|
|
8 |
use Laminas\Db\Adapter\AdapterInterface;
|
|
|
9 |
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
|
|
|
10 |
use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;
|
|
|
11 |
use LeadersLinked\Mapper\RecruitmentSelectionInterviewMapper;
|
|
|
12 |
use LeadersLinked\Mapper\CompanySizeMapper;
|
|
|
13 |
use LeadersLinked\Mapper\IndustryMapper;
|
|
|
14 |
use LeadersLinked\Mapper\JobCategoryMapper;
|
|
|
15 |
use LeadersLinked\Model\Job;
|
|
|
16 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
|
|
17 |
use LeadersLinked\Model\RecruitmentSelectionInterview;
|
|
|
18 |
|
|
|
19 |
class RecruitmentSelectionInterviewFormForm extends Form
|
|
|
20 |
{
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
*
|
|
|
24 |
* @param AdapterInterface $adapter
|
|
|
25 |
* @param int $company_id
|
|
|
26 |
* @param int $vacancy_id
|
|
|
27 |
*/
|
|
|
28 |
public function __construct($adapter, $company_id, $vacancy_id = 0)
|
|
|
29 |
{
|
|
|
30 |
parent::__construct();
|
|
|
31 |
$this->setInputFilter(new RecruitmentSelectionInterviewFormFilter($adapter));
|
|
|
32 |
|
|
|
33 |
$this->add([
|
|
|
34 |
'name' => 'vacancy_uuid',
|
|
|
35 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
36 |
'attributes' => [
|
|
|
37 |
'id' => 'vacancy_uuid',
|
|
|
38 |
],
|
|
|
39 |
'options' => [
|
|
|
40 |
'value_options' => $this->getSelectVacancyOptions($adapter, $company_id)
|
|
|
41 |
]
|
|
|
42 |
]);
|
|
|
43 |
|
|
|
44 |
$this->add([
|
|
|
45 |
'name' => 'candidate_uuid',
|
|
|
46 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
47 |
'attributes' => [
|
|
|
48 |
'id' => 'candidate_uuid',
|
|
|
49 |
],
|
|
|
50 |
'options' => [
|
|
|
51 |
'value_options' => $this->getSelectCandidateOptions($adapter, $company_id, $vacancy_id)
|
|
|
52 |
]
|
|
|
53 |
]);
|
|
|
54 |
|
|
|
55 |
$this->add([
|
|
|
56 |
'name' => 'content',
|
|
|
57 |
'type' => \Laminas\Form\Element\Textarea::class,
|
|
|
58 |
'attributes' => [
|
|
|
59 |
'id' => 'content',
|
|
|
60 |
]
|
|
|
61 |
]);
|
|
|
62 |
|
|
|
63 |
$this->add([
|
|
|
64 |
'name' => 'comment',
|
|
|
65 |
'type' => \Laminas\Form\Element\Textarea::class,
|
|
|
66 |
'attributes' => [
|
|
|
67 |
'id' => 'comment',
|
|
|
68 |
],
|
|
|
69 |
]);
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
$this->add([
|
|
|
73 |
'name' => 'points',
|
|
|
74 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
75 |
'options' => [
|
|
|
76 |
'empty_option' => 'LABEL_EVALUATION',
|
|
|
77 |
'value_options' => [
|
|
|
78 |
RecruitmentSelectionInterview::POINTS_0 => 'LABEL_ANOTHER',
|
|
|
79 |
RecruitmentSelectionInterview::POINTS_1 => '25%',
|
|
|
80 |
RecruitmentSelectionInterview::POINTS_2 => '50%',
|
|
|
81 |
RecruitmentSelectionInterview::POINTS_3 => '75%',
|
|
|
82 |
RecruitmentSelectionInterview::POINTS_4 => '100%',
|
|
|
83 |
|
|
|
84 |
],
|
|
|
85 |
],
|
|
|
86 |
'attributes' => [
|
|
|
87 |
'id' => 'points',
|
|
|
88 |
]
|
|
|
89 |
]);
|
|
|
90 |
|
|
|
91 |
$this->add([
|
|
|
92 |
'name' => 'status',
|
|
|
93 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
94 |
'options' => [
|
|
|
95 |
'empty_option' => 'LABEL_STATUS',
|
|
|
96 |
'value_options' => [
|
|
|
97 |
RecruitmentSelectionInterview::STATUS_ACCEPTED => 'Aceptado',
|
|
|
98 |
RecruitmentSelectionInterview::STATUS_REJECTED => 'Rechazado',
|
|
|
99 |
],
|
|
|
100 |
],
|
|
|
101 |
'attributes' => [
|
|
|
102 |
'id' => 'status',
|
|
|
103 |
]
|
|
|
104 |
]);
|
|
|
105 |
$this->add([
|
|
|
106 |
'name' => 'type',
|
|
|
107 |
'type' => \Laminas\Form\Element\Select::class,
|
|
|
108 |
'options' => [
|
|
|
109 |
'empty_option' => 'LABEL_INTERVIEWED_BY',
|
|
|
110 |
'value_options' => [
|
|
|
111 |
RecruitmentSelectionInterview::STATUS_HUMAN_RESOURCE => 'Recursos Humanos',
|
|
|
112 |
RecruitmentSelectionInterview::STATUS_BOSS => 'Jefe',
|
|
|
113 |
|
|
|
114 |
],
|
|
|
115 |
],
|
|
|
116 |
'attributes' => [
|
|
|
117 |
'id' => 'type',
|
|
|
118 |
]
|
|
|
119 |
]);
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
/**
|
|
|
123 |
*
|
|
|
124 |
* @param AdapterInterface $adapter
|
|
|
125 |
*/
|
|
|
126 |
private function getSelectVacancyOptions($adapter, $company_id)
|
|
|
127 |
{
|
|
|
128 |
$options = [];
|
|
|
129 |
|
|
|
130 |
$mapper = RecruitmentSelectionVacancyMapper::getInstance($adapter);
|
|
|
131 |
$records = $mapper->fetchAllByCompanyId($company_id);
|
|
|
132 |
|
|
|
133 |
foreach($records as $record)
|
|
|
134 |
{
|
|
|
135 |
$options[$record->uuid] = $record->name;
|
|
|
136 |
}
|
|
|
137 |
return $options;
|
|
|
138 |
}
|
|
|
139 |
|
|
|
140 |
/**
|
|
|
141 |
*
|
|
|
142 |
* @param AdapterInterface $adapter
|
|
|
143 |
*/
|
|
|
144 |
public function getSelectCandidateOptions($adapter, $company_id, $vacancy_id)
|
|
|
145 |
{
|
|
|
146 |
$options = [];
|
|
|
147 |
|
|
|
148 |
$mapper = RecruitmentSelectionCandidateMapper::getInstance($adapter);
|
|
|
149 |
$records = $mapper->fetchAllByCompanyIdAndVacancyId($company_id, $vacancy_id);
|
|
|
150 |
|
|
|
151 |
foreach($records as $record)
|
|
|
152 |
{
|
|
|
153 |
$options[$record->uuid] = $record->first_name;
|
|
|
154 |
}
|
|
|
155 |
return $options;
|
|
|
156 |
}
|
|
|
157 |
}
|