<span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span> | <span class="label label-success" v-if="!order.date_update && !order.date_delete"><span class="glyphicon glyphicon-check"></span></span> | ||||
</td> | </td> | ||||
<td class="column-user"> | <td class="column-user"> | ||||
<span v-if="order.user"> | |||||
<a :href="baseUrl+'/user/view?id='+order.id_user" target="_blank" v-if="order.user"> | |||||
<template v-if="order.user.name_legal_person && order.user.name_legal_person.length"> | <template v-if="order.user.name_legal_person && order.user.name_legal_person.length"> | ||||
{{ order.user.name_legal_person }} | {{ order.user.name_legal_person }} | ||||
</template> | </template> | ||||
<template v-else> | <template v-else> | ||||
{{ order.user.lastname+' '+order.user.name }} | {{ order.user.lastname+' '+order.user.name }} | ||||
</template> | </template> | ||||
<span class="shortcuts btn-group" role="group"> | |||||
<!--<span class="shortcuts btn-group" role="group"> | |||||
<a :class="order.user.credit_active ? 'btn btn-success btn-sm' : '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="order.user.credit_active ? 'btn btn-success btn-sm' : '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/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> | <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>--> | |||||
</a> | |||||
<span v-else class="no-user">{{ order.username }}</span> | <span v-else class="no-user">{{ order.username }}</span> | ||||
<span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span> | <span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span> | ||||
<span v-if="order.delivery_home && order.delivery_address && order.delivery_address.length > 0" class="glyphicon glyphicon-home"></span> | <span v-if="order.delivery_home && order.delivery_address && order.delivery_address.length > 0" class="glyphicon glyphicon-home"></span> | ||||
</td> | </td> | ||||
<td class="column-credit" v-if="!idActivePointSale || (pointSaleActive && pointSaleActive.credit == 1)"> | <td class="column-credit" v-if="!idActivePointSale || (pointSaleActive && pointSaleActive.credit == 1)"> | ||||
<template v-if="order.isCreditContext"> | <template v-if="order.isCreditContext"> | ||||
<a :href="baseUrl+'/user/credit?id='+order.id_user" :class="order.user.credit >= 0 ? 'positive' : 'negative'"> | |||||
<a :href="baseUrl+'/user/credit?id='+order.id_user" target="_blank" :class="order.user.credit >= 0 ? 'positive' : 'negative'"> | |||||
{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }} | {{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }} | ||||
</a> | </a> | ||||
</template> | </template> |
<div class="box box-primary box-user"> | <div class="box box-primary box-user"> | ||||
<div class="box-body box-profile"> | <div class="box-body box-profile"> | ||||
<h3 class="profile-username text-center"> | <h3 class="profile-username text-center"> | ||||
<a title="Voir" href="<?= $this->getUrlManagerBackend()->createUrl(['user/view', 'id' => $userWithStatusUserOnline->id]); ?>"> | |||||
<?= $userModule->getSolver()->getUsername($userWithStatusUserOnline); ?> | |||||
</a> | |||||
<?= $userModule->getSolver()->getUsername($userWithStatusUserOnline); ?> | |||||
</h3> | </h3> | ||||
<p class="text-muted text-center"> | <p class="text-muted text-center"> | ||||
<?php $userProducerArray = $userWithStatusUserOnline->userProducer; ?> | <?php $userProducerArray = $userWithStatusUserOnline->userProducer; ?> |
*/ | */ | ||||
use common\helpers\GlobalParam; | use common\helpers\GlobalParam; | ||||
use common\helpers\Price; | |||||
use domain\Order\Order\Order; | use domain\Order\Order\Order; | ||||
use domain\Producer\Producer\ProducerModule; | use domain\Producer\Producer\ProducerModule; | ||||
use domain\User\User\UserModule; | use domain\User\User\UserModule; | ||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'attribute' => 'id_user_user_group', | |||||
'header' => 'Groupes', | |||||
'attribute' => 'credit', | |||||
'format' => 'raw', | 'format' => 'raw', | ||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filter' => $userGroupModule->getRepository()->populateUserGroupDropdownList(false), | |||||
'value' => function ($user) { | |||||
$html = ''; | |||||
foreach($user->userUserGroup as $userUserGroup) { | |||||
$html .= '<span class="label label-default">'.$userUserGroup->userGroup->name.'</span> '; | |||||
} | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile align-center'], | |||||
'value' => function ($model) use ($producer) { | |||||
$userProducer = UserProducer::searchOne([ | |||||
'id_user' => $model->id | |||||
]); | |||||
$credit = $userProducer ? $userProducer->credit : 0; | |||||
$classBtnCredit = $userProducer->credit_active ? 'btn-success' : 'btn-default'; | |||||
$html = '<a class="btn '.$classBtnCredit.'" href="'.Yii::$app->urlManager->createUrl(['user/credit', 'id' => $model->id]).'">'.Price::format($credit).'</a>'; | |||||
return $html; | return $html; | ||||
} | } | ||||
], | ], | ||||
[ | |||||
'attribute' => 'newsletter', | |||||
'header' => "Inscrit au bulletin<br/>d'information", | |||||
'format' => 'raw', | |||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filter' => [ | |||||
0 => 'Non', | |||||
1 => 'Oui' | |||||
], | |||||
'value' => function ($user) use ($userModule) { | |||||
if($userModule->isUserSubscribedNewsletter($user)) { | |||||
return '<span class="label label-success">Oui</span>'; | |||||
} | |||||
return '<span class="label label-danger">Non</span>'; | |||||
} | |||||
], | |||||
[ | [ | ||||
'class' => 'yii\grid\ActionColumn', | 'class' => 'yii\grid\ActionColumn', | ||||
'header' => 'Commandes', | 'header' => 'Commandes', | ||||
'template' => '{orders}', | 'template' => '{orders}', | ||||
'headerOptions' => ['class' => 'actions column-hide-on-mobile'], | 'headerOptions' => ['class' => 'actions column-hide-on-mobile'], | ||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | 'filterOptions' => ['class' => 'column-hide-on-mobile'], | ||||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile align-center'], | |||||
'buttons' => [ | 'buttons' => [ | ||||
'orders' => function ($url, $model) { | 'orders' => function ($url, $model) { | ||||
$url = Yii::$app->urlManager->createUrl(['user/orders', 'id' => $model['id']]); | $url = Yii::$app->urlManager->createUrl(['user/orders', 'id' => $model['id']]); | ||||
$html = ''; | $html = ''; | ||||
if ($countOrders) { | if ($countOrders) { | ||||
$html .= Html::a('<span class="glyphicon glyphicon-eye-open"></span> ' . $countOrders, $url, [ | |||||
$html .= Html::a($countOrders.' commande'.($countOrders > 1 ? 's' : ''), $url, [ | |||||
'title' => 'Commandes', 'class' => 'btn btn-default ' | 'title' => 'Commandes', 'class' => 'btn btn-default ' | ||||
]);; | ]);; | ||||
} else { | } else { | ||||
$html .= 'Aucune commande'; | |||||
$html .= 'Aucune'; | |||||
} | } | ||||
return $html; | return $html; | ||||
], | ], | ||||
], | ], | ||||
[ | [ | ||||
'attribute' => 'credit', | |||||
'attribute' => 'newsletter', | |||||
'header' => "Inscrit au bulletin<br/>d'information", | |||||
'format' => 'raw', | 'format' => 'raw', | ||||
'value' => function ($model) use ($producer) { | |||||
$userProducer = UserProducer::searchOne([ | |||||
'id_user' => $model->id | |||||
]); | |||||
$credit = $userProducer ? $userProducer->credit : 0; | |||||
$classBtnCredit = $userProducer->credit_active ? 'btn-success' : 'btn-default'; | |||||
$html = '<div class="input-group"> | |||||
<input type="text" class="form-control input-credit" readonly="readonly" value="' . number_format($credit, 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 ' . $classBtnCredit | |||||
] | |||||
) . ' | |||||
</span> | |||||
</div>'; | |||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile align-center'], | |||||
'filter' => [ | |||||
0 => 'Non', | |||||
1 => 'Oui' | |||||
], | |||||
'value' => function ($user) use ($userModule) { | |||||
if($userModule->isUserSubscribedNewsletter($user)) { | |||||
return '<span class="label label-success">Oui</span>'; | |||||
} | |||||
return '<span class="label label-danger">Non</span>'; | |||||
} | |||||
], | |||||
[ | |||||
'attribute' => 'id_user_user_group', | |||||
'header' => 'Groupes', | |||||
'format' => 'raw', | |||||
'headerOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filterOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'contentOptions' => ['class' => 'column-hide-on-mobile'], | |||||
'filter' => $userGroupModule->getRepository()->populateUserGroupDropdownList(false), | |||||
'value' => function ($user) { | |||||
$html = ''; | |||||
foreach($user->userUserGroup as $userUserGroup) { | |||||
$html .= '<span class="label label-default">'.$userUserGroup->userGroup->name.'</span> '; | |||||
} | |||||
return $html; | return $html; | ||||
} | } | ||||
], | ], | ||||
[ | [ | ||||
'class' => 'yii\grid\ActionColumn', | 'class' => 'yii\grid\ActionColumn', | ||||
'template' => '{view} {update} {delete} {switch}', | |||||
'template' => '{view} {update} | |||||
<div class="wrapper-button-dropdown"> | |||||
<button type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="btn btn-default dropdown-toggle"><span class="caret"></span></button> | |||||
<ul class="dropdown-menu"> | |||||
<li>{delete}</li> | |||||
<li>{switch}</li> | |||||
</ul></div>', | |||||
'headerOptions' => ['class' => 'column-actions'], | 'headerOptions' => ['class' => 'column-actions'], | ||||
'contentOptions' => ['class' => 'column-actions'], | 'contentOptions' => ['class' => 'column-actions'], | ||||
'buttons' => [ | 'buttons' => [ | ||||
]); | ]); | ||||
}, | }, | ||||
'delete' => function ($url, $model) { | 'delete' => function ($url, $model) { | ||||
return Html::a('<span class="glyphicon glyphicon-trash"></span>', | |||||
return Html::a('<span class="glyphicon glyphicon-minus"></span> Enlever', | |||||
Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), | Yii::$app->urlManager->createUrl(array_merge(['user/delete', 'id' => $model->id], Yii::$app->getRequest()->getQueryParams())), | ||||
[ | [ | ||||
'title' => 'Supprimer', | |||||
'class' => 'btn btn-default btn-confirm-delete' | |||||
'title' => 'Enlever', | |||||
'class' => 'btn-confirm-delete' | |||||
]); | ]); | ||||
}, | }, | ||||
'switch' => function($url, $model) use ($userModule, $userCurrent) { | 'switch' => function($url, $model) use ($userModule, $userCurrent) { | ||||
if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)) { | if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)) { | ||||
return Html::a('<span class="glyphicon glyphicon-user"></span>', | |||||
return Html::a('<i class="fa fa-fw fa-user-secret"></i> Prendre la main', | |||||
Yii::$app->urlManager->createUrl(['user/switch-identity', 'id' => $model->id]), | Yii::$app->urlManager->createUrl(['user/switch-identity', 'id' => $model->id]), | ||||
[ | [ | ||||
'title' => 'Prendre la main', | 'title' => 'Prendre la main', | ||||
'class' => 'btn btn-default' | |||||
'class' => '' | |||||
]); | ]); | ||||
} | } | ||||
} | } |
</li> | </li> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<?php if($model->address): ?> | <?php if($model->address): ?> | ||||
<li class="list-group-item"> | |||||
<li class="list-group-item list-group-item-address"> | |||||
<strong>Adresse</strong> | <strong>Adresse</strong> | ||||
<span class="pull-right"> | <span class="pull-right"> | ||||
<?= $model->address ?> | |||||
<?= nl2br($model->address) ?> | |||||
</span> | </span> | ||||
<div class="clr"></div> | |||||
</li> | </li> | ||||
<?php endif; ?> | <?php endif; ?> | ||||
<li class="list-group-item"> | <li class="list-group-item"> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<?php if(isset($pointSaleBillingArray) && $pointSaleBillingArray && count($pointSaleBillingArray) > 0): ?> | |||||
<div class="panel panel-default"> | |||||
<div class="panel-heading"> | |||||
<h3 class="panel-title"> | |||||
<i class="fa fa-sticky-note-o"></i> | |||||
Contact facturation | |||||
</h3> | |||||
</div> | |||||
<div class="panel-body"> | |||||
<?php foreach($pointSaleBillingArray as $pointSale): ?> | |||||
<a class="btn btn-default btn-sm" href="<?= Yii::$app->urlManager->createUrl(['point-sale/update', 'id' => $pointSale->id]) ?>"> | |||||
<i class="fa fa-map-marker"></i> | |||||
<?= $pointSale->name ?> | |||||
</a><br /> | |||||
<?php endforeach; ?> | |||||
</div> | |||||
<div class="panel panel-default"> | |||||
<div class="panel-heading"> | |||||
<h3 class="panel-title"> | |||||
<span class="glyphicon glyphicon-log-in"></span> | |||||
Dernière connexion et inscription | |||||
</h3> | |||||
</div> | </div> | ||||
<?php endif; ?> | |||||
<div class="panel-body"> | |||||
<ul class="list-group list-group-unbordered"> | |||||
<li class="list-group-item"> | |||||
<strong>Dernière connexion</strong> | |||||
<span class="pull-right"> | |||||
<?php if($model->date_last_connection): ?> | |||||
<?= date('d/m/Y à H:i:s', strtotime($model->date_last_connection)) ?> | |||||
<?php else: ?> | |||||
-- | |||||
<?php endif; ?> | |||||
</span> | |||||
</li> | |||||
<li class="list-group-item"> | |||||
<strong>Inscription</strong> | |||||
<span class="pull-right"> | |||||
<?= date('d/m/Y à H:i:s', $model->created_at) ?> | |||||
</span> | |||||
</li> | |||||
</ul> | |||||
</div> | |||||
</div> | |||||
<?php if($model->email): ?> | <?php if($model->email): ?> | ||||
<div class="panel panel-default"> | <div class="panel panel-default"> | ||||
</div> | </div> | ||||
</div> | </div> | ||||
<?php if(isset($pointSaleBillingArray) && $pointSaleBillingArray && count($pointSaleBillingArray) > 0): ?> | |||||
<div class="panel panel-default"> | |||||
<div class="panel-heading"> | |||||
<h3 class="panel-title"> | |||||
<i class="fa fa-sticky-note-o"></i> | |||||
Contact facturation | |||||
</h3> | |||||
</div> | |||||
<div class="panel-body"> | |||||
<?php foreach($pointSaleBillingArray as $pointSale): ?> | |||||
<a class="btn btn-default btn-sm" href="<?= Yii::$app->urlManager->createUrl(['point-sale/update', 'id' => $pointSale->id]) ?>"> | |||||
<i class="fa fa-map-marker"></i> | |||||
<?= $pointSale->name ?> | |||||
</a><br /> | |||||
<?php endforeach; ?> | |||||
</div> | |||||
</div> | |||||
<?php endif; ?> | |||||
</div> | </div> | ||||
<div class="clr"></div> | <div class="clr"></div> | ||||
</div> | </div> |
display: block; | display: block; | ||||
} | } | ||||
a { | |||||
color: #333; | |||||
&:hover { | |||||
text-decoration: underline; | |||||
} | |||||
} | |||||
.shortcuts { | .shortcuts { | ||||
display: none; | display: none; | ||||
float: right; | float: right; |
float: left; | float: left; | ||||
} | } | ||||
.align-center { | |||||
text-align: center ; | |||||
} | |||||
#block-demo { | #block-demo { | ||||
padding: 10px 0px ; | padding: 10px 0px ; | ||||
background-color: $color2 ; | background-color: $color2 ; | ||||
@import "distribution/_index.scss" ; | @import "distribution/_index.scss" ; | ||||
@import "user/_emails.scss" ; | @import "user/_emails.scss" ; | ||||
@import "user/_credit.scss" ; | @import "user/_credit.scss" ; | ||||
@import "user/_form.scss" ; | |||||
@import "user/_form.scss" ; | |||||
@import "user/_view.scss" ; | |||||
@import "user/_index.scss" ; | |||||
@import "producer/_update.scss" ; | @import "producer/_update.scss" ; | ||||
@import "point_sale/_index.scss" ; | @import "point_sale/_index.scss" ; | ||||
@import "point_sale/_form.scss" ; | @import "point_sale/_form.scss" ; |
.user-index { | |||||
.wrapper-button-dropdown { | |||||
display: inline-block; | |||||
position: relative; | |||||
.dropdown-menu { | |||||
left: -138px; | |||||
a { | |||||
color: #333; | |||||
} | |||||
} | |||||
} | |||||
} |
.user-view { | |||||
.list-group-item-address { | |||||
.pull-right { | |||||
text-align: right; | |||||
} | |||||
} | |||||
} | |||||