Bladeren bron

[Administration] Distribution > étiquettes : ajustements #1343

feature/souke
Guillaume Bourgeois 1 jaar geleden
bovenliggende
commit
658b491c89
10 gewijzigde bestanden met toevoegingen van 148 en 132 verwijderingen
  1. +9
    -6
      backend/views/distribution/shopping-cart-labels.php
  2. +17
    -2
      backend/views/point-sale/_form.php
  3. +29
    -115
      backend/views/producer/update.php
  4. +13
    -4
      backend/views/user/_form.php
  5. +35
    -0
      common/helpers/Dropdown.php
  6. +4
    -0
      common/logic/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php
  7. +3
    -2
      common/logic/PointSale/PointSale/Model/PointSale.php
  8. +3
    -1
      common/logic/Producer/Producer/Model/Producer.php
  9. +5
    -2
      common/logic/User/User/Model/User.php
  10. +30
    -0
      console/migrations/m231025_064432_add_columns_shopping_cart_labels.php

+ 9
- 6
backend/views/distribution/shopping-cart-labels.php Bestand weergeven

@@ -4,14 +4,15 @@ use common\logic\Order\Order\Module\OrderModule;
use yii\helpers\Html;

$orderModule = OrderModule::getInstance();
$index = 1;
$shoppingCartLabelsByColumn = 8;
$index = 0;

?>
<?php
$i = 0;
foreach($ordersArray as $key => $order): ?>
<div class="shopping-cart-label shopping-cart-label-<?= $index ?>">
foreach($ordersArray as $key => $order):
$index ++;
?>
<div class="shopping-cart-label">
<div class="inner">
<div class="username">
<?= $orderModule->getOrderUsername($order); ?>
@@ -25,8 +26,10 @@ foreach($ordersArray as $key => $order): ?>
</div>
</div>
</div>
<?php $index = ($index == $shoppingCartLabelsByColumn) ? 1 : $index + 1; ?>
<?php if($index == 1 && $key !== array_key_last($ordersArray)): ?>
<?php if($index == $shoppingCartLabelsPerColumn) {
$index = 0;
} ?>
<?php if($index == 0 && $key !== array_key_last($ordersArray)): ?>
<columnbreak />
<?php endif; ?>
<?php endforeach; ?>

+ 17
- 2
backend/views/point-sale/_form.php Bestand weergeven

@@ -36,14 +36,18 @@
* termes.
*/

use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Producer\Producer\Module\ProducerModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\User\Module\UserModule;

$producerModule = $this->getProducerModule();
$userModule = $this->getUserModule();
$producerModule = ProducerModule::getInstance();
$userModule = UserModule::getInstance();
$distributionModule = DistributionModule::getInstance();

?>

@@ -150,6 +154,17 @@ $userModule = $this->getUserModule();
<?= $form->field($model, 'button_generate_delivery_note_each_user')->checkbox() ?>
</div>
</div>

<?php if($distributionModule->getExportManager()->isEnabled(ExportManager::SHOPPING_CART_LABELS_PDF)): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Exports</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'exclude_export_shopping_cart_labels')->checkbox(); ?>
</div>
</div>
<?php endif; ?>
</div>
<div class="clr"></div>


+ 29
- 115
backend/views/producer/update.php Bestand weergeven

@@ -36,9 +36,9 @@
* termes.
*/

use common\helpers\Dropdown;
use common\helpers\GlobalParam;
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\User\User\Module\UserModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
@@ -48,6 +48,7 @@ use common\logic\Document\Document\Model\Document;
use yii\helpers\ArrayHelper;

\backend\assets\VuejsProducerUpdateAsset::register($this);

$userModule = UserModule::getInstance();
$userCurrent = GlobalParam::getCurrentUser();
$distributionExportManager = DistributionModule::getInstance()->getExportManager();
@@ -81,10 +82,7 @@ $this->addBreadcrumb($this->getTitle());
<div class="panel-body">
<h4>Accès</h4>
<?= $form->field($model, 'active')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], [])
->dropDownList(Dropdown::noYesChoices())
->label('En ligne')
->hint('Activez cette option pour rendre votre espace visible à vos clients.'); ?>
<?= $form->field($model, 'code')->hint("Saisissez ce champs si vous souhaitez protéger l'accès à votre espace par un code, sinon laissez-le vide.<br />"
@@ -131,18 +129,7 @@ $this->addBreadcrumb($this->getTitle());
<div class="panel-body">
<h4>Tableau de bord administration</h4>
<?= $form->field($model, 'option_dashboard_number_distributions')
->dropDownList([
3 => '3',
6 => '6',
9 => '9',
12 => '12',
15 => '15',
18 => '18',
21 => '21',
24 => '24',
27 => '27',
30 => '30',
], []); ?>
->dropDownList(Dropdown::numberChoices(3, 30, false, '', 3)); ?>

<?= $form->field($model, 'option_dashboard_date_start')->textInput([
'class' => 'datepicker form-control'
@@ -255,33 +242,17 @@ $this->addBreadcrumb($this->getTitle());
Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST => 'Liste',
]); ?>
<?= $form->field($model, 'option_delivery')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?php echo $form->field($model, 'option_allow_order_guest')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>

->dropDownList(Dropdown::noYesChoices()); ?>

<h4>Notifications</h4>
<?= $form->field($model, 'option_notify_producer_order_summary')
->dropDownList([
0 => 'Non',
1 => 'Oui',
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_email_confirm')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_email_confirm_producer')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>

<h4>Divers</h4>
<?php
@@ -318,25 +289,15 @@ $this->addBreadcrumb($this->getTitle());
',' => 'Virgule (,)'
], []); ?>
<?= $form->field($model, 'option_export_display_product_reference')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_export_display_column_delivery_note')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_csv_export_all_products')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_csv_export_by_piece')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'export_shopping_cart_labels_number_per_column')
->dropDownList(Dropdown::numberChoices(1, 20)); ?>
</div>
</div>

@@ -344,10 +305,7 @@ $this->addBreadcrumb($this->getTitle());
<div class="panel-body">
<h4>Abonnements</h4>
<?= $form->field($model, 'user_manage_subscription')
->dropDownList([
0 => 'Non',
1 => 'Oui',
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
</div>
</div>

@@ -355,10 +313,7 @@ $this->addBreadcrumb($this->getTitle());
<div class="panel-body">
<h4>Crédit</h4>
<?= $form->field($model, 'credit')
->dropDownList([
0 => 'Non',
1 => 'Oui',
], [])
->dropDownList(Dropdown::noYesChoices())
->label('Activer le système de Crédit')
->hint('Le système de Crédit permet à vos clients d\'avoir un compte prépayé sur le site <em>distrib</em>.<br />'
. 'Ils créditent leur compte en vous donnant la somme de leur choix et c\'est ensuite à vous de ' . Html::a('mettre à jour', ['user/index']) . ' leur Crédit en ligne.<br />'
@@ -372,43 +327,30 @@ $this->addBreadcrumb($this->getTitle());
], [])->hint(Producer::HINT_CREDIT_FUNCTIONING); ?>

<?= $form->field($model, 'use_credit_checked_default')
->dropDownList([
0 => 'Non',
1 => 'Oui',
], [])->hint('Utilisation optionnelle du Crédit.'); ?>
->dropDownList(Dropdown::noYesChoices())
->hint('Utilisation optionnelle du Crédit.'); ?>

<?= $form->field($model, 'credit_limit_reminder', [
'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}',
])
->hint("Une relance est envoyé au client dès que ce seuil est dépassé."); ?>



<?= $form->field($model, 'credit_limit', [
'template' => '{label}<div class="input-group">{input}<span class="input-group-addon"><span class="glyphicon glyphicon-euro"></span></span></div>{hint}',
])->hint('Limite de crédit que l\'utilisateur ne pourra pas dépasser. Laisser vide pour permettre un crédit négatif et infini.'); ?>

<h4>Paiement en ligne</h4>

<?= $form->field($model, 'online_payment')
->dropDownList([
0 => 'Non',
1 => 'Oui',
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_online_payment_minimum_amount')
->hint('Valeur par défaut si non défini : '.Producer::ONLINE_PAYMENT_MINIMUM_AMOUNT_DEFAULT.' €')
->textInput(); ?>
<?= $form->field($model, 'option_stripe_mode_test')->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>

<?= $form->field($model, 'option_stripe_mode_test')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_online_payment_type')
->dropDownList([
'credit' => 'Alimentation du crédit',
'order' => 'Paiement à la commande',
], []); ?>

<?= $form->field($model, 'option_stripe_public_key')->textInput(); ?>
<?= $form->field($model, 'option_stripe_private_key')->textInput(); ?>
<?= $form->field($model, 'option_stripe_endpoint_secret')->textInput(); ?>
@@ -431,10 +373,7 @@ $this->addBreadcrumb($this->getTitle());
<div class="panel-body">
<h4>Tiller</h4>
<?= $form->field($model, 'tiller')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], [])
->dropDownList(Dropdown::noYesChoices())
->label('Synchroniser avec Tiller'); ?>
<?= $form->field($model, 'tiller_provider_token'); ?>
<?= $form->field($model, 'tiller_restaurant_token'); ?>
@@ -451,10 +390,7 @@ $this->addBreadcrumb($this->getTitle());
->label('TVA à appliquer par défaut'); ?>
<?= $form->field($model, 'option_tax_calculation_method')
->dropDownList(Document::$taxCalculationMethodArray); ?>
<?= $form->field($model, 'option_export_evoliz')->dropDownList([
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'option_export_evoliz')->dropDownList(Dropdown::noYesChoices()); ?>
<?php $hintKeywordsPrefix = "Saisissez [ANNEE] pour intégrer l'année courante"; ?>
<?= $form->field($model, 'document_quotation_prefix')->hint($hintKeywordsPrefix); ?>
<?= $form->field($model, 'document_quotation_first_reference'); ?>
@@ -468,30 +404,11 @@ $this->addBreadcrumb($this->getTitle());
1 => 'Oui'
]); ?>
<?= $form->field($model, 'option_document_height_logo')
->dropDownList([
null => '--',
50 => '50px',
100 => '100px',
150 => '150px',
200 => '200px',
250 => '250px',
]); ?>
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList([
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'document_display_orders_delivery_note')->dropDownList([
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'document_display_prices_delivery_note')->dropDownList([
0 => 'Non',
1 => 'Oui'
]); ?>
<?= $form->field($model, 'document_display_product_description')->dropDownList([
0 => 'Non',
1 => 'Oui'
]); ?>
->dropDownList(Dropdown::numberChoices(50, 250, true, 'px', 50)); ?>
<?= $form->field($model, 'document_display_orders_invoice')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'document_display_orders_delivery_note')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'document_display_prices_delivery_note')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'document_display_product_description')->dropDownList(Dropdown::noYesChoices()); ?>
<?= $form->field($model, 'option_document_price_decimals')->dropDownList([
2 => '2',
3 => '3'
@@ -532,10 +449,7 @@ $this->addBreadcrumb($this->getTitle());
])
->hint("Sélectionnez le temps que vous estimez gagner chaque semaine en utilisant ce logiciel. Cette donnée sera utilisée sur la page <a href=\"".$urlAboutPage."\" target=\"_blanck\">À propos</a> du site.") ; ?>
<?= $form->field($model, 'option_display_message_new_opendistrib_version')
->dropDownList([
1 => 'Oui',
0 => 'Non'
], []); ?>
->dropDownList(Dropdown::noYesChoices()); ?>
</div>
</div>


+ 13
- 4
backend/views/user/_form.php Bestand weergeven

@@ -36,14 +36,19 @@
* termes.
*/

use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Producer\Producer\Module\ProducerModule;
use common\logic\User\User\Module\UserModule;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;

\backend\assets\VuejsUserFormAsset::register($this);

$userModule = $this->getUserModule();
$producerModule = $this->getProducerModule();
$userModule = UserModule::getInstance();
$producerModule = ProducerModule::getInstance();
$distributionModule = DistributionModule::getInstance();

?>

@@ -63,12 +68,16 @@ $producerModule = $this->getProducerModule();
<?= $form->field($model, 'name')->textInput() ?>
<?= $form->field($model, 'phone')->textInput() ?>
<?= $form->field($model, 'email')->textInput() ?>
<?= $form->field($model, 'newsletter')->checkbox() ?>
<?= $form->field($model, 'address')->textarea() ?>

<?php if ($producerModule->getConfig('option_export_evoliz')): ?>
<?php if ($producerModule->getSolver()->getConfig('option_export_evoliz')): ?>
<?= $form->field($model, 'evoliz_code')->textInput() ?>
<?php endif; ?>
<?= $form->field($model, 'newsletter')->checkbox() ?>

<?php if($distributionModule->getExportManager()->isEnabled(ExportManager::SHOPPING_CART_LABELS_PDF)): ?>
<?= $form->field($model, 'exclude_export_shopping_cart_labels')->checkbox(); ?>
<?php endif; ?>

<?php if($pointsSaleArray && count($pointsSaleArray) > 0): ?>
<?= $form->field($model, 'points_sale')->checkboxlist(

+ 35
- 0
common/helpers/Dropdown.php Bestand weergeven

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

namespace common\helpers;

class Dropdown
{
public static function noYesChoices(): array
{
return [
0 => 'Non',
1 => 'Oui'
];
}

public static function numberChoices(
int $start,
int $end,
bool $addNullValue = true,
string $appendToValues = '',
int $increment = 1
): array
{
$choicesArray = [];

if($addNullValue) {
$choicesArray[null] = '--';
}

for($i = $start; $i <= $end; $i += $increment) {
$choicesArray[$i] = $i.$appendToValues;
}

return $choicesArray;
}
}

+ 4
- 0
common/logic/Distribution/Distribution/Export/DistributionShoppingCartLabelsPdfGenerator.php Bestand weergeven

@@ -5,14 +5,17 @@ namespace common\logic\Distribution\Distribution\Export;
use common\logic\AbstractGenerator;
use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Order\Order\Repository\OrderRepository;
use common\logic\Producer\Producer\Service\ProducerSolver;
use kartik\mpdf\Pdf;

class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator implements DistributionExportGeneratorInterface
{
protected ProducerSolver $producerSolver;
protected OrderRepository $orderRepository;

public function loadDependencies(): void
{
$this->producerSolver = $this->loadService(ProducerSolver::class);
$this->orderRepository = $this->loadService(OrderRepository::class);
}

@@ -23,6 +26,7 @@ class DistributionShoppingCartLabelsPdfGenerator extends AbstractGenerator imple
$content = \Yii::$app->getView()->render('@backend/views/distribution/shopping-cart-labels.php', [
'distribution' => $distribution,
'ordersArray' => $ordersArray,
'shoppingCartLabelsPerColumn' => $this->producerSolver->getConfig('export_shopping_cart_labels_number_per_column') ?: 8
]);

$pdf = new Pdf([

+ 3
- 2
common/logic/PointSale/PointSale/Model/PointSale.php Bestand weergeven

@@ -80,7 +80,7 @@ class PointSale extends ActiveRecordCommon
[['point_production', 'credit', 'delivery_monday', 'delivery_tuesday',
'delivery_wednesday', 'delivery_thursday', 'delivery_friday',
'delivery_saturday', 'delivery_sunday', 'default', 'is_bread_box',
'button_generate_delivery_note_point_sale', 'button_generate_delivery_note_each_user'], 'boolean'],
'button_generate_delivery_note_point_sale', 'button_generate_delivery_note_each_user', 'exclude_export_shopping_cart_labels'], 'boolean'],
['point_production', 'default', 'value' => 0],
[['id_producer', 'id_user', 'maximum_number_orders', 'status'], 'integer'],
['id_producer', 'required'],
@@ -126,7 +126,8 @@ class PointSale extends ActiveRecordCommon
'bread_box_code' => 'Code boîte à pain',
'status' => 'Statut',
'button_generate_delivery_note_point_sale' => 'Activer le bouton de génération de bon de livraison par point de vente',
'button_generate_delivery_note_each_user' => 'Activer le bouton de génération de bon de livraison par client'
'button_generate_delivery_note_each_user' => 'Activer le bouton de génération de bon de livraison par client',
'exclude_export_shopping_cart_labels' => "Exclure de l'export d'étiquettes",
];
}


+ 3
- 1
common/logic/Producer/Producer/Model/Producer.php Bestand weergeven

@@ -166,6 +166,7 @@ class Producer extends ActiveRecordCommon
'dolibarr_product_id',
'option_weeks_distributions_activated_in_advance',
'option_document_height_logo',
'export_shopping_cart_labels_number_per_column'
],
'integer'
],
@@ -448,7 +449,8 @@ class Producer extends ActiveRecordCommon
'dolibarr_product_id' => 'Dolibarr : id produit',
'option_weeks_distributions_activated_in_advance' => "Semaines de distributions à activer à l'avance",
'option_invoice_only_based_on_delivery_notes' => 'Facturer uniquement sur la base des bons de livraison',
'option_document_height_logo' => 'Hauteur du logo dans les documents'
'option_document_height_logo' => 'Hauteur du logo dans les documents',
'export_shopping_cart_labels_number_per_column' => "Étiquettes (PDF) : nombre d'étiquettes par colonne",
];
}


+ 5
- 2
common/logic/User/User/Model/User.php Bestand weergeven

@@ -103,7 +103,9 @@ class User extends ActiveRecordCommon implements IdentityInterface
public function rules()
{
return [
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday', 'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday', 'mail_distribution_sunday', 'is_main_contact', 'newsletter'], 'boolean'],
[['no_mail', 'mail_distribution_monday', 'mail_distribution_tuesday', 'mail_distribution_wednesday',
'mail_distribution_thursday', 'mail_distribution_friday', 'mail_distribution_saturday',
'mail_distribution_sunday', 'is_main_contact', 'newsletter', 'exclude_export_shopping_cart_labels'], 'boolean'],
[['lastname', 'name', 'phone', 'address', 'type', 'name_legal_person', 'evoliz_code'], 'string'],
['lastname', 'verifyOneName', 'skipOnError' => false, 'skipOnEmpty' => false],
['email', 'email', 'message' => 'Cette adresse email n\'est pas valide'],
@@ -146,7 +148,8 @@ class User extends ActiveRecordCommon implements IdentityInterface
'product_price_percent' => 'Prix produits : pourcentage',
'user_groups' => "Groupes d'utilisateurs",
'evoliz_code' => 'Code client Evoliz',
'newsletter' => "Inscrit au bulletin d'information"
'newsletter' => "Inscrit au bulletin d'information",
'exclude_export_shopping_cart_labels' => "Exclure de l'export d'étiquettes",
];
}


+ 30
- 0
console/migrations/m231025_064432_add_columns_shopping_cart_labels.php Bestand weergeven

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

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

/**
* Class m231025_064432_add_columns_shopping_cart_labels
*/
class m231025_064432_add_columns_shopping_cart_labels extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('point_sale','exclude_export_shopping_cart_labels', Schema::TYPE_BOOLEAN);
$this->addColumn('user','exclude_export_shopping_cart_labels', Schema::TYPE_BOOLEAN);
$this->addColumn('producer','export_shopping_cart_labels_number_per_column', Schema::TYPE_INTEGER);
}

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

Laden…
Annuleren
Opslaan