<?php
$userModule = $this->getUserModule();
$producerManager = $this->getProducerModule()->getManager();
$producerSignupRemainingPlaces = $producerManager->getProducerSignupRemainingPlaces();
$userCurrent = $this->getUserCurrent();

?>

<?php if($producerManager->isProducerSignupOpen()): ?>
    <?php if(Yii::$app->user->isGuest || $userModule->getSolver()->isStatusUser($userCurrent)): ?>
        <a class="btn btn-primary"
           href="<?= Yii::$app->user->isGuest ? \Yii::$app->urlManagerFrontend->createUrl(['site/signup', 'type' => 'producer']) : \Yii::$app->urlManagerFrontend->createUrl(['site/signup-producer']); ?>">
            <i class="bi bi-shop"></i> Je crée mon espace producteur
        </a><br />
        <?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; ?>
        <br />
        <br />
    <?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; ?>
