|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
-
-
-
- use yii\helpers\Html;
- use yii\grid\GridView;
- use common\helpers\Url;
- use common\models\Product;
- use common\models\TaxRate;
- use common\models\Producer;
-
- $this->setTitle('Factures');
- $this->addBreadcrumb($this->getTitle());
- $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-plus"></span>', 'url' => 'invoice/create', 'class' => 'btn btn-primary']);
-
- ?>
-
- <div class="invoice-index">
-
- <?php if(Invoice::searchCount()): ?>
- <?= GridView::widget([
- 'filterModel' => $searchModel,
- 'dataProvider' => $dataProvider,
- 'columns' => [
- [
- 'attribute' => 'status',
- 'label' => 'Statut',
- 'filter' => [
- 'draft' => 'Brouillon',
- 'valid' => 'Valide',
- ],
- 'format' => 'raw',
- 'value' => function($model) {
- return $model->getHtmlLabel() ;
- }
- ],
- [
- 'attribute' => 'reference',
- 'value' => function($model) {
- if(strlen($model->reference) > 0) {
- return $model->reference ;
- }
- return '' ;
- }
- ],
- 'name',
- [
- 'attribute' => 'username',
- 'header' => 'Utilisateur',
- 'value' => function($model) {
- return $model->user->getUsername() ;
- }
- ],
- [
- 'attribute' => 'date',
- 'header' => 'Date',
- 'value' => function($model) {
- return date('d/m/Y',strtotime($model->date)) ;
- }
- ],
- [
- 'attribute' => 'amount',
- 'header' => 'Montant',
- 'value' => function($invoice) {
- return $invoice->getAmountWithTax(Order::INVOICE_AMOUNT_TOTAL, true) ;
- }
- ],
- [
- 'attribute' => 'is_sent',
- 'header' => 'Envoyé',
- 'format' => 'raw',
- 'value' => function($model) {
- if($model->is_sent) {
- return '<span class="label label-success">Oui</span>';
- }
- else {
- return '<span class="label label-danger">Non</span>';
- }
- }
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{validate} {update} {delete} {send} {download} {export-csv-evoliz}',
- 'headerOptions' => ['class' => 'column-actions'],
- 'contentOptions' => ['class' => 'column-actions'],
- 'buttons' => [
- 'validate' => function ($url, $model) {
- return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-ok"></span>', $url, [
- 'title' => 'Valider', 'class' => 'btn btn-default'
- ]) : '');
- },
- 'send' => function($url, $model) {
- return ((isset($model->user) && strlen($model->user->email) > 0) ? Html::a('<span class="glyphicon glyphicon-send"></span>', $url, [
- 'title' => 'Envoyer', 'class' => 'btn btn-default'
- ]) : '');
- },
- 'download' => function($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-download-alt"></span>', $url, [
- 'title' => 'Télécharger', 'class' => 'btn btn-default'
- ]);
- },
- 'export-csv-evoliz' => function($url, $model) {
- if(Producer::getConfig('option_export_evoliz')) {
- return Html::a('<span class="glyphicon glyphicon-save-file"></span> Evoliz', $url, [
- 'title' => 'Export CSV Evoliz', 'class' => 'btn btn-default'
- ]);
- }
-
- return '';
- },
- 'update' => function ($url, $model) {
- return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [
- 'title' => 'Modifier', 'class' => 'btn btn-default'
- ]);
- },
- 'delete' => function ($url, $model) {
- return ($model->isStatusDraft() ? Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, [
- 'title' => 'Supprimer', 'class' => 'btn btn-default'
- ]) : '');
- }
- ],
- ],
- ],
- ]); ?>
- <?php else: ?>
- <div class="alert alert-info">Aucune facture enregistrée</div>
- <?php endif; ?>
- </div>
|