Ver código fonte

[Administration et boutique] Points de vente : minimum de commande #1345

feature/souke
Guillaume Bourgeois 1 ano atrás
pai
commit
80362ed31d
10 arquivos alterados com 88 adições e 42 exclusões
  1. +2
    -0
      backend/views/point-sale/_form.php
  2. +3
    -1
      common/logic/Feature/Feature/Model/Feature.php
  3. +3
    -2
      common/logic/PointSale/PointSale/Model/PointSale.php
  4. +26
    -0
      console/migrations/m231113_084553_add_column_point_sale_minimum_order_amount.php
  5. +0
    -1
      producer/controllers/OrderController.php
  6. +3
    -0
      producer/views/order/order.php
  7. +35
    -33
      producer/web/css/screen.css
  8. +3
    -3
      producer/web/js/producer.js
  9. +11
    -1
      producer/web/js/vuejs/order-order.js
  10. +2
    -1
      producer/web/sass/order/_order.scss

+ 2
- 0
backend/views/point-sale/_form.php Ver arquivo

@@ -88,6 +88,8 @@ $distributionModule = DistributionModule::getInstance();
->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 id="delivery-days">
<h2>Jours de livraison</h2>

+ 3
- 1
common/logic/Feature/Feature/Model/Feature.php Ver arquivo

@@ -65,6 +65,7 @@ class Feature extends ActiveRecordCommon
return [
[['alias', 'name'], 'required'],
[['status', 'is_paid_feature', 'only_for_selected_producers'], 'boolean'],
[['position'], 'integer'],
[['price'], 'double'],
[['alias', 'name', 'description'], 'string'],
];
@@ -83,7 +84,8 @@ class Feature extends ActiveRecordCommon
'status' => 'Statut',
'is_paid_feature' => "Fonctionnalité payante",
'price' => 'Prix',
'only_for_selected_producers' => 'Uniquement pour les producteurs sélectionnés'
'only_for_selected_producers' => 'Uniquement pour les producteurs sélectionnés',
'position' => 'Position'
];
}


+ 3
- 2
common/logic/PointSale/PointSale/Model/PointSale.php Ver arquivo

@@ -86,7 +86,7 @@ class PointSale extends ActiveRecordCommon
[['id_producer', 'id_user', 'maximum_number_orders', 'status'], 'integer'],
['id_producer', 'required'],
[['users', 'users_comment', 'code'], 'safe'],
[['product_price_percent'], 'double'],
[['product_price_percent', 'minimum_order_amount'], 'double'],
];
}

@@ -129,7 +129,8 @@ class PointSale extends ActiveRecordCommon
'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',
'exclude_export_shopping_cart_labels' => "Exclure de l'export d'étiquettes",
'is_home_delivery' => "Livraison à domicile"
'is_home_delivery' => "Livraison à domicile",
'minimum_order_amount' => "Montant minimum de commande (€)"
];
}


+ 26
- 0
console/migrations/m231113_084553_add_column_point_sale_minimum_order_amount.php Ver arquivo

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

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

/**
* Class m231113_084553_add_column_point_sale_minimum_order_amount
*/
class m231113_084553_add_column_point_sale_minimum_order_amount extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->addColumn('point_sale', 'minimum_order_amount', Schema::TYPE_FLOAT);
}

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

+ 0
- 1
producer/controllers/OrderController.php Ver arquivo

@@ -50,7 +50,6 @@ use common\logic\Order\ProductOrder\Model\ProductOrder;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\Product\Product\Model\Product;
use common\logic\User\CreditHistory\Model\CreditHistory;
use common\logic\User\User\Model\User;
use DateTime;
use yii\base\UserException;

+ 3
- 0
producer/views/order/order.php Ver arquivo

@@ -240,6 +240,9 @@ $this->setTitle('Commander');
</div>
<div class="comment" v-if="pointSale.infos && pointSale.infos.length > 0"
v-html="pointSale.infos"></div>
<div class="minimum-order-amount" v-if="pointSale.minimum_order_amount">
Montant minimum de commande : {{ formatPrice(pointSale.minimum_order_amount) }}
</div>
</td>
<td class="locality">{{ pointSale.locality }}</td>
<td class="actions">

+ 35
- 33
producer/web/css/screen.css Ver arquivo

@@ -1471,26 +1471,28 @@ termes.
font-weight: bold;
}
/* line 222, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.name .comment {
.order-order #main #app-order-order table#points-sale td.name .comment,
.order-order #main #app-order-order table#points-sale td.name .minimum-order-amount {
color: gray;
}
/* line 225, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.name .comment a {
/* line 226, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.name .comment a,
.order-order #main #app-order-order table#points-sale td.name .minimum-order-amount a {
color: #F39C12;
}
/* line 231, ../sass/order/_order.scss */
/* line 232, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.actions {
width: 150px;
}
/* line 233, ../sass/order/_order.scss */
/* line 234, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.actions button {
width: 100%;
}
/* line 239, ../sass/order/_order.scss */
/* line 240, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale tr.selected td {
background-color: white;
}
/* line 247, ../sass/order/_order.scss */
/* line 248, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.category-name {
font-family: "highvoltageregular";
font-size: 22px;
@@ -1498,12 +1500,12 @@ termes.
text-transform: uppercase;
padding-top: 13px;
}
/* line 254, ../sass/order/_order.scss */
/* line 255, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.category-name .glyphicon-triangle-bottom,
.order-order #main #app-order-order table#products td.category-name .glyphicon-triangle-right {
font-size: 15px;
}
/* line 259, ../sass/order/_order.scss */
/* line 260, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.category-name span.label {
font-family: "Arial";
font-weight: normal;
@@ -1511,17 +1513,17 @@ termes.
text-transform: none;
margin-left: 15px;
}
/* line 268, ../sass/order/_order.scss */
/* line 269, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.category-name:hover {
cursor: pointer;
background-color: #F39C12;
color: white;
}
/* line 276, ../sass/order/_order.scss */
/* line 277, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.photo img {
width: 100px;
}
/* line 286, ../sass/order/_order.scss */
/* line 287, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices {
margin-top: 10px;
font-size: 10px;
@@ -1529,34 +1531,34 @@ termes.
padding-bottom: 2px;
margin-bottom: 0px;
}
/* line 294, ../sass/order/_order.scss */
/* line 295, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li {
margin-bottom: 5px;
}
/* line 296, ../sass/order/_order.scss */
/* line 297, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .decreasing-prices ul li strong {
font-weight: bold;
}
/* line 304, ../sass/order/_order.scss */
/* line 305, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit, .order-order #main #app-order-order table#products .price-total {
width: 135px;
text-align: center;
}
/* line 308, ../sass/order/_order.scss */
/* line 309, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .price-unit .unit, .order-order #main #app-order-order table#products .price-total .unit {
color: gray;
font-size: 13px;
}
/* line 313, ../sass/order/_order.scss */
/* line 314, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity {
width: 175px;
}
/* line 315, ../sass/order/_order.scss */
/* line 316, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity input.quantity {
text-align: center;
border-right: 0px none;
}
/* line 319, ../sass/order/_order.scss */
/* line 320, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -1564,69 +1566,69 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 330, ../sass/order/_order.scss */
/* line 331, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary h3 {
margin-top: 0px;
font-family: "capsuularegular";
text-transform: none;
margin-bottom: 5px;
}
/* line 337, ../sass/order/_order.scss */
/* line 338, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul {
margin-bottom: 15px;
padding-left: 20px;
font-size: 23px;
}
/* line 344, ../sass/order/_order.scss */
/* line 345, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul li .quantity {
font-size: 18px;
}
/* line 348, ../sass/order/_order.scss */
/* line 349, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul li .name {
font-family: "capsuularegular";
font-size: 24px;
}
/* line 352, ../sass/order/_order.scss */
/* line 353, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .summary ul li .other {
font-family: "capsuularegular";
font-size: 18px;
}
/* line 360, ../sass/order/_order.scss */
/* line 361, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .price-total {
font-size: 23px;
}
/* line 368, ../sass/order/_order.scss */
/* line 369, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .delivery {
margin-bottom: 20px;
}
/* line 371, ../sass/order/_order.scss */
/* line 372, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .delivery .delivery-home {
margin-bottom: 20px;
}
/* line 380, ../sass/order/_order.scss */
/* line 381, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .comment {
margin-bottom: 20px;
}
/* line 385, ../sass/order/_order.scss */
/* line 386, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .credit .info {
margin-left: 20px;
color: gray;
}
/* line 392, ../sass/order/_order.scss */
/* line 393, ../sass/order/_order.scss */
.order-order #main #app-order-order #specific-delays {
margin-top: 15px;
}
/* line 400, ../sass/order/_order.scss */
/* line 401, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos {
margin-top: 30px;
}
/* line 402, ../sass/order/_order.scss */
/* line 403, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos .panel-body {
padding-top: 0px;
white-space: pre-line;
}

/* line 412, ../sass/order/_order.scss */
/* line 413, ../sass/order/_order.scss */
#main #content .panel h3 {
font-family: "highvoltageregular";
margin: 0px;

+ 3
- 3
producer/web/js/producer.js Ver arquivo

@@ -101,11 +101,11 @@ function opendistrib_fix_width_sidebar() {
}

function opendistrib_scroll(id) {
if ($("#" + id).size())
if ($("#" + id).size()) {
$('html,body').animate({
scrollTop: $("#" + id).offset().top
},
1000);
}, 500);
}
}

function opendistrib_base_url(with_slug) {

+ 11
- 1
producer/web/js/vuejs/order-order.js Ver arquivo

@@ -509,6 +509,7 @@ var app = new Vue({
return thePriceWithTax;
}
},

confirmClick: function() {

var app = this ;
@@ -516,7 +517,16 @@ var app = new Vue({
// delivery
if(app.pointSaleActive.is_home_delivery && !app.deliveryAddress) {
this.errors = [] ;
this.errors.push('Veuillez saisir une adresse de livraison') ;
this.errors.push('Veuillez saisir une adresse de livraison.') ;
opendistrib_scroll('page-title');
return false ;
}

// montant minimum de commande
if(app.pointSaleActive.minimum_order_amount > 0 && app.priceTotal() < app.pointSaleActive.minimum_order_amount) {
this.errors = [] ;
this.errors.push('Le montant minimum de commande est de '+app.formatPrice(app.pointSaleActive.minimum_order_amount)+' pour ce point de vente.') ;
opendistrib_scroll('page-title');
return false ;
}


+ 2
- 1
producer/web/sass/order/_order.scss Ver arquivo

@@ -219,7 +219,8 @@
font-weight: bold;
}

.comment {
.comment,
.minimum-order-amount {
color: gray;

a {

Carregando…
Cancelar
Salvar