1<?php
2/**
3 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures
4 * all the essential functionalities required for any enterprise.
5 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com
6 *
7 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of
8 * the GNU General Public License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along with this program;
16 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA  02110-1301, USA
18 *
19 */
20?>
21<?php use_javascripts_for_form($form) ?>
22<?php use_stylesheets_for_form($form) ?>
23
24<?php use_javascript(plugin_web_path('orangehrmRecruitmentPlugin', 'js/addCandidateSuccess')); ?>
25<?php $title = ($candidateId > 0) ? __('Candidate') : __('Add Candidate'); ?>
26<?php
27$allVacancylist[] = array("id" => "", "name" => __('-- Select --'));
28$allowedVacancylist[] = array("id" => "", "name" => __('-- Select --'));
29$allowedVacancylistWithClosedVacancies[] = array("id" => "", "name" => __('-- Select --'));
30$allowedVacancyIdArray[] = array();
31$closedVacancyIdArray[] = array();
32foreach ($jobVacancyList as $vacancy) {
33    $newVacancyId = $vacancy['id'];
34    $newVacancyName = ($vacancy['status'] == JobVacancy::CLOSED) ? $vacancy['name'] . " (" . __('Closed') . ")" : $vacancy['name'];
35    $allVacancylist[] = array("id" => $newVacancyId, "name" => $newVacancyName);
36    if (in_array($vacancy['id'], $form->allowedVacancyList)) {
37        $allowedVacancylistWithClosedVacancies[] = array("id" => $newVacancyId, "name" => $newVacancyName);
38        $allowedVacancyIdArray[] = $newVacancyId;
39        if ($vacancy['status'] == JobVacancy::ACTIVE) {
40            $allowedVacancylist[] = array("id" => $newVacancyId, "name" => $newVacancyName);
41        } else {
42            $closedVacancyIdArray[] = $newVacancyId;
43        }
44    }
45}
46?>
47<style type="text/css">
48.actionDrpDown {
49    width: 170px;
50    margin:1px 10px 0 10px;
51}
52</style>
53<?php if($candidatePermissions->canRead()){?>
54<div class="box" id="addCandidate">
55
56    <div class="head"><h1 id="addCandidateHeading"><?php echo $title; ?></h1></div>
57    <div class="inner">
58        <?php include_partial('global/flash_messages', array('prefix' => 'addcandidate')); ?>
59        <form name="frmAddCandidate" id="frmAddCandidate" method="post" action="<?php echo url_for('recruitment/addCandidate?id=' . $candidateId); ?>" enctype="multipart/form-data">
60
61            <?php echo $form['_csrf_token']; ?>
62            <fieldset>
63                <ol>
64                    <li class="line nameContainer">
65
66                        <label class="hasTopFieldHelp"><?php echo __('Full Name'); ?></label>
67                        <ol class="fieldsInLine">
68                            <li>
69                                <div class="fieldDescription"><em>*</em> <?php echo __('First Name'); ?></div>
70                                <?php echo $form['firstName']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
71                            </li>
72                            <li>
73                                <div class="fieldDescription"><?php echo __('Middle Name'); ?></div>
74                                 <?php echo $form['middleName']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
75                            </li>
76                            <li>
77                                <div class="fieldDescription"><em>*</em> <?php echo __('Last Name'); ?></div>
78                                <?php echo $form['lastName']->render(array("class" => "formInputText", "maxlength" => 35)); ?>
79                            </li>
80                        </ol>
81
82                    </li>
83
84                    <li>
85
86                        <?php echo $form['email']->renderLabel(__('Email') . ' <em>*</em>'); ?>
87                        <?php echo $form['email']->render(array("class" => "formInputText")); ?>
88                    </li>
89                    <li>
90                        <?php echo $form['contactNo']->renderLabel(__('Contact No'), array("class " => "contactNoLable")); ?>
91                        <?php echo $form['contactNo']->render(array("class" => "contactNo")); ?>
92                    </li>
93                </ol>
94                <ol>
95                    <li  class="line">
96                        <?php echo $form['vacancy']->renderLabel(__('Job Vacancy'), array("class" => "vacancyDrpLabel")); ?>
97                        <?php echo $form['vacancy']->render(array("class" => "vacancyDrp")); ?>
98
99
100                        <?php if ($candidateId > 0) : ?>
101                            <?php $existingVacancyList = $actionForm->candidate->getJobCandidateVacancy(); ?>
102                            <?php if ($existingVacancyList[0]->getVacancyId() > 0) : ?>
103                        <div id="actionPane" style="float:left; width:600px; padding-top:0px">
104                                <?php $i = 0 ?>
105                                <?php foreach ($existingVacancyList as $candidateVacancy) {
106                                    ?>
107                                    <div id="<?php echo $i ?>">
108                                    <?php
109                                    $widgetName = $candidateVacancy->getId();
110                                    echo $actionForm[$widgetName]->render(array("class" => "actionDrpDown"));
111                                    ?>
112                                <span class="status" style="font-weight: bold"><?php echo __("Status") . ": " . __(ucwords(strtolower($candidateVacancy->getStatus()))); ?></span>
113                                    <?php
114                                }
115                                $i++;
116                                ?>
117
118                                <?php //} ?>
119
120                            <?php endif; ?>
121                        <?php endif; ?>
122                    </li>
123
124                    <!-- Resume block : Begins -->
125
126                    <li>
127
128                        <?php
129                        if ($form->attachment == "") {
130                            echo $form['resume']->renderLabel(__('Resume'), array("class " => "resume"));
131                            echo $form['resume']->render();
132                            echo "<label class=\"fieldHelpBottom\">" . __(CommonMessages::FILE_LABEL_DOC) . "</label>";
133                        } else {
134                            $attachment = $form->attachment;
135                            $linkHtml = "<div id=\"fileLink\"><a target=\"_blank\" class=\"fileLink\" href=\"";
136                            $linkHtml .= url_for('recruitment/viewCandidateAttachment?attachId=' . $attachment->getId());
137                            $linkHtml .= "\">{$attachmentName}</a></div>";
138
139                            echo $form['resumeUpdate']->renderLabel(__('Resume'));
140                            echo $linkHtml;
141                            echo "<li class=\"radio noLabel\" id=\"radio\">";
142                            echo $form['resumeUpdate']->render(array("class" => "fileEditOptions"));
143                            echo "</li>";
144                            echo "<li id=\"fileUploadSection\" class=\"noLabel\">";
145                            echo $form['resume']->renderLabel(' ');
146                            echo $form['resume']->render(array("class " => "duplexBox"));
147                            echo "<label class=\"fieldHelpBottom\">" . __(CommonMessages::FILE_LABEL_DOC) . "</label>";
148                            echo "</li>";
149                        }
150                        ?>
151                    </li>
152
153                    <!-- Resume block : Ends -->
154
155                    <li>
156                        <?php echo $form['keyWords']->renderLabel(__('Keywords'), array("class " => "keywrd")); ?>
157                        <?php echo $form['keyWords']->render(array("class" => "keyWords")); ?>
158                    </li>
159                    <li>
160                        <?php echo $form['comment']->renderLabel(__('Comment'), array("class " => "comment")); ?>
161                        <?php echo $form['comment']->render(array("class" => "formInputText", "cols" => 35, "rows" => 4)); ?>
162                    </li>
163                    <li>
164                        <?php echo $form['appliedDate']->renderLabel(__('Date of Application'), array("class " => "appDate")); ?>
165                        <?php echo $form['appliedDate']->render(array("class" => "formDateInput")); ?>
166                    </li>
167                    <li>
168                        <?php echo $form['consentToKeepData']->renderLabel(__('Consent to keep data')); ?>
169                        <?php echo $form['consentToKeepData']->render(array("class" => "checkbox")); ?>
170                    </li>
171                    <li class="required new">
172                        <em>*</em> <?php echo __(CommonMessages::REQUIRED_FIELD); ?>
173                    </li>
174                </ol>
175                <p>
176
177                    <?php if ($edit): ?>
178                        <?php if(($candidatePermissions->canCreate() && empty($candidateId)) || ($candidatePermissions->canUpdate() && $candidateId > 0)) {?>
179                        <input type="button"id="btnSave" value="<?php echo __("Save"); ?>"/>
180                        <?php }?>
181                    <?php endif; ?>
182                    <?php if ($candidateId > 0): ?>
183                        <input type="button" class="cancel" id="btnBack" value="<?php echo __("Back"); ?>"/>
184                    <?php endif; ?>
185
186                </p>
187            </fieldset>
188        </form>
189    </div>
190
191</div>
192
193<?php if ($candidateId > 0) : ?>
194    <?php $existingVacancyList = $actionForm->candidate->getJobCandidateVacancy(); ?>
195    <?php include_component('core', 'ohrmList', $parmetersForListCompoment); ?>
196<?php endif; ?>
197
198<!-- Confirmation box - delete HTML: Begins -->
199<div class="modal hide" id="deleteConfirmation">
200    <div class="modal-header">
201        <a class="close" data-dismiss="modal">×</a>
202        <h3><?php echo __('OrangeHRM - Confirmation Required'); ?></h3>
203    </div>
204    <div class="modal-body">
205        <p><?php echo __(CommonMessages::DELETE_CONFIRMATION); ?></p>
206    </div>
207    <div class="modal-footer">
208        <input type="button" class="btn" data-dismiss="modal" id="dialogDeleteBtn" value="<?php echo __('Ok'); ?>" />
209        <input type="button" class="btn reset" data-dismiss="modal" value="<?php echo __('Cancel'); ?>" />
210    </div>
211</div>
212<!-- Confirmation box HTML: Ends -->
213
214<!-- Confirmation box - remove vacancies & save HTML: Begins -->
215<div class="modal hide" id="deleteConfirmationForSave">
216    <div class="modal-header">
217        <a class="close" data-dismiss="modal">×</a>
218        <h3><?php echo __('OrangeHRM - Confirmation Required'); ?></h3>
219    </div>
220    <div class="modal-body">
221        <p><?php echo __("This action will remove previous vacancy"); ?></p>
222        <br>
223        <p><?php echo __('Remove?'); ?></p>
224    </div>
225    <div class="modal-footer">
226        <input type="button" class="btn" data-dismiss="modal" id="dialogSaveButton" value="<?php echo __('Ok'); ?>" />
227        <input type="button" class="btn reset" data-dismiss="modal" id="dialogCancelButton" value="<?php echo __('Cancel'); ?>" />
228    </div>
229</div>
230<!-- Confirmation box remove vacancies & save HTML: Ends -->
231<?php }?>
232<script type="text/javascript">
233    //<![CDATA[
234    var datepickerDateFormat = '<?php echo get_datepicker_date_format($sf_user->getDateFormat()); ?>';
235    var lang_firstNameRequired = '<?php echo __js(ValidationMessages::REQUIRED); ?>';
236    var lang_lastNameRequired = '<?php echo __js(ValidationMessages::REQUIRED); ?>';
237    var lang_emailRequired = '<?php echo __js(ValidationMessages::REQUIRED); ?>';
238    var lang_validDateMsg = '<?php echo __js(ValidationMessages::DATE_FORMAT_INVALID, array('%format%' => str_replace('yy', 'yyyy', get_datepicker_date_format($sf_user->getDateFormat())))) ?>';
239    var lang_validEmail = '<?php echo __js(ValidationMessages::EMAIL_INVALID); ?>';
240    var list = <?php echo json_encode($allVacancylist); ?>;
241    var allowedVacancylistWithClosedVacancies = <?php echo json_encode($allowedVacancylistWithClosedVacancies); ?>;
242    var allowedVacancylist = <?php echo json_encode($allowedVacancylist); ?>;
243    var allowedVacancyIdArray = <?php echo json_encode($allowedVacancyIdArray); ?>;
244    var closedVacancyIdArray = <?php echo json_encode($closedVacancyIdArray); ?>;
245    var lang_identical_rows = "<?php echo __js('Cannot assign same vacancy twice'); ?>";
246    var lang_tooLargeInput = "<?php echo __js(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 30)); ?>";
247    var lang_commaSeparated = "<?php echo __('Enter comma separated words') . '...'; ?>";
248    var currentDate = '<?php echo set_datepicker_date_format(date("Y-m-d")); ?>';
249    var lang_dateValidation = "<?php echo __js("Should be less than current date"); ?>";
250    var lang_validPhoneNo = "<?php echo __js(ValidationMessages::TP_NUMBER_INVALID); ?>";
251    var lang_noMoreThan250 = "<?php echo __js(ValidationMessages::TEXT_LENGTH_EXCEEDS, array('%amount%' => 250)); ?>";
252    var lang_edit = "<?php echo __js("Edit"); ?>";
253    var lang_save = "<?php echo __js("Save"); ?>";
254    var lang_cancel = "<?php echo __js("Cancel"); ?>";
255    var candidateId = "<?php echo $candidateId; ?>";
256    var attachment = "<?php echo $form->attachment; ?>"
257    var changeStatusUrl = '<?php echo url_for('recruitment/changeCandidateVacancyStatus?'); ?>';
258    var backBtnUrl = '<?php echo url_for('recruitment/viewCandidates?'); ?>';
259    var cancelBtnUrl = '<?php echo url_for('recruitment/addCandidate?'); ?>';
260    var interviewUrl = '<?php echo url_for('recruitment/jobInterview?'); ?>';
261    var interviewAction = '<?php echo WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_INTERVIEW; ?>';
262    var interviewAction2 = '<?php echo WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_2ND_INTERVIEW; ?>';
263    var removeAction = '<?php echo JobCandidateVacancy::REMOVE; ?>';
264    var lang_remove =  '<?php echo __js("Remove"); ?>';
265    var lang_editCandidateTitle = "<?php echo __js('Edit Candidate'); ?>";
266    var editRights = "<?php echo $edit; ?>";
267    var activeStatus = "<?php echo JobCandidate::ACTIVE; ?>";
268    var candidateStatus = "<?php echo $candidateStatus; ?>";
269    var invalidFile = "<?php echo $invalidFile; ?>";
270</script>
271