Guillaume Bourgeois 10 месяцев назад
Родитель
Сommit
60530be082
50 измененных файлов: 689 добавлений и 136 удалений
  1. +10
    -9
      backend/controllers/PointSaleController.php
  2. +9
    -0
      backend/controllers/ProducerAdminController.php
  3. +9
    -4
      backend/controllers/SubscriptionController.php
  4. +0
    -1
      backend/views/dashboard/index.php
  5. +15
    -0
      backend/views/delivery-note/index.php
  6. +4
    -3
      backend/views/document/_form.php
  7. +11
    -1
      backend/views/layouts/content.php
  8. +15
    -4
      backend/views/layouts/left.php
  9. +85
    -0
      backend/views/producer-admin/online.php
  10. +4
    -0
      backend/views/producer/update.php
  11. +11
    -5
      backend/views/setting-admin/index.php
  12. +58
    -48
      backend/views/support/index.php
  13. +18
    -7
      backend/web/css/screen.css
  14. +17
    -0
      backend/web/js/backend.js
  15. +1
    -0
      backend/web/js/vuejs/document-form.js
  16. +1
    -1
      backend/web/sass/_adminlte.scss
  17. +12
    -0
      backend/web/sass/producer-admin/_online.scss
  18. +1
    -0
      backend/web/sass/screen.scss
  19. +0
    -1
      backend/web/sass/support/_index.scss
  20. +1
    -1
      common/config/params.php
  21. +1
    -1
      common/logic/Order/Order/Repository/OrderRepository.php
  22. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  23. +10
    -3
      common/logic/Producer/Producer/Service/ProducerManager.php
  24. +36
    -2
      common/logic/Setting/SettingDetails/Admin/AdminSettingDefinition.php
  25. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageDisplaySetting.php
  26. +18
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageIconSetting.php
  27. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageSetting.php
  28. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageTitleSetting.php
  29. +22
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageTypeSetting.php
  30. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageDisplaySetting.php
  31. +18
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageIconSetting.php
  32. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageSetting.php
  33. +17
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageTitleSetting.php
  34. +22
    -0
      common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageTypeSetting.php
  35. +3
    -3
      common/logic/Setting/SettingDetails/Admin/General/SupportOnlineAdminSetting.php
  36. +6
    -0
      common/logic/User/User/Model/User.php
  37. +13
    -0
      common/logic/User/User/Repository/UserRepository.php
  38. +8
    -0
      common/logic/User/User/Repository/UserRepositoryQuery.php
  39. +27
    -0
      common/versions/24.2.A.php
  40. +24
    -0
      common/views/alert_message.php
  41. +5
    -2
      common/views/nav_user_top.php
  42. +26
    -0
      console/migrations/m240131_142637_producer_add_column_website.php
  43. +0
    -5
      frontend/views/layouts/main.php
  44. +7
    -5
      frontend/views/site/_button_producer_signup.php
  45. +11
    -4
      frontend/views/site/producers.php
  46. +1
    -0
      frontend/web/css/screen.css
  47. +1
    -1
      frontend/web/sass/screen.scss
  48. +21
    -16
      producer/controllers/SiteController.php
  49. +12
    -6
      producer/controllers/SubscriptionController.php
  50. +10
    -2
      producer/views/site/contact.php

+ 10
- 9
backend/controllers/PointSaleController.php Просмотреть файл

@@ -118,11 +118,7 @@ class PointSaleController extends BackendController
{
$distributionModule = $this-> getDistributionModule();
$pointSaleModule = $this->getPointSaleModule();

$model = PointSale::find()
->with('userPointSale')
->where(['id' => $id])
->one();
$model = $this->findModel($id);

foreach ($model->userPointSale as $userPointSale) {
$model->users[] = $userPointSale->id_user;
@@ -240,10 +236,15 @@ class PointSaleController extends BackendController
*/
protected function findModel(int $id)
{
if (($model = PointSale::findOne($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException('The requested page does not exist.');
$model = PointSale::find()
->with('userPointSale')
->where(['id' => $id])
->one();

if(!$model || $model->id_producer != $this->getProducerCurrent()->id) {
throw new NotFoundHttpException('Le point de vente demandé est introuvable.');
}

return $model;
}
}

+ 9
- 0
backend/controllers/ProducerAdminController.php Просмотреть файл

@@ -78,6 +78,15 @@ class ProducerAdminController extends BackendController
];
}

public function actionOnline()
{
$usersWithStatusProducerOnlineArray = $this->getUserModule()->getRepository()->findUsersStatusProducerOnline();

return $this->render('@backend/views/producer-admin/online', [
'usersWithStatusProducerOnlineArray' => $usersWithStatusProducerOnlineArray,
]);
}

/**
* Liste les producteurs.
*

+ 9
- 4
backend/controllers/SubscriptionController.php Просмотреть файл

@@ -242,11 +242,16 @@ class SubscriptionController extends BackendController
$subscriptionModule = $this->getSubscriptionModule();
$orderModule = $this->getOrderModule();

$subscription = $subscriptionModule->findOneSubscriptionById($id);
$subscriptionModule->getOrderManager()->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$subscriptionModule->deleteSubscription($subscription);
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id);

$this->setFlash('success', 'Abonnement supprimé');
if($subscription) {
$subscriptionModule->getOrderManager()->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$subscriptionModule->deleteSubscription($subscription);
$this->setFlash('success', 'Abonnement supprimé');
}
else {
$this->setFlash('danger', 'Abonnement introuvable');
}

return $this->redirect(['subscription/index']);
}

+ 0
- 1
backend/views/dashboard/index.php Просмотреть файл

@@ -58,7 +58,6 @@ $this->setTitle('Tableau de bord');

?>
<div class="dashboard-index">

<div <?php if($adminSettingBag->get('forumFlarumUrl')): ?>class="col-md-8"<?php endif; ?>>
<?php if(Yii::$app->request->get('error_products_points_sale')): ?>
<div class="alert alert-warning">

+ 15
- 0
backend/views/delivery-note/index.php Просмотреть файл

@@ -118,6 +118,21 @@ $this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon gl
return $deliveryNoteModule->getAmountWithTax($deliveryNote, Order::INVOICE_AMOUNT_TOTAL, true);
}
],
[
'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>';
} else {
return '<span class="label label-default">Non</span>';
}
}
],
[
'class' => 'yii\grid\ActionColumn',
'template' => '{validate} {update} {delete} {send} {download}',

+ 4
- 3
backend/views/document/_form.php Просмотреть файл

@@ -107,7 +107,9 @@ $documentClass = $documentModule->getClass($model);
class="table table-bordered">
<thead>
<tr>
<th></th>
<th>
<input type="checkbox" class="check-all-checkboxes" data-selector=".checkbox-delivery-note" />
</th>
<th>Libellé</th>
<th v-if="taxRateProducer != 0">Montant (TTC)</th>
<th v-else>Montant</th>
@@ -115,8 +117,7 @@ $documentClass = $documentModule->getClass($model);
</thead>
<tbody>
<tr v-for="deliveryNote in deliveryNoteCreateArray">
<td><input type="checkbox" name="Invoice[deliveryNotes][]"
:value="deliveryNote.id"/></td>
<td><input type="checkbox" class="checkbox-delivery-note" name="Invoice[deliveryNotes][]" :value="deliveryNote.id"/></td>
<td>{{ deliveryNote.name }}</td>
<td>{{ formatPrice(deliveryNote.total) }}</td>
</tr>

+ 11
- 1
backend/views/layouts/content.php Просмотреть файл

@@ -36,11 +36,13 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use yii\helpers\Html;
use yii\widgets\Breadcrumbs;
use dmstr\widgets\Alert;
use common\helpers\GlobalParam;

$producerModule = $this->getProducerModule();
$adminSettingBag = $this->getSettingModule()->getAdminSettingBag();

?>
<div class="content-wrapper">
@@ -79,9 +81,17 @@ $producerModule = $this->getProducerModule();

<section class="content">

<?= $this->renderFile('@common/views/alert_message.php', [
'display' => $adminSettingBag->get('adminAlertMessageDisplay'),
'type' => $adminSettingBag->get('adminAlertMessageType'),
'title' => $adminSettingBag->get('adminAlertMessageTitle'),
'icon' => $adminSettingBag->get('adminAlertMessageIcon'),
'message' => $adminSettingBag->get('adminAlertMessage'),
]) ?>

<?php $producer = GlobalParam::getCurrentProducer(); ?>
<?php if($producer && !$producerModule->isUpToDateWithOpendistribVersion($producer) && $producer->option_display_message_new_opendistrib_version): ?>
<div class="alert alert-warning">
<div class="alert alert-success">
<p>Opendistrib a été mis à jour vers la version <?= GlobalParam::getOpendistribVersion() ?> ! <a class="alert-link" href="<?= Yii::$app->urlManager->createUrl(['development/index']) ?>">Découvrir les nouveautés</a></p>
<a href="<?= Yii::$app->urlManager->createUrl(['producer/update-opendistrib-version']) ?>" class="close"><span aria-hidden="true">&times;</span></a>
</div>

+ 15
- 4
backend/views/layouts/left.php Просмотреть файл

@@ -72,7 +72,7 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
}

$developerOnlineLabel = '';
if($adminSettingBag->get('supportDeveloperOnline')) {
if($adminSettingBag->get('supportOnline')) {
$developerOnlineLabel = '<small class="label pull-right bg-green"><i class="fa fa-phone"></i></small>';
}

@@ -86,6 +86,12 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
$sumUserProducerCreditsLabel = '';
//$sumUserProducerCreditsLabel = '<span class="pull-right-container"><small class="label pull-right '.($sumUserProducerCredits >= 0 ? 'bg-green' : 'bg-red') .'">'.number_format($sumUserProducerCredits, 2).' €</small></span>';

$countUsersWithStatusProducerOnline = $userModule->getRepository()->countUsersStatusProducerOnline();
$countUsersWithStatusProducerOnlineLabel = '';
if($countUsersWithStatusProducerOnline) {
$countUsersWithStatusProducerOnlineLabel = '<span class="pull-right-container"><small class="label pull-right bg-blue">'.$countUsersWithStatusProducerOnline.'</small></span>';
}

?>

<?= dmstr\widgets\Menu::widget(
@@ -176,7 +182,14 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
],
['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsAdministrator],
[
'label' => 'Tickets',
'label' => 'En ligne',
'icon' => 'wifi',
'url' => ['producer-admin/online'],
'visible' => $isUserCurrentGrantedAsAdministrator,
'template' => '<a href="{url}">{icon} {label}' . $countUsersWithStatusProducerOnlineLabel . '</a>'
],
[
'label' => 'Support',
'icon' => 'comments',
'url' => ['support-admin/index'],
'visible' => $isUserCurrentGrantedAsAdministrator,
@@ -207,7 +220,5 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
],
]
) ?>

</section>

</aside>

+ 85
- 0
backend/views/producer-admin/online.php Просмотреть файл

@@ -0,0 +1,85 @@
<?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.
*/

use common\helpers\Image;
use yii\helpers\Html;
use yii\grid\GridView;
use common\logic\User\User\Model\User;
use common\logic\Producer\Producer\Model\Producer;
use common\helpers\Price;

$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();
$this->setTitle('Producteurs en ligne');
$this->addBreadcrumb($this->getTitle());

?>
<div class="producer-admin-online">
<?php if($usersWithStatusProducerOnlineArray && count($usersWithStatusProducerOnlineArray) > 0): ?>
<?php foreach ($usersWithStatusProducerOnlineArray as $userWithStatusProducerOnline): ?>
<?php $producer = $userWithStatusProducerOnline->producer; ?>
<div class="col-md-3">
<div class="box box-primary">
<div class="box-body box-profile">
<?php if ($producer->logo && Image::isPhotoExist($producer->logo)): ?>
<img class="profile-user-img img-responsive img-circle"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
<?php endif; ?>

<h3 class="profile-username text-center">
<?= $producer->name; ?>
</h3>
<p class="text-muted text-center">
<?= $userModule->getSolver()->getUsername($userWithStatusProducerOnline); ?><br/>
</p>
<!--<ul class="list-group list-group-unbordered">
<li class="list-group-item">
<b>Téléphone</b> <a class="pull-right">06 00 00 00 00</a>
</li>
</ul>
<a href="#" class="btn btn-primary btn-block"><b>Bouton</b></a>-->
</div>
</div>
</div>
<?php endforeach; ?>
<div class="clr"></div>
<?php else: ?>
<div class="alert alert-info">Aucun producteur en ligne actuellement.</div>
<?php endif; ?>
</div>

+ 4
- 0
backend/views/producer/update.php Просмотреть файл

@@ -119,6 +119,10 @@ $this->addBreadcrumb($this->getTitle());
<?= $form->field($model, 'postcode') ?>
<?= $form->field($model, 'city') ?>

<h4>Contact</h4>
<?= $form->field($model, 'contact_email') ?>
<?= $form->field($model, 'website') ?>

<h4>Apparence</h4>
<?= $form->field($model, 'background_color_logo') ?>
<?= $form->field($model, 'logoFile')->fileInput() ?>

+ 11
- 5
backend/views/setting-admin/index.php Просмотреть файл

@@ -90,23 +90,29 @@ $this->addBreadcrumb($this->getTitle());
function field($form, $model, $settingDetail) {
$field = $form->field($model, $settingDetail->getName());
if($settingDetail->getFormType() == 'checkbox') {
return $field->checkbox();
$field = $field->checkbox();
}
elseif($settingDetail->getFormType() == 'toggle') {
return $form->field($model, $settingDetail->getName(), ['options' => ['class' => 'form-group form-toggle']])->widget(Toggle::class, ['options' => ['data-on' => 'Oui', 'data-off' => 'Non', 'data-offstyle' => 'danger']]);
$field = $form->field($model, $settingDetail->getName(), ['options' => ['class' => 'form-group form-toggle']])->widget(Toggle::class, ['options' => ['data-on' => 'Oui', 'data-off' => 'Non', 'data-offstyle' => 'danger']]);
}
elseif($settingDetail->getFormType() == 'select') {
return $field->dropDownList($settingDetail->getOptions());
$field = $field->dropDownList($settingDetail->getOptions());
}
elseif($settingDetail->getFormType() == 'textarea') {
return $field->textarea(['rows' => 4]);
$field = $field->textarea(['rows' => 4]);
}
elseif($settingDetail->getFormType() == 'input') {
return $field->textInput();
$field = $field->textInput();
}
else {
return '<div class="form-group"><span class="glyphicon glyphicon-alert"></span> Type de champ non défini pour le paramètre "'.$settingDetail->getName().'"</div>';
}

if($settingDetail->getHelpMessage()) {
$field->hint($settingDetail->getHelpMessage());
}

return $field;
}

?>

+ 58
- 48
backend/views/support/index.php Просмотреть файл

@@ -36,6 +36,7 @@
* termes.
*/

use common\helpers\Image;
use common\logic\Ticket\Ticket\Model\Ticket;
use common\logic\Ticket\Ticket\Module\TicketModule;
use yii\helpers\Html;
@@ -45,78 +46,89 @@ use yii\grid\GridView;
* @var $this common\components\ViewBackend
*/

$userModule = $this->getUserModule();
$ticketModule = TicketModule::getInstance();
$adminSettingBag = $this->getSettingModule()->getAdminSettingBag();
$userCurrent = $this->getUserCurrent();
$this->setTitle('Support & contact');
$this->addBreadcrumb($this->getTitle());

$supportDeveloperOnline = $adminSettingBag->get('supportDeveloperOnline');
$supportOnline = $adminSettingBag->get('supportOnline');

?>

<div class="support-index">
<?php if($context == 'producer'): ?>
<?php if ($context == 'producer'): ?>

<div class="callout callout-info">
<p><i class="icon fa fa-info-circle"></i> Pour toutes vos questions, remarques, suggestions et remontées de bugs.</p>
</div>
<div>
<div class="col-md-6 col-left">
<div class="info-box">
<span class="info-box-icon <?php if($supportDeveloperOnline): ?>bg-green<?php else: ?>bg-yellow<?php endif; ?>"><i class="fa fa-phone"></i></span>
<div class="info-box-content">
<?= $this->renderFile('@common/views/alert_message.php', [
'display' => $adminSettingBag->get('adminSupportAlertMessageDisplay'),
'type' => $adminSettingBag->get('adminSupportAlertMessageType'),
'title' => $adminSettingBag->get('adminSupportAlertMessageTitle'),
'icon' => $adminSettingBag->get('adminSupportAlertMessageIcon'),
'message' => $adminSettingBag->get('adminSupportAlertMessage'),
]) ?>

<div class="callout callout-info">
<p><i class="icon fa fa-info-circle"></i> Pour toutes vos questions, remarques, suggestions et remontées de
bugs.</p>
</div>
<div>
<div class="col-md-6 col-left">
<div class="info-box">
<span class="info-box-icon <?php if ($supportOnline): ?>bg-green<?php else: ?>bg-yellow<?php endif; ?>"><i
class="fa fa-phone"></i></span>
<div class="info-box-content">
<span class="info-box-text">
Me contacter directement
<?php if($supportDeveloperOnline): ?>
<br /><span class="label label-success">Disponible</span>
<?php if ($supportOnline): ?>
<br/><span class="label label-success">Disponible</span>
<?php endif; ?>
</span>
<span class="info-box-text">
<span class="info-box-text">
<br/>
<strong><?= $adminSettingBag->get('administratorPhoneNumber'); ?></strong>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-right">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-calendar"></i></span>
<div class="info-box-content">
<div class="col-md-6 col-right">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-calendar"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/>
<?= Html::a('Prendre rendez-vous', Yii::$app->parameterBag->get('appointmentUrl'), ['class' => 'btn btn-sm btn-default', 'target' => '_blank']); ?>
</span>
</div>
</div>
</div>
</div>
<div class="col-md-6 col-left">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-comments"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/><?= Html::a('Ouvrir un ticket', ['support/create'], ['class' => 'btn btn-sm btn-default']); ?></span>
</div>
</div>
</div>
<div class="col-md-6 col-right">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-envelope"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/><?= Html::a("M'envoyer un email", 'mailto:'.$adminSettingBag->get('administratorEmail'), ['class' => 'btn btn-sm btn-default']); ?></span>
<div class="col-md-6 col-left">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-comments"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/><?= Html::a('Ouvrir un ticket', ['support/create'], ['class' => 'btn btn-sm btn-default']); ?></span>
</div>
</div>
</div>
</div>
<?php if($adminSettingBag->get('forumFlarumUrl')): ?>
<div class="col-md-6 col-left">
<div class="col-md-6 col-right">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-users"></i></span>
<span class="info-box-icon bg-yellow"><i class="fa fa-envelope"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/><?= Html::a("Ouvrir une discussion sur le forum", $adminSettingBag->get('forumFlarumUrl'), ['class' => 'btn btn-sm btn-default', 'target' => '_blank']); ?></span>
<span class="info-box-text"><br/><?= Html::a("M'envoyer un email", 'mailto:' . $adminSettingBag->get('administratorEmail'), ['class' => 'btn btn-sm btn-default']); ?></span>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="clr"></div>
<?php if ($adminSettingBag->get('forumFlarumUrl')): ?>
<div class="col-md-6 col-left">
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-users"></i></span>
<div class="info-box-content">
<span class="info-box-text"><br/><?= Html::a("Ouvrir une discussion sur le forum", $adminSettingBag->get('forumFlarumUrl'), ['class' => 'btn btn-sm btn-default', 'target' => '_blank']); ?></span>
</div>
</div>
</div>
<?php endif; ?>
</div>
<div class="clr"></div>
<?php endif; ?>

<div class="nav-tabs-custom ticket-list">
@@ -157,11 +169,10 @@ function ticketList($context, $searchTicket, $dataProviderTicket, $userCurrent)
'format' => 'raw',
'value' => function ($ticket) use ($ticketModule, $userCurrent) {

if($ticketModule->isTicketUnread($ticket, $userCurrent)) {
if ($ticketModule->isTicketUnread($ticket, $userCurrent)) {
$firstTicketMessageUnread = $ticketModule->getFirstTicketMessageUnread($ticket, $userCurrent);
$link = '<strong>'.Html::a($ticket->subject, ['view', 'id' => $ticket->id, '#' => $firstTicketMessageUnread->id]).'</strong>';
}
else {
$link = '<strong>' . Html::a($ticket->subject, ['view', 'id' => $ticket->id, '#' => $firstTicketMessageUnread->id]) . '</strong>';
} else {
$link = Html::a($ticket->subject, ['view', 'id' => $ticket->id]);
}

@@ -205,7 +216,7 @@ function ticketList($context, $searchTicket, $dataProviderTicket, $userCurrent)
'headerOptions' => ['class' => 'column-actions'],
'contentOptions' => ['class' => 'column-actions'],
'buttons' => [
'view' => function ($url, $ticket) {
'view' => function ($url, $ticket) {
$url = ['view', 'id' => $ticket->id];
return Html::a('<span class="glyphicon glyphicon-eye-open"></span>', $url, [
'title' => 'Voir le ticket', 'class' => 'btn btn-default'
@@ -235,7 +246,7 @@ function ticketList($context, $searchTicket, $dataProviderTicket, $userCurrent)
}
];

if($context == 'producer') {
if ($context == 'producer') {
$columns = [
$columnCreatedAt,
$columnSubject,
@@ -243,8 +254,7 @@ function ticketList($context, $searchTicket, $dataProviderTicket, $userCurrent)
$columnMessages,
$columnButtonActions
];
}
elseif($context == 'admin') {
} elseif ($context == 'admin') {
$columns = [
$columnCreatedAt,
$columnProducer,

+ 18
- 7
backend/web/css/screen.css Просмотреть файл

@@ -1766,7 +1766,7 @@ body.skin-black .content-wrapper .alert a.btn {
body.skin-black .content-wrapper .alert .close {
font-size: 30px;
position: relative;
top: -15px;
top: -25px;
text-decoration: none;
color: white;
opacity: 0.6;
@@ -2916,32 +2916,32 @@ termes.
padding-left: 25px;
}

/* line 4, ../sass/support/_index.scss */
/* line 3, ../sass/support/_index.scss */
.support-index .col-left {
padding-left: 0px;
}
/* line 7, ../sass/support/_index.scss */
/* line 6, ../sass/support/_index.scss */
.support-index .col-right {
padding-right: 0px;
}
/* line 13, ../sass/support/_index.scss */
/* line 12, ../sass/support/_index.scss */
.support-index .ticket-list .nav-tabs .label {
position: relative;
top: -2px;
left: 2px;
padding: 0.3em 0.6em 0.2em 0.6em;
}
/* line 22, ../sass/support/_index.scss */
/* line 21, ../sass/support/_index.scss */
.support-index .ticket-list .table .filters {
display: none;
}
/* line 26, ../sass/support/_index.scss */
/* line 25, ../sass/support/_index.scss */
.support-index .ticket-list .table .td-created-at,
.support-index .ticket-list .table .td-last-message,
.support-index .ticket-list .table .td-messages {
width: 100px;
}
/* line 31, ../sass/support/_index.scss */
/* line 30, ../sass/support/_index.scss */
.support-index .ticket-list .table .td-producer {
width: 200px;
}
@@ -2966,6 +2966,17 @@ termes.
margin-top: 5px;
}

/* line 3, ../sass/producer-admin/_online.scss */
.producer-admin-online .box {
height: 250px;
}
/* line 6, ../sass/producer-admin/_online.scss */
.producer-admin-online .box .profile-username {
font-family: 'Source Sans Pro',sans-serif;
font-weight: normal;
font-size: 18px;
}

/* line 4, ../sass/feature-admin/_index.scss */
.feature-admin-index table th.only-for-selected-producers,
.feature-admin-index table td.only-for-selected-producers {

+ 17
- 0
backend/web/js/backend.js Просмотреть файл

@@ -56,6 +56,7 @@ $(document).ready(function () {
opendistrib_user_form();
opendistrib_features_index();
opendistrib_point_sale_form();
opendistrib_check_all_checkboxes();
});

var UrlManager = {
@@ -68,6 +69,22 @@ var UrlManager = {
}
};

function opendistrib_check_all_checkboxes() {
$('.check-all-checkboxes').change(function() {
var selector = $(this).data('selector');
var checked = $(this).prop('checked');
$(selector).prop('checked', checked);

if(checked){
$(selector).unbind('change').change(function() {
if(!$(this).prop('checked')) {
$('.check-all-checkboxes').prop('checked', false);
}
});
}
});
}

function opendistrib_point_sale_form() {
if($('.point-sale-form').length) {
opendistrib_point_sale_form_days_distribution_event();

+ 1
- 0
backend/web/js/vuejs/document-form.js Просмотреть файл

@@ -151,6 +151,7 @@ var app = new Vue({
} else {
app.document.address = '';
}
setTimeout("opendistrib_check_all_checkboxes();", 500);
});
},
deleteDeliveryNoteFromInvoice: function(event) {

+ 1
- 1
backend/web/sass/_adminlte.scss Просмотреть файл

@@ -248,7 +248,7 @@ body.skin-black {
.close {
font-size: 30px;
position: relative;
top: -15px;
top: -25px;
text-decoration: none;
color: white;
opacity: 0.6;

+ 12
- 0
backend/web/sass/producer-admin/_online.scss Просмотреть файл

@@ -0,0 +1,12 @@

.producer-admin-online {
.box {
height: 250px;

.profile-username {
font-family: 'Source Sans Pro',sans-serif;
font-weight: normal;
font-size: 18px;
}
}
}

+ 1
- 0
backend/web/sass/screen.scss Просмотреть файл

@@ -1530,6 +1530,7 @@ a.btn, button.btn {
@import "support/_index.scss";
@import "support/_view.scss";
@import "producer-admin/_index.scss";
@import "producer-admin/_online.scss";
@import "feature-admin/_index.scss";
@import "setting/_form.scss";
@import "_responsive.scss" ;

+ 0
- 1
backend/web/sass/support/_index.scss Просмотреть файл

@@ -1,6 +1,5 @@

.support-index {

.col-left {
padding-left: 0px;
}

+ 1
- 1
common/config/params.php Просмотреть файл

@@ -37,7 +37,7 @@
*/

return [
'version' => '24.1.B',
'version' => '24.2.A',
'maintenanceMode' => false,
'siteName' => 'Opendistrib',
'adminEmail' => 'contact@opendistrib.net',

+ 1
- 1
common/logic/Order/Order/Repository/OrderRepository.php Просмотреть файл

@@ -417,7 +417,7 @@ class OrderRepository extends AbstractRepository
$pointSale = null;
$arrayUserPointSale = $this->userPointSaleRepository->findUserPointSalesByUser($user, $distribution);

if (count($arrayUserPointSale) == 1) {
if (count($arrayUserPointSale) == 1 && $arrayUserPointSale[0]->id_point_sale) {
$pointSale = $this->pointSaleRepository->findOnePointSaleById($arrayUserPointSale[0]->id_point_sale);
} else {
$lastOrder = $this->findOneOrderLastByUser($user);

+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Просмотреть файл

@@ -248,6 +248,7 @@ class Producer extends ActiveRecordCommon
'admin_comment',
'export_shopping_cart_labels_format',
'document_image_bottom',
'website'
],
'string'
],
@@ -469,7 +470,8 @@ class Producer extends ActiveRecordCommon
'option_document_display_price_unit_reference' => "Afficher les prix au kilogramme",
'id_user_group_default' => "Groupe utilisateur par défaut attribué à l'inscription",
'option_check_by_default_prevent_user_credit' => "Par défaut, prévenir l'utilisateur quand on crédite son compte",
'delivery_note_automatic_validation' => 'Validation automatique des bons de livraison'
'delivery_note_automatic_validation' => 'Validation automatique des bons de livraison',
'website' => 'Site web'
];
}


+ 10
- 3
common/logic/Producer/Producer/Service/ProducerManager.php Просмотреть файл

@@ -30,15 +30,22 @@ class ProducerManager extends AbstractService implements ManagerInterface
);
}

public function getMaximumNumberProducers(): ?int
{
return $this->adminSettingBag->get('maximumNumberProducers');
}

public function isProducerSignupOpen(): bool
{
return $this->adminSettingBag->get('maximumNumberProducers')
> $this->producerRepository->countCacheProducersActiveWithTurnover();
$maximumNumberProducers = $this->getMaximumNumberProducers();

return !$maximumNumberProducers
|| $maximumNumberProducers > $this->producerRepository->countCacheProducersActiveWithTurnover();
}

public function getProducerSignupRemainingPlaces(): int
{
return max($this->adminSettingBag->get('maximumNumberProducers')
return max($this->getMaximumNumberProducers()
- $this->producerRepository->countCacheProducersActiveWithTurnover(), 0);
}
}

+ 36
- 2
common/logic/Setting/SettingDetails/Admin/AdminSettingDefinition.php Просмотреть файл

@@ -3,29 +3,59 @@
namespace common\logic\Setting\SettingDetails\Admin;

use common\logic\Setting\SettingDefinition;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageIconSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTitleSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageTypeSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageDisplaySetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageIconSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTitleSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminSupportAlertMessageTypeSetting;
use common\logic\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting;
use common\logic\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting;
use common\logic\Setting\SettingDetails\Admin\General\ForumFlarumUrlAdminSetting;
use common\logic\Setting\SettingDetails\Admin\General\MaximumNumberProducersAdminSetting;
use common\logic\Setting\SettingDetails\Admin\General\SupportDeveloperOnlineAdminSetting;
use common\logic\Setting\SettingDetails\Admin\General\SupportOnlineAdminSetting;
use common\logic\Setting\SettingDetails\Admin\AlertMessage\AdminAlertMessageDisplaySetting;

class AdminSettingDefinition extends SettingDefinition
{
const SECTION_GENERAL = 'general';
const SUBSECTION_GENERAL = 'general.main';

const SECTION_ALERT_MESSAGE = 'alertmessage';
const SUBSECTION_ALERT_MESSAGE_GLOBAL = 'alertmessage.global';
const SUBSECTION_ALERT_MESSAGE_SUPPORT = 'alertmessage.support';

public function getSettingDetails(): array
{
return [
self::SECTION_GENERAL => [
self::SUBSECTION_GENERAL => [
new SupportDeveloperOnlineAdminSetting(),
new SupportOnlineAdminSetting(),
new AdministratorEmailAdminSetting(),
new AdministratorPhoneNumberAdminSetting(),
new MaximumNumberProducersAdminSetting(),
new ForumFlarumUrlAdminSetting(),
]
],
self::SECTION_ALERT_MESSAGE => [
self::SUBSECTION_ALERT_MESSAGE_GLOBAL => [
new AdminAlertMessageDisplaySetting(),
new AdminAlertMessageTypeSetting(),
new AdminAlertMessageIconSetting(),
new AdminAlertMessageTitleSetting(),
new AdminAlertMessageSetting(),
],
self::SUBSECTION_ALERT_MESSAGE_SUPPORT => [
new AdminSupportAlertMessageDisplaySetting(),
new AdminSupportAlertMessageTypeSetting(),
new AdminSupportAlertMessageIconSetting(),
new AdminSupportAlertMessageTitleSetting(),
new AdminSupportAlertMessageSetting(),
],
]
];
}

@@ -34,6 +64,10 @@ class AdminSettingDefinition extends SettingDefinition
return [
self::SECTION_GENERAL => 'General',
self::SUBSECTION_GENERAL => 'General',

self::SECTION_ALERT_MESSAGE => 'Message d\'alerte',
self::SUBSECTION_ALERT_MESSAGE_GLOBAL => 'Global',
self::SUBSECTION_ALERT_MESSAGE_SUPPORT => 'Support'
];
}


+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageDisplaySetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminAlertMessageDisplaySetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminAlertMessageDisplay')
->setLabel("Afficher")
->setTypeBoolean()
->setFormTypeToggle();
}
}

+ 18
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageIconSetting.php Просмотреть файл

@@ -0,0 +1,18 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminAlertMessageIconSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminAlertMessageIcon')
->setLabel("Icône")
->setTypeString()
->setFormTypeInput()
->setHelpMessage('<a href="https://adminlte.io/themes/AdminLTE/pages/UI/icons.html" target="_blank">Icônes disponibles</a>');
}
}

+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageSetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminAlertMessageSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminAlertMessage')
->setLabel("Message")
->setTypeText()
->setFormTypeTextarea();
}
}

+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageTitleSetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminAlertMessageTitleSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminAlertMessageTitle')
->setLabel("Titre")
->setTypeString()
->setFormTypeInput();
}
}

+ 22
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminAlertMessageTypeSetting.php Просмотреть файл

@@ -0,0 +1,22 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminAlertMessageTypeSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminAlertMessageType')
->setLabel("Type")
->setTypeString()
->setFormTypeSelect([
'success' => 'Succès',
'info' => 'Information',
'warning' => 'Warning',
'danger' => 'Danger'
]);
}
}

+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageDisplaySetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminSupportAlertMessageDisplaySetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminSupportAlertMessageDisplay')
->setLabel("Afficher")
->setTypeBoolean()
->setFormTypeToggle();
}
}

+ 18
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageIconSetting.php Просмотреть файл

@@ -0,0 +1,18 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminSupportAlertMessageIconSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminSupportAlertMessageIcon')
->setLabel("Icône")
->setTypeString()
->setFormTypeInput()
->setHelpMessage('<a href="https://adminlte.io/themes/AdminLTE/pages/UI/icons.html" target="_blank">Icônes disponibles</a>');
}
}

+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageSetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminSupportAlertMessageSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminSupportAlertMessage')
->setLabel("Message")
->setTypeText()
->setFormTypeTextarea();
}
}

+ 17
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageTitleSetting.php Просмотреть файл

@@ -0,0 +1,17 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminSupportAlertMessageTitleSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminSupportAlertMessageTitle')
->setLabel("Titre")
->setTypeString()
->setFormTypeInput();
}
}

+ 22
- 0
common/logic/Setting/SettingDetails/Admin/AlertMessage/AdminSupportAlertMessageTypeSetting.php Просмотреть файл

@@ -0,0 +1,22 @@
<?php

namespace common\logic\Setting\SettingDetails\Admin\AlertMessage;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class AdminSupportAlertMessageTypeSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('adminSupportAlertMessageType')
->setLabel("Type")
->setTypeString()
->setFormTypeSelect([
'success' => 'Succès',
'info' => 'Information',
'warning' => 'Warning',
'danger' => 'Danger'
]);
}
}

common/logic/Setting/SettingDetails/Admin/General/SupportDeveloperOnlineAdminSetting.php → common/logic/Setting/SettingDetails/Admin/General/SupportOnlineAdminSetting.php Просмотреть файл

@@ -4,13 +4,13 @@ namespace common\logic\Setting\SettingDetails\Admin\General;

use common\logic\Setting\SettingDetails\AbstractSettingDetail;

class SupportDeveloperOnlineAdminSetting extends AbstractSettingDetail
class SupportOnlineAdminSetting extends AbstractSettingDetail
{
public function __construct()
{
$this
->setName('supportDeveloperOnline')
->setLabel("Support : développeur disponible")
->setName('supportOnline')
->setLabel("Support : disponible")
->setTypeBoolean()
->setFormTypeToggle();
}

+ 6
- 0
common/logic/User/User/Model/User.php Просмотреть файл

@@ -39,6 +39,7 @@
namespace common\logic\User\User\Model;

use common\logic\Order\Order\Model\Order;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\UserProducer\Model\UserProducer;
use common\logic\User\UserUserGroup\Model\UserUserGroup;
use yii\base\NotSupportedException;
@@ -246,6 +247,11 @@ class User extends ActiveRecordCommon implements IdentityInterface
* Relations
*/

public function getProducer()
{
return $this->hasOne(Producer::class, ['id' => 'id_producer']);
}

public function getUserProducer()
{
return $this->hasMany(UserProducer::class, ['id_user' => 'id']);

+ 13
- 0
common/logic/User/User/Repository/UserRepository.php Просмотреть файл

@@ -267,4 +267,17 @@ class UserRepository extends AbstractRepository
$userProducer = $this->userProducerRepository->findOneUserProducer($user);
return $userProducer ? $userProducer->active : false;
}

public function findUsersStatusProducerOnline(): array
{
return $this->createDefaultQuery()
->isStatusProducer()
->filterByDateLastConnectionLessThanFewMinutes()
->find();
}

public function countUsersStatusProducerOnline(): int
{
return count($this->findUsersStatusProducerOnline());
}
}

+ 8
- 0
common/logic/User/User/Repository/UserRepositoryQuery.php Просмотреть файл

@@ -50,4 +50,12 @@ class UserRepositoryQuery extends AbstractRepositoryQuery
{
return $this->filterByStatus(User::STATUS_PRODUCER);
}

public function filterByDateLastConnectionLessThanFewMinutes(): self
{
$date = new \DateTime('-5 minutes');
$this->andWhere('user.date_last_connection >= :date')
->addParams(['date' => $date->format('Y-m-d H:i:s')]);
return $this;
}
}

+ 27
- 0
common/versions/24.2.A.php Просмотреть файл

@@ -0,0 +1,27 @@
<?php

require_once dirname(__FILE__).'/_macros.php';

version(
'05/02/2024',
[
[
"[Administration] Bons de livraison > liste : ajout colonne 'Envoyé'",
"[Administration] Factures > création : sélection de tous les BL en un clic",
"[Site & boutique] Producteurs : lien vers site internet"
],
[
]
],
[
[
"[Administration] Producteurs en ligne",
"[Administration] Message général aux producteurs",
],
[
]
],
$userCurrent
);

?>

+ 24
- 0
common/views/alert_message.php Просмотреть файл

@@ -0,0 +1,24 @@
<?php

use yii\helpers\Html;

?>

<?php if($display && $message): ?>
<div class="alert alert-<?= $type ?>">
<?php if($title): ?>
<h4>
<?php if($icon): ?>
<i class="icon fa fa-<?= $icon ?>"></i>
<?php endif; ?>
<?= $title ?>
</h4>
<?php endif; ?>
<p>
<?php if(!$title && $icon): ?>
<i class="icon fa fa-<?= $icon ?>"></i>
<?php endif; ?>
<?= nl2br(Html::encode($message)); ?>
</p>
</div>
<?php endif; ?>

+ 5
- 2
common/views/nav_user_top.php Просмотреть файл

@@ -2,16 +2,19 @@

use common\helpers\GlobalParam;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use yii\bootstrap\Nav;
use yii\helpers\Html;

$userModule = UserModule::getInstance();
$producerModule = ProducerModule::getInstance();
$userCurrent = GlobalParam::getCurrentUser();

$isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGrantedAsProducer($userCurrent);
$producer = null;
if ($isUserCurrentGrantedAsProducer) {
$producer = Producer::searchOne(['id' => \Yii::$app->user->identity->id_producer]);
if ($isUserCurrentGrantedAsProducer && $userCurrent->id_producer) {
$producer = $producerModule->getRepository()->findOneProducerById($userCurrent->id_producer);
}

?>

+ 26
- 0
console/migrations/m240131_142637_producer_add_column_website.php Просмотреть файл

@@ -0,0 +1,26 @@
<?php

use yii\db\Migration;
use yii\db\Schema;

/**
* Class m240131_142637_producer_add_column_website
*/
class m240131_142637_producer_add_column_website extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('producer', 'website', Schema::TYPE_STRING);
}

/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropColumn('producer', 'website');
}
}

+ 0
- 5
frontend/views/layouts/main.php Просмотреть файл

@@ -41,7 +41,6 @@ use common\logic\Setting\SettingModule;
use common\logic\User\User\Module\UserModule;
use yii\helpers\Html;
use yii\bootstrap\Nav;
use common\logic\Producer\Producer\Model\Producer;

\common\assets\CommonAsset::register($this);
\frontend\assets\AppAsset::register($this);
@@ -50,10 +49,6 @@ $userModule = UserModule::getInstance();
$userCurrent = GlobalParam::getCurrentUser();
$isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGrantedAsProducer($userCurrent);
$isHome = (Yii::$app->controller->id == 'site' && \Yii::$app->controller->action->id == 'index');
$producer = null;
if ($isUserCurrentGrantedAsProducer) {
$producer = Producer::searchOne(['id' => \Yii::$app->user->identity->id_producer]);
}
$settingModule = SettingModule::getInstance();
$adminSettingBag = $settingModule->getAdminSettingBag();


+ 7
- 5
frontend/views/site/_button_producer_signup.php Просмотреть файл

@@ -1,15 +1,17 @@
<?php
$producerModule = $this->getProducerModule();
$producerSignupRemainingPlaces = $producerModule->getManager()->getProducerSignupRemainingPlaces();
$producerManager = $this->getProducerModule()->getManager();
$producerSignupRemainingPlaces = $producerManager->getProducerSignupRemainingPlaces();

if (Yii::$app->user->isGuest): ?>
<?php if($producerModule->getManager()->isProducerSignupOpen()): ?>
<?php if($producerManager->isProducerSignupOpen()): ?>
<a class="btn btn-primary"
href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/signup']); ?>">
<span class="glyphicon glyphicon-user"></span> Je crée mon espace producteur
</a><br />
<strong><?= ($producerSignupRemainingPlaces); ?></strong>
place<?php if($producerSignupRemainingPlaces > 1): ?>s<?php endif; ?> restante<?php if($producerSignupRemainingPlaces > 1): ?>s<?php endif; ?>
<?php if($producerManager->getMaximumNumberProducers()): ?>
<strong><?= ($producerSignupRemainingPlaces); ?></strong>
place<?php if($producerSignupRemainingPlaces > 1): ?>s<?php endif; ?> restante<?php if($producerSignupRemainingPlaces > 1): ?>s<?php endif; ?>
<?php endif; ?>
<?php else: ?>
<div class="label label-warning label-producer-signup-closed">
La plateforme n'accueille pas de nouveaux producteurs pour le moment

+ 11
- 4
frontend/views/site/producers.php Просмотреть файл

@@ -75,27 +75,34 @@ $this->setMeta('description', 'Retrouvez les producteurs présents sur Opendistr
<span class="glyphicon glyphicon-map-marker"></span>
<span class="location"><?= Html::encode($producer->postcode.' '.$producer->city); ?></span>
<?php endif; ?>

<?php if($producer->website): ?>
<a href="<?= Html::encode($producer->website); ?>" target="_blank" class="btn btn-default">
<span class="glyphicon glyphicon-globe"></span>
Site web
</a>
<?php endif; ?>
</p>
</div>
<?php if($producer->logo): ?>
<div class="col-md-4 col-sm-4">
<div class="logo"<?php if (!is_null($producer->background_color_logo) && strlen($producer->background_color_logo)): ?> style="background-color:<?= Html::encode($producer->background_color_logo); ?>"<?php endif; ?>>
<img class="img-logo"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>uploads/<?= $producer->logo; ?>"
src="<?= Yii::$app->urlManagerProducer->getHostInfo() . '/' . Yii::$app->urlManagerProducer->baseUrl; ?>/uploads/<?= $producer->logo; ?>"
alt="Logo <?= Html::encode($producer->name) ?>">
</div>
</div>
<?php endif; ?>
</div>
<div class="panel-footer">
<?= Html::a('Visiter',Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]), ['class'=>'btn btn-primary']) ; ?>
<?= Html::a('Visiter',Yii::$app->urlManagerProducer->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]), ['class'=>'btn btn-primary float-right']) ; ?>

<?php if($userCurrent): ?>
<?php $this->getLogic()->setProducerContext($producer); ?>
<?php if($userProducerModule->isProducerBookmarked($userCurrent)): ?>
<?= Html::a('<span class="glyphicon glyphicon-star"></span>', ['bookmark/remove', 'idProducer' => $producer->id], ['class'=>'btn btn-default float-right', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Supprimer de ma liste de producteurs']) ; ?>
<?= Html::a('<span class="glyphicon glyphicon-star"></span>', ['bookmark/remove', 'idProducer' => $producer->id], ['class'=>'btn btn-default', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Supprimer de ma liste de producteurs']) ; ?>
<?php else: ?>
<?= Html::a('<span class="glyphicon glyphicon-star-empty"></span>', ['bookmark/add', 'idProducer' => $producer->id], ['class'=>'btn btn-default float-right', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Ajouter à ma liste de producteurs']) ; ?>
<?= Html::a('<span class="glyphicon glyphicon-star-empty"></span>', ['bookmark/add', 'idProducer' => $producer->id], ['class'=>'btn btn-default', 'data-toggle' => 'tooltip', 'data-placement' => 'bottom', 'data-original-title' => 'Ajouter à ma liste de producteurs']) ; ?>
<?php endif; ?>
<?php endif; ?>
</div>

+ 1
- 0
frontend/web/css/screen.css Просмотреть файл

@@ -853,6 +853,7 @@ section#header-title h1 .glyphicon {
-webkit-border-radius: 0px;
border-radius: 0px 0px 8px 8px;
border: 0px none;
padding: 10px 30px;
}
/* line 881, ../sass/screen.scss */
.site-producers #producers-list .panel .logo {

+ 1
- 1
frontend/web/sass/screen.scss Просмотреть файл

@@ -875,7 +875,7 @@ section#header-title {
.panel-footer {
@include border-radius(0px 0px 8px 8px);
border: 0px none;
//text-align: right;
padding: 10px 30px;
}

.logo {

+ 21
- 16
producer/controllers/SiteController.php Просмотреть файл

@@ -204,6 +204,7 @@ class SiteController extends ProducerBaseController

return $this->render('contact', [
'model' => $model,
'producer' => $this->getProducerCurrent()
]);
}

@@ -214,23 +215,27 @@ class SiteController extends ProducerBaseController
public function actionBookmarks(string $action)
{
$producer = $this->getProducerCurrent();
$userProducer = $this->getUserProducerModule()
->createUserProducerIfNotExist(GlobalParam::getCurrentUser(), $producer);

if ($action == 'add') {
$userProducer->bookmark = 1;
$this->setFlash(
'success',
'Le producteur <strong>' . Html::encode($producer->name) . '</strong> vient d\'être ajouté à vos favoris.'
);
} else {
$userProducer->bookmark = 0;
$this->setFlash(
'success',
'Le producteur <strong>' . Html::encode($producer->name) . '</strong> vient d\'être supprimé de vos favoris.'
);

$userCurrent = $this->getUserCurrent();
if($userCurrent) {
$userProducer = $this->getUserProducerModule()
->createUserProducerIfNotExist($userCurrent, $producer);

if ($action == 'add') {
$userProducer->bookmark = 1;
$this->setFlash(
'success',
'Le producteur <strong>' . Html::encode($producer->name) . '</strong> vient d\'être ajouté à vos favoris.'
);
} else {
$userProducer->bookmark = 0;
$this->setFlash(
'success',
'Le producteur <strong>' . Html::encode($producer->name) . '</strong> vient d\'être supprimé de vos favoris.'
);
}
$userProducer->save();
}
$userProducer->save();

return $this->redirect(['site/index']);
}

+ 12
- 6
producer/controllers/SubscriptionController.php Просмотреть файл

@@ -227,14 +227,20 @@ class SubscriptionController extends ProducerBaseController
}

$subscriptionModule = $this->getSubscriptionModule();
$subscription = $subscriptionModule->findOneSubscriptionById($id);
$subscriptionModule->deleteSubscription($subscription);
$subscription = $subscriptionModule->getRepository()->findOneSubscriptionById($id);

if($subscription) {
$subscriptionModule->getBuilder()->deleteSubscription($subscription);
// @TODO : gérer via événements
$this->getSubscriptionModule()->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);

// @TODO : gérer via événements
$this->getSubscriptionModule()->getOrderManager()
->deleteOrdersIncomingDistributionsFromSubscription($subscription);
$this->setFlash('success', 'Abonnement supprimé');
}
else {
$this->setFlash('error', 'Abonnement introuvable');
}

$this->setFlash('success', 'Abonnement supprimé');

return $this->redirect(['subscription/index']);
}

+ 10
- 2
producer/views/site/contact.php Просмотреть файл

@@ -45,13 +45,12 @@ $this->setTitle('Contact');
?>
<div class="site-contact">
<div class="row">
<div class="col-lg-5">
<div class="col-lg-6">
<?php $form = ActiveForm::begin(['id' => 'contact-form', 'enableClientValidation' => false,]); ?>
<?= $form->field($model, 'name') ?>
<?= $form->field($model, 'email') ?>
<?= $form->field($model, 'subject') ?>
<?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
<?php echo $form->field($model, 'verifyCode')->widget(yii\captcha\Captcha::className(), [
'template' => '<div class="row"><div class="col-md-12">{image}</div><div class="col-md-12">{input}</div></div>',
]); ?>
@@ -61,5 +60,14 @@ $this->setTitle('Contact');
</div>
<?php ActiveForm::end(); ?>
</div>
<div class="col-lg-6">
<?php if($producer->website): ?>
<br />
<a href="<?= Html::encode($producer->website); ?>" target="_blank" class="btn btn-default">
<span class="glyphicon glyphicon-globe"></span>
Site web
</a>
<?php endif; ?>
</div>
</div>
</div>

Загрузка…
Отмена
Сохранить