return ProducerManager::getInstance(); | return ProducerManager::getInstance(); | ||||
} | } | ||||
public function getManager(): ProducerManager | |||||
{ | |||||
return ProducerManager::getInstance(); | |||||
} | |||||
public function getProducerPageSizer(): ProducerPageSizer | public function getProducerPageSizer(): ProducerPageSizer | ||||
{ | { | ||||
return ProducerPageSizer::getInstance(); | return ProducerPageSizer::getInstance(); |
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
use common\logic\Producer\Producer\Service\ProducerSolver; | use common\logic\Producer\Producer\Service\ProducerSolver; | ||||
use common\logic\Producer\ProducerPriceRange\Repository\ProducerPriceRangeRepository; | use common\logic\Producer\ProducerPriceRange\Repository\ProducerPriceRangeRepository; | ||||
use common\logic\Setting\AdminSettingBag; | |||||
use common\logic\User\User\Model\User; | use common\logic\User\User\Model\User; | ||||
use yii\helpers\Html; | use yii\helpers\Html; | ||||
return $count; | return $count; | ||||
} | } | ||||
public function countCacheProducersActiveWithTurnover(): int | |||||
{ | |||||
return \Yii::$app->cache->getOrSet('count_producers_active', function () { | |||||
return $this->countProducersActiveWithTurnover(); | |||||
}, 60 * 60 * 24); | |||||
} | |||||
public function findProducers() | public function findProducers() | ||||
{ | { | ||||
return $this->createQuery()->find(); | return $this->createQuery()->find(); |
use common\logic\AbstractService; | use common\logic\AbstractService; | ||||
use common\logic\Producer\Producer\Model\Producer; | use common\logic\Producer\Producer\Model\Producer; | ||||
use common\logic\ManagerInterface; | use common\logic\ManagerInterface; | ||||
use common\logic\Producer\Producer\Repository\ProducerRepository; | |||||
use common\logic\Setting\AdminSettingBag; | |||||
class ProducerManager extends AbstractService implements ManagerInterface | class ProducerManager extends AbstractService implements ManagerInterface | ||||
{ | { | ||||
protected AdminSettingBag $adminSettingBag; | |||||
protected ProducerRepository $producerRepository; | |||||
public function loadDependencies(): void | |||||
{ | |||||
$this->adminSettingBag = $this->loadService(AdminSettingBag::class); | |||||
$this->producerRepository = $this->loadService(ProducerRepository::class); | |||||
} | |||||
public function sendEmailNewProducer(Producer $producer): void | public function sendEmailNewProducer(Producer $producer): void | ||||
{ | { | ||||
\Yii::$app->mailerService->sendAdmin( | \Yii::$app->mailerService->sendAdmin( | ||||
] | ] | ||||
); | ); | ||||
} | } | ||||
public function isProducerSignupOpen(): bool | |||||
{ | |||||
return $this->adminSettingBag->get('maximumNumberProducers') | |||||
> $this->producerRepository->countCacheProducersActiveWithTurnover(); | |||||
} | |||||
public function getProducerSignupRemainingPlaces(): int | |||||
{ | |||||
return max($this->adminSettingBag->get('maximumNumberProducers') | |||||
- $this->producerRepository->countCacheProducersActiveWithTurnover(), 0); | |||||
} | |||||
} | } |
use common\logic\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting; | use common\logic\Setting\SettingDetails\Admin\General\AdministratorEmailAdminSetting; | ||||
use common\logic\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting; | use common\logic\Setting\SettingDetails\Admin\General\AdministratorPhoneNumberAdminSetting; | ||||
use common\logic\Setting\SettingDetails\Admin\General\ForumFlarumUrlAdminSetting; | use common\logic\Setting\SettingDetails\Admin\General\ForumFlarumUrlAdminSetting; | ||||
use common\logic\Setting\SettingDetails\Admin\General\MaximumNumberProducersAdminSetting; | |||||
class AdminSettingDefinition extends SettingDefinition | class AdminSettingDefinition extends SettingDefinition | ||||
{ | { | ||||
self::SUBSECTION_GENERAL => [ | self::SUBSECTION_GENERAL => [ | ||||
new AdministratorEmailAdminSetting(), | new AdministratorEmailAdminSetting(), | ||||
new AdministratorPhoneNumberAdminSetting(), | new AdministratorPhoneNumberAdminSetting(), | ||||
new MaximumNumberProducersAdminSetting(), | |||||
new ForumFlarumUrlAdminSetting(), | new ForumFlarumUrlAdminSetting(), | ||||
] | ] | ||||
], | ], |
<?php | |||||
namespace common\logic\Setting\SettingDetails\Admin\General; | |||||
use common\logic\Setting\SettingDetails\AbstractSettingDetail; | |||||
class MaximumNumberProducersAdminSetting extends AbstractSettingDetail | |||||
{ | |||||
public function __construct() | |||||
{ | |||||
$this | |||||
->setName('maximumNumberProducers') | |||||
->setLabel("Nombre maximum de producteurs") | |||||
->setTypeInteger() | |||||
->setFormTypeInput(); | |||||
} | |||||
} |
*/ | */ | ||||
public function actionIndex() | public function actionIndex() | ||||
{ | { | ||||
return $this->render('index'); | |||||
return $this->render('index', [ | |||||
'maximumNumberProducers' => $this->getSettingModule()->getAdminSettingBag()->get('maximumNumberProducers'), | |||||
'countProducersActive' => $this->getProducerModule()->getRepository()->countCacheProducersActiveWithTurnover() | |||||
]); | |||||
} | } | ||||
public function actionService() | public function actionService() | ||||
$userModule = $this->getUserModule(); | $userModule = $this->getUserModule(); | ||||
$orderModule = $this->getOrderModule(); | $orderModule = $this->getOrderModule(); | ||||
$countProducersActive = $producerModule->countProducersActiveWithTurnover(); | |||||
$countProducersActive = $producerModule->getRepository()->countProducersActiveWithTurnover(); | |||||
$timeSavedByProducersAverage = $producerModule->getTimeSavedByProducersAverage(); | $timeSavedByProducersAverage = $producerModule->getTimeSavedByProducersAverage(); | ||||
$countProducersWithOptionTimeSaved = $producerModule->countProducersWithTimeSaved(); | $countProducersWithOptionTimeSaved = $producerModule->countProducersWithTimeSaved(); | ||||
$countPointSalesActive = $pointSaleModule->countPointSalesActiveLastThreeMonths(); | $countPointSalesActive = $pointSaleModule->countPointSalesActiveLastThreeMonths(); |
<?php | |||||
$producerModule = $this->getProducerModule(); | |||||
$producerSignupRemainingPlaces = $producerModule->getManager()->getProducerSignupRemainingPlaces(); | |||||
if (Yii::$app->user->isGuest): ?> | |||||
<?php if($producerModule->getManager()->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 else: ?> | |||||
<div class="label label-warning label-producer-signup-closed"> | |||||
La plateforme n'accueille pas de nouveaux producteurs pour le moment | |||||
</div> | |||||
<?php endif; ?> | |||||
<br /> | |||||
<br /> | |||||
<?php endif; ?> |
$this->setTitle('Un outil pour organiser des ventes en circuit court'); | $this->setTitle('Un outil pour organiser des ventes en circuit court'); | ||||
$this->setMeta('description', 'Simplifiez la distribution de vos produits en circuit court grâce à des outils web adaptés.'); | $this->setMeta('description', 'Simplifiez la distribution de vos produits en circuit court grâce à des outils web adaptés.'); | ||||
$producerModule = $this->getProducerModule(); | |||||
?> | ?> | ||||
<div class="row" id="row-users-producers"> | <div class="row" id="row-users-producers"> | ||||
<div class="word-animate"><span class="functionality"></span></div> | <div class="word-animate"><span class="functionality"></span></div> | ||||
</div> | </div> | ||||
<div class="links"> | <div class="links"> | ||||
<?php if (Yii::$app->user->isGuest): ?> | |||||
<a class="btn btn-primary" | |||||
href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/signup']); ?>"> | |||||
<span class="glyphicon glyphicon-user"></span> Je crée mon espace | |||||
</a> | |||||
<?php endif; ?> | |||||
<?= $this->render('_button_producer_signup'); ?> | |||||
<a class="btn btn-default" | <a class="btn btn-default" | ||||
href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/service']); ?>"> | href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/service']); ?>"> | ||||
<span class="glyphicon glyphicon-plus-sign"></span> En savoir plus | <span class="glyphicon glyphicon-plus-sign"></span> En savoir plus | ||||
</a> | </a> | ||||
<?php if (Yii::$app->user->isGuest): ?><br /><?php endif; ?> | |||||
<a class="btn btn-default" href="<?= \Yii::$app->parameterBag->get('appointmentUrl'); ?>" target="_blank"> | <a class="btn btn-default" href="<?= \Yii::$app->parameterBag->get('appointmentUrl'); ?>" target="_blank"> | ||||
<span class="glyphicon glyphicon-education"></span> Je demande une démo | <span class="glyphicon glyphicon-education"></span> Je demande une démo | ||||
</a> | </a> | ||||
<?php if (Yii::$app->user->isGuest): ?> | <?php if (Yii::$app->user->isGuest): ?> | ||||
<a class="btn btn-default" | |||||
href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/producer', 'id' => 32]); ?>"> | |||||
<span class="glyphicon glyphicon-check"></span> Je teste le logiciel | |||||
</a> | |||||
<a class="btn btn-default" | |||||
href="<?= \Yii::$app->urlManagerFrontend->createUrl(['site/producer', 'id' => 32]); ?>"> | |||||
<span class="glyphicon glyphicon-check"></span> Je teste le logiciel | |||||
</a> | |||||
<?php endif; ?> | <?php endif; ?> | ||||
</div> | </div> | ||||
</div> | </div> |
use yii\helpers\Html; | use yii\helpers\Html; | ||||
$producerModule = $this->getProducerModule(); | |||||
$this->setTitle('Fonctionnalités, services & tarifs'); | $this->setTitle('Fonctionnalités, services & tarifs'); | ||||
$this->setIcon('console'); | $this->setIcon('console'); | ||||
//$this->setMeta('description', ''); | //$this->setMeta('description', ''); | ||||
</div> | </div> | ||||
<div class="panel-body"> | <div class="panel-body"> | ||||
<p class="text-center"> | <p class="text-center"> | ||||
<?= $this->render('_button_producer_signup'); ?> | |||||
<?php if (Yii::$app->user->isGuest): ?> | <?php if (Yii::$app->user->isGuest): ?> | ||||
<a class="btn btn-default" | |||||
href="<?= $this->getUrlManagerFrontend()->createUrl(['site/signup']); ?>"> | |||||
<span class="glyphicon glyphicon-user"></span> Je crée un espace producteur | |||||
</a> | |||||
<?php endif; ?> | |||||
<a class="btn btn-default" | <a class="btn btn-default" | ||||
href="<?= $this->getUrlManagerFrontend()->createUrl(['site/producer', 'id' => 32]); ?>"> | href="<?= $this->getUrlManagerFrontend()->createUrl(['site/producer', 'id' => 32]); ?>"> | ||||
<span class="glyphicon glyphicon-check"></span> Je teste le logiciel | <span class="glyphicon glyphicon-check"></span> Je teste le logiciel | ||||
</a> | </a> | ||||
<?php endif; ?> | |||||
<a class="btn btn-default" href="<?= \Yii::$app->parameterBag->get('appointmentUrl'); ?>" | <a class="btn btn-default" href="<?= \Yii::$app->parameterBag->get('appointmentUrl'); ?>" | ||||
target="_blank"> | target="_blank"> | ||||
<span class="glyphicon glyphicon-education"></span> Je demande une démo | <span class="glyphicon glyphicon-education"></span> Je demande une démo | ||||
</a> | </a> | ||||
<br><br> | |||||
<a class="btn btn-default" | <a class="btn btn-default" | ||||
href="<?= $this->getUrlManagerFrontend()->createUrl(['site/about']); ?>"> | href="<?= $this->getUrlManagerFrontend()->createUrl(['site/about']); ?>"> | ||||
<span class="glyphicon glyphicon-info-sign"></span> À propos | <span class="glyphicon glyphicon-info-sign"></span> À propos |
<label class="btn btn-default <?php if($model->option_user_producer == 'user' || !$model->option_user_producer): ?>active<?php endif; ?>"> | <label class="btn btn-default <?php if($model->option_user_producer == 'user' || !$model->option_user_producer): ?>active<?php endif; ?>"> | ||||
<input type="radio" name="SignupForm[option_user_producer]" value="user" id="option-user" autocomplete="off" <?php if($model->option_user_producer == 'user' || !$model->option_user_producer): ?>checked<?php endif; ?>> Je suis client | <input type="radio" name="SignupForm[option_user_producer]" value="user" id="option-user" autocomplete="off" <?php if($model->option_user_producer == 'user' || !$model->option_user_producer): ?>checked<?php endif; ?>> Je suis client | ||||
</label> | </label> | ||||
<label class="btn btn-default <?php if($model->option_user_producer == 'producer'): ?>active<?php endif; ?>"> | |||||
<input type="radio" name="SignupForm[option_user_producer]" value="producer" id="option-producer" autocomplete="off" <?php if($model->option_user_producer == 'producer'): ?>checked<?php endif; ?>> Je suis producteur | |||||
</label> | |||||
<?php if($this->getProducerModule()->getManager()->isProducerSignupOpen()): ?> | |||||
<label class="btn btn-default <?php if($model->option_user_producer == 'producer'): ?>active<?php endif; ?>"> | |||||
<input type="radio" name="SignupForm[option_user_producer]" value="producer" id="option-producer" autocomplete="off" <?php if($model->option_user_producer == 'producer'): ?>checked<?php endif; ?>> Je suis producteur | |||||
</label> | |||||
<?php endif; ?> | |||||
</div> | </div> | ||||
<div id="fields-producer"> | <div id="fields-producer"> |
*/ | */ | ||||
@media screen and (min-width: 768px) { | @media screen and (min-width: 768px) { | ||||
.equal, .equal > div[class*='col-'] { | |||||
display: -webkit-box; | |||||
display: -moz-box; | |||||
display: -ms-flexbox; | |||||
display: -webkit-flex; | |||||
display: flex; | |||||
flex: 1 1 auto; | |||||
.home #row-users-producers { | |||||
.producer, .users { | |||||
.panel-body { | |||||
height: 260px; | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
.home { | .home { | ||||
#content #presentation-distrib h3 { | #content #presentation-distrib h3 { | ||||
color: $courant; | color: $courant; | ||||
} | } |
} | } | ||||
} | } | ||||
.label-producer-signup-closed { | |||||
font-size: 14px; | |||||
} | |||||
#row-users-producers { | #row-users-producers { | ||||
width: 100%; | width: 100%; | ||||
text-align: center; | text-align: center; | ||||
right: 6px; | right: 6px; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
#content .site-service { | |||||
#panel-go-further { | |||||
text-align: center; | |||||
} | |||||
} | |||||
#content #mentions { | #content #mentions { | ||||
padding-top: 20px; | padding-top: 20px; | ||||