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

<?php $__env->startSection('content'); ?>
<div class="tp-dashboard-head"><!-- page header -->
  <div class="container">
    <div class="row">
      <div class="col-md-12 profile-header">
        <div class="profile-pic col-md-2">
          <?php if($user->logo != null): ?>

          <img src="<?php echo e($user->logo_thumb); ?>" alt="" class="img-circle">
          <?php else: ?>
          <img src="<?php echo e(asset('images/couple-profile.jpg')); ?>" alt="" class="img-circle">
          <?php endif; ?>
        </div>
        <div class="profile-info col-md-9">
          <h1 class="profile-title"><?php echo e($user->name); ?><small>#</small></h1>
        </div>
      </div>
    </div>
  </div>
</div>
<!-- /.page header -->
<div class="tp-dashboard-nav">
  <div class="container">
    <div class="row">
      <div class="col-md-12 dashboard-nav">
          <?php echo $__env->make('vendor._partials.navigation', ['_active_navigation' => 'balance'], array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
      </div>
    </div>
  </div>
</div>
<div class="main-container">
	<div class="container">
		<div class="row">
		  <div class="col-md-12">
			<div class="dashboard-page-head">
			  <div class="page-header">
				<h1>Credit - <?php echo e(format_balance($balance->amount)); ?> <small><?php echo e(trans('user.views.balance.subheader')); ?></small></h1>
			  </div>
			</div>
		  </div>
		</div>
		<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>
								Credit:
								<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">Adauga credit</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(); ?>