Quellcode durchsuchen

Merge branch 'dev'

master
Guillaume vor 4 Jahren
Ursprung
Commit
b9b9bce741
11 geänderte Dateien mit 313 neuen und 81 gelöschten Zeilen
  1. +16
    -0
      backend/views/producer/update.php
  2. +10
    -1
      common/models/Producer.php
  3. +22
    -0
      console/migrations/m200601_073309_add_producer_options.php
  4. +19
    -0
      console/migrations/m200602_073010_add_producer_option_payment_text.php
  5. +24
    -7
      producer/controllers/SiteController.php
  6. +27
    -2
      producer/views/order/confirm.php
  7. +39
    -2
      producer/views/order/order.php
  8. +87
    -42
      producer/views/site/index.php
  9. +32
    -19
      producer/web/css/screen.css
  10. +15
    -6
      producer/web/js/vuejs/order-order.js
  11. +22
    -2
      producer/web/sass/order/_order.scss

+ 16
- 0
backend/views/producer/update.php Datei anzeigen

@@ -39,6 +39,7 @@ termes.
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use common\helpers\Url ;
use common\models\Producer ;

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

@@ -101,6 +102,11 @@ $this->addBreadcrumb($this->getTitle()) ;
echo '<input type="checkbox" name="delete_photo" id="delete_photo" /> <label for="delete_photo">Supprimer la photo</label><br /><br />';
}
?>
<?= $form->field($model, 'behavior_home_point_sale_day_list')
->dropDownList([
Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK => 'Jours de la semaine',
Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_INCOMING_DISTRIBUTIONS => 'Distributions à venir',
]); ?>
</div>
</div>
@@ -204,6 +210,16 @@ $this->addBreadcrumb($this->getTitle()) ;
Producer::BEHAVIOR_DELETE_ORDER_DELETE => 'Suppression de la commande',
Producer::BEHAVIOR_DELETE_ORDER_STATUS => 'Passage de la commande en statut "supprimé"',
], []) ; ?>

<?= $form->field($model, 'behavior_order_select_distribution')
->dropDownList([
Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_CALENDAR => 'Calendrier',
Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST => 'Liste',
]); ?>

<?= $form->field($model, 'option_payment_info')
->textarea(['rows' => 6])
->hint('Affiché au client à la fin de la prise de commande')?>
</div>
</div>


+ 10
- 1
common/models/Producer.php Datei anzeigen

@@ -86,6 +86,12 @@ class Producer extends ActiveRecordCommon
const BEHAVIOR_DELETE_ORDER_DELETE = 'delete';
const BEHAVIOR_DELETE_ORDER_STATUS = 'status';

const BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK = 'days-of-week' ;
const BEHAVIOR_HOME_POINT_SALE_DAY_LIST_INCOMING_DISTRIBUTIONS = 'incoming-distributions' ;

const BEHAVIOR_ORDER_SELECT_DISTRIBUTION_CALENDAR = 'calendar' ;
const BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST = 'list' ;

var $secret_key_payplug;

/**
@@ -127,7 +133,7 @@ class Producer extends ActiveRecordCommon
}
}],
[['description', 'mentions', 'gcs', 'order_infos', 'slug', 'secret_key_payplug', 'background_color_logo', 'option_behavior_cancel_order', 'tiller_provider_token', 'tiller_restaurant_token', 'status',
'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address'], 'string'],
'document_infos_bottom', 'document_infos_quotation', 'document_infos_invoice', 'document_infos_delivery_note', 'address', 'behavior_home_point_sale_day_list', 'behavior_order_select_distribution', 'option_payment_info'], 'string'],
[['negative_balance', 'credit', 'active', 'online_payment', 'user_manage_subscription', 'option_allow_user_gift', 'use_credit_checked_default', 'tiller', 'document_display_orders_invoice', 'document_display_orders_delivery_note', 'document_display_prices_delivery_note'], 'boolean'],
[['name', 'siret', 'logo', 'photo', 'postcode', 'city', 'code', 'type', 'credit_functioning', 'option_behavior_cancel_order', 'document_quotation_prefix', 'document_quotation_first_reference', 'document_invoice_prefix', 'document_invoice_first_reference', 'document_delivery_note_prefix', 'document_delivery_note_first_reference'], 'string', 'max' => 255],
[['free_price', 'credit_limit_reminder', 'credit_limit'], 'double'],
@@ -205,6 +211,9 @@ class Producer extends ActiveRecordCommon
'document_display_orders_invoice' => 'Afficher le détail des commandes dans les factures',
'document_display_orders_delivery_note' => 'Afficher le détail des commandes dans les bons de livraison',
'document_display_prices_delivery_note' => 'Afficher le chiffrage dans les bons de livraison',
'behavior_home_point_sale_day_list' => 'Accueil : affichage des jours de distribution',
'behavior_order_select_distribution' => 'Sélection de la date de distribution',
'option_payment_info' => 'Informations liées au paiement'
];
}


+ 22
- 0
console/migrations/m200601_073309_add_producer_options.php Datei anzeigen

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

use yii\db\Migration;
use yii\db\Schema;
use common\models\Producer ;

class m200601_073309_add_producer_options extends Migration
{
public function safeUp()
{
$this->addColumn('producer', 'behavior_home_point_sale_day_list', Schema::TYPE_STRING.' DEFAULT \''.Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK.'\'');
$this->addColumn('producer', 'behavior_order_select_distribution', Schema::TYPE_STRING.' DEFAULT \''.Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_CALENDAR.'\'');
}

public function safeDown()
{
$this->dropColumn('producer', 'behavior_home_point_sale_day_list');
$this->dropColumn('producer', 'behavior_order_select_distribution');

return false;
}
}

+ 19
- 0
console/migrations/m200602_073010_add_producer_option_payment_text.php Datei anzeigen

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

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

class m200602_073010_add_producer_option_payment_text extends Migration
{
public function safeUp()
{
$this->addColumn('producer', 'option_payment_info', Schema::TYPE_TEXT);
}

public function safeDown()
{
$this->dropColumn('producer', 'option_payment_info');

return false;
}
}

+ 24
- 7
producer/controllers/SiteController.php Datei anzeigen

@@ -102,22 +102,39 @@ class SiteController extends ProducerBaseController
]);

// produits
$queryProducts = Product::find()
->andWhere([
'id_producer' => $this->getProducer()->id,
'active' => true
])
->orderBy('order ASC') ;
$dataProviderProducts = new ActiveDataProvider([
'query' => Product::find()
->andWhere([
'id_producer' => $this->getProducer()->id,
'active' => true
])
->orderBy('order ASC'),
'query' => $queryProducts,
'pagination' => [
'pageSize' => 50,
],
'sort' => false,
]);

$products = $queryProducts->all() ;

$hasProductPhoto = false ;
$hasProductWeight = false ;

foreach($products as $product) {
if(strlen($product->photo) > 0) {
$hasProductPhoto = true ;
}
if($product->weight && $product->weight > 0) {
$hasProductWeight = true ;
}
}

return $this->render('index', [
'dataProviderPointsSale' => $dataProviderPointsSale,
'dataProviderProducts' => $dataProviderProducts
'dataProviderProducts' => $dataProviderProducts,
'hasProductPhoto' => $hasProductPhoto,
'hasProductWeight' => $hasProductWeight
]);
}


+ 27
- 2
producer/views/order/confirm.php Datei anzeigen

@@ -37,9 +37,12 @@ termes.
*/

use common\models\Order ;
use common\helpers\GlobalParam ;

$this->setTitle('Confirmation de commande') ;


$producer = GlobalParam::getCurrentProducer() ;
?>

<div id="order-success">
@@ -63,8 +66,30 @@ $this->setTitle('Confirmation de commande') ;
<li><span class="glyphicon glyphicon-map-marker"></span><?= Html::encode($order->pointSale->name) ?><?php if(strlen($order->pointSale->name)): ?> <span class="locality">à <?= Html::encode($order->pointSale->locality) ?></span><?php endif; ?></li>
<li><span class="glyphicon glyphicon-th-list"></span><?= $order->countProducts(); ?> produit<?php if($order->countProducts() > 1): ?>s<?php endif; ?></li>
<li><span class="glyphicon glyphicon-chevron-right"></span><?= $order->getAmountWithTax(Order::AMOUNT_TOTAL, true); ?></li>
</ul>
</ul>
</div>
<div class="clr"></div>
</div>
</div>

<?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
<div class="panel panel-warning payment-info">
<div class="panel-heading">
<h3>Paiement de votre commande</h3>
</div>
<div class="panel-body">
<?= nl2br($producer->option_payment_info); ?>
</div>
</div>
<?php endif; ?>

<?php if ($producer->order_infos && strlen($producer->order_infos) > 0): ?>
<div class="panel panel-info">
<div class="panel-heading">
<h3>Informations</h3>
</div>
<div class="panel-body">
<?= nl2br($producer->order_infos); ?>
</div>
</div>
<?php endif; ?>
</div>

+ 39
- 2
producer/views/order/order.php Datei anzeigen

@@ -36,10 +36,16 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\GlobalParam ;
use common\models\Producer ;
use common\models\Distribution ;

\producer\assets\VuejsOrderOrderAsset::register($this);

$this->setTitle('Commander') ;

$producer = GlobalParam::getCurrentProducer() ;

?>

<div id="app-order-order" :class="{'loaded': !loadingInit}">
@@ -98,6 +104,9 @@ $this->setTitle('Commander') ;
</div>
<transition name="slide">
<div id="content-step-date" v-if="step == 'date'">
<?php if($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST ): ?>
<div style="display:none ;">
<?php endif; ?>
<div id="legend">
<div><span id="distribution-date-color"></span> Prochains jours de distribution</div>
<div><span id="order-date-color"></span> Vos commandes déjà enregistrées</div>
@@ -115,8 +124,25 @@ $this->setTitle('Commander') ;
:attributes="calendar.attrs"
:available-dates="calendar.availableDates"
@dayclick='dayClick'>
></v-calendar>
></v-calendar>
</div>
<?php if($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST ): ?>
</div>
<?php endif; ?>

<?php if($producer->behavior_order_select_distribution == Producer::BEHAVIOR_ORDER_SELECT_DISTRIBUTION_LIST ): ?>
<div id="distributions-list">
<?php $incomingDistributions = Distribution::getIncomingDistributions(); ?>
<?php foreach($incomingDistributions as $distribution): ?>
<div class="panel panel-default">
<div class="panel-body">
<?= ucfirst(strftime('%A %d %B', strtotime($distribution->date))); ?>
<a href="javascript:void(0);" class="btn btn-primary" @click="dayClickList" data-distribution-date="<?= $distribution->date.' 00:00' ?>">Sélectionner cette distribution</a>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</transition>
<transition name="slide">
@@ -273,7 +299,18 @@ $this->setTitle('Commander') ;
</div>
</div>
<div v-else>
<span class="glyphicon glyphicon-chevron-right"></span> La commande sera à régler sur place.
<?php if($producer->option_payment_info && strlen($producer->option_payment_info) > 0): ?>
<div class="panel panel-warning payment-info">
<div class="panel-heading">
<h3>Paiement de votre commande</h3>
</div>
<div class="panel-body">
<?= nl2br($producer->option_payment_info); ?>
</div>
</div>
<?php else: ?>
<span class="glyphicon glyphicon-chevron-right"></span> La commande sera à régler sur place.
<?php endif; ?>
</div>
</div>
<div class="block-actions">

+ 87
- 42
producer/views/site/index.php Datei anzeigen

@@ -36,6 +36,11 @@ pris connaissance de la licence CeCILL, et que vous en avez accepté les
termes.
*/

use common\helpers\GlobalParam ;
use common\models\Distribution;
use common\models\PointSaleDistribution;
use common\models\Producer ;

$producer = $this->context->getProducer() ;
$this->setTitle('Accueil');
$this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;
@@ -71,8 +76,35 @@ $this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;
],
[
'label' => 'Jours de livraison',
'format' => 'raw',
'value' => function($model) {
return $model->getStrDeliveryDays() ;

$producer = GlobalParam::getCurrentProducer() ;

if($producer->behavior_home_point_sale_day_list == Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_WEEK) {
return $model->getStrDeliveryDays() ;
}
elseif($producer->behavior_home_point_sale_day_list == Producer::BEHAVIOR_HOME_POINT_SALE_DAY_LIST_INCOMING_DISTRIBUTIONS) {
$html = '' ;
$incomingDistributions = Distribution::getIncomingDistributions();
$cpt = 0 ;
foreach($incomingDistributions as $distribution) {
$countPointSaleDistribution = PointSaleDistribution::searchCount([
'id_distribution' => $distribution->id,
'id_point_sale' => $model->id
]);
if($countPointSaleDistribution) {
$html .= strftime('%A %d %B', strtotime($distribution->date)).'<br />';
}

$cpt ++ ;

if($cpt >= 5) {
break ;
}
}
return $html ;
}
}
]
],
@@ -82,54 +114,67 @@ $this->setPageTitle(Html::encode($producer->type.' à '.$producer->city)) ;

<section id="products">
<h3><span>Produits</span></h3>
<?= GridView::widget([
'dataProvider' => $dataProviderProducts,
'summary' => '',
'columns' => [
[
'attribute' => 'photo',
'format' => 'raw',
'contentOptions' => ['class' => 'photo'],
'value' => function($model) {
if(strlen($model->photo)) {
return '<img class="photo-product" src="'.Yii::$app->urlManagerProducer->baseUrl.'/uploads/'.$model->photo.'" />' ;
}
return '' ;
}
],
[

<?php

$columnsProducts = [] ;
if($hasProductPhoto) {
$columnsProducts [] = [
'attribute' => 'photo',
'format' => 'raw',
'contentOptions' => ['class' => 'photo'],
'value' => function($model) {
if(strlen($model->photo)) {
return '<img class="photo-product" src="'.Yii::$app->urlManagerProducer->baseUrl.'/uploads/'.$model->photo.'" />' ;
}
return '' ;
}
] ;
}

$columnsProducts[] = [
'attribute' => 'name',
'format' => 'raw',
'contentOptions' => ['class' => 'name'],
'value' => function($model) {
$html = '<span class="the-name">'.Html::encode($model->name).'</span>' ;
if(strlen($model->description)) {
$html .= ' / '.Html::encode($model->description) ;
}
if(strlen($model->recipe)) {
$html .= '<br />'.Html::encode($model->recipe) ;
}
return $html ;
}
],
[
'attribute' => 'weight',
'value' => function($model) {
if($model->unit == 'piece' && strlen($model->weight)) {
return $model->weight.' g' ;
}
return '' ;
$html = '<span class="the-name">'.Html::encode($model->name).'</span>' ;
if(strlen($model->description)) {
$html .= ' / '.Html::encode($model->description) ;
}
if(strlen($model->recipe)) {
$html .= '<br />'.Html::encode($model->recipe) ;
}
return $html ;
}
],
[
] ;

if($hasProductWeight) {
$columnsProducts[] = [
'attribute' => 'weight',
'value' => function($model) {
if($model->unit == 'piece' && strlen($model->weight)) {
return $model->weight.' g' ;
}
return '' ;
}
] ;
}

$columnsProducts[] = [
'attribute' => 'price',
'value' => function($model) {
if($model->price) {
return Price::format($model->getPriceWithTax()).' ('.Product::strUnit($model->unit, 'wording_unit', true).')' ;
}
return '' ;
if($model->price) {
return Price::format($model->getPriceWithTax()).' ('.Product::strUnit($model->unit, 'wording_unit', true).')' ;
}
return '' ;
}
],
],
] ;

?>

<?= GridView::widget([
'dataProvider' => $dataProviderProducts,
'summary' => '',
'columns' => $columnsProducts
]); ?>
</section>

+ 32
- 19
producer/web/css/screen.css Datei anzeigen

@@ -1439,70 +1439,74 @@ termes.
.order-order #main #app-order-order #calendar .c-day-popover-content {
font-size: 1.3rem;
}
/* line 172, ../sass/order/_order.scss */
/* line 175, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-date #distributions-list .panel .btn-primary {
float: right;
}
/* line 182, ../sass/order/_order.scss */
.order-order #main #app-order-order .block-actions {
text-align: right;
margin-top: 20px;
}
/* line 179, ../sass/order/_order.scss */
/* line 189, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.name .the-name {
font-family: "capsuularegular";
color: black;
font-size: 20px;
line-height: 25px;
}
/* line 187, ../sass/order/_order.scss */
/* line 197, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.actions {
width: 150px;
}
/* line 189, ../sass/order/_order.scss */
/* line 199, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale td.actions button {
width: 100%;
}
/* line 195, ../sass/order/_order.scss */
/* line 205, ../sass/order/_order.scss */
.order-order #main #app-order-order table#points-sale tr.selected td {
background-color: white;
}
/* line 203, ../sass/order/_order.scss */
/* line 213, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.photo img {
width: 100px;
}
/* line 209, ../sass/order/_order.scss */
/* line 219, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.name .name {
font-family: "capsuularegular";
color: black;
font-size: 20px;
line-height: 25px;
}
/* line 215, ../sass/order/_order.scss */
/* line 225, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.name .other {
font-size: 14px;
color: #333;
}
/* line 219, ../sass/order/_order.scss */
/* line 229, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products td.name .recipe {
color: gray;
}
/* line 223, ../sass/order/_order.scss */
/* line 233, ../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: 100px;
text-align: center;
}
/* line 227, ../sass/order/_order.scss */
/* line 237, ../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 232, ../sass/order/_order.scss */
/* line 242, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity {
width: 175px;
}
/* line 234, ../sass/order/_order.scss */
/* line 244, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity input.quantity {
text-align: center;
border-right: 0px none;
}
/* line 238, ../sass/order/_order.scss */
/* line 248, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products .td-quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -1510,29 +1514,38 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 248, ../sass/order/_order.scss */
/* line 258, ../sass/order/_order.scss */
.order-order #main #app-order-order table#products tr.total .price-total {
font-size: 23px;
}
/* line 256, ../sass/order/_order.scss */
/* line 266, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .credit .info {
margin-left: 20px;
color: gray;
}
/* line 262, ../sass/order/_order.scss */
/* line 272, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .comment {
margin-bottom: 20px;
}
/* line 273, ../sass/order/_order.scss */
/* line 283, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos {
margin-top: 30px;
}
/* line 275, ../sass/order/_order.scss */
/* line 285, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos .panel-body {
padding-top: 0px;
white-space: pre-line;
}

/* line 295, ../sass/order/_order.scss */
#main #content .panel h3 {
font-family: "highvoltageregular";
margin: 0px;
padding-top: 10px;
padding-bottom: 4px;
font-size: 20px;
}

/* line 5, ../sass/order/_confirm.scss */
.order-confirm #main #order-success .alert.alert-success .glyphicon-big {
background-color: #00A65A;

+ 15
- 6
producer/web/js/vuejs/order-order.js Datei anzeigen

@@ -211,17 +211,26 @@ var app = new Vue({
this.init() ;
}
}
},
dayClickList: function(event) {
var dateStr = event.currentTarget.getAttribute('data-distribution-date') ;
var dateObject = new Date(dateStr) ;
if(this.isAvailableDate(dateObject)) {
this.dayClickEvent(dateObject) ;
}
},
dayClick: function(day) {
if(this.isAvailableDate(day.date)) {
this.date = day.date ;
this.dateFormat = ('0' + this.date.getDate()).slice(-2)+ '/'
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '/'
+ this.date.getFullYear() ;
this.changeStep('point-sale') ;
this.dayClickEvent(day.date) ;
}
},
dayClickEvent: function(date) {
this.date = date ;
this.dateFormat = ('0' + this.date.getDate()).slice(-2)+ '/'
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '/'
+ this.date.getFullYear() ;
this.changeStep('point-sale') ;
},
isAvailableDate: function(date) {
for(var key in this.calendar.availableDates) {
if(date.getTime() == this.calendar.availableDates[key].start.getTime()) {

+ 22
- 2
producer/web/sass/order/_order.scss Datei anzeigen

@@ -168,6 +168,16 @@
font-size: 1.3rem ;
}
}

#content-step-date {
#distributions-list {
.panel {
.btn-primary {
float: right ;
}
}
}
}
.block-actions {
text-align: right ;
@@ -278,6 +288,16 @@
}
}
}
}

#main #content {
.panel {
h3 {
font-family: "highvoltageregular" ;
margin: 0px ;
padding-top: 10px ;
padding-bottom: 4px ;
font-size: 20px ;
}
}
}

Laden…
Abbrechen
Speichern