setTitle('Points de vente');
$this->addBreadcrumb($this->getTitle());
$this->addButton(
[
'label' => 'Nouveau point de vente ',
'url' => 'point-sale/create',
'class' => 'btn btn-primary'
]
);
?>
= GridView::widget([
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'name',
'label' => 'Nom',
'format' => 'raw',
'value' => function ($model) {
$html = '';
$html .= $model->name;
if ($model->is_bread_box) {
$html .= ' Boîte à pain ';
}
return $html;
}
],
'locality',
[
'attribute' => 'delivery',
'label' => 'Livraison',
'filter' => [
'monday' => 'Lundi',
'tuesday' => 'Mardi',
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'value' => function ($model) {
return $model->getStrDeliveryDays();
}
],
[
'attribute' => 'access_type',
'label' => 'Accès',
'filter' => [
'open' => 'Ouvert',
'code' => 'Code',
'restricted_access' => 'Accès restreint'
],
'format' => 'raw',
'value' => function ($model) {
$count = UserPointSale::find()->where(
['id_point_sale' => $model->id]
)->count();
$html = '';
if ($model->restricted_access) {
$html .= ' ';
if ($count == 1) {
$html .= '1 utilisateur';
} else {
$html .= $count . ' utilisateurs';
}
}
if (strlen($model->code)) {
if (strlen($html)) {
$html .= '
';
}
$html .= 'Code : ' . Html::encode(
$model->code
) . '';
}
return $html;
}
],
[
'attribute' => 'credit',
'label' => 'Crédit',
'format' => 'raw',
'value' => function ($model) {
if ($model->credit && isset(Producer::$creditFunctioningArray[$model->credit_functioning])) {
return ' ' . Producer::$creditFunctioningArray[$model->credit_functioning];
}
return '';
}
],
[
'attribute' => 'default',
'label' => 'Par défaut',
'format' => 'raw',
'contentOptions' => ['class' => 'td-default'],
'value' => function ($model) {
if ($model->default) {
return Html::a(
'',
['point-sale/default', 'id' => $model->id],
[
'title' => Yii::t(
'app',
'Point de vente par défaut'
),
'class' => 'btn btn-default'
]
);
} else {
return Html::a(
'',
['point-sale/default', 'id' => $model->id],
[
'title' => Yii::t(
'app',
'Point de vente par défaut'
),
'class' => 'btn btn-default'
]
);
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{update} {delete}',
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'update' => function ($url, $model) {
return Html::a(
'',
$url,
[
'title' => 'Modifier',
'class' => 'btn btn-default'
]
);
},
'delete' => function ($url, $model) {
return Html::a(
'',
$url,
[
'title' => 'Supprimer',
'class' => 'btn btn-default'
]
);
}
],
],
],
]); ?>