Browse Source

Merge branch 'develop'

master
Guillaume 1 year ago
parent
commit
4529cc9c9a
21 changed files with 376 additions and 253 deletions
  1. +11
    -7
      backend/models/MailForm.php
  2. +5
    -0
      backend/views/distribution/index.php
  3. +1
    -1
      backend/views/document/_download_product_line.php
  4. +4
    -3
      backend/views/layouts/header.php
  5. +1
    -2
      backend/views/layouts/left.php
  6. +3
    -2
      backend/views/point-sale/_form.php
  7. +1
    -24
      backend/views/producer/billing.php
  8. +1
    -1
      backend/views/producer/update.php
  9. +130
    -127
      backend/views/product/_form.php
  10. +6
    -2
      backend/views/subscription/_form.php
  11. +3
    -2
      backend/views/user/_form.php
  12. +34
    -12
      backend/web/css/screen.css
  13. +24
    -1
      backend/web/sass/_adminlte.scss
  14. +1
    -1
      common/config/params.php
  15. +12
    -3
      common/helpers/Image.php
  16. +1
    -1
      common/logic/Distribution/Distribution/Export/DistributionReportCsvGenerator.php
  17. +10
    -3
      common/logic/Order/Order/Service/TillerManager.php
  18. +18
    -3
      common/logic/Order/ProductOrder/Service/ProductOrderSolver.php
  19. +27
    -0
      common/versions/23.12.B.php
  20. +81
    -57
      frontend/views/site/_prices_producer.php
  21. +2
    -1
      producer/views/layouts/main.php

+ 11
- 7
backend/models/MailForm.php View File

$fromEmail = $producerModule->getEmailOpendistrib($producer) ; $fromEmail = $producerModule->getEmailOpendistrib($producer) ;
$fromName = $producer->name ; $fromName = $producer->name ;


$linkProducer = 'https://'.$producer->slug.'.opendistrib.net';
$linkUnsubscribe = Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/unsubscribe', 'slug_producer' => $producer->slug]);

// Message inscription newsletter // Message inscription newsletter
$messageAutoText .= " $messageAutoText .= "


-- --
Boutique : ".$linkProducer."
Me désinscrire : ".$linkUnsubscribe;


Me désinscrire de ce bulletin d'information :
".Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/index', 'slug_producer' => $producer->slug]);

$messageAutoHtml .= "<br /><br />--<br /><br /><a href=\"".Yii::$app->urlManagerProducer->createAbsoluteUrl(['newsletter/unsubscribe', 'slug_producer' => $producer->slug])."\">Me désinscrire</a> de ce bulletin d'information";
$messageAutoHtml .= "<br /><br />--<br>";
$messageAutoHtml .= "Boutique : <a href=\"".$linkProducer."\">".$linkProducer."</a><br>";
$messageAutoHtml .= "Me désinscrire : <a href=\"".$linkUnsubscribe."\">".$linkUnsubscribe."</a>";
} }
else { else {
$fromEmail = 'contact@opendistrib.net' ; $fromEmail = 'contact@opendistrib.net' ;
} }


// Tests // Tests
/*$usersArray = [
['email' => '', 'name' => '', 'lastname' => '']
];*/
$usersArray = [
['email' => 'contact@guillaumebourgeois.fr', 'name' => '', 'lastname' => '']
];


foreach($usersArray as $user) { foreach($usersArray as $user) {
$body['Messages'][] = [ $body['Messages'][] = [

+ 5
- 0
backend/views/distribution/index.php View File

<span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par virement') }} <span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par virement') }}
</a> </a>
</li> </li>
<li>
<a href="javascript:void(0);" @click="orderPaymentClick" :data-id-order="order.id" :data-type="getTypePayment(order)" data-mean-payment="credit-card">
<span class="glyphicon glyphicon-euro"></span> {{ getLabelPaymentRefund(order, 'Payer', 'Rembourser', 'par carte bancaire') }}
</a>
</li>
</template> </template>
</template> </template>
<li> <li>

+ 1
- 1
backend/views/document/_download_product_line.php View File

<?php if($displayPrices): ?> <?php if($displayPrices): ?>
<td class="align-center column-unit-price"> <td class="align-center column-unit-price">
<?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?> <?php $displayPriceUnitReference = $producerModule->getSolver()->getConfig('option_document_display_price_unit_reference'); ?>
<?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder); ?>
<?php $priceUnitReference = $productOrderModule->getSolver()->getPriceUnitReference($productOrder, true); ?>
<?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?> <?php $priceUnitReferenceString = Price::format($priceUnitReference, $documentPriceDecimals).' / kg' ?>
<?php if($productOrder->unit == 'piece'): ?> <?php if($productOrder->unit == 'piece'): ?>
<?= Price::format($price, $documentPriceDecimals) ?> <?= Price::format($price, $documentPriceDecimals) ?>

+ 4
- 3
backend/views/layouts/header.php View File

* termes. * termes.
*/ */


use common\helpers\Image;
use common\helpers\Price; use common\helpers\Price;
use common\logic\Producer\Producer\Module\ProducerModule; use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule; use common\logic\User\User\Module\UserModule;
<span class="sr-only">Toggle navigation</span> <span class="sr-only">Toggle navigation</span>
</a> </a>


<span class="producer-panel<?php if(!$producer->logo): ?> without-logo<?php endif; ?>">
<?php if($producer->logo): ?>
<span class="producer-panel<?php if(!$producer->logo || !Image::isPhotoExist($producer->logo)): ?> without-logo<?php endif; ?>">
<?php if($producer->logo && Image::isPhotoExist($producer->logo)): ?>
<span class="logo"> <span class="logo">
<img class="img-logo" <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; ?>"
</a> </a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']); ?>"><i <li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['site/index']); ?>"><i
class="fa fa-chevron-left"></i> Retour à l'accueil</a></li>
class="fa fa-home"></i> Retour à l'accueil</a></li>
<li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']); ?>"><i <li><a href="<?= Yii::$app->urlManagerFrontend->createAbsoluteUrl(['user/update']); ?>"><i
class="fa fa-user"></i> Mon profil</a></li> class="fa fa-user"></i> Mon profil</a></li>
<li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/logout']); ?>"><i <li><a href="<?= Yii::$app->urlManagerBackend->createUrl(['site/logout']); ?>"><i

+ 1
- 2
backend/views/layouts/left.php View File

'visible' => $isUserCurrentGrantedAsProducer && Yii::$app->parameterBag->get('dolibarrApiKey'), 'visible' => $isUserCurrentGrantedAsProducer && Yii::$app->parameterBag->get('dolibarrApiKey'),
'active' => Yii::$app->controller->id == 'producer-invoice', 'active' => Yii::$app->controller->id == 'producer-invoice',
], ],
['label' => 'Tarifs & modules', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $isUserCurrentGrantedAsProducer],
[ [
'label' => 'Développement', 'label' => 'Développement',
'icon' => 'code', 'icon' => 'code',
'active' => Yii::$app->controller->id == 'development', 'active' => Yii::$app->controller->id == 'development',
'template' => '<a href="{url}">{icon} {label}' . $newVersionOpendistribLabel . '</a>' 'template' => '<a href="{url}">{icon} {label}' . $newVersionOpendistribLabel . '</a>'
], ],
['label' => 'Tarifs', 'icon' => 'euro', 'url' => ['/producer/billing'], 'visible' => $isUserCurrentGrantedAsProducer],

['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsAdministrator], ['label' => 'Administration', 'options' => ['class' => 'header'], 'visible' => $isUserCurrentGrantedAsAdministrator],
[ [
'label' => 'Tickets', 'label' => 'Tickets',

+ 3
- 2
backend/views/point-sale/_form.php View File

</div> </div>
<div class="clr"></div> <div class="clr"></div>


<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<div class="form-group form-actions">
<?= Html::a('Retour', ['point-sale/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div> </div>


<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>

+ 1
- 24
backend/views/producer/billing.php View File

$producerModule = $this->getProducerModule(); $producerModule = $this->getProducerModule();
$producerPriceRangeModule = $this->getProducerPriceRangeModule(); $producerPriceRangeModule = $this->getProducerPriceRangeModule();


$this->setTitle('Tarifs') ;
$this->setTitle('Tarifs hébergement & modules') ;
$this->addBreadcrumb($this->getTitle()) ; $this->addBreadcrumb($this->getTitle()) ;


?> ?>


<?php

if($producerModule->isBillingTypeFreePrice($producer)) {
echo '<div class="alert alert-info">';
echo "Vous bénéficiez actuellement d'un abonnement à prix libre dont voici le montant : <strong>".$producer->getFreePrice()."</strong>";
echo '</div>';
}
elseif($producerModule->isBillingTypeClassic($producer)) {
$month = date('Y-m', strtotime('-1 month'));
$turnover = $producerModule->getTurnover($producer, $month);
$amountBilledLastMonth = $producerPriceRangeModule->getAmountToBeBilledByTurnover($turnover);

if($amountBilledLastMonth) {
echo '<div class="alert alert-info">';
echo "À titre d'information, voici le tarif retenu pour le mois dernier (".strftime('%B', strtotime('-1 month')).") : <strong>".$producerModule->getAmountToBeBilledByMonth($producer, $month, true)."</strong>";
echo "<br />Le chiffre d'affaire pris en compte pour ce calcul est : <strong>".Price::format($turnover)." HT</strong>";
echo '<br /><a href="'.Yii::$app->urlManager->createUrl(['stats/index']).'">Voir l\'évolution de mon chiffre d\'affaire</a>';
echo '</div>';
}
}

?>

<?= <?=


$this->render('@frontend/views/site/_prices_producer', [ $this->render('@frontend/views/site/_prices_producer', [

+ 1
- 1
backend/views/producer/update.php View File

</div> </div>
</div> </div>


<div class="form-group">
<div class="form-group form-actions">
<?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> <?= Html::submitButton('Mettre à jour', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div> </div>
</div> </div>

+ 130
- 127
backend/views/product/_form.php View File

use common\logic\PointSale\PointSale\Model\PointSale; use common\logic\PointSale\PointSale\Model\PointSale;


$productCategoryModule = $this->getProductCategoryModule(); $productCategoryModule = $this->getProductCategoryModule();
$taxRateModule = $this-> getTaxRateModule();
$taxRateModule = $this->getTaxRateModule();


?> ?>


<div class="product-form"> <div class="product-form">


<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'options' => ['enctype' => 'multipart/form-data']
]); ?>
<div>
<div class="col-md-8">
<?= $form->field($model, 'status')->radioList([1 => 'Oui', 0 => 'Non']) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'reference')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'id_product_category')->dropDownList($productCategoryModule->populateProductCategoriesDropdownList()); ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'recipe')->textarea()->label('Description longue') ?>
<?= $form->field($model, 'unit')
->dropDownList(ArrayHelper::map(Product::$unitsArray, 'unit', 'wording'))
->label('Unité (pièce, poids ou volume)'); ?>
<?php
//Récupère la tva par défaut du producteur courant
$producer = \common\helpers\GlobalParam::getCurrentProducer();
$taxRateDefault = $producer->taxRate;
$taxRateNamesArray = array_merge(array(0 => 'Tva par défaut'), ArrayHelper::map($taxRateModule->findTaxRates(), 'id', function ($model) {
return $model->name;
}));
$taxRateValuesArray = array_merge(array(0 => $taxRateDefault->value), ArrayHelper::map($taxRateModule->findTaxRates(), 'id', function ($model) {
return $model->value;
}));
foreach ($taxRateValuesArray as $key => $taxRateValue) {
$taxRateValuesArrayFormatted[$key] = array('data-tax-rate-value' => $taxRateValue);
}
?>
<?php if($taxRateDefault->value != 0): ?>
<?= $form->field($model, 'id_tax_rate')->dropDownList($taxRateNamesArray, ['options' => $taxRateValuesArrayFormatted])->label('Taxe'); ?>
<?php endif; ?>
<?= $form->field($model, 'price', [
'template' => '
<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'options' => ['enctype' => 'multipart/form-data']
]); ?>
<div>
<div class="col-md-8">
<?= $form->field($model, 'status')->radioList([1 => 'Oui', 0 => 'Non']) ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'reference')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'id_product_category')->dropDownList($productCategoryModule->populateProductCategoriesDropdownList()); ?>
<?= $form->field($model, 'description')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'recipe')->textarea()->label('Description longue') ?>
<?= $form->field($model, 'unit')
->dropDownList(ArrayHelper::map(Product::$unitsArray, 'unit', 'wording'))
->label('Unité (pièce, poids ou volume)'); ?>
<?php
//Récupère la tva par défaut du producteur courant
$producer = \common\helpers\GlobalParam::getCurrentProducer();
$taxRateDefault = $producer->taxRate;
$taxRateNamesArray = array_merge(array(0 => 'Tva par défaut'), ArrayHelper::map($taxRateModule->findTaxRates(), 'id', function ($model) {
return $model->name;
}));
$taxRateValuesArray = array_merge(array(0 => $taxRateDefault->value), ArrayHelper::map($taxRateModule->findTaxRates(), 'id', function ($model) {
return $model->value;
}));
foreach ($taxRateValuesArray as $key => $taxRateValue) {
$taxRateValuesArrayFormatted[$key] = array('data-tax-rate-value' => $taxRateValue);
}
?>
<?php if ($taxRateDefault->value != 0): ?>
<?= $form->field($model, 'id_tax_rate')->dropDownList($taxRateNamesArray, ['options' => $taxRateValuesArrayFormatted])->label('Taxe'); ?>
<?php endif; ?>
<?= $form->field($model, 'price', [
'template' => '
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-6">
<label for="product-price" class="control-label without-tax"></label> <label for="product-price" class="control-label without-tax"></label>
</div> </div>
', ',
]) ?>
<?= $form->field($model, 'step')->textInput()->hint('Définit ce qui est ajouté ou enlevé lors des changements de quantité.') ?>
<?= $form->field($model, 'weight')->textInput()->label('Poids (g)')->hint("Si unité au poids ou volume, utilisé pour déterminer le nombre de pièces dans les exports.") ?>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_monday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_tuesday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_wednesday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_thursday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_friday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_saturday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_sunday')->textInput() ?>
</div>
<div class="clr"></div>
<?php
if (!$model->isNewRecord) {
echo $form->field($model, 'apply_distributions')
->checkbox()
->hint('Sélectionnez cette option si vous souhaitez que ces modifications (actif / non actif, quantité max) soient répercutées dans les distributions à venir déjà initialisées.');
}
?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'photoFile')->fileInput() ?>
<?php
if (strlen($model->photo)) {
echo '<img class="photo-product" src="' . Image::getThumbnailSmall($model->photo, true). '" width="200px" /><br />';
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label>';
}
?>
<div id="days-production">
<h2>Jours de distribution</h2>
<?= $form->field($model, 'monday')->checkbox() ?>
<?= $form->field($model, 'tuesday')->checkbox() ?>
<?= $form->field($model, 'wednesday')->checkbox() ?>
<?= $form->field($model, 'thursday')->checkbox() ?>
<?= $form->field($model, 'friday')->checkbox() ?>
<?= $form->field($model, 'saturday')->checkbox() ?>
<?= $form->field($model, 'sunday')->checkbox() ?>
</div>
<div class="clr"></div>
<div id="availability-points-sale">
<h2>Disponibilité points de vente</h2>
<?= $form->field($model, 'available_on_points_sale')->radioList([1 => 'Disponible', 0 => 'Indisponible']) ?>
<strong id="label-availability-points-sale">Et <span><?php if($model->available_on_points_sale): ?>indisponible<?php else: ?>disponible<?php endif; ?></span> sur les points de vente</strong>
<?php $pointSaleArray = PointSale::find()
->where([
'id_producer' => GlobalParam::getCurrentProducerId(),
'status' => 1
])
->orderBy('is_bread_box ASC, name ASC')
->all(); ?>
<?= Html::activeCheckboxList($model, 'pointsSale', ArrayHelper::map($pointSaleArray, 'id', function ($pointSale, $defaultValue) use ($model) {
return Html::encode($pointSale->name) ;
}), ['encode' => false, 'class' => '']) ?>
</div>
</div>
<div class="clr"></div>
]) ?>
<?= $form->field($model, 'step')->textInput()->hint('Définit ce qui est ajouté ou enlevé lors des changements de quantité.') ?>
<?= $form->field($model, 'weight')->textInput()->label('Poids (g)')->hint("Si unité au poids ou volume, utilisé pour déterminer le nombre de pièces dans les exports.") ?>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_monday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_tuesday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_wednesday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_thursday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_friday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_saturday')->textInput() ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_sunday')->textInput() ?>
</div>
<div class="clr"></div>
<?php
if (!$model->isNewRecord) {
echo $form->field($model, 'apply_distributions')
->checkbox()
->hint('Sélectionnez cette option si vous souhaitez que ces modifications (actif / non actif, quantité max) soient répercutées dans les distributions à venir déjà initialisées.');
}
?>
</div>
<div class="col-md-4">
<?= $form->field($model, 'photoFile')->fileInput() ?>
<?php
if (strlen($model->photo)) {
echo '<img class="photo-product" src="' . Image::getThumbnailSmall($model->photo, true) . '" width="200px" /><br />';
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label>';
}
?>
<div id="days-production">
<h2>Jours de distribution</h2>
<?= $form->field($model, 'monday')->checkbox() ?>
<?= $form->field($model, 'tuesday')->checkbox() ?>
<?= $form->field($model, 'wednesday')->checkbox() ?>
<?= $form->field($model, 'thursday')->checkbox() ?>
<?= $form->field($model, 'friday')->checkbox() ?>
<?= $form->field($model, 'saturday')->checkbox() ?>
<?= $form->field($model, 'sunday')->checkbox() ?>
</div>
<div class="clr"></div>
<div id="availability-points-sale">
<h2>Disponibilité points de vente</h2>
<?= $form->field($model, 'available_on_points_sale')->radioList([1 => 'Disponible', 0 => 'Indisponible']) ?>
<strong id="label-availability-points-sale">Et
<span><?php if ($model->available_on_points_sale): ?>indisponible<?php else: ?>disponible<?php endif; ?></span>
sur les points de vente</strong>
<?php $pointSaleArray = PointSale::find()
->where([
'id_producer' => GlobalParam::getCurrentProducerId(),
'status' => 1
])
->orderBy('is_bread_box ASC, name ASC')
->all(); ?>
<?= Html::activeCheckboxList($model, 'pointsSale', ArrayHelper::map($pointSaleArray, 'id', function ($pointSale, $defaultValue) use ($model) {
return Html::encode($pointSale->name);
}), ['encode' => false, 'class' => '']) ?>
</div>
</div> </div>
<div class="clr"></div>
</div>


<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?>
<?= $form->field($model, 'id_producer')->hiddenInput()->label('') ?>


<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<div class="form-group form-actions">
<?= Html::a('Retour', ['product/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div>


<?php ActiveForm::end(); ?>
<?php ActiveForm::end(); ?>


</div> </div>

+ 6
- 2
backend/views/subscription/_form.php View File

</div> </div>
<?= $form->field($model, 'comment')->textarea(['rows' => 6]) ?> <?= $form->field($model, 'comment')->textarea(['rows' => 6]) ?>
<?= Html::submitButton('Enregistrer' , ['class' => 'btn btn-primary']) ?>

<div class="form-group form-actions">
<?= Html::a('Retour', ['subscription/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->id ? 'Modifier' : 'Créer', ['class' => 'btn btn-primary']) ?>
</div>

<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>
</div> </div>

+ 3
- 2
backend/views/user/_form.php View File

<?php /* $form->field($model, 'product_price_percent') <?php /* $form->field($model, 'product_price_percent')
->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?> ->dropDownList( ProductPrice::percentValues(), [])->hint('Pourcentage appliqué aux prix de chaque produit pour cet utilisateur.');*/ ?>


<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<div class="form-group form-actions">
<?= Html::a('Retour', ['user/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div> </div>


<?php ActiveForm::end(); ?> <?php ActiveForm::end(); ?>

+ 34
- 12
backend/web/css/screen.css View File

border: solid 1px #F39C12; border: solid 1px #F39C12;
color: white; color: white;
} }
/* line 293, ../sass/_adminlte.scss */
/* line 294, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .pagination > li > a, body.skin-black .content-wrapper .pagination > li > span { body.skin-black .content-wrapper .pagination > li > a, body.skin-black .content-wrapper .pagination > li > span {
color: #F39C12; color: #F39C12;
} }
/* line 295, ../sass/_adminlte.scss */
/* line 296, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .pagination > li > a:hover, body.skin-black .content-wrapper .pagination > li > span:hover { body.skin-black .content-wrapper .pagination > li > a:hover, body.skin-black .content-wrapper .pagination > li > span:hover {
color: #c87f0a; color: #c87f0a;
} }
/* line 300, ../sass/_adminlte.scss */
/* line 301, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .submenu { body.skin-black .content-wrapper .submenu {
margin-bottom: 25px; margin-bottom: 25px;
} }
/* line 306, ../sass/_adminlte.scss */
/* line 305, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
padding: 15px 30px 15px 30px;
margin: 0px;
background-color: white;
text-align: right;
z-index: 10;
border-top: solid 1px #e0e0e0;
}
/* line 318, ../sass/_adminlte.scss */
body.skin-black .content-wrapper .form-actions a, body.skin-black .content-wrapper .form-actions button {
margin-left: 10px;
}
/* line 325, ../sass/_adminlte.scss */
body.skin-black .main-footer a { body.skin-black .main-footer a {
color: #F39C12; color: #F39C12;
} }
/* line 311, ../sass/_adminlte.scss */
/* line 330, ../sass/_adminlte.scss */
body.skin-black .gridview-pagesize { body.skin-black .gridview-pagesize {
float: right; float: right;
margin-bottom: 8px; margin-bottom: 8px;
} }
/* line 335, ../sass/_adminlte.scss */
body.skin-black #yii-debug-toolbar {
bottom: 64px;
}


/* line 317, ../sass/_adminlte.scss */
/* line 340, ../sass/_adminlte.scss */
body.login-page { body.login-page {
background: none; background: none;
background-color: white; background-color: white;
} }
/* line 321, ../sass/_adminlte.scss */
/* line 344, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo { body.login-page .login-box .login-logo {
text-align: center; text-align: center;
font-family: 'highvoltageregular'; font-family: 'highvoltageregular';
} }
/* line 325, ../sass/_adminlte.scss */
/* line 348, ../sass/_adminlte.scss */
body.login-page .login-box .login-logo img { body.login-page .login-box .login-logo img {
width: 50px; width: 50px;
} }
/* line 330, ../sass/_adminlte.scss */
/* line 353, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary { body.login-page .login-box .login-box-body .btn-primary {
background-color: #F39C12; background-color: #F39C12;
border-color: #F39C12; border-color: #F39C12;
padding: 5px 10px; padding: 5px 10px;
} }
/* line 335, ../sass/_adminlte.scss */
/* line 358, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body .btn-primary:active { body.login-page .login-box .login-box-body .btn-primary:active {
background-color: #f4a62a; background-color: #f4a62a;
border-color: #F39C12; border-color: #F39C12;
} }
/* line 341, ../sass/_adminlte.scss */
/* line 364, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a { body.login-page .login-box .login-box-body a {
color: #F39C12; color: #F39C12;
} }
/* line 343, ../sass/_adminlte.scss */
/* line 366, ../sass/_adminlte.scss */
body.login-page .login-box .login-box-body a:hover { body.login-page .login-box .login-box-body a:hover {
color: #f4a62a; color: #f4a62a;
} }

+ 24
- 1
backend/web/sass/_adminlte.scss View File

border: solid 1px $color1 ; border: solid 1px $color1 ;
color: white ; color: white ;
} }

.pagination > li > a, .pagination > li > span { .pagination > li > a, .pagination > li > span {
color: $color1 ; color: $color1 ;
&:hover { &:hover {
color: darken($color1, 10) ; color: darken($color1, 10) ;
} }
} }
.submenu { .submenu {
margin-bottom: 25px ; margin-bottom: 25px ;
} }

.form-actions {
position: fixed;
bottom: 0;
left: 0;
right: 0;
width: 100%;
padding: 15px 30px 15px 30px;
margin: 0px;
background-color: white;
text-align: right;
z-index: 10;
border-top: solid 1px #e0e0e0;

a, button {
margin-left: 10px;
}
}
} }
.main-footer { .main-footer {
float: right; float: right;
margin-bottom: 8px; margin-bottom: 8px;
} }

#yii-debug-toolbar {
bottom: 64px;
}
} }


body.login-page { body.login-page {

+ 1
- 1
common/config/params.php View File

*/ */


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

+ 12
- 3
common/helpers/Image.php View File

$thumbnailFilename = self::getThumbnailFilename($filenameOriginal, $thumbnail); $thumbnailFilename = self::getThumbnailFilename($filenameOriginal, $thumbnail);
$thumbnailPath = $basePath . $thumbnailFilename; $thumbnailPath = $basePath . $thumbnailFilename;
$originalPath = $basePath . $filenameOriginal; $originalPath = $basePath . $filenameOriginal;
$defaultImagePath = $basePath . 'default.jpg';


return self::isThumbnailExist($thumbnailFilename) ? $thumbnailPath : $originalPath;
if(self::isPhotoExist($thumbnailFilename)) {
return $thumbnailPath;
}

if(self::isPhotoExist($filenameOriginal)) {
return $originalPath;
}

return $defaultImagePath;
} }


public static function getBasePath(bool $absoluteUrl = false): string public static function getBasePath(bool $absoluteUrl = false): string
return $filenameArray[0].'-'.$thumbnail.'.'.$filenameArray[1]; return $filenameArray[0].'-'.$thumbnail.'.'.$filenameArray[1];
} }


public static function isThumbnailExist(string $thumbnailFilename): bool
public static function isPhotoExist(string $filename): bool
{ {
return file_exists(\Yii::getAlias('@producer').'/web/'.self::DIR_UPLOADS.'/'.$thumbnailFilename);
return file_exists(\Yii::getAlias('@producer').'/web/'.self::DIR_UPLOADS.'/'.$filename);
} }
} }

+ 1
- 1
common/logic/Distribution/Distribution/Export/DistributionReportCsvGenerator.php View File

$totalsPointSaleArray[$index] .= $quantity; $totalsPointSaleArray[$index] .= $quantity;


if ($product->unit != $unit) { if ($product->unit != $unit) {
$totalsPointSaleArray[$index] .= '' . $this->productSolver->strUnit($unit, 'wording_short', true);
$totalsPointSaleArray[$index] .= '' . $this->unitSolver->strUnit($unit, 'wording_short', true);
} }
} }
} }

+ 10
- 3
common/logic/Order/Order/Service/TillerManager.php View File

if ($ordersOpendistrib) { if ($ordersOpendistrib) {
foreach ($ordersOpendistrib as $orderOpendistrib) { foreach ($ordersOpendistrib as $orderOpendistrib) {
$this->orderBuilder->initOrder($orderOpendistrib); $this->orderBuilder->initOrder($orderOpendistrib);
$ordersOpendistribSynchro[$orderOpendistrib->id] = false;
if (isset($ordersTiller->orders)) {

if($orderOpendistrib->tiller_external_id) {
$ordersOpendistribSynchro[$orderOpendistrib->id] = true;
}
else {
$ordersOpendistribSynchro[$orderOpendistrib->id] = false;
}

/*if (isset($ordersTiller->orders)) {
foreach ($ordersTiller->orders as $orderTiller) { foreach ($ordersTiller->orders as $orderTiller) {
if ($orderOpendistrib->tiller_external_id == $orderTiller->id) { if ($orderOpendistrib->tiller_external_id == $orderTiller->id) {
$amountTotalPaidOrderOpendistrib = (int)round( $amountTotalPaidOrderOpendistrib = (int)round(
} }
} }
} }
}
}*/
} }
} }



+ 18
- 3
common/logic/Order/ProductOrder/Service/ProductOrderSolver.php View File

return $productOrder->price; return $productOrder->price;
} }


public function getPriceUnitReference(ProductOrder $productOrder): ?float
public function getPriceUnitReference(ProductOrder $productOrder, bool $isInvoicePrice = false): ?float
{ {
$productOrderPrice = $productOrder->price;
if($isInvoicePrice) {
$productOrderPrice = $this->getInvoicePrice($productOrder);
}

if($productOrder->unit == 'piece') { if($productOrder->unit == 'piece') {
if($productOrder->product->weight) { if($productOrder->product->weight) {
$price = (1000 * $productOrder->price) / $productOrder->product->weight;
$price = (1000 * $productOrderPrice) / $productOrder->product->weight;
} }
else { else {
return null; return null;
} }
} }
else { else {
$price = $productOrder->price;
$price = $productOrderPrice;
} }


return $price; return $price;
} }

public function getInvoicePrice(ProductOrder $productOrder)
{
if($productOrder->invoice_price) {
return $productOrder->invoice_price;
}
else {
return $productOrder->price;
}
}
} }

+ 27
- 0
common/versions/23.12.B.php View File

<?php

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

version(
'11/12/2023',
[
[
"[Administration] Distributions > paiement : ajout 'Carte bancaire' en moyen de paiement",
"[Administration] Communiquer > envoyer un email : ajout du lien vers la boutique du producteur dans le footer",
"[Administration] Formulaires : boutons d'actions en position fixe",
],
[
"[Administration] Tiller : correctif problème synchronisation"
]
],
[
[
],
[
"[Technique] Images : gestion image par défaut"
]
],
$userCurrent
);

?>

+ 81
- 57
frontend/views/site/_prices_producer.php View File



?> ?>


<div class="alert alert-warning" role="alert">
Découvrez ci-dessous la <strong>grille tarifaire</strong> pour l'hébergement de votre circuit court sur Opendistrib.
Le montant qui vous est facturé mensuellement dépend de votre chiffre d’affaire hors taxe réalisé sur le logiciel.
Il est donc adapté chaque mois en fonction de l’évolution de votre activité.<br>
Le service est <strong>sans engagement</strong>, vous arrêtez quand vous voulez sur simple désactivation de votre compte.
</div>

<?=
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<div class="glyphicon glyphicon-hdd"></div>
Hébergement
</h3>
</div>
<div class="panel-body">
<div class="alert alert-warning" role="alert">
Découvrez ci-dessous la <strong>grille tarifaire</strong> pour l'hébergement de votre circuit court sur Opendistrib.
Le montant qui vous est facturé mensuellement dépend de votre chiffre d’affaire hors taxe réalisé sur le logiciel.
Il est donc adapté chaque mois en fonction de l’évolution de votre activité. Le service est
<strong>sans engagement</strong>, vous arrêtez quand vous voulez sur simple désactivation de votre compte.
</div>
<?=
GridView::widget([
'dataProvider' => $dataProviderPrices,
'summary' => '',
'columns' => [
[
'label' => 'Tranches (CA HT / mois)',
'format' => 'raw',
'value' => function ($model) {
if ($model->range_begin == 0) {
$html = 'Moins de ' . $model->range_end . ' &euro;';
} elseif ($model->range_end == null) {
$html = 'Plus de ' . $model->range_begin . ' &euro;';
} else {
$html = 'Entre ' . $model->range_begin . ' &euro;';
$html .= ' et ' . $model->range_end . ' &euro;';
}
return $html;
}
],
[
'label' => 'Tarif (HT)',
'format' => 'raw',
'value' => function ($model) {
$html = $model->price . ' &euro;';


GridView::widget([
'dataProvider' => $dataProviderPrices,
'summary' => '',
'columns' => [
[
'label' => 'Tranches (CA HT / mois)',
'format' => 'raw',
'value' => function ($model) {
if ($model->range_begin == 0) {
$html = 'Moins de ' . $model->range_end . ' &euro;';
} elseif ($model->range_end == null) {
$html = 'Plus de ' . $model->range_begin . ' &euro;';
} else {
$html = 'Entre ' . $model->range_begin . ' &euro;';
$html .= ' et ' . $model->range_end . ' &euro;';
}
return $html;
}
],
[
'label' => 'Tarifs (HT)',
'format' => 'raw',
'value' => function ($model) {
$html = $model->price . ' &euro;';
return $html;
}
],
]
]);
?>
</div>
</div>


return $html;
}
],
]
]);
?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-th-large"></span>
Modules
</h3>
</div>
<div class="panel-body">
<div class="alert alert-warning" role="alert">
Retrouvez ici les modules payants d'Opendistrib correspondant aux développements qui n'ont pas encore
été totalement financés et aux fonctionnalités nécessitant une configuration spécifique. Contactez-moi
pour demander l'activation d'un module.
</div>
<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Module</th>
<th>Tarif (HT)</th>
</tr>
</thead>
<tbody>
<?php foreach($paidFeaturesArray as $paidFeature): ?>
<tr>
<td>
<div><strong><?= Html::encode($paidFeature->name) ?></strong></div>
<div><?= $paidFeature->description ?></div>
</td>
<td><?= Price::format($paidFeature->price, 0) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>


<table class="table table-striped table-bordered">
<thead>
<tr>
<th>Module</th>
<th>Activation du module (HT)</th>
</tr>
</thead>
<tbody>
<?php foreach($paidFeaturesArray as $paidFeature): ?>
<tr>
<td>
<div><strong><?= Html::encode($paidFeature->name) ?></strong></div>
<div><?= $paidFeature->description ?></div>
</td>
<td><?= Price::format($paidFeature->price, 0) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>



+ 2
- 1
producer/views/layouts/main.php View File

* termes. * termes.
*/ */


use common\helpers\Image;
use common\logic\Feature\Feature\Feature; use common\logic\Feature\Feature\Feature;
use common\logic\Feature\Feature\FeatureModule; use common\logic\Feature\Feature\FeatureModule;
use common\logic\Order\Order\Model\Order; use common\logic\Order\Order\Model\Order;
<div class="container"> <div class="container">
<div id="left" class="col-md-3"> <div id="left" class="col-md-3">
<div class="fixed"> <div class="fixed">
<?php if (strlen($producer->logo)): ?>
<?php if (strlen($producer->logo) && Image::isPhotoExist($producer->logo)): ?>
<div id="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; ?>> <div id="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; ?>>
<a href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>"> <a href="<?= \Yii::$app->urlManager->createUrl(['site/index']) ?>">
<img class="img-logo" <img class="img-logo"

Loading…
Cancel
Save