<?php | |||||
/** | |||||
Copyright distrib (2018) | |||||
contact@opendistrib.net | |||||
Ce logiciel est un programme informatique servant à aider les producteurs | |||||
à distribuer leur production en circuits courts. | |||||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
sur le site "http://www.cecill.info". | |||||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
de modification et de redistribution accordés par cette licence, il n'est | |||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
associés au chargement, à l'utilisation, à la modification et/ou au | |||||
développement et à la reproduction du logiciel par l'utilisateur étant | |||||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
avertis possédant des connaissances informatiques approfondies. Les | |||||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
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. | |||||
*/ | |||||
namespace backend\assets; | |||||
use yii\web\AssetBundle; | |||||
use yii ; | |||||
/** | |||||
* @author Qiang Xue <qiang.xue@gmail.com> | |||||
* @since 2.0 | |||||
*/ | |||||
class VuejsProducerUpdateAsset extends \common\components\MyAssetBundle | |||||
{ | |||||
public $basePath = '@webroot'; | |||||
public $baseUrl = '@web'; | |||||
public $css = []; | |||||
public $js = []; | |||||
public $depends = [ | |||||
'common\assets\CommonAsset' | |||||
]; | |||||
public function __construct() | |||||
{ | |||||
parent::__construct() ; | |||||
$this->addAsset('js','js/vuejs/producer-update.js') ; | |||||
} | |||||
} |
'date' => date('d/m/Y H:i:s', strtotime($creditHistory->date)), | 'date' => date('d/m/Y H:i:s', strtotime($creditHistory->date)), | ||||
'user_action' => $creditHistory->strUserAction(), | 'user_action' => $creditHistory->strUserAction(), | ||||
'wording' => $creditHistory->getStrWording(), | 'wording' => $creditHistory->getStrWording(), | ||||
'debit' => ($creditHistory->isTypeDebit() ? '- '.$creditHistory->getAmount(Order::AMOUNT_TOTAL,true) : ''), | |||||
'credit' => ($creditHistory->isTypeCredit() ? '+ '.$creditHistory->getAmount(Order::AMOUNT_TOTAL,true) : '') | |||||
'debit' => ($creditHistory->isTypeDebit() ? '- '.$creditHistory->getAmount(Order::AMOUNT_TOTAL,true) : ''), | |||||
'credit' => ($creditHistory->isTypeCredit() ? '+ '.$creditHistory->getAmount(Order::AMOUNT_TOTAL,true) : '') | |||||
] ; | ] ; | ||||
} | } | ||||
'pointsSaleArray' => $pointsSaleArray, | 'pointsSaleArray' => $pointsSaleArray, | ||||
'pointSale' => $pointSale, | 'pointSale' => $pointSale, | ||||
'mailForm' => $mailForm, | 'mailForm' => $mailForm, | ||||
'idPointSaleActive' => $idPointSale | |||||
]); | ]); | ||||
} | } | ||||
<td class="column-actions"> | <td class="column-actions"> | ||||
<a class="btn btn-default" :href="baseUrl+'/subscription/update?id='+order.id_subscription" v-if="order.id_subscription > 0"><span class="glyphicon glyphicon-repeat"></span></a> | <a class="btn btn-default" :href="baseUrl+'/subscription/update?id='+order.id_subscription" v-if="order.id_subscription > 0"><span class="glyphicon glyphicon-repeat"></span></a> | ||||
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> | <button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> | ||||
<button class="btn btn-default" :data-id-order="order.id" @click="orderPaymentModalClick"><span class="glyphicon glyphicon-euro"></span></button> | |||||
<button class="btn btn-default" :data-id-order="order.id" @click="orderPaymentModalClick" v-show="order.user"><span class="glyphicon glyphicon-euro"></span></button> | |||||
<button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button> | <button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button> | ||||
<button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button> | <button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button> | ||||
<modal v-if="showModalPayment && idOrderPayment == order.id" class="modal-payment" @close="showModalPayment = false"> | <modal v-if="showModalPayment && idOrderPayment == order.id" class="modal-payment" @close="showModalPayment = false"> | ||||
<h3 slot="header"> | <h3 slot="header"> | ||||
Commande du <strong>{{ dateFormat }}</strong> > | Commande du <strong>{{ dateFormat }}</strong> > | ||||
<strong><span v-if="order.user">{{ order.user.name +' '+order.user.lastname }}</span> | |||||
<span v-else>{{ order.username }}</span></strong> | |||||
<strong><span v-if="order.user">{{ order.user.name +' '+order.user.lastname }}</span> | |||||
<span v-else>{{ order.username }}</span></strong> | |||||
</h3> | </h3> | ||||
<div slot="body"> | <div slot="body"> | ||||
<div class="col-md-4"> | <div class="col-md-4"> | ||||
<td>{{ creditHistory.date }}</td> | <td>{{ creditHistory.date }}</td> | ||||
<td>{{ creditHistory.user_action }}</td> | <td>{{ creditHistory.user_action }}</td> | ||||
<td v-html="creditHistory.wording"></td> | <td v-html="creditHistory.wording"></td> | ||||
<td>{{ creditHistory.debit }}</td> | |||||
<td>{{ creditHistory.credit }}</td> | |||||
<td v-html="creditHistory.debit"></td> | |||||
<td v-html="creditHistory.credit"></td> | |||||
</tr> | </tr> | ||||
</tbody> | </tbody> | ||||
</table> | </table> |
use yii\widgets\ActiveForm; | use yii\widgets\ActiveForm; | ||||
use common\helpers\Url ; | use common\helpers\Url ; | ||||
\backend\assets\VuejsProducerUpdateAsset::register($this); | |||||
$this->setTitle('Paramètres') ; | $this->setTitle('Paramètres') ; | ||||
$this->addBreadcrumb($this->getTitle()) ; | $this->addBreadcrumb($this->getTitle()) ; | ||||
?> | ?> | ||||
<div class="user-update"> | |||||
<div class="user-update" id="app-producer-update"> | |||||
<div id="nav-params"> | |||||
<button v-for="section in sectionsArray" :class="'btn '+((currentSection == section.name) ? 'btn-primary' : 'btn-default')" @click="changeSection(section)"> | |||||
{{ section.nameDisplay }} | |||||
<span class="glyphicon glyphicon-triangle-bottom"></span> | |||||
</button> | |||||
</div> | |||||
<div class="user-form"> | <div class="user-form"> | ||||
<?php $form = ActiveForm::begin(); ?> | <?php $form = ActiveForm::begin(); ?> | ||||
<div class=""> | |||||
<div class="panel panel-default"> | |||||
<div> | |||||
<div v-show="currentSection == 'general'" class="panel panel-default"> | |||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
<h3 class="panel-title">Général</h3> | <h3 class="panel-title">Général</h3> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="panel panel-default"> | |||||
<div v-show="currentSection == 'prise-commande'" class="panel panel-default"> | |||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
<h3 class="panel-title">Prise de commande</h3> | <h3 class="panel-title">Prise de commande</h3> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="panel panel-default"> | |||||
<div v-show="currentSection == 'abonnements'" class="panel panel-default"> | |||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
<h3 class="panel-title">Abonnements</h3> | <h3 class="panel-title">Abonnements</h3> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<div class="panel panel-default"> | |||||
<div v-show="currentSection == 'credit-payment'" class="panel panel-default"> | |||||
<div class="panel-heading"> | <div class="panel-heading"> | ||||
<h3 class="panel-title">Crédit / paiement en ligne</h3> | <h3 class="panel-title">Crédit / paiement en ligne</h3> | ||||
</div> | </div> |
use dosamigos\chartjs\ChartJs; | use dosamigos\chartjs\ChartJs; | ||||
$this->setTitle('Statistiques <small>Chiffre d\'affaire</small>') ; | $this->setTitle('Statistiques <small>Chiffre d\'affaire</small>') ; | ||||
$this->addBreadcrumb($this->getTitle()) ; | |||||
$this->addBreadcrumb('Statistiques (chiffre d\'affaire)') ; | |||||
?> | ?> | ||||
'datasets' => [ | 'datasets' => [ | ||||
[ | [ | ||||
'label' => 'Recettes commandes', | 'label' => 'Recettes commandes', | ||||
'backgroundColor' => "rgb(187,135,87,0.5)", | |||||
'borderColor' => "rgb(187,135,87,1)", | |||||
'pointBackgroundColor' => "rgb(187,135,87,1)", | |||||
'backgroundColor' => "rgb(255,127,0,0.5)", | |||||
'borderColor' => "rgb(255,127,0,1)", | |||||
'pointBackgroundColor' => "rgb(255,127,0,1)", | |||||
'pointStrokeColor' => "#fff", | 'pointStrokeColor' => "#fff", | ||||
'data' => $data | 'data' => $data | ||||
] | ] |
<?php | |||||
/** | |||||
Copyright distrib (2018) | |||||
contact@opendistrib.net | |||||
Ce logiciel est un programme informatique servant à aider les producteurs | |||||
à distribuer leur production en circuits courts. | |||||
Ce logiciel est régi par la licence CeCILL soumise au droit français et | |||||
respectant les principes de diffusion des logiciels libres. Vous pouvez | |||||
utiliser, modifier et/ou redistribuer ce programme sous les conditions | |||||
de la licence CeCILL telle que diffusée par le CEA, le CNRS et l'INRIA | |||||
sur le site "http://www.cecill.info". | |||||
En contrepartie de l'accessibilité au code source et des droits de copie, | |||||
de modification et de redistribution accordés par cette licence, il n'est | |||||
offert aux utilisateurs qu'une garantie limitée. Pour les mêmes raisons, | |||||
seule une responsabilité restreinte pèse sur l'auteur du programme, le | |||||
titulaire des droits patrimoniaux et les concédants successifs. | |||||
A cet égard l'attention de l'utilisateur est attirée sur les risques | |||||
associés au chargement, à l'utilisation, à la modification et/ou au | |||||
développement et à la reproduction du logiciel par l'utilisateur étant | |||||
donné sa spécificité de logiciel libre, qui peut le rendre complexe à | |||||
manipuler et qui le réserve donc à des développeurs et des professionnels | |||||
avertis possédant des connaissances informatiques approfondies. Les | |||||
utilisateurs sont donc invités à charger et tester l'adéquation du | |||||
logiciel à leurs besoins dans des conditions permettant d'assurer la | |||||
sécurité de leurs systèmes et ou de leurs données et, plus généralement, | |||||
à l'utiliser et l'exploiter dans les mêmes conditions de sécurité. | |||||
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. | |||||
*/ | |||||
?> | |||||
<div id="menu-users"> | |||||
<div id="nav-points-sale"> | |||||
<a class="btn <?php if(!$idPointSaleActive && !$sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/index']); ?>"> | |||||
Tous <span class="glyphicon glyphicon-triangle-bottom"></span> | |||||
</a> | |||||
<?php foreach($pointsSaleArray as $pointSale): ?> | |||||
<a class="btn <?php if($idPointSaleActive == $pointSale->id): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/index','idPointSale' => $pointSale->id]); ?>"> | |||||
<?= Html::encode($pointSale->name) ?> | |||||
<span class="glyphicon glyphicon-triangle-bottom"></span> | |||||
</a> | |||||
<?php endforeach; ?> | |||||
<?php if(isset($sectionInactiveUsers) && !is_null($sectionInactiveUsers)): ?> | |||||
<a class="btn <?php if($sectionInactiveUsers): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/index','sectionInactiveUsers' => 1]); ?>"> | |||||
Inactifs <span class="glyphicon glyphicon-triangle-bottom"></span> | |||||
</a> | |||||
<?php endif; ?> | |||||
</div> | |||||
<div id="submenu"> | |||||
<a class="btn btn-xs <?php if($section == 'list'): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/index','idPointSale' => $idPointSaleActive]); ?>"> | |||||
<span class="glyphicon glyphicon-th-list"></span> Liste | |||||
</a> | |||||
<a class="btn btn-xs <?php if($section == 'sendmail'): ?>btn-primary<?php else: ?>btn-default<?php endif; ?>" href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale' => $idPointSaleActive]); ?>"> | |||||
<span class="glyphicon glyphicon-envelope"></span> Envoyer un email | |||||
</a> | |||||
</div> | |||||
</div> |
?> | ?> | ||||
<ul id="tabs-points-sale" class="nav nav-tabs" role="tablist"> | |||||
<li class="<?php if(!isset($pointSale)): ?>active<?php endif; ?>"> | |||||
<a href="<?= Yii::$app->urlManager->createUrl(['user/mail']); ?>">Tous</a> | |||||
</li> | |||||
<?php foreach($pointsSaleArray as $thePointSale): ?> | |||||
<li class="<?php if(isset($pointSale) && $pointSale->id == $thePointSale->id): ?>active<?php endif; ?>"> | |||||
<a href="<?= Yii::$app->urlManager->createUrl(['user/mail','idPointSale'=>$thePointSale->id]); ?>"><?= Html::encode($thePointSale->name) ?></a> | |||||
</li> | |||||
<?php endforeach; ?> | |||||
</ul> | |||||
<?= | |||||
$this->render('_menu',[ | |||||
'idPointSaleActive' => $idPointSaleActive, | |||||
'sectionInactiveUsers' => isset($sectionInactiveUsers) ? $sectionInactiveUsers : null, | |||||
'pointsSaleArray' => $pointsSaleArray, | |||||
'section' => 'sendmail' | |||||
]) ; | |||||
?> | |||||
<div id=""> | <div id=""> | ||||
<div class="col-md-6"> | <div class="col-md-6"> |
?> | ?> | ||||
<div class="user-index"> | |||||
<ul id="tabs-points-vente" class="nav nav-tabs" role="tablist"> | |||||
<li class="<?php if(!$idPointSaleActive && !$sectionInactiveUsers): ?>active<?php endif; ?>"> | |||||
<a href="<?= Yii::$app->urlManager->createUrl(['user/index']); ?>">Tous</a> | |||||
</li> | |||||
<?php foreach($pointsSaleArray as $pointSale): ?> | |||||
<li class="<?php if($idPointSaleActive == $pointSale->id): ?>active<?php endif; ?>"> | |||||
<a href="<?= Yii::$app->urlManager->createUrl(['user/index','idPointSale' => $pointSale->id]); ?>"><?= Html::encode($pointSale->name) ?></a> | |||||
</li> | |||||
<?php endforeach; ?> | |||||
<li class="<?php if($sectionInactiveUsers): ?>active<?php endif; ?>"> | |||||
<a href="<?= Yii::$app->urlManager->createUrl(['user/index','sectionInactiveUsers' => 1]); ?>">Inactifs</a> | |||||
</li> | |||||
</ul> | |||||
<?= Html::a('<span class="glyphicon glyphicon-envelope"></span> Envoyer un email', ['mail', 'idPointSale' => $idPointSaleActive], ['class' => 'btn btn-default btn-liste-emails']) ?> | |||||
<?= GridView::widget([ | |||||
'dataProvider' => $dataProvider, | |||||
'filterModel' => $searchModel, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'username', | |||||
'label' => 'Nom', | |||||
'value' => function($model) { | |||||
return $model['lastname'].' '.$model['name'] ; | |||||
<?= | |||||
$this->render('_menu',[ | |||||
'idPointSaleActive' => $idPointSaleActive, | |||||
'sectionInactiveUsers' => $sectionInactiveUsers, | |||||
'pointsSaleArray' => $pointsSaleArray, | |||||
'section' => 'list' | |||||
]) ; | |||||
?> | |||||
<?= GridView::widget([ | |||||
'dataProvider' => $dataProvider, | |||||
'filterModel' => $searchModel, | |||||
'columns' => [ | |||||
[ | |||||
'attribute' => 'username', | |||||
'label' => 'Nom', | |||||
'value' => function($model) { | |||||
return $model['lastname'].' '.$model['name'] ; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'contacts', | |||||
'header' => 'Contacts', | |||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
$html = '' ; | |||||
if(strlen($model['phone'])) { | |||||
$html .= $model['phone'] ; | |||||
} | } | ||||
], | |||||
[ | |||||
'attribute' => 'contacts', | |||||
'header' => 'Contacts', | |||||
'format' => 'raw', | |||||
'value' => function($model) { | |||||
if(strlen($model['phone']) && strlen($model['email'])) { | |||||
$html .= '<br />' ; | |||||
} | |||||
if(strlen($model['email'])) { | |||||
$html .= $model['email'] ; | |||||
} | |||||
return $html ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'header' => 'Commandes', | |||||
'template' => '{orders}', | |||||
'headerOptions' => ['class' => 'actions'], | |||||
'buttons' => [ | |||||
'orders' => function ($url, $model) { | |||||
$url = Yii::$app->urlManager->createUrl(['user/orders','id' => $model['id']]) ; | |||||
$countOrders = Order::searchCount([ | |||||
'id_user' => $model['id'] | |||||
], ['conditions' => 'date_delete IS NULL']) ; | |||||
$html = '' ; | $html = '' ; | ||||
if(strlen($model['phone'])) { | |||||
$html .= $model['phone'] ; | |||||
} | |||||
if(strlen($model['phone']) && strlen($model['email'])) { | |||||
$html .= '<br />' ; | |||||
if($countOrders) { | |||||
$html .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> '.$countOrders, $url, [ | |||||
'title' => Yii::t('app', 'Commandes'), 'class' => 'btn btn-default ' | |||||
]); ; | |||||
} | } | ||||
if(strlen($model['email'])) { | |||||
$html .= $model['email'] ; | |||||
else { | |||||
$html .= 'Aucune commande' ; | |||||
} | } | ||||
return $html ; | return $html ; | ||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'created_at', | |||||
'label' => 'Date d\'inscription', | |||||
'value' => function($model) { | |||||
if(isset($model['created_at'])) | |||||
return date('m/d/Y à H:i', $model['created_at']); | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'header' => 'Commandes', | |||||
'template' => '{orders}', | |||||
'headerOptions' => ['class' => 'actions'], | |||||
'buttons' => [ | |||||
'orders' => function ($url, $model) { | |||||
$url = Yii::$app->urlManager->createUrl(['user/orders','id' => $model['id']]) ; | |||||
$countOrders = Order::searchCount([ | |||||
'id_user' => $model['id'] | |||||
], ['conditions' => 'date_delete IS NULL']) ; | |||||
$html = '' ; | |||||
if($countOrders) { | |||||
$html .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> '.$countOrders, $url, [ | |||||
'title' => Yii::t('app', 'Commandes'), 'class' => 'btn btn-default ' | |||||
]); ; | |||||
} | |||||
else { | |||||
$html .= 'Aucune commande' ; | |||||
} | |||||
return $html ; | |||||
}, | |||||
], | |||||
}, | |||||
], | ], | ||||
[ | |||||
'attribute' => 'credit', | |||||
'format' => 'raw', | |||||
'value' => function($model) use($producer) { | |||||
$user = User::findOne($model->id) ; | |||||
$html = '<div class="input-group"> | |||||
<input type="text" class="form-control input-credit" readonly="readonly" value="'.number_format($user->getCredit($producer->id),2).' €" placeholder=""> | |||||
<span class="input-group-btn"> | |||||
'.Html::a( | |||||
'<span class="glyphicon glyphicon-euro"></span>', | |||||
Yii::$app->urlManager->createUrl(['user/credit','id' => $model->id]), | |||||
[ | |||||
'title' => 'Crédit', | |||||
'class' => 'btn btn-default' | |||||
] | |||||
).' | |||||
</span> | |||||
</div>' ; | |||||
return $html ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{update} {delete}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'update' => function ($url, $model) { | |||||
$url = Yii::$app->urlManager->createUrl(['user/update','id' => $model->id]) ; | |||||
$user = User::find()->with('userProducer')->where(['id' => $model->id])->one() ; | |||||
if(count($user->userProducer) <= 1) | |||||
{ | |||||
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' | |||||
]); | |||||
} | |||||
else { | |||||
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les utilisateurs qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>' ; | |||||
} | |||||
}, | |||||
'delete' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete','id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [ | |||||
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' | |||||
]); | |||||
], | |||||
[ | |||||
'attribute' => 'credit', | |||||
'format' => 'raw', | |||||
'value' => function($model) use($producer) { | |||||
$user = User::findOne($model->id) ; | |||||
$html = '<div class="input-group"> | |||||
<input type="text" class="form-control input-credit" readonly="readonly" value="'.number_format($user->getCredit($producer->id),2).' €" placeholder=""> | |||||
<span class="input-group-btn"> | |||||
'.Html::a( | |||||
'<span class="glyphicon glyphicon-euro"></span>', | |||||
Yii::$app->urlManager->createUrl(['user/credit','id' => $model->id]), | |||||
[ | |||||
'title' => 'Crédit', | |||||
'class' => 'btn btn-default' | |||||
] | |||||
).' | |||||
</span> | |||||
</div>' ; | |||||
return $html ; | |||||
} | |||||
], | |||||
[ | |||||
'class' => 'yii\grid\ActionColumn', | |||||
'template' => '{update} {delete}', | |||||
'headerOptions' => ['class' => 'column-actions'], | |||||
'contentOptions' => ['class' => 'column-actions'], | |||||
'buttons' => [ | |||||
'update' => function ($url, $model) { | |||||
$url = Yii::$app->urlManager->createUrl(['user/update','id' => $model->id]) ; | |||||
$user = User::find()->with('userProducer')->where(['id' => $model->id])->one() ; | |||||
if(count($user->userProducer) <= 1) | |||||
{ | |||||
return Html::a('<span class="glyphicon glyphicon-pencil"></span>', $url, [ | |||||
'title' => Yii::t('app', 'Modifier'), 'class' => 'btn btn-default' | |||||
]); | |||||
} | } | ||||
], | |||||
else { | |||||
return '<span data-toggle="tooltip" data-placement="top" title="Vous ne pouvez pas modifier les utilisateurs qui sont liés à plusieurs producteurs."><span class="glyphicon glyphicon-remove-sign"></span> Non modifiable</span>' ; | |||||
} | |||||
}, | |||||
'delete' => function($url, $model) { | |||||
return Html::a('<span class="glyphicon glyphicon-trash"></span>', Yii::$app->urlManager->createUrl(array_merge(['user/delete','id' => $model->id], Yii::$app->getRequest()->getQueryParams())), [ | |||||
'title' => Yii::t('app', 'Supprimer'), 'class' => 'btn btn-default' | |||||
]); | |||||
} | |||||
], | ], | ||||
], | ], | ||||
]); ?> | |||||
</div> | |||||
], | |||||
]); ?> |
var app = new Vue({ | |||||
el: '#app-producer-update', | |||||
data: { | |||||
currentSection: 'general', | |||||
sectionsArray: [ | |||||
{ | |||||
name: 'general', | |||||
nameDisplay: 'Général' | |||||
}, | |||||
{ | |||||
name: 'prise-commande', | |||||
nameDisplay: 'Prise de commande' | |||||
}, | |||||
{ | |||||
name: 'abonnements', | |||||
nameDisplay: 'Abonnements' | |||||
}, | |||||
{ | |||||
name: 'credit-payment', | |||||
nameDisplay: 'Crédit / paiement en ligne' | |||||
} | |||||
] | |||||
}, | |||||
methods: { | |||||
changeSection: function(section) { | |||||
this.currentSection = section.name ; | |||||
} | |||||
} | |||||
}); | |||||
margin-right: 10px ; | margin-right: 10px ; | ||||
margin-bottom: 10px ; | margin-bottom: 10px ; | ||||
a { | |||||
position: relative ; | |||||
&.btn-primary { | |||||
.glyphicon { | |||||
display: block ; | |||||
} | |||||
} | |||||
.glyphicon { | |||||
display: none ; | |||||
position: absolute ; | |||||
top: 26px ; | |||||
left: 50% ; | |||||
margin-left: -10px ; | |||||
font-size: 20px ; | |||||
color: $color1 ; | |||||
position: absolute ; | |||||
} | |||||
a { | |||||
.label { | .label { | ||||
background-color: white ; | background-color: white ; | ||||
border: solid 1px #e0e0e0 ; | border: solid 1px #e0e0e0 ; |
.producer-update { | |||||
#nav-params { | |||||
margin-bottom: 30px ; | |||||
button { | |||||
margin-right: 10px ; | |||||
} | |||||
} | |||||
} |
} | } | ||||
} | } | ||||
a.btn, button.btn { | |||||
position: relative ; | |||||
.glyphicon-triangle-bottom { | |||||
display: none; | |||||
position: absolute; | |||||
top: 26px; | |||||
left: 50%; | |||||
margin-left: -10px; | |||||
font-size: 20px; | |||||
color: #FF7F00; | |||||
} | |||||
&.btn-primary { | |||||
.glyphicon-triangle-bottom { | |||||
display: block ; | |||||
} | |||||
} | |||||
} | |||||
// liste de commandes | // liste de commandes | ||||
.site-index, .user-commandes { | .site-index, .user-commandes { | ||||
#last-orders, #history-orders { | #last-orders, #history-orders { | ||||
padding: 10px ; | padding: 10px ; | ||||
@include border-radius(10px) ; | @include border-radius(10px) ; | ||||
margin-bottom: 30px ; | margin-bottom: 30px ; | ||||
font-family: 'myriadpro-regular' ; | |||||
font-family: 'Arial' ; | |||||
.header { | .header { | ||||
.logo { | .logo { | ||||
/* utilisateurs */ | /* utilisateurs */ | ||||
#menu-users { | |||||
#nav-points-sale { | |||||
margin-bottom: 30px ; | |||||
} | |||||
#submenu { | |||||
margin-bottom: 30px ; | |||||
text-align: center ; | |||||
} | |||||
} | |||||
.user-index { | .user-index { | ||||
.input-group { | .input-group { | ||||
width: 180px ; | width: 180px ; | ||||
text-align: center ; | text-align: center ; | ||||
} | } | ||||
} | } | ||||
#tabs-points-sale { | |||||
margin-bottom: 20px ; | |||||
} | |||||
.btn-liste-emails { | |||||
float: right ; | |||||
position: relative ; | |||||
top: 6px ; | |||||
} | |||||
} | } | ||||
.user-credit { | .user-credit { | ||||
@import "product/_form.scss" ; | @import "product/_form.scss" ; | ||||
@import "stats/_products.scss" ; | @import "stats/_products.scss" ; | ||||
@import "distribution/_index.scss" ; | @import "distribution/_index.scss" ; | ||||
@import "user/_emails.scss" ; | |||||
@import "user/_emails.scss" ; | |||||
@import "producer/_update.scss" ; |
*/ | */ | ||||
$this->fontdata = array( | $this->fontdata = array( | ||||
"highvoltageregular" => array( | |||||
'R' => "highvoltage-webfont.ttf", | |||||
), | |||||
"capsuularegular" => array( | |||||
'R' => "capsuula-webfont.ttf", | |||||
), | |||||
"dejavusanscondensed" => array( | "dejavusanscondensed" => array( | ||||
'R' => "DejaVuSansCondensed.ttf", | 'R' => "DejaVuSansCondensed.ttf", | ||||
'B' => "DejaVuSansCondensed-Bold.ttf", | 'B' => "DejaVuSansCondensed-Bold.ttf", |