<?php

use yii\helpers\Html;
use wsipl\models\Saldo;
use wsipl\models\Usermember;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel app\models\SessionkelasSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'INVOICE';
//$this->params['breadcrumbs'][] = $this->title;
?>
<!-- Content Header (Page header) -->
<section class="content-header">    
  <h1 style="text-transform:capitalize; ">
    <?= $this->title; ?>
     <small></small> 
    </h1>
  <ol class="breadcrumb">
    <!-- <li><a href="#" data-toggle="control-sidebar"><i class="fa fa-dashboard"></i> GANTI BULAN</a>  </li> -->
    
  </ol>
  <br>
</section>
<?php 
      // echo $create =  Html::a('<i class="glyphicon glyphicon-plus"></i> PESAN ', ['create-inv'], ['class' => 'btn btn-success']);
?>
<div class="box">

  <div class="box-body">
  </div>
  <div class="box-body" style="overflow: auto;">
  <table id="datatables_w0" class="table" style="width:100%">
        <thead>
            <tr>
                <th>No</th>
                <th>INV</th>
                <th>Tanggal Invoice</th>
                <th>Jatuh Tempo</th>
                <th>Total</th>
                <th>Status</th>
            </tr>
        </thead>
        <tbody>
            <?php
            $no = 1;
            foreach($loghist as $loghist){
            ?>            
            <tr>
                <td><?php echo $no++; ?></td>
                <td><?php echo $loghist->vKode; ?></td>
                <td><?php echo $loghist->dateStart; ?></td>
                <td><?php echo $loghist->dateFinish; ?></td>
                <td><?php echo $loghist->vNilai; ?></td>
                <td>

                <?php if ($loghist->eStatus === 'PROSES'){ ?>

                    <?= \yii\helpers\Html::a(
                        '<i class="fa fa-file-text-o"></i> Invoice Detail',
                        ['/admin/view-inv', 'id' => $loghist->vKode],
                        [
                            'class' => 'btn btn btn-danger',
                        ]
                    ) ?>

                <?php } else if ($loghist->eStatus === 'VERIFIKASI'){ ?>

                    <?= \yii\helpers\Html::a(
                        '<i class="fa fa-file-text-o"></i> Verifikasi',
                        ['/admin/view-inv', 'id' => $loghist->vKode],
                        [
                            'class' => 'btn btn-s btn-warning',
                            
                        ]
                    ) ?>

                <?php } else if ($loghist->eStatus === 'GRATIS'){ ?>

                    <span class="btn btn-s btn-success">
                        <?= $loghist->eStatus ?>
                    </span>
                    

                <?php } else { ?>

                    <!-- <span class="label label-success">
                        <?= $loghist->eStatus ?>
                    </span> -->
                    <?= \yii\helpers\Html::a(
                        '<i class="fa fa-file-text-o"></i> Pembayaran Diterima',
                        ['/admin/view-inv', 'id' => $loghist->vKode],
                        [
                            'class' => 'btn btn-s btn-success',
                            
                        ]
                    ) ?>

                <?php } ?>

                <?php

                if(Yii::$app->user->identity->id=='256'){
                    if ($loghist->eStatus === 'VERIFIKASI'){
                    echo \yii\helpers\Html::a(
                        '<i class="fa fa-file-text-o"></i> OK BOSS',
                        ['/admin/verif-inv', 'id' => $loghist->vKode],
                        [
                            'class' => 'btn btn-s btn-danger',
                            
                        ]
                    );
                    }
                }

                ?>


                </td>
            </tr>
            <?php
      }
            ?>
        </tbody>
</table>
  
                
    </div>
</div>
