Browse Source

[backend] Synchronisation avec Tiller : possibilité de séléctionner les commandes que l'on souhaite synchroniser

refactoring
Guillaume Bourgeois 4 years ago
parent
commit
2f1f9c790c
9 changed files with 112 additions and 28 deletions
  1. +2
    -1
      backend/controllers/DistributionController.php
  2. +24
    -0
      backend/controllers/OrderController.php
  3. +5
    -0
      backend/views/distribution/index.php
  4. +35
    -23
      backend/web/css/screen.css
  5. +12
    -1
      backend/web/js/vuejs/distribution-index.js
  6. +13
    -0
      backend/web/sass/distribution/_index.scss
  7. +2
    -1
      common/helpers/Tiller.php
  8. +2
    -2
      common/models/Order.php
  9. +17
    -0
      console/migrations/m191227_110133_ajout_champs_order_tiller_synchronisation.php

+ 2
- 1
backend/controllers/DistributionController.php View File

if(!$isSynchro) { if(!$isSynchro) {
$orders = Order::searchAll([ $orders = Order::searchAll([
'distribution.date' => $date
'distribution.date' => $date,
'order.tiller_synchronization' => 1
]) ; ]) ;


$strDate = date('Y-m-d\T12:i:s+0000', strtotime($date) + 1) ; $strDate = date('Y-m-d\T12:i:s+0000', strtotime($date) + 1) ;

+ 24
- 0
backend/controllers/OrderController.php View File



return ['success']; return ['success'];
} }
/**
* Modifie l'état de la synchronisation Tiller d'une commande.
*
* @param int $idOrder
* @param boolean $boolSynchroTiller
* @return array
*/
public function actionAjaxChangeSynchroTiller($idOrder, $boolSynchroTiller)
{
\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$order = Order::searchOne([
'id' => (int) $idOrder
]) ;
if($order) {
$order->tiller_synchronization = (int) $boolSynchroTiller ;
$res = $order->save() ;
return ['success'];
}
return ['error'];
}


} }

+ 5
- 0
backend/views/distribution/index.php View File

</ul> </ul>
</div> </div>
</td> </td>
<td v-if="producer.tiller" class="tiller">
<input v-if="order.tiller_synchronization == true" type="checkbox" checked="checked" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" />
<input v-else type="checkbox" :id="'checkbox-tiller-synchronization-'+order.id" :data-id-order="order.id" @change="changeSynchroTiller" />
<label :for="'checkbox-tiller-synchronization-'+order.id">Tiller</label>
</td>
<td class="column-actions"> <td class="column-actions">
<span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span> <span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span>
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button> <button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button>

+ 35
- 23
backend/web/css/screen.css View File

-webkit-border-radius: 10px; -webkit-border-radius: 10px;
border-radius: 10px; border-radius: 10px;
} }
/* line 206, ../sass/distribution/_index.scss */
/* line 207, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller {
width: 60px;
}
/* line 210, ../sass/distribution/_index.scss */
.distribution-index #orders table td.tiller label {
font-size: 12px;
cursor: pointer;
position: relative;
top: -2px;
font-weight: normal;
}
/* line 219, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions { .distribution-index #orders table td.column-actions {
text-align: right; text-align: right;
width: 230px; width: 230px;
} }
/* line 210, ../sass/distribution/_index.scss */
/* line 223, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .modal-form-order, .distribution-index #orders table td.column-actions .modal-form-order,
.distribution-index #orders table td.column-actions .modal-payment { .distribution-index #orders table td.column-actions .modal-payment {
text-align: left; text-align: left;
} }
/* line 215, ../sass/distribution/_index.scss */
/* line 228, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription { .distribution-index #orders table td.column-actions .add-subscription {
position: relative; position: relative;
} }
/* line 217, ../sass/distribution/_index.scss */
/* line 230, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus { .distribution-index #orders table td.column-actions .add-subscription .glyphicon-plus {
position: absolute; position: absolute;
top: 4px; top: 4px;
right: 4px; right: 4px;
font-size: 7px; font-size: 7px;
} }
/* line 226, ../sass/distribution/_index.scss */
/* line 239, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-state-payment { .distribution-index #orders table td.column-state-payment {
width: 120px; width: 120px;
} }
/* line 231, ../sass/distribution/_index.scss */
/* line 244, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment div.btn-group { .distribution-index #orders table td.column-payment div.btn-group {
width: 125px; width: 125px;
} }
/* line 237, ../sass/distribution/_index.scss */
/* line 250, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul { .distribution-index #orders table tr.view ul {
list-style-type: none; list-style-type: none;
margin-left: 0px; margin-left: 0px;
padding-left: 15px; padding-left: 15px;
} }
/* line 246, ../sass/distribution/_index.scss */
/* line 259, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment { .distribution-index #orders table tr.view .comment {
margin-top: 20px; margin-top: 20px;
} }
/* line 255, ../sass/distribution/_index.scss */
/* line 268, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit { .distribution-index .modal-form-order .btn-credit {
float: right; float: right;
} }
/* line 261, ../sass/distribution/_index.scss */
/* line 274, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered td { .distribution-index .modal-form-order table.table-products .product-ordered td {
background-color: #e9e9e9; background-color: #e9e9e9;
} }
/* line 265, ../sass/distribution/_index.scss */
/* line 278, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products .product-ordered input { .distribution-index .modal-form-order table.table-products .product-ordered input {
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
} }
/* line 271, ../sass/distribution/_index.scss */
/* line 284, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity { .distribution-index .modal-form-order table.table-products td.quantity {
width: 165px; width: 165px;
} }
/* line 274, ../sass/distribution/_index.scss */
/* line 287, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity input { .distribution-index .modal-form-order table.table-products td.quantity input {
text-align: center; text-align: center;
color: black; color: black;
} }
/* line 278, ../sass/distribution/_index.scss */
/* line 291, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .form-control { .distribution-index .modal-form-order table.table-products td.quantity .form-control {
border-right: 0px none; border-right: 0px none;
padding-right: 4px; padding-right: 4px;
} }
/* line 282, ../sass/distribution/_index.scss */
/* line 295, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity .input-group-addon { .distribution-index .modal-form-order table.table-products td.quantity .input-group-addon {
padding: 5px; padding: 5px;
padding-left: 0px; padding-left: 0px;
border-left: 0px none; border-left: 0px none;
border-right: 0px none; border-right: 0px none;
} }
/* line 290, ../sass/distribution/_index.scss */
/* line 303, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining { .distribution-index .modal-form-order table.table-products td.quantity-remaining {
text-align: right; text-align: right;
} }
/* line 293, ../sass/distribution/_index.scss */
/* line 306, ../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 { .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; color: #00A65A;
} }
/* line 297, ../sass/distribution/_index.scss */
/* line 310, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order table.table-products td.quantity-remaining.negative { .distribution-index .modal-form-order table.table-products td.quantity-remaining.negative {
color: #DD4B39; color: #DD4B39;
} }
/* line 301, ../sass/distribution/_index.scss */
/* line 314, ../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 { .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; font-size: 18px;
} }
/* line 308, ../sass/distribution/_index.scss */
/* line 321, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button { .distribution-index .modal-form-order .actions-form button {
margin-left: 15px; margin-left: 15px;
} }
/* line 316, ../sass/distribution/_index.scss */
/* line 329, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon { .distribution-index .modal-payment .info-box .info-box-icon {
width: 50px; width: 50px;
} }
/* line 318, ../sass/distribution/_index.scss */
/* line 331, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i { .distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px; font-size: 30px;
} }
/* line 322, ../sass/distribution/_index.scss */
/* line 335, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content { .distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px; margin-left: 50px;
} }

+ 12
- 1
backend/web/js/vuejs/distribution-index.js View File

.then(function(response) { .then(function(response) {
app.init(app.idActivePointSale) ; app.init(app.idActivePointSale) ;
}) ; }) ;
}
},
changeSynchroTiller: function(event) {
var app = this ;
var idOrder = event.currentTarget.getAttribute('data-id-order') ;
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-change-synchro-tiller",{params: {
idOrder: idOrder,
boolSynchroTiller: event.currentTarget.checked ? 1 : 0
}})
.then(function(response) {
app.init() ;
}) ;
},
}, },
}); });



+ 13
- 0
backend/web/sass/distribution/_index.scss View File

table { table {
td.tiller {
width: 60px ;
label {
font-size: 12px ;
cursor: pointer ;
position: relative ;
top: -2px ;
font-weight: normal ;
}
}
td.column-actions { td.column-actions {
text-align: right ; text-align: right ;
width: 230px ; width: 230px ;

+ 2
- 1
common/helpers/Tiller.php View File

if($this->producer_tiller) { if($this->producer_tiller) {
$ordersTiller = $this->getOrders($date) ; $ordersTiller = $this->getOrders($date) ;
$ordersOpendistrib = Order::searchAll([ $ordersOpendistrib = Order::searchAll([
'distribution.date' => $date
'distribution.date' => $date,
'order.tiller_synchronization' => 1
]) ; ]) ;


$ordersOpendistribSynchro = [] ; $ordersOpendistribSynchro = [] ;

+ 2
- 2
common/models/Order.php View File

return [ return [
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''], [['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''],
[['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'], [['id_user', 'id_point_sale', 'id_distribution','id_subscription'], 'integer'],
[['auto_payment'], 'boolean'],
[['date', 'date_update', 'comment', 'comment_point_sale'], 'safe']
[['auto_payment', 'tiller_synchronization'], 'boolean'],
[['date', 'date_update', 'comment', 'comment_point_sale', 'mean_payment'], 'safe']
]; ];
} }



+ 17
- 0
console/migrations/m191227_110133_ajout_champs_order_tiller_synchronisation.php View File

<?php

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

class m191227_110133_ajout_champs_order_tiller_synchronisation extends Migration
{
public function up()
{
$this->addColumn('order', 'tiller_synchronization', Schema::TYPE_BOOLEAN.' DEFAULT 1') ;
}

public function down()
{
$this->dropColumn('order', 'tiller_synchronization') ;
}
}

Loading…
Cancel
Save