<?php $__env->startSection('head'); ?>

    
    <?php echo HTML::style("assets/global/css/plugins.css"); ?>

    <?php echo HTML::style("assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.css"); ?>


<?php $__env->stopSection(); ?>

<?php $__env->startSection('mainarea'); ?>
    <div class="col-md-9">
        <!--Profile Body-->
        <div class="profile-body">
            <div class="row">
                <!--Profile Post-->
                <div class="col-sm-12 margin-bottom-20">


                    <div class="panel">
                        <div class="panel-heading  service-block-u">
                            <h3 class="panel-title"><i class="fa fa-tasks"></i> <?php echo e(trans('core.myLeaveApp')); ?></h3>
                        </div>
                        <div class="panel-body">
                            
                            <div id="alert_message">
                                <?php if(Session::get('success_leave')): ?>
                                    <div class="alert alert-success"><i
                                                class="fa fa-check"></i> <?php echo Session::get('success_leave'); ?></div>
                                <?php endif; ?>

                                <?php if(Session::get('error_leave')): ?>
                                    <div class="alert alert-danger alert-dismissable ">
                                        <button type="button" class="close" data-dismiss="alert"
                                                aria-hidden="true"></button>
                                        <?php $__currentLoopData = Session::get('error_leave'); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $error): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <p><strong><i class="fa fa-warning"></i></strong> <?php echo $error; ?></p>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </div>
                                <?php endif; ?>
                            </div>
                            
                            <table class="table table-striped table-bordered table-hover" id="applications">
                                <thead>
                                <tr>
                                    <th><?php echo e(trans('core.id')); ?></th>
                                    <th><?php echo e(trans('core.date')); ?></th>
                                    <th class="text-center"><?php echo e(trans('core.days')); ?></th>
                                    <th><?php echo e(trans('core.type')); ?></th>

                                    <th><?php echo e(trans('core.reason')); ?></th>
                                    <th><?php echo e(trans('core.appliedOn')); ?></th>
                                    <th><?php echo e(trans('core.status')); ?></th>
                                    <th><?php echo e(trans('core.action')); ?></th>

                                </tr>
                                </thead>
                                <tbody>
                                <tr>
                                    <td>  </td>
                                    <td class="text-center">  </td>
                                    <td>  </td>
                                    <td>  </td>
                                    <td>  </td>
                                    <td>  </td>
                                    <td>  </td>
                                    <td>  </td>
                                </tr>

                                </tbody>

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


                    <!--End Profile Post-->


                </div><!--/end row-->


                <div class="col-sm-12 ">
                    <div class="panel panel-profile no-bg">
                        <div class="panel-heading overflow-h  service-block-u">
                            <h2 class="panel-title heading-sm pull-left"><?php echo app('translator')->get('core.leavesLeft'); ?></h2>
                        </div>
                        <div class="panel-body panelHolder">
                            <table class="table table-light margin-bottom-0">
                                <tbody>
                                <?php $__currentLoopData = $leaveTypesData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $leaveType): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td><span class="primary-link"><?php echo e(ucfirst($leaveType->leaveType)); ?></span></td>
                                        <?php if(strtolower($leaveType->leaveType) == "annual"): ?>
                                            <td><?php echo e($employee->annual_leave); ?></td>
                                        <?php elseif(($key = array_search($leaveType->leaveType, $takenLeaveTypes)) !== FALSE ): ?>
                                            <td><?php echo e($leaveType->num_of_leave - $takenLeaves[$key]); ?></td>
                                        <?php else: ?>
                                            <td><?php echo e($leaveType->num_of_leave); ?></td>
                                        <?php endif; ?>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>


            </div>
            <!--End Profile Body-->
        </div>

    </div>


    


    <div class="modal fade show_notice" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel"
         aria-hidden="true" id="modal-data">
        <div class="modal-dialog">
            <div class="modal-content">

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


    

<?php $__env->stopSection(); ?>

<?php $__env->startSection('footerjs'); ?>
    <?php echo HTML::script("assets/global/plugins/datatables/datatables.min.js"); ?>

    <?php echo HTML::script("assets/global/plugins/datatables/plugins/bootstrap/datatables.bootstrap.js"); ?>


    <script>

        var table = $('#applications').dataTable(
            {
                processing: true,
                serverSide: true,
                "ajax": "<?php echo e(URL::route("front.leave_applications")); ?>",
                "aaSorting": [[0, "asc"]],
                columns: [
                    {data: 'id', name: 'id'},
                    {data: 'start_date', name: 'start_date'},
                    {data: 'days', name: 'days'},
                    {data: 'leaveType', name: 'leaveType'},
                    {data: 'reason', name: 'reason'},
                    {data: 'applied_on', name: 'applied_on'},
                    {data: 'application_status', name: 'application_status'},
                    {data: 'edit', name: 'edit', "bSortable": false}
                ],
                "sPaginationType": "full_numbers",
                "language": {
                    "lengthMenu": "Display _MENU_ records per page",
                    "info": "Showing page _PAGE_ of _PAGES_",
                    "emptyTable": "<?php echo e(trans('messages.noDataTable')); ?>",
                    "infoFiltered": "(filtered from _MAX_ total records)",
                    "search": "<?php echo e(trans('core.search')); ?>:"
                },
                "fnRowCallback": function (nRow, aData, iDisplayIndex) {
                    var oSettings = this.fnSettings();
                    $("td:first", nRow).html(oSettings._iDisplayStart + iDisplayIndex + 1);
                    return nRow;
                }

            });


        function show_application(id) {
            var url = "<?php echo e(route('leaves.show',':id')); ?>";
            url = url.replace(':id', id);
            $.ajaxModal('#modal-data', url);
        }

        <?php if(Session::get('error_leave')): ?>
        $("html, body").animate({scrollTop: $('#applications').height() + 600}, 2000);
        <?php endif; ?>


    </script>


<?php $__env->stopSection(); ?>

<?php echo $__env->make('front.layouts.frontlayout', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/dmwachinga/projects/hr/KodiHRM/resources/views/front/leave.blade.php ENDPATH**/ ?>