Переглянути джерело

[Administration] Ergonomie formulaires produit, point de vente, abonnement et utilisateur

feature/souke
Guillaume Bourgeois 10 місяці тому
джерело
коміт
611ed8903f
16 змінених файлів з 635 додано та 223 видалено
  1. +1
    -1
      backend/views/layouts/left.php
  2. +171
    -63
      backend/views/point-sale/_form.php
  3. +15
    -5
      backend/views/product-category/_form.php
  4. +112
    -76
      backend/views/product/_form.php
  5. +0
    -1
      backend/views/product/index.php
  6. +1
    -1
      backend/views/product/update/_nav.php
  7. +29
    -22
      backend/views/product/update/prices/_form.php
  8. +6
    -12
      backend/views/product/update/prices/list.php
  9. +145
    -17
      backend/web/css/screen.css
  10. +26
    -3
      backend/web/js/backend.js
  11. +62
    -0
      backend/web/sass/point_sale/_form.scss
  12. +50
    -7
      backend/web/sass/product/_form.scss
  13. +2
    -1
      backend/web/sass/screen.scss
  14. +3
    -3
      common/logic/PointSale/PointSale/Model/PointSale.php
  15. +9
    -9
      common/logic/Product/Product/Model/Product.php
  16. +3
    -2
      common/logic/User/User/Service/UserSolver.php

+ 1
- 1
backend/views/layouts/left.php Переглянути файл

@@ -102,7 +102,7 @@ $isUserCurrentGrantedAsProducer = $userModule->getAuthorizationChecker()->isGran
'icon' => 'clone',
'url' => ['/product/index'],
'visible' => $isUserCurrentGrantedAsProducer,
'active' => Yii::$app->controller->id == 'product',
'active' => Yii::$app->controller->id == 'product' || Yii::$app->controller->id == 'product-category',
'items' => [
['label' => 'Liste', 'icon' => 'th-list', 'url' => ['/product/index'], 'visible' => $isUserCurrentGrantedAsProducer],
['label' => 'Catégories', 'icon' => 'book', 'url' => ['/product-category/index'], 'visible' => $isUserCurrentGrantedAsProducer],

+ 171
- 63
backend/views/point-sale/_form.php Переглянути файл

@@ -39,6 +39,7 @@
use common\logic\Distribution\Distribution\Module\DistributionModule;
use common\logic\Distribution\Distribution\Service\ExportManager;
use common\logic\Producer\Producer\Module\ProducerModule;
use lo\widgets\Toggle;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
@@ -53,76 +54,164 @@ $distributionModule = DistributionModule::getInstance();

<div class="point-sale-form">

<?php $form = ActiveForm::begin(); ?>
<?php $form = ActiveForm::begin([
'enableClientValidation' => false
]); ?>

<div class="col-md-8">
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'locality')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'address')->textarea(['rows' => 6]) ?>
<?= $form->field($model, 'id_user', [
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
])
->dropDownList($userModule->populateUserDropdownList(), ['class' => 'select2'])
->hint('Utilisé lors de la facturation'); ?>
<?php
$addHintCredit = '';
if (!$producerModule->getConfig('credit')):
$addHintCredit = '<br /><strong>Attention, le système de Crédit est désactivé au niveau des ' . Html::a('paramètres globaux', ['producer/update']) . '.</strong>';
endif;

echo $form->field($model, 'credit')
->checkbox()
->hint('Cochez cette case si le client peut régler ses commandes via son compte <strong>Crédit</strong> pour ce point de vente.'
. $addHintCredit);
?>

<?= $form->field($model, 'credit_functioning')
->dropDownList([
'' => 'Paramètres globaux (' . Producer::$creditFunctioningArray[$producerModule->getConfig('credit_functioning')] . ')',
Producer::CREDIT_FUNCTIONING_OPTIONAL => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_OPTIONAL],
Producer::CREDIT_FUNCTIONING_MANDATORY => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_MANDATORY],
Producer::CREDIT_FUNCTIONING_USER => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_USER],
], [])->hint(Producer::HINT_CREDIT_FUNCTIONING); ?>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-th-list"></i>
Général
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'locality')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'address')->textarea(['rows' => 4]) ?>
<?= $form->field($model, 'minimum_order_amount')->textInput() ?>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span class="glyphicon glyphicon-piggy-bank"></span>
Crédit
</h3>
</div>
<div class="panel-body">
<div id="credit">
<?php
$addHintCredit = '';
if (!$producerModule->getConfig('credit')):
$addHintCredit = '<br /><strong>Attention, le système de Crédit est désactivé au niveau des ' . Html::a('paramètres globaux', ['producer/update']) . '.</strong>';
endif;

echo $form->field($model, 'credit')->widget(Toggle::class,
[
'options' => [
'data-id' => $model->id,
'data-on' => 'Oui',
'data-off' => 'Non',
],
]
)->hint('Activez cette option si vous souhaitez que vos clients puissent régler leurs commandes via leur compte <strong>Crédit</strong> pour ce point de vente.'
. $addHintCredit); ?>

<?= $form->field($model, 'credit_functioning')
->dropDownList([
'' => 'Paramètres globaux (' . Producer::$creditFunctioningArray[$producerModule->getConfig('credit_functioning')] . ')',
Producer::CREDIT_FUNCTIONING_OPTIONAL => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_OPTIONAL],
Producer::CREDIT_FUNCTIONING_MANDATORY => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_MANDATORY],
Producer::CREDIT_FUNCTIONING_USER => Producer::$creditFunctioningArray[Producer::CREDIT_FUNCTIONING_USER],
], [])->hint(Producer::HINT_CREDIT_FUNCTIONING); ?>
</div>
</div>
</div>


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

<?= $form->field($model, 'maximum_number_orders')->textInput() ?>
<?= $form->field($model, 'minimum_order_amount')->textInput() ?>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-truck"></i>
Livraison à domicile
</h3>
</div>
<div class="panel-body">
<div id="home-delivery">
<?= $form->field($model, 'is_home_delivery')->widget(Toggle::class,
[
'options' => [
'data-id' => $model->id,
'data-on' => 'Oui',
'data-off' => 'Non',
],
]
); ?>
</div>
</div>
</div>

<div id="delivery-days">
<h2>Jours de livraison</h2>
<?= $form->field($model, 'delivery_monday')->checkbox() ?>
<?= $form->field($model, 'delivery_tuesday')->checkbox() ?>
<?= $form->field($model, 'delivery_wednesday')->checkbox() ?>
<?= $form->field($model, 'delivery_thursday')->checkbox() ?>
<?= $form->field($model, 'delivery_friday')->checkbox() ?>
<?= $form->field($model, 'delivery_saturday')->checkbox() ?>
<?= $form->field($model, 'delivery_sunday')->checkbox() ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-th-large"></i>
Boîte à pain
</h3>
</div>
<div class="panel-body">
<div id="bread-box">
<?= $form->field($model, 'is_bread_box')->widget(Toggle::class,
[
'options' => [
'data-id' => $model->id,
'data-on' => 'Oui',
'data-off' => 'Non',
],
]
); ?>
<?= $form->field($model, 'bread_box_code')->textInput() ?>
<?= $form->field($model, 'maximum_number_orders')->textInput() ?>
</div>
</div>
</div>
<div class="clr"></div>

<h2>Informations</h2>
<?= $form->field($model, 'infos_monday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_tuesday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_wednesday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_thursday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_friday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_saturday')->textarea(['rows' => 3]) ?>
<?= $form->field($model, 'infos_sunday')->textarea(['rows' => 3]) ?>

<h2>Livraison à domicile</h2>
<?= $form->field($model, 'is_home_delivery')->checkbox() ?>

<h2>Boîte à pain</h2>
<?= $form->field($model, 'is_bread_box')->checkbox() ?>
<?= $form->field($model, 'bread_box_code')->textInput() ?>
</div>

<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Accès</h3>
<h3 class="panel-title">
<i class="fa fa-calendar"></i>
Jours de distributions
</h3>
</div>
<div class="panel-body">
<div id="days-distribution">
<?php $optionsTextareaInfos = ['rows' => 2, 'placeholder' => 'Informations'] ?>
<div class="day">
<?= $form->field($model, 'delivery_monday')->checkbox() ?>
<?= $form->field($model, 'infos_monday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_tuesday')->checkbox() ?>
<?= $form->field($model, 'infos_tuesday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_wednesday')->checkbox() ?>
<?= $form->field($model, 'infos_wednesday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_thursday')->checkbox() ?>
<?= $form->field($model, 'infos_thursday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_friday')->checkbox() ?>
<?= $form->field($model, 'infos_friday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_saturday')->checkbox() ?>
<?= $form->field($model, 'infos_saturday')->textarea($optionsTextareaInfos) ?>
</div>
<div class="day">
<?= $form->field($model, 'delivery_sunday')->checkbox() ?>
<?= $form->field($model, 'infos_sunday')->textarea($optionsTextareaInfos) ?>
</div>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-lock"></i>
Accès
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'code')
@@ -152,11 +241,32 @@ $distributionModule = DistributionModule::getInstance();

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Génération des bons de livraison</h3>
<h3 class="panel-title">
<i class="fa fa-sticky-note-o"></i>
Facturation
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'id_user', [
'template' => '{label} <a href="' . Yii::$app->urlManager->createUrl(['user/create']) . '" class="btn btn-xs btn-default">Nouvel utilisateur <span class="glyphicon glyphicon-plus"></span></a><div>{input}</div>{hint}',
])
->dropDownList($userModule->populateUserDropdownList(), ['class' => 'select2'])
->hint('Utilisateur au nom duquel les factures de ce point de vente seront éditées'); ?>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-sticky-note-o"></i>
Génération des bons de livraison
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'button_generate_delivery_note_point_sale')->checkbox() ?>
<?= $form->field($model, 'button_generate_delivery_note_each_user')->checkbox() ?>
<div id="delivery-note-generation">
<?= $form->field($model, 'button_generate_delivery_note_point_sale')->checkbox() ?>
<?= $form->field($model, 'button_generate_delivery_note_each_user')->checkbox() ?>
</div>
</div>
</div>

@@ -177,7 +287,5 @@ $distributionModule = DistributionModule::getInstance();
<?= Html::a('Retour', ['point-sale/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Créer' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div>

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

</div>

+ 15
- 5
backend/views/product-category/_form.php Переглянути файл

@@ -45,13 +45,23 @@ use yii\widgets\ActiveForm;

<?php $form = ActiveForm::begin(); ?>
<div class="col-md-8">
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-th-list"></i>
Général
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
</div>
</div>

</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', ['product-category/index'], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div>

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

</div>

+ 112
- 76
backend/views/product/_form.php Переглянути файл

@@ -1,6 +1,7 @@
<?php

use common\helpers\Image;
use lo\widgets\Toggle;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use yii\helpers\ArrayHelper;
@@ -8,6 +9,7 @@ use common\helpers\GlobalParam;
use common\logic\Product\Product\Model\Product;
use common\logic\PointSale\PointSale\Model\PointSale;

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

@@ -22,7 +24,6 @@ $taxRateModule = $this->getTaxRateModule();

<div>
<div class="col-md-8">

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
@@ -31,42 +32,67 @@ $taxRateModule = $this->getTaxRateModule();
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'status')->radioList([1 => 'Oui', 0 => 'Non']) ?>
<?= $form->field($model, 'status')->widget(Toggle::class,
[
'options' => [
'data-id' => $model->id,
'data-on' => 'Oui',
'data-off' => 'Non',
],
]
); ?>

<?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?>
<?= $form->field($model, 'reference')->textInput(['maxlength' => 255]) ?>
<?php if($producerModule->getSolver()->getConfig('option_export_display_product_reference')): ?>
<?= $form->field($model, 'reference')->textInput(['maxlength' => 255]) ?>
<?php endif; ?>
<?= $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)'); ?>
<?= $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>
</div>

<?php
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-euro"></i> Prix

//Récupère la tva par défaut du producteur courant
$producer = \common\helpers\GlobalParam::getCurrentProducer();
$taxRateDefault = $producer->taxRate;
<a href="<?= Yii::$app->urlManager->createUrl(['product/prices-list', 'id' => $model->id]) ?>"
class="btn btn-default btn-xs">
Prix spécifiques (<?= count($model->productPrice) ?>)
</a>
</h3>
</div>
<div class="panel-body">
<?php

$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);
}
//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; ?>
<?php if ($taxRateDefault->value != 0): ?>
<?= $form->field($model, 'id_tax_rate')->dropDownList($taxRateNamesArray, ['options' => $taxRateValuesArrayFormatted])->label('Taxe'); ?>
<?php endif; ?>

<?= $form->field($model, 'price', [
'template' => '
<?= $form->field($model, 'price', [
'template' => '
<div class="row">
<div class="col-xs-6">
<label for="product-price" class="control-label without-tax"></label>
@@ -82,46 +108,26 @@ $taxRateModule = $this->getTaxRateModule();
</div>
</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>
<div class="col-md-3">
<?= $form->field($model, 'quantity_max_sunday')->textInput() ?>

<?php if (!$model->isNewRecord): ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-edit"></i>
Distributions à venir
</h3>
</div>
<div class="panel-body">
<?= $form->field($model, 'apply_distributions')
->checkbox()
->hint('Sélectionnez cette option si vous souhaitez que ces modifications (actif / non actif, quantités maximum) soient répercutées dans les distributions à venir.'); ?>
</div>
</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.');
}
?>
<?php endif; ?>
</div>
<div class="col-md-4">
<div class="panel panel-default">
@@ -163,24 +169,54 @@ $taxRateModule = $this->getTaxRateModule();
</div>
</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 class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-balance-scale"></i>
Quantités maximum par distribution
</h3>
</div>
<div class="panel-body">
<div id="maximum-quantities">
<?= $form->field($model, 'quantity_max')->textInput() ?>
<?= $form->field($model, 'quantity_max_monday')->textInput() ?>
<?= $form->field($model, 'quantity_max_tuesday')->textInput() ?>
<?= $form->field($model, 'quantity_max_wednesday')->textInput() ?>
<?= $form->field($model, 'quantity_max_thursday')->textInput() ?>
<?= $form->field($model, 'quantity_max_friday')->textInput() ?>
<?= $form->field($model, 'quantity_max_saturday')->textInput() ?>
<?= $form->field($model, 'quantity_max_sunday')->textInput() ?>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-map-marker"></i>
Disponibilité par point de vente
</h3>
</div>
<div class="panel-body">
<div id="availability-points-sale">
<?= $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>
<div class="clr"></div>
</div>

+ 0
- 1
backend/views/product/index.php Переглянути файл

@@ -130,7 +130,6 @@ $this->addButton(['label' => 'Nouveau produit <span class="glyphicon glyphicon-p
if ($model->price) {
$return = Price::format($productModule->getPriceWithTax($model)) . ' (' . $productModule->getSolver()->strUnit($model, 'wording_unit', true) . ')';
}

return $return;
}
],

+ 1
- 1
backend/views/product/update/_nav.php Переглянути файл

@@ -6,7 +6,7 @@
'model' => $model,
]); ?>
<?= $this->render('_nav_item', [
'title' => 'Prix spécifiques',
'title' => 'Prix spécifiques ('.count($model->productPrice).')',
'action' => 'prices-list',
'currentAction' => $action,
'model' => $model,

+ 29
- 22
backend/views/product/update/prices/_form.php Переглянути файл

@@ -15,33 +15,38 @@ $productModule = ProductModule::getInstance();
?>

<div class="product-form">

<?=
$this->render('_base_price', [
'model' => $modelProduct,
]) ;
?>

<?php $form = ActiveForm::begin([
'enableClientValidation' => false,
'options' => ['enctype' => 'multipart/form-data']
]); ?>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<i class="fa fa-euro"></i>
<?= $model->isNewRecord ? 'Ajouter un prix' : 'Modifier un prix'; ?>
</h3>
</div>
<div class="panel-body">

<?= $form->field($model, 'id_user')->dropDownList($userModule->populateUserDropdownList()); ?>
<?= $form->field($model, 'id_user_group')->dropDownList($userGroupModule->populateUserGroupDropdownList()); ?>
<?= $form->field($model, 'id_point_sale')->dropDownList($pointSaleModule->populatePointSaleDropdownList()); ?>
<?= $form->field($model, 'from_quantity')->label('À partir de la quantité ('. $productModule->getSolver()->strUnit($modelProduct, 'wording', true).')'); ?>
<?= $this->render('_base_price', [
'model' => $modelProduct,
]) ; ?>

<?= $form->field($model, 'id_user')->dropDownList($userModule->populateUserDropdownList()); ?>
<?= $form->field($model, 'id_user_group')->dropDownList($userGroupModule->populateUserGroupDropdownList()); ?>
<?= $form->field($model, 'id_point_sale')->dropDownList($pointSaleModule->populatePointSaleDropdownList()); ?>
<?= $form->field($model, 'from_quantity')->label('À partir de la quantité ('. $productModule->getSolver()->strUnit($modelProduct, 'wording', true).')'); ?>

<?php
$producer = GlobalParam::getCurrentProducer();
$taxRateValue = $producer->taxRate->value;
if($modelProduct->taxRate) {
<?php
$producer = GlobalParam::getCurrentProducer();
$taxRateValue = $producer->taxRate->value;
if($modelProduct->taxRate) {
$taxRateValue = $modelProduct->taxRate->value ;
}
?>
}
?>

<?= $form->field($model, 'price', [
'template' => '
<?= $form->field($model, 'price', [
'template' => '
<div class="row">
<div class="col-xs-4">
<label for="reduction-increase-percent" class="control-label">Réduction / augmentation</label>
@@ -64,10 +69,12 @@ $productModule = ProductModule::getInstance();
</div>
</div>
</div>',
]) ?>
]) ?>
</div>
</div>

<div class="form-group">
<?= Html::a('Annuler', ['prices-list', 'id' => $model->id_product], ['class' => 'btn btn-default']) ?>
<div class="form-group form-actions">
<?= Html::a('Retour', ['prices-list', 'id' => $model->id_product], ['class' => 'btn btn-default']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Ajouter' : 'Modifier', ['class' => 'btn btn-primary']) ?>
</div>


+ 6
- 12
backend/views/product/update/prices/list.php Переглянути файл

@@ -64,7 +64,8 @@ $this->render('../_nav', [
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Prix spécifiques à ce produit
<i class="fa fa-th-list"></i>
Liste des prix
<a href="<?= Yii::$app->urlManager->createUrl(['product/prices-create', 'idProduct' => $model->id]) ?>"
class="btn btn-default btn-xs">
Nouveau prix
@@ -73,8 +74,11 @@ $this->render('../_nav', [
</h3>
</div>
<div class="panel-body">
<?php
<?= $this->render('_base_price', [
'model' => $model,
]) ; ?>

<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
@@ -151,17 +155,7 @@ $this->render('../_nav', [
],
],
]);

?>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">Rappel du prix de base</h3>
</div>
<div class="panel-body">
<p>Prix de base : <strong><?= Price::format($productModule->getPrice($model)); ?> HT</strong> /
<strong><?= Price::format($productModule->getPriceWithTax($model)); ?> TTC</strong><br/></p>
</div>
</div>
</div>

+ 145
- 17
backend/web/css/screen.css Переглянути файл

@@ -2005,48 +2005,95 @@ body.login-page .login-box .login-box-body a:hover {
}

/* line 6, ../sass/product/_form.scss */
.product-create .field-product-status label,
.product-update .field-product-status label {
display: block;
}
/* line 12, ../sass/product/_form.scss */
.product-create #product-active label,
.product-update #product-active label {
margin-right: 15px;
}
/* line 10, ../sass/product/_form.scss */
/* line 18, ../sass/product/_form.scss */
.product-create .field-product-photofile label,
.product-update .field-product-photofile label {
display: none;
}
/* line 24, ../sass/product/_form.scss */
.product-create #maximum-quantities label, .product-create #maximum-quantities .form-control,
.product-update #maximum-quantities label,
.product-update #maximum-quantities .form-control {
width: 49%;
height: 35px;
margin-bottom: 5px;
}
/* line 29, ../sass/product/_form.scss */
.product-create #maximum-quantities label,
.product-update #maximum-quantities label {
float: left;
line-height: 35px;
}
/* line 33, ../sass/product/_form.scss */
.product-create #maximum-quantities .form-control,
.product-update #maximum-quantities .form-control {
float: right;
}
/* line 38, ../sass/product/_form.scss */
.product-create #days-production,
.product-create #availability-points-sale,
.product-update #days-production,
.product-update #availability-points-sale {
margin-top: 30px;
}
/* line 14, ../sass/product/_form.scss */
.product-create #days-production h2,
.product-create #availability-points-sale h2,
.product-update #days-production h2,
.product-update #availability-points-sale h2 {
font-size: 20px;
.product-update #days-production {
padding-left: 3px;
}
/* line 20, ../sass/product/_form.scss */
/* line 41, ../sass/product/_form.scss */
.product-create #days-production .form-group,
.product-update #days-production .form-group {
margin-bottom: 7px;
}
/* line 45, ../sass/product/_form.scss */
.product-create #days-production label,
.product-update #days-production label {
font-weight: normal;
}
/* line 26, ../sass/product/_form.scss */
/* line 48, ../sass/product/_form.scss */
.product-create #days-production label input,
.product-update #days-production label input {
position: relative;
top: 1px;
left: -3px;
}
/* line 55, ../sass/product/_form.scss */
.product-create #days-production .checkbox,
.product-update #days-production .checkbox {
margin-top: 0px;
}
/* line 59, ../sass/product/_form.scss */
.product-create #days-production .field-product-sunday,
.product-update #days-production .field-product-sunday {
margin-bottom: 0px;
}
/* line 62, ../sass/product/_form.scss */
.product-create #days-production .field-product-sunday .checkbox,
.product-update #days-production .field-product-sunday .checkbox {
margin-bottom: 0px;
}
/* line 69, ../sass/product/_form.scss */
.product-create #availability-points-sale #label-availability-points-sale,
.product-update #availability-points-sale #label-availability-points-sale {
display: block;
margin-bottom: 6px;
}
/* line 30, ../sass/product/_form.scss */
/* line 73, ../sass/product/_form.scss */
.product-create #availability-points-sale #label-availability-points-sale span,
.product-update #availability-points-sale #label-availability-points-sale span {
border-bottom: dotted 1px black;
}
/* line 36, ../sass/product/_form.scss */
/* line 79, ../sass/product/_form.scss */
.product-create #availability-points-sale .field-product-available_on_points_sale label.control-label,
.product-update #availability-points-sale .field-product-available_on_points_sale label.control-label {
margin-bottom: 0px;
position: relative;
top: 3px;
}
/* line 44, ../sass/product/_form.scss */
/* line 87, ../sass/product/_form.scss */
.product-create #availability-points-sale #product-pointssale label,
.product-update #availability-points-sale #product-pointssale label {
display: block;
@@ -2553,6 +2600,87 @@ termes.
text-align: center;
}

/* line 6, ../sass/point_sale/_form.scss */
.point-sale-create #credit .field-pointsale-credit label,
.point-sale-update #credit .field-pointsale-credit label {
display: block;
}
/* line 13, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .form-group,
.point-sale-update #days-distribution .form-group {
margin-bottom: 0px;
}
/* line 15, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .form-group label,
.point-sale-update #days-distribution .form-group label {
font-weight: normal;
}
/* line 18, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .form-group.has-success label,
.point-sale-update #days-distribution .form-group.has-success label {
color: #333;
}
/* line 21, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .form-group .help-block,
.point-sale-update #days-distribution .form-group .help-block {
display: none;
}
/* line 26, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .field-pointsale-infos_monday,
.point-sale-create #days-distribution .field-pointsale-infos_tuesday,
.point-sale-create #days-distribution .field-pointsale-infos_wednesday,
.point-sale-create #days-distribution .field-pointsale-infos_thursday,
.point-sale-create #days-distribution .field-pointsale-infos_friday,
.point-sale-create #days-distribution .field-pointsale-infos_saturday,
.point-sale-create #days-distribution .field-pointsale-infos_sunday,
.point-sale-update #days-distribution .field-pointsale-infos_monday,
.point-sale-update #days-distribution .field-pointsale-infos_tuesday,
.point-sale-update #days-distribution .field-pointsale-infos_wednesday,
.point-sale-update #days-distribution .field-pointsale-infos_thursday,
.point-sale-update #days-distribution .field-pointsale-infos_friday,
.point-sale-update #days-distribution .field-pointsale-infos_saturday,
.point-sale-update #days-distribution .field-pointsale-infos_sunday {
margin-bottom: 10px;
}
/* line 34, ../sass/point_sale/_form.scss */
.point-sale-create #days-distribution .field-pointsale-infos_monday label,
.point-sale-create #days-distribution .field-pointsale-infos_tuesday label,
.point-sale-create #days-distribution .field-pointsale-infos_wednesday label,
.point-sale-create #days-distribution .field-pointsale-infos_thursday label,
.point-sale-create #days-distribution .field-pointsale-infos_friday label,
.point-sale-create #days-distribution .field-pointsale-infos_saturday label,
.point-sale-create #days-distribution .field-pointsale-infos_sunday label,
.point-sale-update #days-distribution .field-pointsale-infos_monday label,
.point-sale-update #days-distribution .field-pointsale-infos_tuesday label,
.point-sale-update #days-distribution .field-pointsale-infos_wednesday label,
.point-sale-update #days-distribution .field-pointsale-infos_thursday label,
.point-sale-update #days-distribution .field-pointsale-infos_friday label,
.point-sale-update #days-distribution .field-pointsale-infos_saturday label,
.point-sale-update #days-distribution .field-pointsale-infos_sunday label {
display: none;
}
/* line 41, ../sass/point_sale/_form.scss */
.point-sale-create #delivery-note-generation .form-group,
.point-sale-update #delivery-note-generation .form-group {
margin-bottom: 0px;
}
/* line 44, ../sass/point_sale/_form.scss */
.point-sale-create #delivery-note-generation .form-group label,
.point-sale-update #delivery-note-generation .form-group label {
margin-bottom: 0px;
font-weight: normal;
}
/* line 52, ../sass/point_sale/_form.scss */
.point-sale-create #home-delivery .field-pointsale-is_home_delivery label,
.point-sale-update #home-delivery .field-pointsale-is_home_delivery label {
display: block;
}
/* line 58, ../sass/point_sale/_form.scss */
.point-sale-create #bread-box .field-pointsale-is_bread_box label,
.point-sale-update #bread-box .field-pointsale-is_bread_box label {
display: block;
}

/**
Copyright distrib (2018)


+ 26
- 3
backend/web/js/backend.js Переглянути файл

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

var UrlManager = {
@@ -67,6 +68,28 @@ var UrlManager = {
}
};

function opendistrib_point_sale_form() {
if($('.point-sale-form').length) {
opendistrib_point_sale_form_days_distribution_event();
$('#days-distribution .day input[type=checkbox]').change(function() {
opendistrib_point_sale_form_days_distribution_event();
});
}
}

function opendistrib_point_sale_form_days_distribution_event() {
$('#days-distribution .day').each(function() {
var isChecked = $(this).find('input[type=checkbox]').prop('checked');
var $textareaInfos = $(this).find('textarea');
if(isChecked) {
$textareaInfos.show();
}
else {
$textareaInfos.hide();
}
});
}

function opendistrib_user_form() {
if($('#app-user-form').length) {
var $fieldUserEmail = $('#app-user-form .field-user-email input');
@@ -270,16 +293,16 @@ function opendistrib_products_event_unit(change) {
if (unit == 'piece') {
label_price_ttc.html('Prix (la pièce) TTC');
label_price_ht.html('Prix (la pièce) HT');
label_quantity_max.html('Quantité max par défaut (pièces)');
label_quantity_max.html('Par défaut (pièces)');
} else if (unit == 'g' || unit == 'kg') {
label_price_ttc.html('Prix (au kg) TTC');
label_price_ht.html('Prix (au kg) HT');
label_quantity_max.html('Quantité max par défaut (kg)');
label_quantity_max.html('Par défaut (kg)');
label_step.html('Pas (' + unit + ')');
} else if (unit == 'mL' || unit == 'L') {
label_price_ttc.html('Prix (au litre) TTC');
label_price_ht.html('Prix (au litre) HT');
label_quantity_max.html('Quantité max par défaut (litres)');
label_quantity_max.html('Par défaut (litres)');
label_step.html('Pas (' + unit + ')');
}


+ 62
- 0
backend/web/sass/point_sale/_form.scss Переглянути файл

@@ -0,0 +1,62 @@

.point-sale-create,
.point-sale-update {
#credit {
.field-pointsale-credit {
label {
display: block;
}
}
}

#days-distribution {
.form-group {
margin-bottom: 0px;
label {
font-weight: normal;
}
&.has-success label {
color: #333;
}
.help-block {
display: none;
}
}

.field-pointsale-infos_monday,
.field-pointsale-infos_tuesday,
.field-pointsale-infos_wednesday,
.field-pointsale-infos_thursday,
.field-pointsale-infos_friday,
.field-pointsale-infos_saturday,
.field-pointsale-infos_sunday {
margin-bottom: 10px;
label {
display: none;
}
}
}

#delivery-note-generation {
.form-group {
margin-bottom: 0px;

label {
margin-bottom: 0px;
font-weight: normal;
}
}
}

#home-delivery {
.field-pointsale-is_home_delivery label {
display: block;
}
}

#bread-box {
.field-pointsale-is_bread_box label {
display: block;
}
}
}

+ 50
- 7
backend/web/sass/product/_form.scss Переглянути файл

@@ -1,24 +1,67 @@

.product-create,
.product-update {

.field-product-status {
label {
display: block;
}
}

#product-active {
label {
margin-right: 15px ;
}
}
#days-production,
#availability-points-sale {
margin-top: 30px ;
h2 {
font-size: 20px ;

.field-product-photofile {
label {
display: none;
}
}

#maximum-quantities {
label, .form-control {
width: 49%;
height: 35px;
margin-bottom: 5px;
}
label {
float: left;
line-height: 35px;
}
.form-control {
float: right;
}
}

#days-production {
padding-left: 3px;

.form-group {
margin-bottom: 7px;
}

label {
font-weight: normal ;

input {
position: relative;
top: 1px;
left: -3px;
}
}

.checkbox {
margin-top: 0px;
}

.field-product-sunday {
margin-bottom: 0px;

.checkbox {
margin-bottom: 0px;
}
}
}


+ 2
- 1
backend/web/sass/screen.scss Переглянути файл

@@ -1526,7 +1526,8 @@ a.btn, button.btn {
@import "user/_credit.scss" ;
@import "user/_form.scss" ;
@import "producer/_update.scss" ;
@import "point_sale/_index.scss" ;
@import "point_sale/_index.scss" ;
@import "point_sale/_form.scss" ;
@import "report/_index.scss" ;
@import "document/_form.scss" ;
@import "document/_index.scss" ;

+ 3
- 3
common/logic/PointSale/PointSale/Model/PointSale.php Переглянути файл

@@ -122,12 +122,12 @@ class PointSale extends ActiveRecordCommon
'default' => 'Point de vente par défaut',
'id_user' => 'Contact facturation',
'product_price_percent' => 'Prix produits : pourcentage',
'maximum_number_orders' => 'Nombre maximum de commandes',
'maximum_number_orders' => 'Nombre maximum de commandes par distribution',
'is_bread_box' => 'Boîte à pain',
'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_point_sale' => 'Par point de vente',
'button_generate_delivery_note_each_user' => 'Par client',
'exclude_export_shopping_cart_labels' => "Exclure de l'export d'étiquettes",
'is_home_delivery' => "Livraison à domicile",
'minimum_order_amount' => "Montant minimum de commande (€)"

+ 9
- 9
common/logic/Product/Product/Model/Product.php Переглянути файл

@@ -161,16 +161,16 @@ class Product extends ActiveRecordCommon implements StatusInterface
'saturday' => 'Samedi',
'sunday' => 'Dimanche',
'order' => 'Ordre',
'quantity_max' => 'Quantité max par défaut',
'quantity_max_monday' => 'Quantité max : lundi',
'quantity_max_tuesday' => 'Quantité max : mardi',
'quantity_max_wednesday' => 'Quantité max : mercredi',
'quantity_max_thursday' => 'Quantité max : jeudi',
'quantity_max_friday' => 'Quantité max : vendredi',
'quantity_max_saturday' => 'Quantité max : samedi',
'quantity_max_sunday' => 'Quantité max : dimanche',
'quantity_max' => 'Par défaut',
'quantity_max_monday' => 'Lundi',
'quantity_max_tuesday' => 'Mardi',
'quantity_max_wednesday' => 'Mercredi',
'quantity_max_thursday' => 'Jeudi',
'quantity_max_friday' => 'Vendredi',
'quantity_max_saturday' => 'Samedi',
'quantity_max_sunday' => 'Dimanche',
'unavailable' => 'Épuisé',
'apply_distributions' => 'Appliquer ces modifications dans les distributions futures',
'apply_distributions' => 'Appliquer ces modifications dans les distributions à venir',
'unit' => 'Unité',
'step' => 'Pas',
'id_tax_rate' => 'TVA',

+ 3
- 2
common/logic/User/User/Service/UserSolver.php Переглянути файл

@@ -100,12 +100,13 @@ class UserSolver extends AbstractService implements SolverInterface

public function getUsernameFromArray(array $modelArray, $withType = false): string
{
$username = '';
$username = 'Nom indéfini';
if ($modelArray['type'] == User::TYPE_LEGAL_PERSON
&& isset($modelArray['name_legal_person'])
&& strlen($modelArray['name_legal_person'])) {
$username = $modelArray['name_legal_person'];
} else {
} elseif((isset($modelArray['lastname']) && $modelArray['lastname'])
|| (isset($modelArray['name']) && $modelArray['name'])) {
$username = $modelArray['lastname'] . ' ' . $modelArray['name'];
}


Завантаження…
Відмінити
Зберегти