@@ -457,11 +457,15 @@ class DistributionController extends BackendController | |||
{ | |||
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; | |||
$userManager = $this->getUserManager(); | |||
$user = $userManager->findOneUserById($idUser); | |||
$favoritePointSale = $userManager->getUserFavoritePointSale($user); | |||
$idFavoritePointSale = 0; | |||
if ($favoritePointSale) { | |||
$idFavoritePointSale = $favoritePointSale->id; | |||
if($user) { | |||
$favoritePointSale = $userManager->getUserFavoritePointSale($user); | |||
if ($favoritePointSale) { | |||
$idFavoritePointSale = $favoritePointSale->id; | |||
} | |||
} | |||
return [ |
@@ -183,7 +183,7 @@ class PointSaleController extends BackendController | |||
UserPointSale::deleteAll(['id_point_sale' => $id]); | |||
// Suppression du lien PointSaleDistribution pour toutes les distributions à venir | |||
$incomingDistributions = $distributionManager->findDistributionsIncoming(); | |||
$incomingDistributions = $distributionManager->findDistributionsIncoming(true); | |||
foreach ($incomingDistributions as $distribution) { | |||
PointSaleDistribution::deleteAll(['id_point_sale' => $id, 'id_distribution' => $distribution->id]); | |||
} |
@@ -142,6 +142,19 @@ class ProducerAdminController extends BackendController | |||
} | |||
} | |||
/** | |||
* Facturation producteur. | |||
*/ | |||
public function actionBilling(int $id) | |||
{ | |||
$producerManager = $this->getProducerManager(); | |||
$producer = $this->findModel($id); | |||
return $this->render('billing', [ | |||
'producer' => $producer, | |||
]); | |||
} | |||
public function actionUserTransfer($fromProducerId, $toProducerId, $withOrders = 1) | |||
{ | |||
$producerManager = $this->getProducerManager(); |
@@ -239,6 +239,7 @@ class UserController extends BackendController | |||
{ | |||
$userManager = $this->getUserManager(); | |||
$producerManager = $this->getProducerManager(); | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$model = $this->findModel($id); | |||
@@ -295,6 +296,7 @@ class UserController extends BackendController | |||
return $this->render('update', array_merge($this->initForm($model), [ | |||
'model' => $model, | |||
'pointSaleBillingArray' => $pointSaleManager->findByBillingUser($model) | |||
])); | |||
} | |||
@@ -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) : ''; |
@@ -67,18 +67,18 @@ $this->setPageTitle('Distributions') ; | |||
<div id="wrapper-app-distribution-index" :class="'wrapper-app-vuejs '+(loading ? '' : 'loaded')"> | |||
<div class="col-md-4"> | |||
<div id="calendar"> | |||
<v-date-picker | |||
<v-calendar | |||
is-inline | |||
is-expanded | |||
v-model="date" | |||
popover-visibility="hidden" | |||
firstDayOfWeek="1" | |||
color="green" | |||
:mode="calendar.mode" | |||
:formats="calendar.formats" | |||
:theme-styles="calendar.themeStyles" | |||
:attributes="calendar.attrs" | |||
@dayclick='dayClicked'> | |||
></v-date-picker> | |||
></v-calendar> | |||
</div> | |||
<div class="clr"></div> | |||
</div> | |||
@@ -107,7 +107,9 @@ $this->setPageTitle('Distributions') ; | |||
<span class="info-box-icon bg-yellow"><i class="fa fa-clone"></i></span> | |||
<div class="info-box-content"> | |||
<span class="info-box-text"> | |||
{{ countActiveProducts }} Produits<br /><br /> | |||
{{ countActiveProducts }} Produits<br /> | |||
<template v-if="isOneProductMaximumQuantityExceeded()"><span class="glyphicon glyphicon-alert"></span> Quantités max dépassées<br /></template> | |||
<br /> | |||
<button class="btn btn-default" @click="showModalProducts = true">Configurer</button> | |||
</span> | |||
</div> | |||
@@ -134,13 +136,15 @@ $this->setPageTitle('Distributions') ; | |||
<button class="btn btn-default" v-else data-active-product="0" :data-id-product="product.id" @click="productActiveClick"><span class="glyphicon glyphicon-remove"></span></button> | |||
</td> | |||
<td>{{ product.name }}</td> | |||
<td class="quantity-ordered">{{ product.quantity_ordered ? product.quantity_ordered + ' '+ ((product.unit == 'piece') ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') : '∅' }}</td> | |||
<td class="quantity-ordered"> | |||
<span v-if="isProductMaximumQuantityExceeded(product)" class="glyphicon glyphicon-alert"></span> | |||
{{ product.quantity_ordered ? product.quantity_ordered + ' '+ ((product.unit == 'piece') ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') : '∅' }} | |||
</td> | |||
<td class="quantity-max"> | |||
<div class="input-group"> | |||
<input type="text" class="form-control quantity-max" placeholder="∞" :data-id-product="product.id" v-model="product.productDistribution[0].quantity_max" @keyup="productQuantityMaxChange" /> | |||
<span class="input-group-addon">{{ (product.unit == 'piece') ? 'p.' : ' '+((product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') }}</span> | |||
</div> | |||
</td> | |||
</tr> | |||
</tbody> | |||
@@ -349,7 +353,11 @@ $this->setPageTitle('Distributions') ; | |||
<template v-else> | |||
{{ order.user.lastname+' '+order.user.name }} | |||
</template> | |||
<span class="shortcuts btn-group" role="group"> | |||
<a class="btn btn-default btn-sm" :href="baseUrl+'/user/credit?id='+order.id_user" data-toggle="popover" data-trigger="hover" data-placement="bottom" :data-content="order.user.credit.toFixed(2)+' €'"><span class="glyphicon glyphicon-euro"></span></a> | |||
<a class="btn btn-default btn-sm" :href="baseUrl+'/user/update?id='+order.id_user" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="Modifier"><span class="glyphicon glyphicon-user"></span></a> | |||
<a class="btn btn-default btn-sm" :href="baseUrl+'/user/orders?id='+order.id_user" data-toggle="popover" data-trigger="hover" data-placement="bottom" data-content="Voir les commandes"><span class="glyphicon glyphicon-eye-open"></span></a> | |||
</span> | |||
</span> | |||
<span v-else>{{ order.username }}</span> | |||
<span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span> | |||
@@ -458,7 +466,7 @@ $this->setPageTitle('Distributions') ; | |||
<span :class="'info-box-icon ' +((order.user.credit > 0) ? 'bg-green' : 'bg-red')"><i class="fa fa-user"></i></span> | |||
<div class="info-box-content"> | |||
<span class="info-box-text">Crédit utilisateur</span> | |||
<span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span> | |||
<span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span> | |||
</div> | |||
</div> | |||
@@ -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>'; |
@@ -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> |
@@ -1,6 +1,6 @@ | |||
<?php | |||
/** | |||
/** | |||
Copyright distrib (2018) | |||
contact@opendistrib.net | |||
@@ -34,56 +34,17 @@ sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||
Le fait que vous puissiez accéder à cet en-tête signifie que vous avez | |||
pris connaissance de la licence CeCILL, et que vous en avez accepté les | |||
termes. | |||
*/ | |||
*/ | |||
use yii\helpers\Html; | |||
use yii\grid\GridView; | |||
use common\models\ User ; | |||
use common\models\Etablissement ; | |||
use common\logic\Producer\Producer\Wrapper\ProducerManager; | |||
$this->title = 'Facturation'; | |||
$this->params['breadcrumbs'][] = 'Administration' ; | |||
$this->params['breadcrumbs'][] = $this->title; | |||
$this->setTitle('Facturation producteur ('.$producer->name.')') ; | |||
$this->addBreadcrumb(['label' => 'Producteurs', 'url' => ['index']]) ; | |||
$this->addBreadcrumb('Facturation') ; | |||
$producerManager = ProducerManager::getInstance(); | |||
?> | |||
<h1>Facturation</h1> | |||
<?= GridView::widget([ | |||
'dataProvider' => $datas_factures, | |||
'columns' => [ | |||
[ | |||
'attribute' => 'reference', | |||
'label' => 'Référence', | |||
], | |||
[ | |||
'attribute' => 'id_producer', | |||
'label' => 'Producteur', | |||
'value' => function($model) { | |||
return Html::encode($model->producer->name) ; | |||
} | |||
], | |||
'libelle', | |||
[ | |||
'attribute' => 'amount_ht', | |||
'label' => 'Montant', | |||
'value' => function($model) { | |||
return number_format($model->amount_ht,2).' €' ; | |||
} | |||
], | |||
[ | |||
'attribute' => 'paid', | |||
'label' => 'Payé', | |||
'format' => 'raw', | |||
'value' => function($model) { | |||
if($model->paid) | |||
{ | |||
return '<span class="label label-success">Oui</span>' ; | |||
} | |||
else { | |||
return '<span class="label label-danger">Non</span>' ; | |||
} | |||
} | |||
] | |||
], | |||
]); ?> | |||
<div class="producer-billing"> | |||
<?= $producerManager->getSummaryAmountsToBeBilled($producer, '12 derniers mois', 12, 'billing'); ?> | |||
</div> |
@@ -202,7 +202,7 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico | |||
], | |||
[ | |||
'class' => 'yii\grid\ActionColumn', | |||
'template' => '{update}', | |||
'template' => '{update} {billing}', | |||
'headerOptions' => ['class' => 'column-actions'], | |||
'contentOptions' => ['class' => 'column-actions'], | |||
'buttons' => [ | |||
@@ -216,6 +216,16 @@ $this->addButton(['label' => 'Nouveau producteur <span class="glyphicon glyphico | |||
] | |||
); | |||
}, | |||
'billing' => function ($url, $model) { | |||
return Html::a( | |||
'<span class="glyphicon glyphicon-euro"></span>', | |||
$url, | |||
[ | |||
'title' => 'Facturation', | |||
'class' => 'btn btn-default' | |||
] | |||
); | |||
}, | |||
], | |||
], | |||
], |
@@ -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)); | |||
} |
@@ -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) { |
@@ -49,64 +49,71 @@ $producerManager = $this->getProducerManager(); | |||
<div class="user-form" id="app-user-form"> | |||
<div class="col-md-8"> | |||
<?php $form = ActiveForm::begin([ | |||
'enableClientValidation' => false | |||
]); ?> | |||
<?= $form->field($model, 'type') | |||
->dropDownList( $userManager->getTypeChoicesArray(), [ | |||
'v-model' => 'type' | |||
]) ; ?> | |||
<?= $form->field($model, 'name_legal_person', ['options' => ['v-show' => "type == 'legal-person'"]])->textInput() ?> | |||
<?= $form->field($model, 'lastname')->textInput() ?> | |||
<?= $form->field($model, 'name')->textInput() ?> | |||
<?= $form->field($model, 'phone')->textInput() ?> | |||
<?= $form->field($model, 'email')->textInput() ?> | |||
<?= $form->field($model, 'address')->textarea() ?> | |||
<?php if($producerManager->getConfig('option_export_evoliz')): ?> | |||
<?= $form->field($model, 'evoliz_code')->textInput() ?> | |||
<?php endif; ?> | |||
<?= $form->field($model, 'points_sale')->checkboxlist( | |||
ArrayHelper::map($pointsSaleArray, 'id', function ($pointSale) use ($model) { | |||
$commentUserPointSale = isset($pointSale->userPointSale[0]) ? $pointSale->userPointSale[0]->comment : ''; | |||
$html = Html::encode($pointSale->name); | |||
if ($pointSale->restricted_access) { | |||
$html .= '<input type="text" placeholder="Commentaire" class="form-control" name="User[comment_point_sale_' . $pointSale->id . ']" value="' . (($model->id) ? Html::encode($commentUserPointSale) : '') . '" />'; | |||
} | |||
return $html; | |||
}), [ | |||
'encode' => false | |||
]); | |||
?> | |||
<?= $form->field($model, 'user_groups')->checkboxlist( | |||
ArrayHelper::map($userGroupsArray, 'id', function ($userGroup) use ($model) { | |||
return Html::encode($userGroup->name); | |||
}), [ | |||
'encode' => false | |||
]); | |||
?> | |||
<?php /* $form->field($model, 'product_price_percent') | |||
<div class="col-md-8"> | |||
<?php $form = ActiveForm::begin([ | |||
'enableClientValidation' => false | |||
]); ?> | |||
<?= $form->field($model, 'type') | |||
->dropDownList($userManager->getTypeChoicesArray(), [ | |||
'v-model' => 'type' | |||
]); ?> | |||
<?= $form->field($model, 'name_legal_person', ['options' => ['v-show' => "type == 'legal-person'"]])->textInput() ?> | |||
<?= $form->field($model, 'lastname')->textInput() ?> | |||
<?= $form->field($model, 'name')->textInput() ?> | |||
<?= $form->field($model, 'phone')->textInput() ?> | |||
<?= $form->field($model, 'email')->textInput() ?> | |||
<?= $form->field($model, 'address')->textarea() ?> | |||
<?php if ($producerManager->getConfig('option_export_evoliz')): ?> | |||
<?= $form->field($model, 'evoliz_code')->textInput() ?> | |||
<?php endif; ?> | |||
<?= $form->field($model, 'points_sale')->checkboxlist( | |||
ArrayHelper::map($pointsSaleArray, 'id', function ($pointSale) use ($model) { | |||
$commentUserPointSale = isset($pointSale->userPointSale[0]) ? $pointSale->userPointSale[0]->comment : ''; | |||
$html = Html::encode($pointSale->name); | |||
if ($pointSale->restricted_access) { | |||
$html .= '<input type="text" placeholder="Commentaire" class="form-control" name="User[comment_point_sale_' . $pointSale->id . ']" value="' . (($model->id) ? Html::encode($commentUserPointSale) : '') . '" />'; | |||
} | |||
return $html; | |||
}), [ | |||
'encode' => false | |||
]); | |||
?> | |||
<?= $form->field($model, 'user_groups')->checkboxlist( | |||
ArrayHelper::map($userGroupsArray, 'id', function ($userGroup) use ($model) { | |||
return Html::encode($userGroup->name); | |||
}), [ | |||
'encode' => false | |||
]); | |||
?> | |||
<?php /* $form->field($model, 'product_price_percent') | |||
->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?> | |||
<div class="form-group"> | |||
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |||
</div> | |||
<?php ActiveForm::end(); ?> | |||
<div class="form-group"> | |||
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | |||
</div> | |||
<div class="col-md-4"> | |||
<h2>Mot de passe</h2> | |||
<?php $form = ActiveForm::begin(); ?> | |||
<div class="form-group"> | |||
<?= Html::submitButton('Envoyer un nouveau mot de passe', ['class' => 'btn btn-primary', 'name' => 'submit_new_password', 'value' => 1]) ?> | |||
</div> | |||
<?php ActiveForm::end(); ?> | |||
</div> | |||
<?php ActiveForm::end(); ?> | |||
</div> | |||
<div class="col-md-4"> | |||
<?php if($pointSaleBillingArray && count($pointSaleBillingArray) > 0): ?> | |||
<h3>Facturation</h3> | |||
<?php foreach($pointSaleBillingArray as $pointSale): ?> | |||
<a href="<?= Yii::$app->urlManager->createUrl(['point-sale/update', 'id' => $pointSale->id]) ?>"><?= $pointSale->name ?></a><br /> | |||
<?php endforeach; ?> | |||
<?php endif; ?> | |||
<h3>Mot de passe</h3> | |||
<?php $form = ActiveForm::begin(); ?> | |||
<div class="form-group"> | |||
<?= Html::submitButton('Envoyer un nouveau mot de passe', ['class' => 'btn btn-primary', 'name' => 'submit_new_password', 'value' => 1]) ?> | |||
</div> | |||
<?php ActiveForm::end(); ?> | |||
</div> | |||
</div> |
@@ -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']]); |
@@ -50,5 +50,6 @@ $this->addBreadcrumb('Modifier') ; | |||
'model' => $model, | |||
'pointsSaleArray' => $pointsSaleArray, | |||
'userGroupsArray' => $userGroupsArray, | |||
'pointSaleBillingArray' => $pointSaleBillingArray | |||
]) ?> | |||
</div> |
@@ -2136,10 +2136,26 @@ termes. | |||
text-transform: uppercase; | |||
} | |||
/* line 257, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-user { | |||
position: relative; | |||
} | |||
/* line 260, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-user:hover .shortcuts { | |||
display: block; | |||
} | |||
/* line 264, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-user .shortcuts { | |||
display: none; | |||
float: right; | |||
position: absolute; | |||
top: 1px; | |||
right: 1px; | |||
} | |||
/* line 273, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.tiller { | |||
width: 60px; | |||
} | |||
/* line 260, ../sass/distribution/_index.scss */ | |||
/* line 276, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.tiller label { | |||
font-size: 12px; | |||
cursor: pointer; | |||
@@ -2147,72 +2163,72 @@ termes. | |||
top: -2px; | |||
font-weight: normal; | |||
} | |||
/* line 269, ../sass/distribution/_index.scss */ | |||
/* line 285, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions { | |||
position: relative; | |||
text-align: right; | |||
} | |||
/* line 273, ../sass/distribution/_index.scss */ | |||
/* line 289, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .dropdown-menu { | |||
top: 0px; | |||
right: 0px; | |||
} | |||
/* line 278, ../sass/distribution/_index.scss */ | |||
/* line 294, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .modal-form-order, | |||
.distribution-index #orders table td.column-actions .modal-payment { | |||
text-align: left; | |||
} | |||
/* line 283, ../sass/distribution/_index.scss */ | |||
/* line 299, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .add-subscription { | |||
position: relative; | |||
} | |||
/* line 286, ../sass/distribution/_index.scss */ | |||
/* line 302, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { | |||
position: absolute; | |||
top: 4px; | |||
right: 4px; | |||
font-size: 7px; | |||
} | |||
/* line 295, ../sass/distribution/_index.scss */ | |||
/* line 311, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-state-payment { | |||
width: 120px; | |||
} | |||
/* line 299, ../sass/distribution/_index.scss */ | |||
/* line 315, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table .state-payment-mobile { | |||
display: none; | |||
} | |||
/* line 304, ../sass/distribution/_index.scss */ | |||
/* line 320, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table td.column-payment div.btn-group { | |||
width: 125px; | |||
} | |||
/* line 310, ../sass/distribution/_index.scss */ | |||
/* line 326, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table tr.view ul { | |||
list-style-type: none; | |||
margin-left: 0px; | |||
padding-left: 15px; | |||
} | |||
/* line 320, ../sass/distribution/_index.scss */ | |||
/* line 336, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table tr.view .comment { | |||
margin-top: 20px; | |||
} | |||
/* line 324, ../sass/distribution/_index.scss */ | |||
/* line 340, ../sass/distribution/_index.scss */ | |||
.distribution-index #orders table tr.view .delivery { | |||
margin-top: 20px; | |||
} | |||
/* line 333, ../sass/distribution/_index.scss */ | |||
/* line 349, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container { | |||
width: 100%; | |||
padding: 0px; | |||
} | |||
/* line 337, ../sass/distribution/_index.scss */ | |||
/* line 353, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container .modal-body { | |||
padding-right: 15px; | |||
} | |||
/* line 340, ../sass/distribution/_index.scss */ | |||
/* line 356, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container .modal-body table { | |||
margin-bottom: 150px; | |||
} | |||
/* line 345, ../sass/distribution/_index.scss */ | |||
/* line 361, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container .modal-footer { | |||
border-top-color: #f4f4f4; | |||
position: fixed; | |||
@@ -2224,64 +2240,64 @@ termes. | |||
text-align: center; | |||
border-top: solid 1px #e0e0e0; | |||
} | |||
/* line 357, ../sass/distribution/_index.scss */ | |||
/* line 373, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button { | |||
float: none; | |||
} | |||
/* line 361, ../sass/distribution/_index.scss */ | |||
/* line 377, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form div.right { | |||
float: right; | |||
} | |||
/* line 368, ../sass/distribution/_index.scss */ | |||
/* line 384, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .btn-credit { | |||
float: right; | |||
} | |||
/* line 374, ../sass/distribution/_index.scss */ | |||
/* line 390, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products .product-ordered td { | |||
background-color: #e9e9e9; | |||
} | |||
/* line 378, ../sass/distribution/_index.scss */ | |||
/* line 394, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products .product-ordered input.input-quantity { | |||
font-size: 16px; | |||
font-weight: bold; | |||
} | |||
/* line 384, ../sass/distribution/_index.scss */ | |||
/* line 400, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.price { | |||
width: 150px; | |||
} | |||
/* line 387, ../sass/distribution/_index.scss */ | |||
/* line 403, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.price input { | |||
text-align: center; | |||
} | |||
/* line 391, ../sass/distribution/_index.scss */ | |||
/* line 407, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.price .input-group-addon { | |||
background-color: #eee; | |||
} | |||
/* line 395, ../sass/distribution/_index.scss */ | |||
/* line 411, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.price .invoice-price { | |||
margin-top: 8px; | |||
} | |||
/* line 397, ../sass/distribution/_index.scss */ | |||
/* line 413, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.price .invoice-price .label-invoice-price { | |||
font-size: 11px; | |||
font-weight: bold; | |||
color: gray; | |||
} | |||
/* line 405, ../sass/distribution/_index.scss */ | |||
/* line 421, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity { | |||
width: 165px; | |||
} | |||
/* line 408, ../sass/distribution/_index.scss */ | |||
/* line 424, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity input { | |||
text-align: center; | |||
color: black; | |||
} | |||
/* line 413, ../sass/distribution/_index.scss */ | |||
/* line 429, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity .form-control { | |||
border-right: 0px none; | |||
padding-right: 4px; | |||
} | |||
/* line 418, ../sass/distribution/_index.scss */ | |||
/* line 434, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { | |||
padding: 5px; | |||
padding-left: 0px; | |||
@@ -2289,35 +2305,35 @@ termes. | |||
border-left: 0px none; | |||
border-right: 0px none; | |||
} | |||
/* line 427, ../sass/distribution/_index.scss */ | |||
/* line 443, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining { | |||
text-align: right; | |||
} | |||
/* line 430, ../sass/distribution/_index.scss */ | |||
/* line 446, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite { | |||
color: #00A65A; | |||
} | |||
/* line 434, ../sass/distribution/_index.scss */ | |||
/* line 450, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { | |||
color: #DD4B39; | |||
} | |||
/* line 438, ../sass/distribution/_index.scss */ | |||
/* line 454, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty { | |||
font-size: 18px; | |||
} | |||
/* line 445, ../sass/distribution/_index.scss */ | |||
/* line 461, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-form-order .actions-form button { | |||
margin-left: 15px; | |||
} | |||
/* line 453, ../sass/distribution/_index.scss */ | |||
/* line 469, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-icon { | |||
width: 50px; | |||
} | |||
/* line 456, ../sass/distribution/_index.scss */ | |||
/* line 472, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-icon i { | |||
font-size: 30px; | |||
} | |||
/* line 461, ../sass/distribution/_index.scss */ | |||
/* line 477, ../sass/distribution/_index.scss */ | |||
.distribution-index .modal-payment .info-box .info-box-content { | |||
margin-left: 50px; | |||
} |
@@ -36,7 +36,7 @@ | |||
$(document).ready(function () { | |||
opendistrib_datepicker(); | |||
$('button[data-toggle=popover]').popover(); | |||
opendistrib_popover(); | |||
opendistrib_commandeauto(); | |||
opendistrib_points_vente_acces(); | |||
opendistrib_tooltip(); | |||
@@ -62,6 +62,10 @@ var UrlManager = { | |||
} | |||
}; | |||
function opendistrib_popover() { | |||
$('button[data-toggle=popover], a[data-toggle=popover]').popover(); | |||
} | |||
function opendistrib_select2() { | |||
$('.select2').select2({ | |||
width: 'resolve' |
@@ -206,12 +206,7 @@ var app = new Vue({ | |||
if(distributions.length) { | |||
for(var i= 0; i < distributions.length; i++) { | |||
app.calendar.attrs.push({ | |||
highlight: { | |||
backgroundColor: '#5cb85c', | |||
}, | |||
contentStyle: { | |||
color: 'white', | |||
}, | |||
highlight: true, | |||
dates: distributions[i].date | |||
}) ; | |||
} | |||
@@ -229,6 +224,8 @@ var app = new Vue({ | |||
if(app.idOrderUpdate) { | |||
app.updateOrderFromUrl(); | |||
} | |||
setTimeout("opendistrib_popover();", 500); | |||
}) ; | |||
}, | |||
initCountActiveProducts: function() { | |||
@@ -298,7 +295,20 @@ var app = new Vue({ | |||
} | |||
} | |||
this.initCountActiveProducts() ; | |||
}, | |||
isOneProductMaximumQuantityExceeded: function() { | |||
for(var i= 0; i < this.products.length; i++) { | |||
if(this.isProductMaximumQuantityExceeded(this.products[i])) { | |||
return true; | |||
} | |||
} | |||
return false; | |||
}, | |||
isProductMaximumQuantityExceeded: function(product) { | |||
return product.productDistribution[0].quantity_max | |||
&& product.quantity_ordered | |||
&& product.quantity_ordered > product.productDistribution[0].quantity_max; | |||
}, | |||
pointSaleActiveClick: function(event) { | |||
var idPointSale = event.currentTarget.getAttribute('data-id-point-sale') ; | |||
@@ -322,26 +332,51 @@ var app = new Vue({ | |||
}, | |||
activeDistribution: function(event) { | |||
var app = this ; | |||
var active = parseInt(event.currentTarget.getAttribute('data-active')); | |||
axios.get("ajax-process-active-distribution",{params: { | |||
idDistribution: this.distribution.id, | |||
active: event.currentTarget.getAttribute('data-active') | |||
active: active | |||
}}) | |||
.then(function(response) { | |||
app.init() ; | |||
app.alertsActiveDistribution(active, 'Distribution'); | |||
}) ; | |||
}, | |||
activeWeekDistribution: function(event) { | |||
var app = this ; | |||
var active = parseInt(event.currentTarget.getAttribute('data-active')); | |||
axios.get("ajax-process-active-week-distribution",{params: { | |||
date: this.date.getFullYear() + '-' | |||
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '-' | |||
+ ('0' + this.date.getDate()).slice(-2), | |||
active: event.currentTarget.getAttribute('data-active') | |||
active: active | |||
}}) | |||
.then(function(response) { | |||
app.init() ; | |||
app.alertsActiveDistribution(active, 'Semaine de distribution'); | |||
}) ; | |||
}, | |||
alertsActiveDistribution: function(active, label) { | |||
if(!active) { | |||
appAlerts.alert( | |||
'success', | |||
label+' désactivée.', | |||
) ; | |||
appAlerts.alert( | |||
'info', | |||
'Pensez à bien rembourser les clients qui auraient passé commande en utilisant leur crédit.', | |||
6000 | |||
); | |||
} | |||
else { | |||
appAlerts.alert( | |||
'success', | |||
label+' activée.', | |||
) ; | |||
} | |||
}, | |||
pointSaleClick: function(event) { | |||
this.setIdActivePointSale(event.currentTarget.getAttribute('data-id-point-sale')) ; | |||
}, | |||
@@ -403,6 +438,14 @@ var app = new Vue({ | |||
Vue.set(app.ordersUpdate[app.getOrderUpdateKey()], 'id_user', idUser); | |||
} | |||
}); | |||
// Passage à la ligne du dessous quand on appuie sur "Entrée" | |||
$('.modal-form-order .input-quantity').keypress(function(e) { | |||
if(e.which == 13) { | |||
$(this).parent().parent().parent() | |||
.next().find('.input-quantity').focus(); | |||
} | |||
}); | |||
},500); | |||
}, | |||
getOrderUpdateKey: function() { |
@@ -261,15 +261,19 @@ var app = new Vue({ | |||
}, | |||
deleteProductOrder: function (idProductOrder) { | |||
var app = this; | |||
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-product-order", { | |||
params: { | |||
idProductOrder: idProductOrder | |||
} | |||
}) | |||
.then(function (response) { | |||
appAlerts.alertResponse(response); | |||
app.init(); | |||
}); | |||
result = confirm("Êtes-vous sûr de vouloir supprimer ce produit ? Cela le supprimera également de la commande à laquelle il est lié."); | |||
if(result) { | |||
axios.get(UrlManager.getBaseUrlAbsolute() + "document/ajax-delete-product-order", { | |||
params: { | |||
idProductOrder: idProductOrder | |||
} | |||
}) | |||
.then(function (response) { | |||
appAlerts.alertResponse(response); | |||
app.init(); | |||
}); | |||
} | |||
}, | |||
formatProductAddPrice: function () { | |||
this.productAddPrice = Number(this.productAddPrice).toFixed(2).replace(',', '.'); |
@@ -254,6 +254,22 @@ termes. | |||
table { | |||
td.column-user { | |||
position: relative; | |||
&:hover .shortcuts { | |||
display: block; | |||
} | |||
.shortcuts { | |||
display: none; | |||
float: right; | |||
position: absolute; | |||
top: 1px; | |||
right: 1px; | |||
} | |||
} | |||
td.tiller { | |||
width: 60px; | |||
@@ -69,7 +69,10 @@ class CommonAsset extends \common\components\MyAssetBundle | |||
$this->addAsset('js','js/promise-polyfill/promise.min.js'); | |||
$this->addAsset('js','js/axios/axios.min.js'); | |||
$this->addAsset('js','js/vuejs/vue.js'); | |||
$this->addAsset('js','js/vuejs/vcalendar/vcalendar.min.js') ; | |||
// Documentation : https://vcalendar.io/ | |||
$this->addAsset('js','js/vuejs/vcalendar/v-calendar.umd.min.js') ; | |||
$this->addAsset('js','js/utils.js') ; | |||
} | |||
} |
@@ -37,7 +37,7 @@ | |||
*/ | |||
return [ | |||
'version' => '23.6.A', | |||
'version' => '23.6.B', | |||
'adminEmail' => 'contact@opendistrib.net', | |||
'supportEmail' => 'contact@opendistrib.net', | |||
'user.passwordResetTokenExpire' => 3600, |
@@ -87,14 +87,19 @@ class DistributionRepository extends AbstractRepository | |||
/** | |||
* Récupère les distributions futures. | |||
*/ | |||
public function findDistributionsIncoming(): array | |||
public function findDistributionsIncoming($ignoreActive = false): array | |||
{ | |||
$paramsWhere = [ | |||
'id_producer' => $this->getProducerContext()->id, | |||
]; | |||
if(!$ignoreActive) { | |||
$paramsWhere['active'] = 1; | |||
} | |||
$distributionsArray = Distribution::find() | |||
->where('date > \'' . date('Y-m-d') . '\'') | |||
->andWhere([ | |||
'id_producer' => $this->getProducerContext()->id, | |||
'active' => 1 | |||
]) | |||
->andWhere($paramsWhere) | |||
->orderBy('date ASC') | |||
->all(); | |||
@@ -105,7 +110,7 @@ class DistributionRepository extends AbstractRepository | |||
* Recherche les distributions futures où l'abonnement peut s'appliquer. | |||
*/ | |||
// searchMatchedIncomingDistributions | |||
public function findDistributionsIncomingMatchWithSubscrtiption(Subscription $subscription): array | |||
public function findDistributionsIncomingMatchWithSubscrtiption(Subscription $subscription, bool $filterByOrderDeadline = false): array | |||
{ | |||
$params = [ | |||
':date_earliest_order' => date('Y-m-d'), | |||
@@ -136,6 +141,10 @@ class DistributionRepository extends AbstractRepository | |||
} | |||
} | |||
if($filterByOrderDeadline) { | |||
$matchedIncomingDistributionsArray = $this->distributionSolver->filterDistributionsByDateDelay($matchedIncomingDistributionsArray); | |||
} | |||
return $matchedIncomingDistributionsArray; | |||
} | |||
@@ -113,7 +113,7 @@ class DistributionBuilder extends AbstractBuilder | |||
*/ | |||
public function addProductIncomingDistributions(Product $product): void | |||
{ | |||
$distributionArray = $this->distributionRepository->findDistributionsIncoming(); | |||
$distributionArray = $this->distributionRepository->findDistributionsIncoming(true); | |||
foreach ($distributionArray as $distribution) { | |||
$this->addProduct($distribution, $product); | |||
} | |||
@@ -144,7 +144,7 @@ class DistributionBuilder extends AbstractBuilder | |||
*/ | |||
public function addPointSaleIncomingDistributions(PointSale $pointSale): void | |||
{ | |||
$distributionArray = $this->distributionRepository->findDistributionsIncoming(); | |||
$distributionArray = $this->distributionRepository->findDistributionsIncoming(true); | |||
foreach ($distributionArray as $distribution) { | |||
$this->addPointSale($distribution, $pointSale); | |||
} |
@@ -9,6 +9,7 @@ use common\logic\AbstractBuilder; | |||
use common\logic\Config\TaxRate\Model\TaxRate; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\Distribution\Distribution\Repository\DistributionRepository; | |||
use common\logic\Distribution\Distribution\Service\DistributionSolver; | |||
use common\logic\Document\Document\Model\Document; | |||
use common\logic\Order\Order\Model\Order; | |||
use common\logic\Order\Order\Repository\OrderRepository; | |||
@@ -54,6 +55,7 @@ class OrderBuilder extends AbstractBuilder | |||
protected SubscriptionRepository $subscriptionRepository; | |||
protected SubscriptionSolver $subscriptionSolver; | |||
protected ProductSolver $productSolver; | |||
protected DistributionSolver $distributionSolver; | |||
public function loadDependencies(): void | |||
{ | |||
@@ -75,6 +77,7 @@ class OrderBuilder extends AbstractBuilder | |||
$this->subscriptionRepository = $this->loadService(SubscriptionRepository::class); | |||
$this->subscriptionSolver = $this->loadService(SubscriptionSolver::class); | |||
$this->productSolver = $this->loadService(ProductSolver::class); | |||
$this->distributionSolver = $this->loadService(DistributionSolver::class); | |||
} | |||
public function instanciateOrder(Distribution $distribution): Order | |||
@@ -153,7 +156,7 @@ class OrderBuilder extends AbstractBuilder | |||
public function updateOrdersIncomingDistributionsFromSubscription(Subscription $subscription, $update = false): array | |||
{ | |||
$orderArray = []; | |||
$matchedDistributionsArray = $this->distributionRepository->findDistributionsIncomingMatchWithSubscrtiption($subscription); | |||
$matchedDistributionsArray = $this->distributionRepository->findDistributionsIncomingMatchWithSubscrtiption($subscription, true); | |||
if ($update) { | |||
$this->deleteOrdersIncomingDistributionsFromSubscription($subscription); | |||
@@ -184,19 +187,10 @@ class OrderBuilder extends AbstractBuilder | |||
':id_subscription' => $subscription->id | |||
]; | |||
$orderDeadline = $this->producerRepository->getConfig('order_deadline'); | |||
$hour = date('G'); | |||
if ($hour >= $orderDeadline) { | |||
$conditionDistributionDate = 'distribution.date > :date_today'; | |||
} else { | |||
$conditionDistributionDate = 'distribution.date >= :date_today'; | |||
} | |||
$orders = Order::find() | |||
->joinWith('distribution') | |||
->where('distribution.id_producer = :id_producer') | |||
->andWhere($conditionDistributionDate) | |||
->andWhere('distribution.date >= :date_today') | |||
->andWhere('distribution.date ' . $comparatorDateStart . ' :date_start') | |||
->andWhere('order.id_subscription = :id_subscription'); | |||
@@ -208,25 +202,26 @@ class OrderBuilder extends AbstractBuilder | |||
$countOrdersDeleted = 0; | |||
if ($ordersArray && count($ordersArray)) { | |||
foreach ($ordersArray as $order) { | |||
if($this->distributionSolver->isDistributionAvailable($order->distribution)) { | |||
$theOrder = $this->orderRepository->findOneOrderById($order->id); | |||
$this->initOrder($theOrder); | |||
// remboursement de la commande | |||
if ($theOrder->id_user && $this->orderSolver->getOrderAmount($theOrder, Order::AMOUNT_PAID) && $configCredit) { | |||
$this->creditHistoryBuilder->createCreditHistory( | |||
CreditHistory::TYPE_REFUND, | |||
$this->orderSolver->getOrderAmount($theOrder, Order::AMOUNT_PAID), | |||
$theOrder->distribution->producer, | |||
$theOrder->user, | |||
GlobalParam::getCurrentUser() | |||
); | |||
} | |||
$theOrder = $this->orderRepository->findOneOrderById($order->id); | |||
$this->initOrder($theOrder); | |||
// remboursement de la commande | |||
if ($theOrder->id_user && $this->orderSolver->getOrderAmount($theOrder, Order::AMOUNT_PAID) && $configCredit) { | |||
$this->deleteOrder($order, true); | |||
$this->creditHistoryBuilder->createCreditHistory( | |||
CreditHistory::TYPE_REFUND, | |||
$this->orderSolver->getOrderAmount($theOrder, Order::AMOUNT_PAID), | |||
$theOrder->distribution->producer, | |||
$theOrder->user, | |||
GlobalParam::getCurrentUser() | |||
); | |||
$countOrdersDeleted++; | |||
} | |||
$this->deleteOrder($order, true); | |||
$countOrdersDeleted++; | |||
} | |||
} | |||
@@ -7,6 +7,7 @@ use common\logic\AbstractRepository; | |||
use common\logic\Distribution\Distribution\Model\Distribution; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\Producer\Producer\Model\Producer; | |||
use common\logic\User\User\Model\User; | |||
class PointSaleRepository extends AbstractRepository | |||
{ | |||
@@ -96,4 +97,16 @@ class PointSaleRepository extends AbstractRepository | |||
return $pointSalesArrayDropdown; | |||
} | |||
public function findByBillingUser(User $user) | |||
{ | |||
return PointSale::find() | |||
->where([ | |||
'id_producer' => GlobalParam::getCurrentProducerId(), | |||
'status' => 1, | |||
'id_user' => $user->id | |||
])->orderBy( | |||
'name ASC' | |||
)->all(); | |||
} | |||
} |
@@ -82,5 +82,12 @@ class PointSaleSolver extends AbstractService implements SolverInterface | |||
return $str; | |||
} | |||
public function isPublic(PointSale $pointSale): bool | |||
{ | |||
if($pointSale->restricted_access || ($pointSale->code && strlen($pointSale->code))) { | |||
return false; | |||
} | |||
return true; | |||
} | |||
} |
@@ -155,33 +155,44 @@ class ProducerRepository extends AbstractRepository | |||
return $this->producerPriceRangeRepository->getAmountToBeBilledByTurnover($turnover, $format); | |||
} | |||
public function getSummaryAmountsToBeBilled(Producer $producer, string $label, int $numberOfMonths = 1): string | |||
public function getSummaryAmountsToBeBilled(Producer $producer, string $label, int $numberOfMonths = 1, $context = 'list'): string | |||
{ | |||
$text = ''; | |||
$numMonthCurrent = date('m'); | |||
$sumInvoicePrice = 0; | |||
if ($numberOfMonths == 1 | |||
|| ($numberOfMonths == 3 && (in_array($numMonthCurrent, [1, 4, 7, 10]))) | |||
|| ($numberOfMonths == 6 && (in_array($numMonthCurrent, [1, 7])))) { | |||
|| ($numberOfMonths == 6 && (in_array($numMonthCurrent, [1, 7]))) | |||
|| $context == 'billing') { | |||
for ($i = 1; $i <= $numberOfMonths; $i++) { | |||
$month = date('Y-m', strtotime('-' . $i . ' month')); | |||
$timeMonth = strtotime('-' . $i . ' month'); | |||
$month = date('Y-m', $timeMonth); | |||
$turnover = $this->getTurnover($producer, $month); | |||
if ($turnover) { | |||
if($numberOfMonths > 1) { | |||
$text .= ucfirst(strftime('%B ', $timeMonth)).' '.date('Y', $timeMonth).' : '; | |||
} | |||
$isBold = $this->producerSolver->isBillingTypeClassic($producer) && !$producer->option_billing_permanent_transfer; | |||
if ($isBold) $text .= '<strong>'; | |||
$text .= $this->producerPriceRangeRepository->getAmountToBeBilledByTurnover($turnover, true); | |||
if ($isBold) $text .= '</strong>'; | |||
$text .= ' / ' . Price::format($turnover, 0); | |||
$text .= '<br />'; | |||
$sumInvoicePrice += $this->producerPriceRangeRepository->getAmountToBeBilledByTurnover($turnover, false); | |||
} | |||
} | |||
if (strlen($text)) { | |||
$text = $label . ' : <br />' . $text; | |||
$text = '<i>'.$label.'</i>' . ' : <br />' . $text; | |||
} | |||
} | |||
if($numberOfMonths > 1) { | |||
$text .= '<br />Total : <strong>'.Price::format($sumInvoicePrice, 0).'</strong>'; | |||
} | |||
return $text; |
@@ -6,6 +6,7 @@ use common\helpers\GlobalParam; | |||
use common\helpers\Price; | |||
use common\logic\AbstractService; | |||
use common\logic\PointSale\PointSale\Model\PointSale; | |||
use common\logic\PointSale\PointSale\Service\PointSaleSolver; | |||
use common\logic\Product\Product\Model\Product; | |||
use common\logic\Product\ProductPrice\Service\ProductPriceSolver; | |||
use common\logic\SolverInterface; | |||
@@ -13,10 +14,12 @@ use common\logic\SolverInterface; | |||
class ProductSolver extends AbstractService implements SolverInterface | |||
{ | |||
protected ProductPriceSolver $productPriceSolver; | |||
protected PointSaleSolver $pointSaleSolver; | |||
public function loadDependencies(): void | |||
{ | |||
$this->productPriceSolver = $this->loadService(ProductPriceSolver::class); | |||
$this->pointSaleSolver = $this->loadService(PointSaleSolver::class); | |||
} | |||
public function getPrice(Product $product, array $params = []): ?float | |||
@@ -177,14 +180,13 @@ class ProductSolver extends AbstractService implements SolverInterface | |||
$producer = GlobalParam::getCurrentProducer(); | |||
if ($producer->option_export_display_product_reference | |||
&& $product->reference | |||
&& strlen($product->reference) > 0) | |||
{ | |||
&& strlen($product->reference) > 0) { | |||
return $product->reference; | |||
} | |||
return $product->name; | |||
} | |||
public function isProductActiveByDay(Product $product, string $day): bool | |||
{ | |||
return $product->active && $product->$day; | |||
@@ -192,7 +194,7 @@ class ProductSolver extends AbstractService implements SolverInterface | |||
public function getProductFieldNameQuantityMax(string $day): string | |||
{ | |||
return 'quantity_max_'.$day; | |||
return 'quantity_max_' . $day; | |||
} | |||
public function isProductQuantityMaxDefinedByDay(Product $product, string $day): bool | |||
@@ -204,11 +206,41 @@ class ProductSolver extends AbstractService implements SolverInterface | |||
public function getProductQuantityMaxByDay(Product $product, string $day): ?float | |||
{ | |||
$quantityMax = ($product->quantity_max && $product->quantity_max > 0) ? $product->quantity_max : null; | |||
if($this->isProductQuantityMaxDefinedByDay($product, $day)) { | |||
if ($this->isProductQuantityMaxDefinedByDay($product, $day)) { | |||
$fieldQuantityMax = $this->getProductFieldNameQuantityMax($day); | |||
$quantityMax = $product->$fieldQuantityMax; | |||
} | |||
return $quantityMax; | |||
} | |||
public function isPublic(Product $product): bool | |||
{ | |||
if ($product->available_on_points_sale) { | |||
return true; | |||
} else { | |||
foreach ($product->productPointSale as $productPointSale) { | |||
if ($productPointSale->pointSale && $this->pointSaleSolver->isPublic($productPointSale->pointSale)) { | |||
return true; | |||
} | |||
} | |||
} | |||
return false; | |||
} | |||
public function filterProductsByPointSale(array $productArray, PointSale $pointSale = null): array | |||
{ | |||
$productArrayFilter = []; | |||
if($pointSale) { | |||
foreach ($productArray as $product) { | |||
if ($this->isAvailableOnPointSale($product, $pointSale)) { | |||
$productArrayFilter[] = $product; | |||
} | |||
} | |||
} | |||
return $productArrayFilter; | |||
} | |||
} |
@@ -3,7 +3,7 @@ | |||
<li>27/04/2023</li> | |||
</ul> | |||
<h4>Évolution</h4> | |||
<h4>Évolutions</h4> | |||
<ul> | |||
<li> | |||
[Administration] Distributions > édition commande : possibilité de modifier les prix facturés |
@@ -0,0 +1,24 @@ | |||
<h4>Date de sortie</h4> | |||
<ul> | |||
<li>22/06/2023</li> | |||
</ul> | |||
<h4>Évolutions</h4> | |||
<ul> | |||
<li>[Administration et Espace producteur] Calendrier pour le choix du jour de distribution : affichage du lundi en premier</li> | |||
<li>[Administration] Distribution : alerte remboursement commandes lors de la désactivation d'une distribution</li> | |||
<li>[Administration] Distribution > édition commande : alerte si quantité max d'un produit dépassée</li> | |||
<li>[Administration] Distributions > liste commandes : ajout lien vers fiche client (crédit, profil, commandes)</li> | |||
<li>[Administration] Documents > Bons de livraison : alerte suppression produits</li> | |||
<li>[Administration] Distributions > formulaire commande : raccourci "Entrée" pour passer à la ligne du dessous</li> | |||
<li>[Administration] Utilisateur > édition : ajout info contact facturation</li> | |||
<li>[Administration] Responsive > listes : accès facilité aux boutons d'action</li> | |||
<li>[Espace producteur] Accueil : gestion visibilité produits présents uniquement sur un point de vente à accès restreint</li> | |||
<li>[Espace producteur] Commande > choix du point de vente : ajout informations en fonction du jour choisi</li> | |||
</ul> | |||
<h4>Maintenance</h4> | |||
<ul> | |||
<li>[Espace producteur] Abonnements : correctif disponibilité produits par point de vente</li> | |||
<li>Abonnements > ajout/modification : prise en compte des contraintes de délai et d'heure limite de commande dans la génération des commandes des distributions à venir</li> | |||
</ul> |
@@ -752,6 +752,7 @@ class OrderController extends ProducerBaseController | |||
if (is_array($ordersUserArray) && count($ordersUserArray)) { | |||
foreach ($ordersUserArray as &$order) { | |||
$orderManager->initOrder($order); | |||
$order = array_merge($order->getAttributes(), [ | |||
'amount_total' => $orderManager->getOrderAmountWithTax($order, Order::AMOUNT_TOTAL), | |||
'date_distribution' => $order->distribution->date, | |||
@@ -791,6 +792,7 @@ class OrderController extends ProducerBaseController | |||
private function ajaxInfosPointsSale($producer, $distribution = false) | |||
{ | |||
$pointSaleManager = $this->getPointSaleManager(); | |||
$userManager = $this->getUserManager(); | |||
$producerManager = $this->getProducerManager(); | |||
@@ -834,6 +836,7 @@ class OrderController extends ProducerBaseController | |||
$position = 0; | |||
foreach ($pointsSaleArray as &$pointSale) { | |||
$pointSaleObject = $pointSale; | |||
$pointSale = array_merge($pointSale->getAttributes(), [ | |||
'pointSaleDistribution' => [ | |||
'id_distribution' => $pointSale->pointSaleDistribution ? $pointSale->pointSaleDistribution[0]->id_distribution : false, | |||
@@ -854,6 +857,8 @@ class OrderController extends ProducerBaseController | |||
'id_distribution' => $distribution->id, | |||
'id_point_sale' => $pointSale['id'] | |||
]); | |||
$pointSale['infos'] = $pointSaleManager->getStrInfos($pointSaleObject, strtolower(date('l', strtotime($distribution->date)))); | |||
} | |||
$pointSale['position'] = $position; | |||
@@ -926,17 +931,7 @@ class OrderController extends ProducerBaseController | |||
->orderBy('product_distribution.active DESC, order ASC') | |||
->all(); | |||
$productsArrayFilter = []; | |||
// filtre sur les points de vente | |||
if($pointSale) { | |||
foreach ($productsArray as $product) { | |||
if ($productManager->isAvailableOnPointSale($product, $pointSale)) { | |||
$productsArrayFilter[] = $product; | |||
} | |||
} | |||
} | |||
$productsArrayFilter = $productManager->filterProductsByPointSale($productsArray, $pointSale); | |||
$indexProduct = 0; | |||
foreach ($productsArrayFilter as $key => &$product) { | |||
@@ -1012,6 +1007,10 @@ class OrderController extends ProducerBaseController | |||
} | |||
} | |||
if($orderUser) { | |||
$orderManager->initOrder($orderUser); | |||
} | |||
return $orderUser; | |||
} | |||
} |
@@ -110,6 +110,7 @@ class SiteController extends ProducerBaseController | |||
], | |||
'sort' => false, | |||
]); | |||
$this->filterProductsPublic($dataProviderProductsByCategories[$productCategory->id]); | |||
} | |||
$queryProducts = Product::find() | |||
@@ -118,6 +119,7 @@ class SiteController extends ProducerBaseController | |||
'active' => true, | |||
'id_product_category' => null, | |||
]) | |||
->with('productPointSale') | |||
->orderBy('order ASC'); | |||
$dataProviderProducts = new ActiveDataProvider([ | |||
@@ -127,6 +129,7 @@ class SiteController extends ProducerBaseController | |||
], | |||
'sort' => false, | |||
]); | |||
$this->filterProductsPublic($dataProviderProducts); | |||
$products = $queryProducts->all(); | |||
foreach ($dataProviderProductsByCategories as $dataProvider) { | |||
@@ -158,6 +161,18 @@ class SiteController extends ProducerBaseController | |||
]); | |||
} | |||
public function filterProductsPublic($dataProviderProducts) | |||
{ | |||
$productManager = $this->getProductManager(); | |||
$models = $dataProviderProducts->getModels(); | |||
foreach($models as $index => $product) { | |||
if(!$productManager->isPublic($product)) { | |||
unset($models[$index]); | |||
} | |||
} | |||
$dataProviderProducts->setModels($models); | |||
} | |||
/** | |||
* Affiche et traite le formulaire de contact dédié aux producteurs. | |||
*/ | |||
@@ -173,9 +188,6 @@ class SiteController extends ProducerBaseController | |||
if (strlen($email) && $model->sendEmail($email)) { | |||
$isSent = true; | |||
} | |||
else { | |||
die('email : '.$email); | |||
} | |||
} | |||
if ($isSent) { |
@@ -274,6 +274,11 @@ class SubscriptionController extends ProducerBaseController | |||
} | |||
} | |||
$productPointSaleArray = []; | |||
foreach($product->productPointSale as $productPointSale) { | |||
$productPointSaleArray[] = $productPointSale->id_point_sale; | |||
} | |||
$product = array_merge( | |||
$product->getAttributes(), | |||
[ | |||
@@ -287,6 +292,7 @@ class SubscriptionController extends ProducerBaseController | |||
'user_producer' => $userProducer, | |||
'point_sale' => $pointSale | |||
]), | |||
'product_point_sale_array' => $productPointSaleArray | |||
] | |||
); | |||
@@ -150,13 +150,11 @@ $this->setTitle('Commander') ; | |||
<div id="calendar"> | |||
<v-calendar | |||
is-inline | |||
is-double-paned | |||
is-expanded | |||
v-model="date" | |||
mode="single" | |||
locale="fr" | |||
:locale="{ id: 'fr', firstDayOfWeek: 1, masks: { weekdays: 'WW' } }" | |||
:first-day-of-week="1" | |||
columns="2" | |||
color="green" | |||
:formats="calendar.formats" | |||
:theme-styles="calendar.themeStyles" | |||
:attributes="calendar.attrs" | |||
@@ -231,6 +229,7 @@ $this->setTitle('Commander') ; | |||
<div class="comment" v-if="pointSale.userPointSale"> | |||
{{ pointSale.userPointSale.comment }} | |||
</div> | |||
<div class="comment" v-if="pointSale.infos && pointSale.infos.length > 0" v-html="pointSale.infos"></div> | |||
</td> | |||
<td class="locality">{{ pointSale.locality }}</td> | |||
<td class="actions"> | |||
@@ -417,7 +416,9 @@ $this->setTitle('Commander') ; | |||
<template v-if="producer.online_payment == 1"><a href="<?= \Yii::$app->urlManager->createUrl(['credit/add']) ?>">recharger votre crédit</a></template> | |||
<template v-else>recharger votre crédit</template> auprès de votre producteur ou supprimer des produits.</span> | |||
Votre producteur n'autorise pas un crédit inférieur | |||
à <strong>{{ formatPrice(producer.credit_limit) }}</strong>.</div> | |||
à <strong>{{ formatPrice(producer.credit_limit) }}</strong>. | |||
/ {{ priceTotal() }} | |||
</div> | |||
<div class="block-actions"> | |||
<a class="btn btn-primary" href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>">Retour à l'accueil</a> | |||
</div> |
@@ -1493,20 +1493,25 @@ termes. | |||
color: black; | |||
font-size: 20px; | |||
line-height: 25px; | |||
font-weight: bold; | |||
} | |||
/* line 219, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#points-sale td.name .comment { | |||
color: gray; | |||
} | |||
/* line 224, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#points-sale td.actions { | |||
width: 150px; | |||
} | |||
/* line 221, ../sass/order/_order.scss */ | |||
/* line 226, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#points-sale td.actions button { | |||
width: 100%; | |||
} | |||
/* line 227, ../sass/order/_order.scss */ | |||
/* line 232, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#points-sale tr.selected td { | |||
background-color: white; | |||
} | |||
/* line 235, ../sass/order/_order.scss */ | |||
/* line 240, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.category-name { | |||
font-family: "highvoltageregular"; | |||
font-size: 22px; | |||
@@ -1514,12 +1519,12 @@ termes. | |||
text-transform: uppercase; | |||
padding-top: 13px; | |||
} | |||
/* line 242, ../sass/order/_order.scss */ | |||
/* line 247, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.category-name .glyphicon-triangle-bottom, | |||
.order-order #main #app-order-order table#products td.category-name .glyphicon-triangle-right { | |||
font-size: 15px; | |||
} | |||
/* line 247, ../sass/order/_order.scss */ | |||
/* line 252, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.category-name span.label { | |||
font-family: "Arial"; | |||
font-weight: normal; | |||
@@ -1527,17 +1532,17 @@ termes. | |||
text-transform: none; | |||
margin-left: 15px; | |||
} | |||
/* line 256, ../sass/order/_order.scss */ | |||
/* line 261, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.category-name:hover { | |||
cursor: pointer; | |||
background-color: #FF7F00; | |||
color: white; | |||
} | |||
/* line 264, ../sass/order/_order.scss */ | |||
/* line 269, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.photo img { | |||
width: 100px; | |||
} | |||
/* line 270, ../sass/order/_order.scss */ | |||
/* line 275, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.name .name { | |||
font-family: "capsuularegular"; | |||
color: black; | |||
@@ -1545,22 +1550,22 @@ termes. | |||
line-height: 25px; | |||
font-weight: bold; | |||
} | |||
/* line 277, ../sass/order/_order.scss */ | |||
/* line 282, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.name .other { | |||
font-family: "capsuularegular"; | |||
color: black; | |||
font-weight: bold; | |||
font-size: 17px; | |||
} | |||
/* line 283, ../sass/order/_order.scss */ | |||
/* line 288, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.name .description { | |||
color: gray; | |||
} | |||
/* line 286, ../sass/order/_order.scss */ | |||
/* line 291, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products td.name .recipe { | |||
color: gray; | |||
} | |||
/* line 292, ../sass/order/_order.scss */ | |||
/* line 297, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .price-unit .decreasing-prices { | |||
margin-top: 10px; | |||
font-size: 10px; | |||
@@ -1568,34 +1573,34 @@ termes. | |||
padding-bottom: 2px; | |||
margin-bottom: 0px; | |||
} | |||
/* line 300, ../sass/order/_order.scss */ | |||
/* line 305, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li { | |||
margin-bottom: 5px; | |||
} | |||
/* line 302, ../sass/order/_order.scss */ | |||
/* line 307, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li strong { | |||
font-weight: bold; | |||
} | |||
/* line 310, ../sass/order/_order.scss */ | |||
/* line 315, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .price-unit, .order-order #main #app-order-order table#products .price-total { | |||
width: 135px; | |||
text-align: center; | |||
} | |||
/* line 314, ../sass/order/_order.scss */ | |||
/* line 319, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .price-unit .unit, .order-order #main #app-order-order table#products .price-total .unit { | |||
color: gray; | |||
font-size: 13px; | |||
} | |||
/* line 319, ../sass/order/_order.scss */ | |||
/* line 324, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .td-quantity { | |||
width: 175px; | |||
} | |||
/* line 321, ../sass/order/_order.scss */ | |||
/* line 326, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .td-quantity input.quantity { | |||
text-align: center; | |||
border-right: 0px none; | |||
} | |||
/* line 325, ../sass/order/_order.scss */ | |||
/* line 330, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products .td-quantity .input-group-addon { | |||
padding: 5px; | |||
padding-left: 0px; | |||
@@ -1603,69 +1608,69 @@ termes. | |||
border-left: 0px none; | |||
border-right: 0px none; | |||
} | |||
/* line 336, ../sass/order/_order.scss */ | |||
/* line 341, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .summary h3 { | |||
margin-top: 0px; | |||
font-family: "capsuularegular"; | |||
text-transform: none; | |||
margin-bottom: 5px; | |||
} | |||
/* line 343, ../sass/order/_order.scss */ | |||
/* line 348, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .summary ul { | |||
margin-bottom: 15px; | |||
padding-left: 20px; | |||
font-size: 23px; | |||
} | |||
/* line 350, ../sass/order/_order.scss */ | |||
/* line 355, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .summary ul li .quantity { | |||
font-size: 18px; | |||
} | |||
/* line 354, ../sass/order/_order.scss */ | |||
/* line 359, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .summary ul li .name { | |||
font-family: "capsuularegular"; | |||
font-size: 24px; | |||
} | |||
/* line 358, ../sass/order/_order.scss */ | |||
/* line 363, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .summary ul li .other { | |||
font-family: "capsuularegular"; | |||
font-size: 18px; | |||
} | |||
/* line 366, ../sass/order/_order.scss */ | |||
/* line 371, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order table#products tr.total .price-total { | |||
font-size: 23px; | |||
} | |||
/* line 374, ../sass/order/_order.scss */ | |||
/* line 379, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #content-step-payment .delivery { | |||
margin-bottom: 20px; | |||
} | |||
/* line 377, ../sass/order/_order.scss */ | |||
/* line 382, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #content-step-payment .delivery .delivery-home { | |||
margin-bottom: 20px; | |||
} | |||
/* line 386, ../sass/order/_order.scss */ | |||
/* line 391, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #content-step-payment .comment { | |||
margin-bottom: 20px; | |||
} | |||
/* line 391, ../sass/order/_order.scss */ | |||
/* line 396, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #content-step-payment .credit .info { | |||
margin-left: 20px; | |||
color: gray; | |||
} | |||
/* line 398, ../sass/order/_order.scss */ | |||
/* line 403, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #specific-delays { | |||
margin-top: 15px; | |||
} | |||
/* line 406, ../sass/order/_order.scss */ | |||
/* line 411, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #infos { | |||
margin-top: 30px; | |||
} | |||
/* line 408, ../sass/order/_order.scss */ | |||
/* line 413, ../sass/order/_order.scss */ | |||
.order-order #main #app-order-order #infos .panel-body { | |||
padding-top: 0px; | |||
white-space: pre-line; | |||
} | |||
/* line 418, ../sass/order/_order.scss */ | |||
/* line 423, ../sass/order/_order.scss */ | |||
#main #content .panel h3 { | |||
font-family: "highvoltageregular"; | |||
margin: 0px; |
@@ -150,13 +150,8 @@ var app = new Vue({ | |||
var arrayDate; | |||
for (var i = 0; i < distributions.length; i++) { | |||
app.calendar.attrs.push({ | |||
highlight: { | |||
backgroundColor: '#5cb85c', | |||
}, | |||
contentStyle: { | |||
color: 'white', | |||
}, | |||
dates: distributions[i].date, | |||
highlight: true, | |||
dates: distributions[i].date | |||
}); | |||
arrayDate = distributions[i].date.split('-'); | |||
@@ -185,7 +180,15 @@ var app = new Vue({ | |||
if (app.isAvailableDate(dateOrder)) { | |||
app.calendar.attrs.push({ | |||
highlight: { | |||
highlight: true, | |||
popover: { | |||
label: orders[i].pointSale.name + ' / ' + app.formatPrice(orders[i].amount_total), | |||
hideIndicator: true | |||
}, | |||
dates: orders[i].date_distribution | |||
/*highlight: { | |||
backgroundColor: '#FF7F00' | |||
}, | |||
contentStyle: { | |||
@@ -195,7 +198,7 @@ var app = new Vue({ | |||
label: orders[i].pointSale.name + ' / ' + app.formatPrice(orders[i].amount_total), | |||
hideIndicator: true | |||
}, | |||
dates: orders[i].date_distribution, | |||
dates: orders[i].date_distribution,*/ | |||
}); | |||
} | |||
} | |||
@@ -473,7 +476,7 @@ var app = new Vue({ | |||
return this.formatPrice(price) ; | |||
} | |||
else { | |||
return price ; | |||
return numberDecimals(price, 2) ; | |||
} | |||
}, | |||
productHasPrice: function(product) { |
@@ -116,9 +116,6 @@ var app = new Vue({ | |||
} | |||
}, | |||
dayChange: function () { | |||
console.log(this.monday + ' ' + this.tuesday + ' ' + this.wednesday + ' ' + | |||
this.thursday + ' ' + this.friday + ' ' + this.saturday + ' ' + this.sunday); | |||
var count = Number(this.monday) + Number(this.tuesday) + Number(this.wednesday) | |||
+ Number(this.thursday) + Number(this.friday) + Number(this.saturday) | |||
+ Number(this.sunday); | |||
@@ -136,7 +133,12 @@ var app = new Vue({ | |||
(!this.thursday || (this.thursday && product.thursday)) && | |||
(!this.friday || (this.friday && product.friday)) && | |||
(!this.saturday || (this.saturday && product.saturday)) && | |||
(!this.sunday || (this.sunday && product.sunday)); | |||
(!this.sunday || (this.sunday && product.sunday)) && | |||
( | |||
(product.available_on_points_sale && !this.checkProductPointSaleInclude(product)) | |||
|| (!product.available_on_points_sale && this.checkProductPointSaleInclude(product)) | |||
) | |||
; | |||
if (!available) { | |||
product.quantity_form = 0; | |||
@@ -144,6 +146,9 @@ var app = new Vue({ | |||
return available; | |||
}, | |||
checkProductPointSaleInclude: function(product) { | |||
return this.idPointSaleActive && product.product_point_sale_array.includes(parseInt(this.idPointSaleActive)); | |||
}, | |||
checkOneProductAvailable: function () { | |||
var count = 0; | |||
for (key in this.products) { |
@@ -213,6 +213,11 @@ | |||
color: black ; | |||
font-size: 20px ; | |||
line-height: 25px ; | |||
font-weight: bold; | |||
} | |||
.comment { | |||
color: gray; | |||
} | |||
} | |||