Переглянути джерело

[Administration] Responsive > listes : accès aux boutons d'action #756

feature/souke
Guillaume Bourgeois 1 рік тому
джерело
коміт
410fd3065d
6 змінених файлів з 208 додано та 144 видалено
  1. +9
    -0
      backend/views/delivery-note/index.php
  2. +12
    -0
      backend/views/invoice/index.php
  3. +152
    -139
      backend/views/point-sale/index.php
  4. +9
    -0
      backend/views/quotation/index.php
  5. +17
    -4
      backend/views/subscription/index.php
  6. +9
    -1
      backend/views/user/index.php

+ 9
- 0
backend/views/delivery-note/index.php Переглянути файл

@@ -72,6 +72,9 @@ $this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon gl
],
[
'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 : '';
}
@@ -87,6 +90,9 @@ $this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon gl
'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 ($deliveryNoteManager) {
$distribution = $deliveryNoteManager->getDistribution($model);
return $distribution ? date('d/m/Y', strtotime($distribution->date)) : '';
@@ -97,6 +103,9 @@ $this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon gl
'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 ($deliveryNoteManager) {
$pointSale = $deliveryNoteManager->getPointSale($model);
return $pointSale ? Html::encode($pointSale->name) : '';

+ 12
- 0
backend/views/invoice/index.php Переглянути файл

@@ -73,6 +73,9 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
],
[
'attribute' => 'reference',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($invoice) {
return (strlen($invoice->reference) > 0) ? $invoice->reference : '';
}
@@ -81,6 +84,9 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
[
'attribute' => 'username',
'header' => 'Utilisateur',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($invoice) use ($userManager) {
return $userManager->getUsername($invoice->user);
}
@@ -88,6 +94,9 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
[
'attribute' => 'date',
'header' => 'Date',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($invoice) {
return date('d/m/Y', strtotime($invoice->date));
}
@@ -103,6 +112,9 @@ $this->addButton(['label' => 'Nouvelle facture <span class="glyphicon glyphicon-
'attribute' => 'is_sent',
'header' => 'Envoyé',
'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 '<span class="label label-success">Oui</span>';

+ 152
- 139
backend/views/point-sale/index.php Переглянути файл

@@ -46,153 +46,166 @@ $pointSaleManager = $this->getPointSaleManager();
$this->setTitle('Points de vente');
$this->addBreadcrumb($this->getTitle());
$this->addButton(
[
'label' => 'Nouveau point de vente <span class="glyphicon glyphicon-plus"></span>',
'url' => 'point-sale/create',
'class' => 'btn btn-primary'
]
[
'label' => 'Nouveau point de vente <span class="glyphicon glyphicon-plus"></span>',
'url' => 'point-sale/create',
'class' => 'btn btn-primary'
]
);

?>

<div class="point-sale-index">
<?= 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 .= ' <span class="label label-default">Boîte à pain</span> ';
}
'filterModel' => $searchModel,
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'name',
'label' => 'Nom',
'format' => 'raw',
'value' => function ($model) {
$html = '';
$html .= $model->name;
if ($model->is_bread_box) {
$html .= ' <span class="label label-default">Boîte à pain</span> ';
}

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) use ($pointSaleManager) {
return $pointSaleManager->getStrDeliveryDays($model);
}
],
[
'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 .= '<span class="glyphicon glyphicon-lock"></span> ';
if ($count == 1) {
$html .= '1 utilisateur';
} else {
$html .= $count . ' utilisateurs';
}
}
return $html;
}
],
[
'attribute' => 'locality',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
],
[
'attribute' => 'delivery',
'label' => 'Livraison',
'filter' => [
'monday' => 'Lundi',
'tuesday' => 'Mardi',
'wednesday' => 'Mercredi',
'thursday' => 'Jeudi',
'friday' => 'Vendredi',
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'value' => function ($model) use ($pointSaleManager) {
return $pointSaleManager->getStrDeliveryDays($model);
}
],
[
'attribute' => 'access_type',
'label' => 'Accès',
'filter' => [
'open' => 'Ouvert',
'code' => 'Code',
'restricted_access' => 'Accès restreint'
],
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) {
$count = UserPointSale::find()->where(
['id_point_sale' => $model->id]
)->count();
$html = '';
if ($model->restricted_access) {
$html .= '<span class="glyphicon glyphicon-lock"></span> ';
if ($count == 1) {
$html .= '1 utilisateur';
} else {
$html .= $count . ' utilisateurs';
}
}

if (strlen($model->code)) {
if (strlen($html)) {
$html .= '<br />';
}
$html .= 'Code : <strong>' . Html::encode(
$model->code
) . '</strong>';
}
if (strlen($model->code)) {
if (strlen($html)) {
$html .= '<br />';
}
$html .= 'Code : <strong>' . Html::encode(
$model->code
) . '</strong>';
}

return $html;
}
],
[
'attribute' => 'credit',
'label' => 'Crédit',
'format' => 'raw',
'value' => function ($model) {
if ($model->credit && isset(Producer::$creditFunctioningArray[$model->credit_functioning])) {
return '<span class="glyphicon glyphicon-euro"></span> ' . Producer::$creditFunctioningArray[$model->credit_functioning];
}
return $html;
}
],
[
'attribute' => 'credit',
'label' => 'Crédit',
'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->credit && isset(Producer::$creditFunctioningArray[$model->credit_functioning])) {
return '<span class="glyphicon glyphicon-euro"></span> ' . 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(
'<span class="glyphicon glyphicon-star"></span>',
['point-sale/default', 'id' => $model->id],
[
'title' => 'Point de vente par défaut',
'class' => 'btn btn-default'
]
);
} else {
return Html::a(
'<span class="glyphicon glyphicon-star-empty"></span>',
['point-sale/default', 'id' => $model->id],
[
'title' => '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(
'<span class="glyphicon glyphicon-pencil"></span>',
$url,
[
'title' => 'Modifier',
'class' => 'btn btn-default'
]
);
},
'delete' => function ($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-trash"></span>',
$url,
[
'title' => 'Supprimer',
'class' => 'btn btn-default'
]
);
}
],
],
],
]); ?>
return '';
}
],
[
'attribute' => 'default',
'label' => 'Par défaut',
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'td-default column-hide-on-mobile'],
'value' => function ($model) {
if ($model->default) {
return Html::a(
'<span class="glyphicon glyphicon-star"></span>',
['point-sale/default', 'id' => $model->id],
[
'title' => 'Point de vente par défaut',
'class' => 'btn btn-default'
]
);
} else {
return Html::a(
'<span class="glyphicon glyphicon-star-empty"></span>',
['point-sale/default', 'id' => $model->id],
[
'title' => '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(
'<span class="glyphicon glyphicon-pencil"></span>',
$url,
[
'title' => 'Modifier',
'class' => 'btn btn-default'
]
);
},
'delete' => function ($url, $model) {
return Html::a(
'<span class="glyphicon glyphicon-trash"></span>',
$url,
[
'title' => 'Supprimer',
'class' => 'btn btn-default'
]
);
}
],
],
],
]); ?>
</div>

+ 9
- 0
backend/views/quotation/index.php Переглянути файл

@@ -70,6 +70,9 @@ $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plu
],
[
'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 : '';
}
@@ -78,6 +81,9 @@ $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plu
[
'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 ($userManager) {
return $userManager->getUsername($quotation->user);
}
@@ -85,6 +91,9 @@ $this->addButton(['label' => 'Nouveau devis <span class="glyphicon glyphicon-plu
[
'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));
}

+ 17
- 4
backend/views/subscription/index.php Переглянути файл

@@ -78,6 +78,9 @@ $subscriptionsArray = Subscription::searchAll() ;
'attribute' => 'product_name',
'label' => 'Produits',
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function($model) {
$productManager = ProductManager::getInstance();
$html = '' ;
@@ -116,6 +119,9 @@ $subscriptionsArray = Subscription::searchAll() ;
'attribute' => 'date_begin',
'label' => 'Période',
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function($model) {
$html = '<small>' ;
if($model->date_end) {
@@ -149,7 +155,9 @@ $subscriptionsArray = Subscription::searchAll() ;
'saterday' => 'Samedi',
'sunday' => 'Dimanche',
],
'contentOptions' => ['class' => 'text-small'],
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'text-small column-hide-on-mobile'],
'value' => function($model) {
$html = '' ;
if($model->monday) {
@@ -188,7 +196,11 @@ $subscriptionsArray = Subscription::searchAll() ;
1 => 'Toutes les semaines',
2 => 'Toutes les 2 semaines',
3 => 'Toutes les 3 semaines',
4 => 'Tous les mois'],
4 => 'Tous les mois'
],
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function($model) {
if($model->week_frequency == 1) {
return 'Toutes les semaines' ;
@@ -203,8 +215,9 @@ $subscriptionsArray = Subscription::searchAll() ;
'attribute' => 'auto_payment',
'format' => 'raw',
'label' => 'Paiement automatique',
'headerOptions' => ['class' => 'column-auto-payment'],
'contentOptions' => ['class' => 'column-auto-payment'],
'headerOptions' => ['class' => 'column-auto-payment column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-auto-payment column-hide-on-mobile'],
'filter' => [0 => 'Non', 1 => 'Oui'],
'value' => function($model) {
if($model->auto_payment) {

+ 9
- 1
backend/views/user/index.php Переглянути файл

@@ -76,6 +76,9 @@ $this->render('_menu', [
[
'attribute' => 'type',
'label' => 'Type',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) {
$userManager = UserManager::getInstance();
$typeArray = $userManager->getTypeChoicesArray();
@@ -89,6 +92,9 @@ $this->render('_menu', [
'attribute' => 'contacts',
'header' => 'Contacts',
'format' => 'raw',
'headerOptions' => ['class' => 'column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'value' => function ($model) {
$html = '';
if (strlen($model['phone'])) {
@@ -107,7 +113,9 @@ $this->render('_menu', [
'class' => 'yii\grid\ActionColumn',
'header' => 'Commandes',
'template' => '{orders}',
'headerOptions' => ['class' => 'actions'],
'headerOptions' => ['class' => 'actions column-hide-on-mobile'],
'filterOptions' => ['class' => 'column-hide-on-mobile'],
'contentOptions' => ['class' => 'column-hide-on-mobile'],
'buttons' => [
'orders' => function ($url, $model) {
$url = Yii::$app->urlManager->createUrl(['user/orders', 'id' => $model['id']]);

Завантаження…
Відмінити
Зберегти