getQuotationModule();
$userModule = $this->getUserModule();
$this->setTitle('Devis');
$this->addBreadcrumb($this->getTitle());
$this->addButton(['label' => 'Nouveau devis ', 'url' => 'quotation/create', 'class' => 'btn btn-primary']);
?>
= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'status',
'label' => 'Statut',
'filter' => [
'draft' => 'Brouillon',
'valid' => 'Valide',
],
'format' => 'raw',
'value' => function ($quotation) use ($quotationModule) {
return $quotationModule->getHtmlLabel($quotation);
}
],
[
'attribute' => 'reference',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) {
return (strlen($model->reference) > 0) ? $model->reference : '';
}
],
'name',
[
'attribute' => 'id_user',
'header' => 'Utilisateur',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($quotation) use ($userModule) {
return $userModule->getUsername($quotation->user);
}
],
[
'attribute' => 'date',
'header' => 'Date',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($quotation) {
return date('d/m/Y', strtotime($quotation->date));
}
],
[
'attribute' => 'amount',
'header' => 'Montant',
'value' => function ($quotation) use ($quotationModule) {
return $quotationModule->getAmountWithTax($quotation, 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, $quotation) use ($quotationModule) {
return ($quotationModule->isStatusValid($quotation) ? Html::a('
', $url, [
'title' => 'Transformer en facture', 'class' => 'btn btn-default'
]) : '');
},
'validate' => function ($url, $quotation) use ($quotationModule) {
return ($quotationModule->isStatusValid($quotation) ? Html::a('
', $url, [
'title' => 'Valider', 'class' => 'btn btn-default'
]) : '');
},
'send' => function ($url, $quotation) {
return ((isset($quotation->user) && strlen($quotation->user->email) > 0) ? Html::a('
', $url, [
'title' => 'Envoyer', 'class' => 'btn btn-default'
]) : '');
},
'download' => function ($url, $model) {
return Html::a('
', $url, [
'title' => 'Télécharger', 'class' => 'btn btn-default'
]);
},
'update' => function ($url, $quotation) use ($quotationModule) {
return ($quotationModule->isStatusDraft($quotation) ? Html::a('
', $url, [
'title' => 'Modifier', 'class' => 'btn btn-default'
]) : '');
},
'delete' => function ($url, $quotation) use ($quotationModule) {
return ($quotationModule->isStatusDraft($quotation) ? Html::a('
', $url, [
'title' => 'Supprimer', 'class' => 'btn btn-default'
]) : '');
}
],
],
],
]); ?>
Aucun devis enregistré