|
- <?php
-
-
-
- $this->setTitle('Devis');
- $this->addBreadcrumb($this->getTitle());
- $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plus"></span>', 'url' => 'quotation/create', 'class' => 'btn btn-primary']);
-
- ?>
-
- <div class="quotation-index">
- <?php if(Quotation::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' => 'id_user',
- '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::AMOUNT_TOTAL, true) ;
- }
- ],
- [
- 'class' => 'yii\grid\ActionColumn',
- 'template' => '{transform} {validate} {update} {delete} {send} {download}',
- 'headerOptions' => ['class' => 'column-actions'],
- 'contentOptions' => ['class' => 'column-actions'],
- 'buttons' => [
- 'transform' => function ($url, $model) {
- return ($model->isStatusValid() ? Html::a('<span class="glyphicon glyphicon-check"></span>', $url, [
- 'title' => 'Transformer en facture', 'class' => 'btn btn-default'
- ]) : '');
- },
- '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'
- ]);
- },
- 'update' => function ($url, $model) {
- return ($model->isStatusDraft() ? 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">Aucun devis enregistré</div>
- <?php endif; ?>
- </div>
|