<?php $__env->startSection('content'); ?>
    <?php Fun::lang()?>
    <?php echo $__env->make('hr.exchange-rate.confirm-delete', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
    <div class="top-header">
        <ol class="breadcrumb">
            <li><a href="#"><?php echo e(__('administrator.dashboard')); ?></a></li>
            <li><a href="#"><?php echo e(__('administrator.exchange_rate')); ?></a></li>
        </ol>
    </div>
    <div class="page">
        <div class="top-content">
            <div class="row">
                <div class="col-sm-6 col-xs-12">
                    <div class="title-add">
                        <div class="pull-left">
                            <h3><?php echo e(__('administrator.exchange_rate')); ?> </h3>
                        </div>
                    </div>
                </div>
                <div class="col-sm-6 col-xs-12">
                    <div class="title-add">
                        <div class="pull-right">
                            <?php if(Gate::check('Exchange Rate Create')): ?>
                                <a href="<?php echo e(route('hr-exchange-rate.create')); ?>"
                                   class="button_primary"><?php echo e(__('administrator.add_new')); ?></a>
                            <?php endif; ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="box-body">
            <table id="datatable_products" width="100%" class="table table-striped">
                <thead>
                    <tr>
                        <th>#</th>
                        <th><?php echo e(__('administrator.name')); ?></th>
                        <th><?php echo e(__('administrator.symbol')); ?></th>
                        <th><?php echo e(__('administrator.code')); ?></th>
                        <th><?php echo e(__('administrator.rate')); ?></th>
                        <th><?php echo e(__('administrator.action')); ?></th>
                    </tr>
                </thead>
                <tbody>
                <?php $__currentLoopData = $currency; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <tr>
                        <td><?php echo e($key+1); ?></td>
                        <td><?php echo e($row->name); ?></td>
                        <td><?php echo e($row->symbol); ?></td>
                        <td><?php echo e($row->code); ?></td>
                        <td><?php echo e($row->rate); ?></td>
                        <td>
                            <?php if($key === 0): ?>
                                <a href="javascript:void(0)" class="button_info btn_history" title="History"><i class="fa fa-history"></i> </a>
                            <?php endif; ?>

                        </td>
                    </tr>
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                </tbody>
            </table>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('script'); ?>
    <script type="text/javascript">
        $(document).ready(function () {

        });
        $(document).on('click', '.btn_history', function () {
            $.get("<?php echo e(route('hr.history-currency')); ?>", function (data) {
                let row = '';
                $.each(data, function (k,v) {
                    row += `<tr>
                                <td>${k+1}</td>
                                <td>${v.name}</td>
                                <td>${v.symbol+' '+v.old_rate}</td>
                                <td>${v.date}</td>
                            </tr>
                        `;
                })
                $.confirm({
                    title: 'History Currency!',
                    content: `
                        <table id="datatable_products" width="100%" class="table table-striped">
                            <thead>
                                <tr>
                                    <th width="5%">#</th>
                                    <th><?php echo e(__('administrator.currency')); ?></th>
                                    <th><?php echo e(__('administrator.rate')); ?></th>
                                    <th><?php echo e(__('administrator.date')); ?></th>
                                </tr>
                            </thead>
                            <tbody>
                            ${row}
                            </tbody>
                        </table>
                    `,
                    columnClass: 'large',
                    buttons: {
                        close: function () {

                        },
                    }
                });
            });

        });
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.app-hr', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/hr/exchange-rate/index.blade.php ENDPATH**/ ?>