getDeliveryNoteModule();
$this->setTitle('Bons de livraison');
$this->addBreadcrumb($this->getTitle());
$this->addButton(['label' => 'Nouveau bon de livraison ', 'url' => ['distribution/index', 'message_generate_bl' => 1], 'class' => 'btn btn-primary']);
?>
= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'status',
'label' => 'Statut',
'filter' => [
'draft' => 'Brouillon',
'valid' => 'Valide',
],
'format' => 'raw',
'value' => function ($model) use ($deliveryNoteModule) {
return $deliveryNoteModule->getHtmlLabel($model);
}
],
[
'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' => 'date_distribution',
'header' => 'Jour de distribution',
'filter' => \yii\jui\DatePicker::widget([
'language' => 'fr',
'dateFormat' => 'dd/MM/yyyy',
'model' => $searchModel,
'attribute' => 'date_distribution',
'options' => ['class' => 'form-control']
]),
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) use ($deliveryNoteModule) {
$distribution = $deliveryNoteModule->getDistribution($model);
return $distribution ? date('d/m/Y', strtotime($distribution->date)) : '';
}
],
[
'attribute' => 'id_point_sale',
'header' => 'Point de vente',
'filter' => ArrayHelper::map(PointSale::searchAll([], ['as_array' => true]), 'id', 'name'),
'format' => 'html',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) use ($deliveryNoteModule) {
$pointSale = $deliveryNoteModule->getPointSale($model);
return $pointSale ? Html::encode($pointSale->name) : '';
}
],
[
'attribute' => 'amount',
'header' => 'Montant',
'value' => function ($deliveryNote) use ($deliveryNoteModule) {
return $deliveryNoteModule->getAmountWithTax($deliveryNote, Order::INVOICE_AMOUNT_TOTAL, true);
}
],
[
'attribute' => 'with_invoice',
'header' => 'Facture',
'filter' => [
0 => 'Non',
1 => 'Oui',
],
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($deliveryNote) use ($deliveryNoteModule) {
$invoice = $deliveryNoteModule->getSolver()->getInvoice($deliveryNote);
if($invoice) {
return Html::a($invoice->reference, ['invoice/update', 'id' => $invoice->id], ['class' => 'btn btn-xs btn-default']);
}
return '';
}
],
[
'attribute' => 'is_sent',
'header' => 'Envoyé',
'filter' => [
0 => 'Non',
1 => 'Oui',
],
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) {
if ($model->is_sent) {
return '
Oui';
} else {
return '
Non';
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{validate} {update} {delete} {send} {download}',
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'send' => function ($url, $deliveryNote) use ($deliveryNoteModule) {
return ((isset($deliveryNote->user) && strlen($deliveryNote->user->email) > 0) ? Html::a('
', $url, [
'title' => 'Envoyer', 'class' => 'btn btn-default'
]) : '');
},
'download' => function ($url, $deliveryNote) {
return Html::a('
', $url, [
'title' => 'Télécharger', 'class' => 'btn btn-default'
]);
},
'validate' => function ($url, $deliveryNote) use ($deliveryNoteModule) {
return ($deliveryNoteModule->isStatusDraft($deliveryNote) ? Html::a('
', $url, [
'title' => 'Valider', 'class' => 'btn btn-default'
]) : '');
},
'update' => function ($url, $deliveryNote) {
return Html::a('
', $url, [
'title' => 'Modifier', 'class' => 'btn btn-default'
]);
},
'delete' => function ($url, $deliveryNote) use ($deliveryNoteModule) {
return ($deliveryNoteModule->isStatusDraft($deliveryNote) ? Html::a('
', $url, [
'title' => 'Supprimer', 'class' => 'btn btn-default'
]) : '');
}
],
],
],
]); ?>
Aucun bon de livraison enregistré