<?php

use yii\helpers\Html;
use yii\grid\GridView;
use common\models\User ;
use common\models\Etablissement ;

$this->title = 'Facturation';
$this->params['breadcrumbs'][] = 'Administration' ;
$this->params['breadcrumbs'][] = $this->title;

?>

<h1>Facturation</h1>

<?= GridView::widget([
    'dataProvider' => $datas_factures,
    'columns' => [
        [
            'attribute' => 'reference',
            'label' => 'Référence',
        ],
        [
            'attribute' => 'id_etablissement',
            'label' => 'Établissement',
            'value' => function($model) {
                return Html::encode($model->etablissement->nom) ;
            }
        ],
        'libelle',
        [
            'attribute' => 'montant_ht',
            'label' => 'Montant',
            'value' => function($model) {
                return number_format($model->montant_ht,2).' €' ;
            }
        ],
        [
            'attribute' => 'paye',
            'label' => 'Payé',
            'format' => 'raw',
            'value' => function($model) {
                if($model->paye)
                {
                    return '<span class="label label-success">Oui</span>' ;
                }
                else {
                    return '<span class="label label-danger">Non</span>' ;
                }
            }
        ]
    ],
]); ?>