<?php
include("Views/HRM/UploadDocument.php");
include("Views/HRM/addDocumentType.php");

if ($permissions->hasPermission('editVolunteers')) {
    include("Views/HRM/EditVolunteer.php");
    include("Views/HRM/addNationality.php");
}
?>


<style>
    .divClass{
        border: 1px solid #4c0870;
        margin-bottom: 10px;
    }


    .table.dataTable{
        width:100% !important;
    }
    .b-r {
        border-left-width: 1px;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd;  
    }
    .profile-pic {
        text-align: center;
        border-radius: 100%;
        -moz-border-radius: 100%;
        -webkit-border-radius: 100%;
        /*width: auto;*/
        /*height: auto;*/
        border: 5px solid #4c0870;
        overflow: hidden;
        margin: 0 auto;
        background: #fafafa;
    }
    .profile-pic img {
        width: 188px;
        height: 188px;
        margin-top: 6px;
        border-radius: 100%;
        -moz-border-radius: 100%;
        -webkit-border-radius: 100%;
        overflow: hidden;
        -webkit-transition: all .3s ease-in-out;
        -moz-transition: all .3s ease-in-out;
        transition: all .3s ease-in-out;
    }
    .table thead tr >th{
        background-color:#4c0870;
        color:#fff;
    }
    .table thead tr th[class*='sorting_'] {
        color: #fff;
    }
    .table tbody tr td{
        font-size: 17px;
        font-weight: bold;
    }
    .bg-master-lighter {
        border:none;
        background-color:#fff;
        border-top:1px solid #ddd;  
    }

    #tableWithSearch_length{
        display: none;
    }

    a .btn.btn-success{
        border: 4px solid;
        border-radius: 8px;
    }
</style>

<?php
if (file_exists(upload_path . 'volunteer/' . $employee_ID . '.jpg')) {
    $filename = upload_url . 'volunteer/' . $employee_ID . '.jpg';
} else {
    $filename = SITE_LINK.'img/profiles/avatar.jpg';
}
//echo"<pre>";
//die(print_r($Content));
?>

<div class="wrapper">
    <div class="panel invoice">
        <div class="panel-body">
            <div id="DeleteAlert"></div>
            <div class="row">
                <a href="javascript:void(0)" id="print_data"  class="mainPageLinks" ><button type='button'  class='btn btn-success pull-right' ><i class='fa fa-print'></i> <?php print CommonLanguage::getMessage('print'); ?></button></a>
                <a href="#" class="mainPageLinks" data-toggle="modal" data-target="#document-modal" ><button type='button' class='btn btn-success pull-right' ><i class='fa fa-paperclip'></i> <?php print CommonLanguage::getMessage('upload_file'); ?></button></a>
                <?php if ($permissions->hasPermission('editVolunteers')) { ?>  <a href="#" class="mainPageLinks" data-toggle="modal" data-target="#Edit_Volunteer" ><button type='button' class='btn btn-success pull-right' ><i class='fa fa-pencil'></i> <?php print CommonLanguage::getMessage('Edit') ?></button></a><?php } ?>
                <br>
                <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
                    <h1><?php print CommonLanguage::getMessage('volunteer_info') . ' &#91; ' . $Content[0]["Volunteer_Name"] . ' - ' . $Content[0]["Volunteer_Work_ID"] . ' &#93;'; ?></h1>

                </div>

                <div class=" col-xs-2 col-sm-2 col-md-2 profile-col pull-right">
                    <div class="profile-pic">
                        <div class="profile-border" >
                            <img id="VolunteerImagePreview" src="<?php echo $filename; ?>" data-src="<?php echo $filename; ?>" alt="" >


                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-12 col-md-12 col-lg-12 divClass"  >
                <div class="col-sm-4 col-md-4 col-lg-4">
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('hr_pers') ?></h3>

                </div>
                <div class="col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('gender'); ?></label>
                            <div class="col-sm-4 "> <?php echo CommonLanguage::getMessage($Content[0]["Gender_Name"]); ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('blood_type'); ?></label>

                            <div class="col-sm-4 "><?php echo $Content[0]["Blood_Group_Name"]; ?></div>  

                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('dob'); ?></label>
                            <div class="col-sm-4 "> <?php echo $Content[0]["Volunteer_DOB"]; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('marital_status'); ?></label>
                            <div class="col-sm-4 "><?php echo CommonLanguage::getMessage($Content[0]['Merital_Status_Name']); ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('country'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Country_Name"]; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('city'); ?></label>
                            <div class="col-sm-4 " ><?php echo $Content[0]["Name"]; ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('home_phone'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_HomePhone"]; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('mobile_phone'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_MobilePhone"]; ?></div>

                        </div>
                    </div>

                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('record_number'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_RecordNumber"]; ?></div>

                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('nationality'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Nationality_Name"]; ?></div>  

                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('Email'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_Email"]; ?></div>

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


            <div class="col-sm-12 col-md-12 col-lg-12 divClass"  >
                <div class="col-sm-4 col-md-4 col-lg-4">
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('hr_pers_prob') ?></h3>
                </div>
                <div class="col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('child_prob'); ?></label>
                            <div class="col-sm-4 "> <?php echo $Content[0]["Volunteer_Problem"]; ?></div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-12 col-md-12 col-lg-12 divClass"  >
                <div class="col-sm-4 col-md-4 col-lg-4">
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('hr_pers_edu') ?></h3>
                </div>

                <div class="col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('emp_edu'); ?></label>
                            <div class="col-sm-4 "> <?php echo $Content[0]["Volunteer_Education"]; ?></div>
                            <label class="col-sm-2 control-label"><?php print CommonLanguage::getMessage('emp_major'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_Major"]; ?></div>
                        </div>
                    </div>
                </div>
            </div>



            <div class="col-sm-12 col-md-12 col-lg-12 divClass"      >
                <div class="col-sm-4 col-md-4 col-lg-4" >
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('hr_vlnt_work') ?></h3>
                </div>  
                <div class="col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <div class="form-group">
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('work_id'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_Work_ID"]; ?></div>
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('working_hours'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["working_hours"]; ?></div>

                        </div>
                    </div>


                    <div class="row">
                        <div class="form-group">


                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('start_date'); ?></label>
                            <div class="col-sm-4 "><?php echo $Content[0]["Volunteer_StartDate"] ?></div>
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('volunteer_notice'); ?></label>
                            <div class="col-sm-4 "><?php
                                $i = 0;
                                foreach ($Content[0]['volunteer_notice_arr'] as $skills) {
                                    echo $skills . ($i == 0 ? ',' : '');
                                    $i++;
                                }
                                ?></div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="form-group">


                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('volunteer_team'); ?></label>
                            <div class="col-sm-4 "> <?php
                                $i = 0;
                                foreach ($Content[0]['volunteer_team_arr'] as $skills) {
                                    echo $skills . ($i == 0 ? ',' : '');
                                    $i++;
                                }
                                ?></div>
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('volunteer_skills'); ?></label>
                            <div class="col-sm-4 ">

                                <?php
                                $i = 0;
                                foreach ($Content[0]['skills_name_arr'] as $skills) {
                                    echo $skills . ($i == 0 ? ',' : '');
                                    $i++;
                                }
                                ?>

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






                </div>

            </div>


            <div class="col-sm-12 col-md-12 col-lg-12 divClass"      >
                <div class="col-sm-4 col-md-4 col-lg-4" >
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('pro_list') ?></h3>
                </div>  
                <div class="col-sm-12 col-md-12 col-lg-12">
                    <div class="row">
                        <?php
                        $total = 0.0;
                        for ($i = 0; $i < count($Content[0]['details']); $i++) {
                            $Current = $Content[0]['details'][$i];
                            $total += $Content[0]['details'][$i]['vlnt_hours'];
                            ?>
                            <div class="col-md-12" style="border-bottom:1px solid #000;">
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('pro_name'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["pro_name"]; ?></div>
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('Date'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["pro_date"]; ?></div>
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('Location'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["pro_loc"]; ?></div>
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('Description'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["pro_desc"]; ?></div>
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('pro_link'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["pro_link"]; ?></div>
                                <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('hours'); ?></label>
                                <div class="col-sm-2 "><?php echo $Current["vlnt_hours"]; ?></div>

                            </div>
<?php } ?>
                        <div class="col-md-12">
                            <label class="col-sm-2 control-label "><?php print CommonLanguage::getMessage('real_work'); ?></label>
                            <div class="col-sm-2 "><?php echo $total . ' ' . CommonLanguage::getMessage('hour');
; ?></div>
                        </div>
                    </div>
                </div>
            </div>











            <div class="col-sm-12 col-md-12 col-lg-12 divClass"  >
                <div class="col-sm-4 col-md-4 col-lg-4">
                    <h3 class="text-left" style="border:6px solid #4c0870;background-color: #4c0870;color: #fff;"><?php echo CommonLanguage::getMessage('vlnt_doc_list') ?></h3>
                </div>

                <table class="table table-bordered table-hover demo-table-search" id="empDoc">
                    <thead>
                    <th  class="text-center"><?php print CommonLanguage::getMessage('doc_name'); ?></th>
                    <th  class="text-center"><?php print CommonLanguage::getMessage('comments'); ?></th>
                    <th  class="text-center"><?php print CommonLanguage::getMessage('Date'); ?></th>
                    <th  class="text-center"><?php print CommonLanguage::getMessage('Type'); ?></th>
                    <th  class="text-center" style="width:20%"><?php print CommonLanguage::getMessage('Action'); ?></th>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>







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

<div class="modal fade bs-example-modal-md" id="DeleteMedicalFromList" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:50%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title"><?php print CommonLanguage::getMessage('Confirm_Delete'); ?></h4>
                <div id="Delete_modalAlert" class="alert alert-success"></div>
            </div>
            <div class="modal-body">
                <form>
                    <div class="row">
                        <div class="col-sm-12 col-md-12 col-lg-12 ">
                            <div class="col-sm-12 col-md-12 col-lg-12" style="margin-top: 20px;">
                                <p><?php print CommonLanguage::getMessage('About_Delete'); ?> <strong class="Name"></strong> <strong class="Days">  </strong> </p>
                                <p><?php print CommonLanguage::getMessage('Proceed_Delete'); ?></p>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close'); ?></button>
                <button type="button" class="btn btn-danger" id="Medical_Delete" style="width:auto"><?php print CommonLanguage::getMessage('Save'); ?></button>
            </div>
        </div>
    </div>
</div>
<div class="modal fade bs-example-modal-md" id="DeleteEmergencyFromList" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:50%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title"><?php print CommonLanguage::getMessage('Confirm_Delete'); ?></h4>
                <div id="DeleteEmergency_modalAlert" class="alert alert-success"></div>
            </div>
            <div class="modal-body">
                <form>
                    <div class="row">
                        <div class="col-sm-12 col-md-12 col-lg-12 ">
                            <div class="col-sm-12 col-md-12 col-lg-12" style="margin-top: 20px;">
                                <p><?php print CommonLanguage::getMessage('About_Delete'); ?> <strong class="Name"></strong> </p>
                                <p><?php print CommonLanguage::getMessage('Proceed_Delete'); ?></p>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal"><?php print CommonLanguage::getMessage('Close'); ?></button>
                <button type="button" class="btn btn-danger" id="Emergency_Delete" style="width:auto"><?php print CommonLanguage::getMessage('delete'); ?></button>
            </div>
        </div>
    </div>
</div>
<script>
    var emp_id = <?php echo json_encode($employee_ID); ?>;
    var title = <?php echo json_encode(CommonLanguage::getMessage('vlnt_doc_list')); ?>;
    var emp_name = <?php echo json_encode($Content[0]["Volunteer_Name"]); ?>;
    var myurl = "HRM/printVltDetails/" + emp_id;
    var Submitted_Successfully = <?php echo json_encode(CommonLanguage::getMessage('Submitted_Successfully')); ?>,
            Failed_Submit = <?php echo json_encode(CommonLanguage::getMessage('Failed_Submit')); ?>;
    $(function () {
        RebuildDataTable((title + ' ' + emp_name), [0, 1, 2, 3], 'HRMAjax/EmployeeDocumentList', {emp_id: emp_id, Is_Vlnt: Is_Vlnt}, '#empDoc');
    });
    $("#print_data").on('click', function () {
        printPOSExternal(myurl);
    });
    function printPOSExternal(url) {
        $("#print_iframe").remove();
        $("<iframe id='print_iframe' style='position:absolute;top:0px;left:0;width:0px;height:0px;opacity:0;' src='" + url + "' '  ></iframe>").appendTo("body");
    }
</script>