Преглед на файлове

Gestion de la livraison à domicile

dev
Guillaume преди 3 години
родител
ревизия
0139c3c5c3
променени са 14 файла, в които са добавени 209 реда и са изтрити 55 реда
  1. +6
    -0
      backend/views/distribution/index.php
  2. +1
    -1
      backend/views/distribution/report.php
  3. +6
    -0
      backend/views/producer/update.php
  4. +26
    -22
      backend/web/css/screen.css
  5. +4
    -0
      backend/web/sass/distribution/_index.scss
  6. +27
    -3
      common/models/Order.php
  7. +3
    -2
      common/models/Producer.php
  8. +24
    -0
      console/migrations/m210330_072516_add_option_delivery.php
  9. +12
    -0
      producer/controllers/OrderController.php
  10. +8
    -3
      producer/views/order/confirm.php
  11. +12
    -0
      producer/views/order/order.php
  12. +14
    -6
      producer/web/css/screen.css
  13. +49
    -14
      producer/web/js/vuejs/order-order.js
  14. +17
    -4
      producer/web/sass/order/_order.scss

+ 6
- 0
backend/views/distribution/index.php Целия файл

@@ -328,6 +328,7 @@ $this->setPageTitle('Distributions') ;
</span>
<span v-else>{{ order.username }}</span>
<span v-if="order.comment && order.comment.length > 0" class="glyphicon glyphicon-comment"></span>
<span v-if="order.delivery_home && order.delivery_address && order.delivery_address.length > 0" class="glyphicon glyphicon-home"></span>
</td>
<td class="column-point-sale" v-if="idActivePointSale == 0">
{{ order.pointSale.name }}
@@ -515,6 +516,11 @@ $this->setPageTitle('Distributions') ;
<strong><span class="glyphicon glyphicon-menu-right"></span> Commentaire</strong><br />
{{ order.comment }}
</div>

<div v-if="order.delivery_home && order.delivery_address && order.delivery_address.length > 0" class="delivery">
<strong><span class="glyphicon glyphicon-menu-right"></span> Livraison à domicile</strong><br />
{{ order.delivery_address }}
</div>
</td>
</tr>
</template>

+ 1
- 1
backend/views/distribution/report.php Целия файл

@@ -109,7 +109,7 @@ foreach ($pointsSaleArray as $pointSale) {
if($isBig) {
$html .= '<td></td>' ;
}
$html .= '<td>'.$order->comment.'</td>';
$html .= '<td>'.$order->getCommentReport().'</td>';
if($pointSale->credit) {
$credit = '' ;

+ 6
- 0
backend/views/producer/update.php Целия файл

@@ -295,6 +295,12 @@ $this->addBreadcrumb($this->getTitle()) ;
Producer::ORDER_ENTRY_POINT_DATE => 'Date',
Producer::ORDER_ENTRY_POINT_POINT_SALE => 'Point de vente',
], []); ?>

<?= $form->field($model, 'option_delivery')
->dropDownList([
0 => 'Non',
1 => 'Oui'
], []); ?>
</div>
</div>


+ 26
- 22
backend/web/css/screen.css Целия файл

@@ -2102,20 +2102,24 @@ termes.
.distribution-index #orders table tr.view .comment {
margin-top: 20px;
}
/* line 309, ../sass/distribution/_index.scss */
/* line 304, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .delivery {
margin-top: 20px;
}
/* line 313, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container {
width: 100%;
padding: 0px;
}
/* line 313, ../sass/distribution/_index.scss */
/* line 317, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body {
padding-right: 15px;
}
/* line 315, ../sass/distribution/_index.scss */
/* line 319, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-body table {
margin-bottom: 150px;
}
/* line 320, ../sass/distribution/_index.scss */
/* line 324, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer {
border-top-color: #f4f4f4;
position: fixed;
@@ -2127,46 +2131,46 @@ termes.
text-align: center;
border-top: solid 1px #e0e0e0;
}
/* line 332, ../sass/distribution/_index.scss */
/* line 336, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .modal-container .modal-footer .actions-form button {
float: none;
}
/* line 339, ../sass/distribution/_index.scss */
/* line 343, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit {
float: right;
}
/* line 345, ../sass/distribution/_index.scss */
/* line 349, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9;
}
/* line 349, ../sass/distribution/_index.scss */
/* line 353, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input {
font-size: 16px;
font-weight: bold;
}
/* line 355, ../sass/distribution/_index.scss */
/* line 359, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price {
width: 150px;
}
/* line 357, ../sass/distribution/_index.scss */
/* line 361, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.price input {
text-align: center;
}
/* line 362, ../sass/distribution/_index.scss */
/* line 366, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity {
width: 165px;
}
/* line 365, ../sass/distribution/_index.scss */
/* line 369, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center;
color: black;
}
/* line 370, ../sass/distribution/_index.scss */
/* line 374, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none;
padding-right: 4px;
}
/* line 375, ../sass/distribution/_index.scss */
/* line 379, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px;
padding-left: 0px;
@@ -2174,35 +2178,35 @@ termes.
border-left: 0px none;
border-right: 0px none;
}
/* line 384, ../sass/distribution/_index.scss */
/* line 388, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right;
}
/* line 387, ../sass/distribution/_index.scss */
/* line 391, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.quantity-remaining, .distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite {
color: #00A65A;
}
/* line 391, ../sass/distribution/_index.scss */
/* line 395, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39;
}
/* line 395, ../sass/distribution/_index.scss */
/* line 399, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.infinite, .distribution-index .modal-form-order table.table-products td.quantity-remaining.empty {
font-size: 18px;
}
/* line 402, ../sass/distribution/_index.scss */
/* line 406, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 410, ../sass/distribution/_index.scss */
/* line 414, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 413, ../sass/distribution/_index.scss */
/* line 417, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 418, ../sass/distribution/_index.scss */
/* line 422, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}

+ 4
- 0
backend/web/sass/distribution/_index.scss Целия файл

@@ -300,6 +300,10 @@ termes.
.comment {
margin-top: 20px;
}

.delivery {
margin-top: 20px;
}
}
}
}

+ 27
- 3
common/models/Order.php Целия файл

@@ -102,8 +102,8 @@ class Order extends ActiveRecordCommon
return [
[['id_user', 'date', 'status'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution', 'id_subscription', 'id_invoice', 'id_quotation', 'id_delivery_note'], 'integer'],
[['auto_payment', 'tiller_synchronization'], 'boolean'],
[['status', 'reference'], 'string'],
[['auto_payment', 'tiller_synchronization', 'delivery_home'], 'boolean'],
[['status', 'reference', 'delivery_address'], 'string'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe']
];
}
@@ -125,7 +125,9 @@ class Order extends ActiveRecordCommon
'id_invoice' => 'Facture',
'id_quotation' => 'Devis',
'id_delivery_note' => 'Bon de livraison',
'reference' => 'Référence'
'reference' => 'Référence',
'delivery_home' => 'Livraison à domicile',
'delivery_address' => 'Adresse de livraison'
];
}

@@ -996,4 +998,26 @@ class Order extends ActiveRecordCommon
$this->save() ;
}
}

public function getCommentReport()
{
$comment = '' ;

$hasComment = false ;
if($this->comment && strlen($this->comment) > 0) {
$hasComment = true ;
$comment .= $this->comment ;
}

if($this->delivery_home && $this->delivery_address && strlen($this->delivery_address) > 0) {
if($hasComment) {
$comment .= '<br /><br />' ;
}

$comment .= '<strong>Livraison à domicile :</strong><br />' ;
$comment .= nl2br($this->delivery_address) ;
}

return $comment ;
}
}

+ 3
- 2
common/models/Producer.php Целия файл

@@ -140,7 +140,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', 'behavior_home_point_sale_day_list', 'behavior_order_select_distribution', 'option_payment_info', 'option_order_reference_type', 'option_order_entry_point'], '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', 'option_email_confirm', 'option_email_confirm_producer', 'option_csv_export_all_products', 'option_csv_export_by_piece', 'option_export_display_product_reference', 'option_allow_order_guest'], 'boolean'],
[['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', 'option_email_confirm', 'option_email_confirm_producer', 'option_csv_export_all_products', 'option_csv_export_by_piece', 'option_export_display_product_reference', 'option_allow_order_guest', 'option_delivery'], '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'],
['free_price', 'compare', 'compareValue' => 0, 'operator' => '>=', 'type' => 'number', 'message' => 'Prix libre doit être supérieur ou égal à 0'],
@@ -232,7 +232,8 @@ class Producer extends ActiveRecordCommon
'option_order_reference_type' => 'Type de référence',
'option_export_display_product_reference' => 'Afficher la référence des produits au moment de l\'export',
'option_allow_order_guest' => 'Autoriser les visiteurs à passer commande (création de compte à la fin du tunnel)',
'option_order_entry_point' => 'Point d\'entrée par point de vente ou par date'
'option_order_entry_point' => 'Point d\'entrée par point de vente ou par date',
'option_delivery' => 'Proposer la livraison à domicile'
];
}


+ 24
- 0
console/migrations/m210330_072516_add_option_delivery.php Целия файл

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

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

class m210330_072516_add_option_delivery extends Migration
{

public function safeUp()
{
$this->addColumn('producer', 'option_delivery', Schema::TYPE_BOOLEAN. ' DEFAULT 0');
$this->addColumn('order', 'delivery_home', Schema::TYPE_BOOLEAN.' DEFAULT 0');
$this->addColumn('order', 'delivery_address', Schema::TYPE_TEXT);
}

public function safeDown()
{
$this->dropColumn('producer', 'option_delivery');
$this->dropColumn('order', 'delivery_home');
$this->dropColumn('order', 'delivery_address');
}

}


+ 12
- 0
producer/controllers/OrderController.php Целия файл

@@ -355,12 +355,20 @@ class OrderController extends ProducerBaseController
'id' => $order->id_point_sale
]);

// commentaire point de vente
$order->comment_point_sale = ($pointSale && strlen($pointSale->getComment())) ?
$pointSale->getComment() : '';

// la commande est automatiquement réactivée lors d'une modification
$order->date_delete = null;

// delivery
$order->delivery_home = isset($posts['Order']['delivery_home']) ? $posts['Order']['delivery_home'] : false ;
$order->delivery_address = (isset($posts['Order']['delivery_address']) && $order->delivery_home) ? $posts['Order']['delivery_address'] : null ;

// comment
$order->comment = isset($posts['Order']['comment']) ? $posts['Order']['comment'] : null ;

// sauvegarde de la commande
$order->save();

@@ -583,6 +591,8 @@ class OrderController extends ProducerBaseController
$format = 'Y-m-d';
$dateObject = DateTime::createFromFormat($format, $date);

$user = User::getCurrent() ;

// PointSale current
$pointSaleCurrent = PointSale::findOne($pointSaleId) ;

@@ -598,6 +608,7 @@ class OrderController extends ProducerBaseController
'credit_limit' => is_numeric($producer->credit_limit) ? $producer->credit_limit : null,
'option_allow_order_guest' => $producer->option_allow_order_guest,
'option_order_entry_point' => $producer->option_order_entry_point,
'option_delivery' => $producer->option_delivery
];

// Distributions
@@ -674,6 +685,7 @@ class OrderController extends ProducerBaseController

if($userProducer) {
$json['user'] = [
'address' => $user->address,
'credit' => $userProducer->credit,
'credit_active' => $userProducer->credit_active,
];

+ 8
- 3
producer/views/order/confirm.php Целия файл

@@ -69,9 +69,14 @@ $producer = GlobalParam::getCurrentProducer() ;
<ul>
<?php if($order->reference && strlen($order->reference) > 0): ?><li><span class="glyphicon glyphicon-check"></span> Commande N°<strong><?= Html::encode($order->reference); ?></strong></li><?php endif; ?>
<li><span class="glyphicon glyphicon-time"></span>Le <?= date('d/m/Y',strtotime($order->distribution->date)) ?></li>
<li><span class="glyphicon glyphicon-map-marker"></span><?= Html::encode($order->pointSale->name) ?><?php if(strlen($order->pointSale->name)): ?>
<br />&nbsp; &nbsp; &nbsp;<span class="locality">à <?= Html::encode($order->pointSale->locality) ?></span><?php endif; ?></li>

<li><span class="glyphicon glyphicon-map-marker"></span>
<?php if($order->delivery_home): ?>
Livraison à domicile
<br /><span class="locality"><?= nl2br(Html::encode($order->delivery_address)); ?></span>
<?php else: ?>
<?= Html::encode($order->pointSale->name) ?><?php if(strlen($order->pointSale->name)): ?>
<br />&nbsp; &nbsp; &nbsp;<span class="locality">à <?= Html::encode($order->pointSale->locality) ?></span><?php endif; ?></li>
<?php endif; ?>
</ul>
</div>
<div class="col-md-6">

+ 12
- 0
producer/views/order/order.php Целия файл

@@ -345,6 +345,18 @@ $producer = GlobalParam::getCurrentProducer() ;
</transition>
<transition name="slide">
<div id="content-step-payment" v-if="step == 'payment'">

<div class="delivery">
<div class="delivery-home" v-if="producer.option_delivery">
<input type="checkbox" name="delivery" id="delivery" v-model="delivery" />
<label for="delivery">Je souhaite être livré à domicile</label>
</div>
<div class="delivery-address" v-if="delivery">
<label for="deliver-address">Adresse de livraison</label>
<textarea id="deliver-address" v-model="deliveryAddress" class="form-control" required="required"></textarea>
</div>
</div>

<div class="comment">
<label for="order-comment">Commentaire</label>
<textarea id="order-comment" v-model="comment" class="form-control"></textarea>

+ 14
- 6
producer/web/css/screen.css Целия файл

@@ -1601,25 +1601,33 @@ termes.
font-size: 23px;
}
/* line 335, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .credit .info {
margin-left: 20px;
color: gray;
.order-order #main #app-order-order #content-step-payment .delivery {
margin-bottom: 20px;
}
/* line 338, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .delivery .delivery-home {
margin-bottom: 20px;
}
/* line 341, ../sass/order/_order.scss */
/* line 347, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .comment {
margin-bottom: 20px;
}
/* line 352, ../sass/order/_order.scss */
.order-order #main #app-order-order #content-step-payment .credit .info {
margin-left: 20px;
color: gray;
}
/* line 365, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos {
margin-top: 30px;
}
/* line 354, ../sass/order/_order.scss */
/* line 367, ../sass/order/_order.scss */
.order-order #main #app-order-order #infos .panel-body {
padding-top: 0px;
white-space: pre-line;
}

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

+ 49
- 14
producer/web/js/vuejs/order-order.js Целия файл

@@ -23,6 +23,8 @@ var app = new Vue({
useCredit: false,
errors: [],
disableConfirmButton: false,
delivery: false,
deliveryAddress: null,
calendar: {
mode: 'single',
attrs: [],
@@ -123,6 +125,7 @@ var app = new Vue({
}})
.then(function(response) {

// distributions
var distributions = response.data.distributions;

app.calendar.attrs = [];
@@ -150,10 +153,12 @@ var app = new Vue({
}
}

// distribution
if (response.data.distribution) {
app.distribution = response.data.distribution;
}

// liste commandes
var orders = [];
if (response.data.orders) {
orders = response.data.orders;
@@ -182,15 +187,19 @@ var app = new Vue({
}
}

// produits
if(response.data.products) {
app.products = response.data.products ;
}

// catégories
if(response.data.categories) {
app.categories = response.data.categories ;
app.setCategoryCurrent(response.data.categories[0]) ;
}



if(type != 'products') {

app.producer = response.data.producer;
@@ -208,12 +217,25 @@ var app = new Vue({
}
}

// commande
app.order = null ;
if(response.data.order) {
app.order = response.data.order ;
app.comment = app.order.comment ;
console.log(app.order) ;
app.delivery = app.order.delivery_home ;
if(app.order.delivery_address && app.order.delivery_address.length > 0) {
app.deliveryAddress = app.order.delivery_address ;
}
app.pointSaleActive = app.getPointSale(response.data.order.id_point_sale) ;
}
else {
app.comment = null ;
app.delivery = false ;
app.deliveryAddress = null ;
if(app.user.address.length > 0) {
app.deliveryAddress = app.user.address ;
}
app.pointSaleActive = null ;
}
}
@@ -272,12 +294,13 @@ var app = new Vue({
this.step = step ;
window.scroll(0, $('#page-title').position().top - 25) ;

if(oldStep == 'date' && step == 'point-sale') {
if((oldStep == 'date' && step == 'point-sale')
|| (oldStep == 'date' && step == 'products')) {

this.init('basic') ;
}

if((oldStep == 'date' && step == 'products')
|| (oldStep == 'point-sale' && step == 'products')
if((oldStep == 'point-sale' && step == 'products')
|| (oldStep == 'point-sale' && step == 'date')) {

this.init('products') ;
@@ -393,22 +416,21 @@ var app = new Vue({
confirmClick: function() {

var app = this ;

// delivery
if(app.delivery && !app.deliveryAddress) {
this.errors = [] ;
this.errors.push('Veuillez saisir une adresse de livraison') ;
return false ;
}

// guest form
var $signupGuestForm = $('#signup-guest form') ;
if($signupGuestForm.length > 0 && !$signupGuestForm.valid()) {
$signupGuestForm.submit() ;
return false ;
}

app.disableConfirmButton = true ;
var productsArray = {} ;
for(var key in this.products) {
if( this.products[key].quantity_form != null &&
this.products[key].quantity_form > 0) {
productsArray[this.products[key].id] = this.products[key].quantity_form ;
}
}

var user = false ;
if(this.producer.option_allow_order_guest && !this.user) {
user = {
@@ -419,12 +441,25 @@ var app = new Vue({
phone: $('#signupguest-phone').val(),
} ;
}

// products
var productsArray = {} ;
for(var key in this.products) {
if( this.products[key].quantity_form != null &&
this.products[key].quantity_form > 0) {
productsArray[this.products[key].id] = this.products[key].quantity_form ;
}
}

app.disableConfirmButton = true ;
axios.post('ajax-process', {
Order: {
id_distribution : this.distribution.id,
id_point_sale: this.pointSaleActive.id,
comment: this.comment
comment: this.comment,
delivery_home: this.delivery,
delivery_address: this.deliveryAddress
},
code_point_sale: this.pointsSaleCodes[this.pointSaleActive.id],
products: productsArray,

+ 17
- 4
producer/web/sass/order/_order.scss Целия файл

@@ -331,16 +331,29 @@
}
#content-step-payment {

.delivery {
margin-bottom: 20px ;

.delivery-home {
margin-bottom: 20px ;
}

.delivery-address {

}
}

.comment {
margin-bottom: 20px ;
}

.credit {
.info {
margin-left: 20px ;
color: gray ;
}
}
.comment {
margin-bottom: 20px ;
}
}

#specific-delays {

Loading…
Отказ
Запис