<?php $__env->startSection('title', trans('user.views.balance.title')); ?>

<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-md-12">
            <div class="page-header">
                <h1><?php echo e(trans('user.views.balance.header')); ?> - <?php echo e(format_balance($balance->amount)); ?> <small><?php echo e(trans('user.views.balance.subheader')); ?></small></h1>
            </div>

            <?php echo $__env->make('user._partials.navigation', ['_active_navigation' => 'balance'], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>

            <hr>

            <div class="row">
                <div class="col-lg-10 col-lg-offset-1">
                    <p class="small text-center">
                        <?php echo e(trans('user.views.balance.note')); ?>

                    </p>

                    <hr>

                    <div class="row">
                        <div class="col-lg-5 col-lg-push-1">
                            <p class="form-control-static text-center">
                                <strong>
                                    <?php echo e(trans('user.views.balance.balance')); ?>:
                                    <span class="<?php if($balance->amount < 0): ?> text-danger <?php elseif($balance->amount > 0): ?> text-success <?php else: ?> text-muted <?php endif; ?>"><?php echo e(format_balance($balance->amount)); ?></span>
                                </strong>
                            </p>
                        </div>
                        <div class="col-lg-5 text-center">
                            <a href="<?php echo e(route('furnizor.balance.add')); ?>" class="btn btn-success"><?php echo e(trans('user.views.balance.add_funds')); ?></a>
                        </div>
                    </div>

                    <hr>

                    <?php echo Notification::showAll(); ?>


                    <?php if(count($history) > 0): ?>
                        <table class="table table-striped table-hover">
                            <thead>
                            <tr>
                                <th><?php echo e(trans('user.views.balance.table.type')); ?></th>
                                <th><?php echo e(trans('user.views.balance.table.amount')); ?></th>
                                <th><?php echo e(trans('user.views.balance.table.amount_before')); ?></th>
                                <th><?php echo e(trans('user.views.balance.table.amount_after')); ?></th>
                                <th><?php echo e(trans('user.views.balance.table.description')); ?></th>
                                <th><?php echo e(trans('user.views.balance.table.date')); ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php foreach($history as $item): ?>
                                <tr>
                                    <td>
                                        <?php if($item->type == 'in'): ?>
                                            <span class="label label-success"><i class="fa fa-arrow-up"></i></span>
                                        <?php else: ?>
                                            <span class="label label-danger"><i class="fa fa-arrow-down"></i></span>
                                        <?php endif; ?>
                                    </td>
                                    <td><span class="<?php if($item->type == 'out'): ?> text-danger <?php else: ?> text-success <?php endif; ?>"><?php echo e(format_balance($item->amount)); ?></span></td>
                                    <td><span class="<?php if($item->amount_before < 0): ?> text-danger <?php elseif($item->amount_before > 0): ?> text-success <?php else: ?> text-muted <?php endif; ?>"><?php echo e(format_balance($item->amount_before)); ?></span></td>
                                    <td><span class="<?php if($item->amount_after < 0): ?> text-danger <?php elseif($item->amount_after > 0): ?> text-success <?php else: ?> text-muted <?php endif; ?>"><?php echo e(format_balance($item->amount_after)); ?></span></td>
                                    <td><?php echo e($item->historable->getHistoryTitle()); ?></td>
                                    <td><?php echo e($item->created_at); ?></td>
                                </tr>
                            <?php endforeach; ?>
                            </tbody>
                        </table>
                    <?php else: ?>
                        <div class="alert alert-info" role="alert"><?php echo trans('user.views.balance.table.empty'); ?></div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('app', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>