|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415 |
- <?php
-
- /**
- Copyright Guillaume Bourgeois (2018)
-
- contact@souke.fr
-
- 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.
- */
-
- use common\helpers\GlobalParam;
- use common\helpers\Price;
- use domain\Communication\Email\Email;
- use domain\Order\Order\OrderModule;
- use domain\Subscription\Subscription\SubscriptionModule;
- use domain\User\User\UserModule;
- use domain\User\UserProducer\UserProducerModule;
- use yii\helpers\Html;
- use yii\widgets\ActiveForm;
-
- $userCurrent = GlobalParam::getCurrentUser();
- $orderModule = OrderModule::getInstance();
- $userModule = UserModule::getInstance();
- $userProducerModule = UserProducerModule::getInstance();
- $subscriptionModule = SubscriptionModule::getInstance();
- $userProducer = $userProducerModule->findOneUserProducer($model);
- $username = Html::encode($userModule->getSolver()->getUsername($model));
- $producer = GlobalParam::getCurrentProducer();
- $this->setTitle($username.' (#'.$model->id.')') ;
- $this->addBreadcrumb(['label' => 'Utilisateurs', 'url' => ['index']]) ;
- $this->addBreadcrumb(['label' => $username]) ;
- $this->addBreadcrumb('Récapitulatif') ;
-
- ?>
-
- <?= $this->render('_menu_navigation', [
- 'action' => 'view',
- 'user' => $model
- ]); ?>
-
- <div class="user-view tab-content">
- <div class="col-md-6 col-no-padding-left">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-user"></i>
- Profil
- <a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['user/update','id' => $model->id]) ?>">
- <span class="glyphicon glyphicon-pencil"></span>
- Modifier
- </a>
- </h3>
- </div>
- <div class="panel-body">
- <ul class="list-group list-group-unbordered">
- <li class="list-group-item">
- <strong>Type</strong>
- <span class="pull-right">
- <?= $userModule->getSolver()->getTypeLabel($model->type) ?>
- </span>
- </li>
- <li class="list-group-item">
- <strong>Nom</strong>
- <span class="pull-right">
- <?= $userModule->getSolver()->getUsername($model) ?>
- </span>
- </li>
- <?php if($model->phone): ?>
- <li class="list-group-item">
- <strong>Téléphone</strong>
- <span class="pull-right">
- <span class="glyphicon glyphicon-phone"></span>
- <?= $userModule->getSolver()->getPhone($model); ?>
- </span>
- </li>
- <?php endif; ?>
- <?php if($model->email): ?>
- <li class="list-group-item">
- <strong>Email</strong>
- <span class="pull-right">
- <span class="glyphicon glyphicon-envelope"></span>
- <a href="mailto:<?= $userModule->getSolver()->getEmail($model) ?>"><?= $userModule->getSolver()->getEmail($model) ?></a>
- </span>
- </li>
- <?php endif; ?>
- <?php if($model->address): ?>
- <li class="list-group-item list-group-item-address">
- <strong>Adresse</strong>
- <span class="pull-right">
- <?= nl2br($userModule->getSolver()->getAddress($model)) ?>
- </span>
- <div class="clr"></div>
- </li>
- <?php endif; ?>
- <li class="list-group-item">
- <strong>Infolettre</strong>
- <span class="pull-right">
- <?php $isUserSubscribedNewsletter = $userModule->getNewsletterManager()->isUserSubscribedNewsletter($model, Email::TYPE_NEWSLETTER); ?>
- <span class="label label-<?= $isUserSubscribedNewsletter ? 'success' : 'default' ?>">
- <?= $isUserSubscribedNewsletter ? 'Oui' : 'Non' ?>
- </span>
- </span>
- </li>
- <li class="list-group-item">
- <strong>Emails de prise de commande</strong>
- <span class="pull-right">
- <?php $isUserSubscribedNewsletterOrderTaking = $userModule->getNewsletterManager()->isUserSubscribedNewsletter($model, Email::TYPE_ORDER_TAKING); ?>
- <span class="label label-<?= $isUserSubscribedNewsletterOrderTaking ? 'success' : 'default' ?>">
- <?= $isUserSubscribedNewsletterOrderTaking ? 'Oui' : 'Non' ?>
- </span>
- </span>
- </li>
- <?php if($userModule->getAuthorizationChecker()->isGrantedAsAdministrator($userCurrent)): ?>
- <li class="list-group-item">
- <strong>Infolettre Souke</strong>
- <span class="pull-right">
- <?php $isUserSubscribedNewsletterSouke = $model->newsletter_souke; ?>
- <span class="label label-<?= $isUserSubscribedNewsletterSouke ? 'success' : 'default' ?>">
- <?= $isUserSubscribedNewsletterSouke ? 'Oui' : 'Non' ?>
- </span>
- </span>
- </li>
- <?php endif; ?>
- <li class="list-group-item">
- <strong>Problème réception emails</strong>
- <span class="pull-right">
- <?php $hasProblemReceivingEmails = $model->problem_receiving_emails; ?>
- <span class="label label-<?= $hasProblemReceivingEmails ? 'danger' : 'default' ?>">
- <?= $hasProblemReceivingEmails ? 'Oui' : 'Non' ?>
- </span>
- </span>
- </li>
- <?php if($model->userPointSale): ?>
- <li class="list-group-item">
- <strong>Points de vente</strong>
- <span class="pull-right">
- <?php foreach($model->userPointSale as $userPointSale): ?>
- <?php if($userPointSale->pointSale->id_producer == $producer->id): ?>
- <span class="label label-default"><?= $userPointSale->pointSale->name; ?></span>
- <?php endif; ?>
- <?php endforeach; ?>
- </span>
- </li>
- <?php endif; ?>
- <?php if($model->userUserGroup): ?>
- <li class="list-group-item">
- <strong>Groupes d'utilisateurs</strong>
- <span class="pull-right">
- <?php foreach($model->userUserGroup as $userUserGroup): ?>
- <span class="label label-default"><?= $userUserGroup->userGroup->name; ?></span>
- <?php endforeach; ?>
- </span>
- </li>
- <?php endif; ?>
- </ul>
- </div>
- </div>
-
- <?php if($userProducer->trust_alert): ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-exclamation-triangle"></i>
- Alerte confiance
- </h3>
- </div>
- <div class="panel-body">
- <ul class="list-group list-group-unbordered">
- <li class="list-group-item">
- <strong>Alerte confiance</strong>
- <span class="pull-right">
- <span class="label label-danger">Oui</span>
- </span>
- </li>
- <?php if($userProducer->trust_alert_comment && strlen($userProducer->trust_alert_comment) > 0): ?>
- <li class="list-group-item">
- <strong>Commentaire</strong>
- <span class="pull-right">
- <?= nl2br($userProducer->trust_alert_comment) ?>
- </span>
- <div class="clr"></div>
- </li>
- <?php endif; ?>
- </ul>
- </div>
- </div>
- <?php endif; ?>
-
- <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 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): ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="fa fa-envelope"></i>
- Emails accès
- </h3>
- </div>
- <div class="panel-body">
- <?php $form = ActiveForm::begin(); ?>
- <div class="form-group">
- <?= Html::submitButton(
- '<i class="fa fa-key"></i> Envoyer un nouveau mot de passe',
- ['class' => 'btn btn-default', 'name' => 'submit_new_password', 'value' => 1]
- ) ?>
- </div>
- <?php ActiveForm::end(); ?>
-
- <?php $form = ActiveForm::begin(); ?>
- <div class="form-group">
- <?= Html::submitButton(
- '<i class="fa fa-home"></i> Envoyer l\'email de bienvenue',
- ['class' => 'btn btn-default', 'name' => 'submit_mail_welcome', 'value' => 1]
- ) ?>
- </div>
- <?php ActiveForm::end(); ?>
- </div>
- </div>
- <?php endif; ?>
-
- </div>
- <div class="col-md-6 col-no-padding-right">
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="glyphicon glyphicon-piggy-bank"></i>
- Cagnotte
- <a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['user/credit','id' => $model->id]) ?>">
- <span class="glyphicon glyphicon-euro"></span>
- Voir / créditer
- </a>
- </h3>
- </div>
- <div class="panel-body">
- <ul class="list-group list-group-unbordered">
- <li class="list-group-item">
- <strong>Montant</strong>
- <span class="pull-right">
- <?php $credit = $userModule->getRepository()->getCredit($model); ?>
- <span class="label label-<?= $credit > 0 ? 'success' : 'danger' ?>">
- <?= Price::format($credit) ?>
- </span>
- </span>
- </li>
- <li class="list-group-item">
- <strong>Cagnotte obligatoire</strong>
- <span class="pull-right">
- <?php $creditActive = $userModule->getRepository()->getCreditActive($model) ?>
- <span class="label label-<?= $creditActive ? 'success' : 'default' ?>">
- <?= $creditActive ? 'Oui' : 'Non' ?>
- </span>
- </span>
- </li>
- </ul>
- </div>
- </div>
-
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="glyphicon glyphicon-th-list"></i>
- Commandes
- <a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['user/orders','id' => $model->id]) ?>">
- <span class="glyphicon glyphicon-eye-open"></span>
- Voir
- </a>
- </h3>
- </div>
- <div class="panel-body">
- <?php $countOrders = $orderModule->getRepository()->countOrdersByUser($model); ?>
- <?php if($countOrders): ?>
- <ul class="list-group list-group-unbordered">
- <li class="list-group-item">
- <strong>Nombre</strong>
- <span class="pull-right">
- <?= $orderModule->getRepository()->countOrdersByUser($model) ?>
- </span>
- </li>
- <li class="list-group-item">
- <strong>Panier moyen</strong>
- <span class="pull-right">
- <?= Price::format($orderModule->getRepository()->getAverageBasketByUser($model)); ?>
- </span>
- </li>
- </ul>
- <?php else: ?>
- <div class="alert alert-info">
- Aucune commande
- </div>
- <?php endif; ?>
- </div>
- </div>
-
- <?php $hasSubscription = $subscriptionsArray && count($subscriptionsArray); ?>
- <div class="panel panel-default">
- <div class="panel-heading">
- <h3 class="panel-title">
- <i class="glyphicon glyphicon-repeat"></i>
- Abonnements
- <?php if($hasSubscription): ?>
- <a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['subscription/index','SubscriptionSearch[id_user]' => $model->id]) ?>">
- <span class="glyphicon glyphicon-eye-open"></span>
- Voir
- </a>
- <?php else: ?>
- <a class="btn btn-default btn-xs" href="<?= Yii::$app->urlManager->createUrl(['subscription/create']) ?>">
- <span class="glyphicon glyphicon-plus"></span>
- Créer
- </a>
- <?php endif; ?>
- </h3>
- </div>
- <div class="panel-body">
- <?php if($hasSubscription): ?>
- <ul class="list-group list-group-unbordered">
- <?php foreach($subscriptionsArray as $subscription): ?>
- <li class="list-group-item">
- <span class="pull-right">
- <?= $subscriptionModule->getSolver()->getProductsListAsHtml($subscription) ?>
- </span>
-
- <strong><?= $subscriptionModule->getSolver()->getDaysAsHtml($subscription) ?></strong>
- (<?= strtolower($subscriptionModule->getSolver()->getWeekFrequencyAsString($subscription)) ?>)<br />
- <?= Html::encode($subscription->pointSale->name); ?><br />
- <?= $subscriptionModule->getSolver()->getPeriodAsHtml($subscription) ?>
-
- <div class="clr"></div>
- </li>
- <?php endforeach; ?>
- </ul>
- <?php else: ?>
- <div class="alert alert-info">
- Aucun abonnement
- </div>
- <?php endif; ?>
- </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 class="clr"></div>
- </div>
|