<?php //exit('asdf');?>
<table class="data-list-table" id="wrapper" data-table="simpleDataTables" style="width:100% !important">
    <thead>
        <tr>
            <th colspan="3" style="text-align: center; font-size:18px">
                
                Employee Leave Data
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td style="text-align:center;font-weight: bold;" colspan="3">Employee Information<br>
                <hr style="margin: 2px;"></td>
        </tr>
        <?php if($lvData): ?>
        <tr>
            
            <td style="font-weight: bold"><?php echo e(__('messages.employee')); ?> <?php echo e(__('messages.name')); ?></td>
            <td style="width: 21px !important;"> : </td>
            <td style="font-weight: bold"><?php echo e($lvData->employee_name); ?></td>
        </tr>
        <tr>
            <td style="font-weight: bold"><?php echo e(__('messages.employee_no')); ?></td>
            <td> : </td>
            <td><?php echo e($lvData->employee_no ?: ''); ?></td>
        </tr>
        <tr>
            <td><?php echo e(__('messages.mobile_no')); ?></td>
            <td> : </td>
            <td><?php echo e($lvData->mobile_no ?? 'N/A'); ?></td>
        </tr>
        <tr>
            <td style="text-align:center;font-weight: bold;" colspan="3">Leave Information<br>
                <hr style="margin: 2px;">
                
            </td>
        </tr>
        <tr>
            <td>Leave Type</td>
            <td> : </td>
            <td> <?php echo $lvData->leave_type_name?></td>
        </tr>
        <tr>
            <td>Leave Days Of</td>
            <td> : </td>
            <td> <?php echo $lvData->total_days; echo ($lvData->total_days > 1) ? ' Days' : ' Day'?></td>
        </tr>
        <tr>
            <td style="width: 25% !important;">Leave Dates</td>
            <td> : </td>
            <td style="font-weight:bold">
                <?php
                $dates = explode(",", $lvData->leave_dates);
                foreach ($dates as $key => $dta) {
                    echo date('d-M-Y', strtotime($dta)) . ',&nbsp;&nbsp;';
                }
                ?>
            </td>
        </tr>
        <tr>
            <td>Leave Description</td>
            <td> : </td>
            <td> <?php echo $lvData->leave_description?></td>
        </tr>
        <tr>
            <td>Responsible Person</td>
            <td> : </td>
            <td> <?php echo $lvData->resp_name?></td>
        </tr>
        <tr>
            <td>Entry At</td>
            <td> : </td>
            <td> <?php echo date('d-M-Y', strtotime($lvData->added_on));?></td>
        </tr>
        <tr>
            <td>Leave Status</td>
            <td> : </td>
            <td> <?php echo ($lvData->lStatus == 2) ? 'Approved' : 'Pending';?></td>
        </tr>
        <tr>
            <td style="text-align:center;font-weight: bold;" colspan="3">Leave Documents<br>
                <hr style="margin: 2px;">
                
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <div style="height: 350px; overflow-y:scroll; width:100%">
                    <?php if($leaveDocuments): ?>
                        <?php $__currentLoopData = $leaveDocuments; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <div style="width:100%">
                                <span>
                                    <?php echo e(($key+1) . ') ' . substr($item->document_reference, 0, 10)); ?>

                                    <a href="<?php echo e(url('storage/leave_documents/'.$item->document_reference)); ?>" title="Click to download the files" style="font-size: 14px;line-height: 1;color:green" download="<?php echo e(($key+1) . ') ' . $item->document_reference); ?>">Download</a>
                                    <br>
                                    <?php
                                    $arr = explode(".", strtolower($item->document_reference));
                                    $extension = $arr[(count($arr) - 1)];
                                    if (in_array($extension, ['jpg', 'jpeg', 'png', 'gif'])) {
                                        ?>
                                        <img class="user-profile" style="width:100px; height:auto" src="<?php echo e(url('storage/leave_documents/'.$item->document_reference)); ?>" alt="">
                                        <?php
                                    } else {
                                        echo 'Not Image File';
                                    } ?>
                                    <br>
                                    <br>
                                </span>
                            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                    <?php endif; ?>
                </div>
            </td>
        </tr>
        <?php else: ?>
        <tr>
            <td style="text-align:center;font-weight: bold;" colspan="3">
                No data found !!!
            </td>
        </tr>
        <?php endif; ?>

    </tbody>
</table>
<script type="text/javascript">
    var tag = $("#tag").val();

    function saveAs(uri, filename) {
        var link = document.createElement('a');
        if (typeof link.download === 'string') {
            link.href = uri;
            link.download = filename;
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        } else {
            window.open(uri);
        }
    }

    $(document).ready(function () {
        $('#carouselExampleCaption').carousel({
            interval: 20000
        });
        let items = document.querySelectorAll('.carousel .carousel-item')
        items.forEach((el) => {
            const minPerSlide = 3
            let next = el.nextElementSibling
            for (var i = 1; i < minPerSlide; i++) {
                if (!next) {
                    next = items[0]
                }
                let cloneChild = next.cloneNode(true)
                el.appendChild(cloneChild.children[0])
                next = next.nextElementSibling
            }
        })
    });
</script>
<?php /**PATH /home/ussitbd/public_html/hr.ussitbd.com/resources/views/backend/hr/attend/leave_show.blade.php ENDPATH**/ ?>