<?php
if ($this->session->userdata('isAdmin') != 1 && $hr_flag != 1) { ?>
    <div class="row">
        <!--  table area -->
        <div class="col-sm-12">

            <div class="panel panel-bd">

                <div class="panel-heading panel-aligner">
                    <div class="panel-title">
                        <h4><?php echo "Final Interview" ?></h4>
                    </div>
                    <div class="mr-25">

                        <?php if ($this->permission->method('recruitment', 'create')->access()): ?>
                            <button type="button" class="btn btn-primary btn-md" data-target="#add0"
                                    data-toggle="modal"><i
                                        class="fa fa-plus-circle" aria-hidden="true"></i>
                                <?php echo "Final Interview Form" ?></button>
                        <?php endif; ?>
                    </div>

                </div>

                <div class="panel-body">
                    <table width="100%" class="datatable table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th><?php echo display('cid') ?></th>
                            <th><?php echo display('name') ?></th>
                            <th><?php echo display('can_id') ?></th>
                            <th><?php echo display('job_adv_id') ?></th>
                            <th><?php echo display('interview_date') ?></th>
                            <th><?php echo display('interview_marks') ?></th>
                            <th><?php echo display('written_total_marks') ?></th>
                            <th><?php echo display('mcq_total_marks') ?></th>
                            <th><?php echo display('total_marks') ?></th>
                            <th><?php echo display('selection') ?></th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if (!empty($manager_interview)) { ?>
                            <?php $sl = 1; ?>
                            <?php foreach ($manager_interview as $que) { ?>
                                <tr class="<?php echo ($sl & 1) ? "odd gradeX" : "even gradeC" ?>">
                                    <td><?php echo $sl; ?></td>
                                    <td><?php echo $que->firstname . ' ' . $que->lastname; ?></td>
                                    <td><?php echo $que->can_id; ?></td>
                                    <td><?php echo $que->position_name; ?></td>
                                    <td><?php echo $que->interview_date; ?></td>
                                    <td><?php echo $que->interview_marks; ?></td>
                                    <td><?php echo $que->written_total_marks; ?></td>
                                    <td><?php echo $que->mcq_total_marks; ?></td>
                                    <td><?php echo $que->total_marks; ?></td>
                                    <td><?php echo $que->selection; ?></td>
                                </tr>
                                <?php $sl++; ?>
                            <?php } ?>
                        <?php } ?>
                        </tbody>
                    </table>  <!-- /.table-responsive -->
                </div>
            </div>
        </div>
    </div>
<?php } else { ?>
    <div class="row">
        <!--  table area -->
        <div class="col-sm-12">

            <div class="panel panel-bd">

                <div class="panel-heading panel-aligner">
                    <div class="panel-title">
                        <h4><?php echo "Final Interview" ?></h4>
                    </div>
                    <div class="mr-25">

                        <?php if ($this->permission->method('recruitment', 'create')->access()): ?>
                            <button type="button" class="btn btn-primary btn-md" data-target="#add0"
                                    data-toggle="modal"><i
                                        class="fa fa-plus-circle" aria-hidden="true"></i>
                                <?php echo "Final Interview Form" ?></button>
                        <?php endif; ?>
                        <?php if ($this->permission->method('recruitment', 'read')->access()): ?>
                            <a href="<?php echo base_url(); ?>/recruitment/Candidate_select/final_candidate_interview_view"
                               class="btn btn-primary"><?php echo display('manage_interview') ?></a>
                        <?php endif; ?>


                    </div>

                </div>

                <div class="panel-body">
                    <table width="100%" class="datatable table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th><?php echo display('cid') ?></th>
                            <th><?php echo display('name') ?></th>
                            <th><?php echo display('can_id') ?></th>
                            <th><?php echo display('job_adv_id') ?></th>
                            <th><?php echo display('interview_date') ?></th>
                            <th><?php echo display('interview_marks') ?></th>
                            <th><?php echo display('written_total_marks') ?></th>
                            <th><?php echo display('mcq_total_marks') ?></th>
                            <th><?php echo display('total_marks') ?></th>
                            <th><?php echo display('selection') ?></th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php if (!empty($interview)) { ?>
                            <?php $sl = 1; ?>
                            <?php foreach ($interview as $que) { ?>
                                <tr class="<?php echo ($sl & 1) ? "odd gradeX" : "even gradeC" ?>">
                                    <td><?php echo $sl; ?></td>
                                    <td><?php echo $que->firstname . ' ' . $que->lastname; ?></td>
                                    <td><?php echo $que->can_id; ?></td>
                                    <td><?php echo $que->position_name; ?></td>
                                    <td><?php echo $que->interview_date; ?></td>
                                    <td><?php echo $que->interview_marks; ?></td>
                                    <td><?php echo $que->written_total_marks; ?></td>
                                    <td><?php echo $que->mcq_total_marks; ?></td>
                                    <td><?php echo $que->total_marks; ?></td>
                                    <td><?php echo $que->selection; ?></td>
                                </tr>
                                <?php $sl++; ?>
                            <?php } ?>
                        <?php } ?>
                        </tbody>
                    </table>  <!-- /.table-responsive -->
                </div>
            </div>
        </div>
    </div>
<?php }
?>


<div id="add0" class="modal fade right" role="dialog">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <center><strong> INTERVIEW FORM</strong></center>
            </div>
            <div class="modal-body">
                <div class="row">
                    <div class="col-sm-12 col-md-12">
                        <div class="panel">
                            <div class="panel-heading">
                                <div class="panel-title">
                                    <h4><?php echo(!empty($title) ? $title : null) ?></h4>
                                </div>
                            </div>
                            <div class="panel-body">

                                <?php echo form_open('recruitment/Candidate_select/create_final_interview') ?>
                                <div class="form-group row">
                                    <label for="can_id"
                                           class="col-sm-2 col-form-label"><?php echo display('candidate_name') ?>
                                        *</label>
                                    <div class="col-sm-4">
                                        <?php
                                        if ($this->session->userdata('isAdmin') != 1 && $hr_flag != 1) { ?>
                                            <?php echo form_dropdown('can_id', $dropdowninterviewmanager, null, ' class="form-control" onchange="SelectToLoadInterview(this.value)" id="c_id" ') ?>
                                        <?php } else { ?>
                                            <?php echo form_dropdown('can_id', $dropdowninterview, null, ' class="form-control" onchange="SelectToLoadInterview(this.value)" id="c_id" ') ?>
                                        <?php }
                                        ?>

                                    </div>
                                    <label for="job_adv_id"
                                           class="col-sm-2 col-form-label"><?php echo display('job_adv_id') ?> *</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="position_name" class="form-control"
                                               placeholder="<?php echo display('position') ?>" readonly>
                                        <input type="hidden" name="job_adv_id" class="form-control">
                                    </div>
                                </div>

                                <div class="form-group row">
                                    <label for="interview_date"
                                           class="col-sm-2 col-form-label"><?php echo display('interview_date') ?>
                                        *</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="interview_date" class="datepicker form-control"
                                               placeholder="<?php echo display('interview_date') ?>"
                                               id="interview_date">
                                    </div>
                                    <label for="interviewer_id"
                                           class="col-sm-2 col-form-label"><?php echo display('interviewer_id') ?>
                                        *</label>
                                    <div class="col-sm-4">
                                        <input type="text" name="interviewer_id" class="form-control"
                                               placeholder="<?php echo display('interviewer_id') ?>"
                                               id="interviewer_id">
                                    </div>
                                </div>


                                <div class="form-group row">
                                    <label for="interview_marks"
                                           class="col-sm-2 col-form-label"><?php echo display('interview_marks') ?></label>
                                    <div class="col-sm-4">
                                        <input type="text" name="interview_marks" class="txt form-control"
                                               placeholder="<?php echo display('interview_marks') ?>"
                                               id="interview_marks">
                                    </div>
                                    <label for="written_total_marks"
                                           class="col-sm-2 col-form-label"><?php echo display('written_total_marks') ?></label>
                                    <div class="col-sm-4">
                                        <input type="text" name="written_total_marks" class="txt form-control"
                                               placeholder="<?php echo display('written_total_marks') ?>"
                                               id="written_total_marks">
                                    </div>
                                </div>


                                <div class="form-group row">
                                    <label for="mcq_total_marks"
                                           class="col-sm-2 col-form-label"><?php echo display('mcq_total_marks') ?></label>
                                    <div class="col-sm-4">
                                        <input type="text" name="mcq_total_marks" class="txt form-control"
                                               placeholder="<?php echo display('mcq_total_marks') ?>"
                                               id="mcq_total_marks">
                                    </div>
                                    <label for="total_marks"
                                           class="col-sm-2 col-form-label"><?php echo display('total_marks') ?></label>
                                    <div class="col-sm-4">
                                        <input type="text" name="total_marks" class=" form-control"
                                               placeholder="<?php echo display('total_marks') ?>" id="total_marks">
                                    </div>
                                </div>

                                <div class="form-group row">
                                    <label for="recommandation"
                                           class="col-sm-2 col-form-label"><?php echo display('recommandation') ?></label>
                                    <div class="col-sm-4">
                                        <input type="text" name="recommandation" class="form-control"
                                               placeholder="<?php echo display('recommandation') ?>"
                                               id="recommandation">
                                    </div>
                                    <label for="selection"
                                           class="col-sm-2 col-form-label"><?php echo display('selection') ?> *</label>
                                    <div class="col-sm-4">

                                        <select name="selection" class="form-control"
                                                placeholder="<?php echo display('selection') ?>" id="selection">
                                            <option value="">Selection type</option>
                                            <option value="ok">Selected</option>
                                            <option value="No">Deselected</option>

                                        </select>
                                    </div>
                                </div>


                                <div class="form-group row">
                                    <label for="details"
                                           class="col-sm-2 col-form-label"><?php echo display('details') ?></label>
                                    <div class="col-sm-10">
                                        <textarea name="details" class="form-control"
                                                  placeholder="<?php echo display('details') ?>"
                                                  id="details"></textarea>
                                    </div>
                                </div>


                                <div class="form-group form-group-margin text-right">
                                    <button type="reset"
                                            class="btn btn-primary w-md m-b-5"><?php echo display('reset') ?></button>
                                    <?php
                                    if ($this->session->userdata('isAdmin') != 1) { ?>
                                        <button onclick="return confirm('<?php echo "Are you sure to submit? You cannot edit after submission" ?>') "
                                                type="submit"
                                                class="btn btn-success w-md m-b-5"><?php echo display('Ad') ?></button>
                                    <?php } else { ?>
                                        <button type="submit"
                                                class="btn btn-success w-md m-b-5"><?php echo display('Ad') ?></button>
                                    <?php }
                                    ?>

                                </div>
                                <?php echo form_close() ?>

                            </div>
                        </div>
                    </div>
                </div>


            </div>

        </div>
        <div class="modal-footer">

        </div>

    </div>

</div>

<script src="<?php echo base_url('assets/js/recruitment.js') ?>" type="text/javascript"></script>