瀏覽代碼

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

refactoring
Guillaume Bourgeois 4 年之前
父節點
當前提交
2f1f9c790c
共有 9 個檔案被更改,包括 112 行新增28 行删除
  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 查看文件

@@ -917,7 +917,8 @@ class DistributionController extends BackendController
if(!$isSynchro) {
$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) ;

+ 24
- 0
backend/controllers/OrderController.php 查看文件

@@ -1075,6 +1075,30 @@ class OrderController extends BackendController

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 查看文件

@@ -309,6 +309,11 @@ $this->setPageTitle('Distributions') ;
</ul>
</div>
</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">
<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>

+ 35
- 23
backend/web/css/screen.css 查看文件

@@ -1983,73 +1983,85 @@ termes.
-webkit-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 {
text-align: right;
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-payment {
text-align: left;
}
/* line 215, ../sass/distribution/_index.scss */
/* line 228, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-actions .add-subscription {
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 {
position: absolute;
top: 4px;
right: 4px;
font-size: 7px;
}
/* line 226, ../sass/distribution/_index.scss */
/* line 239, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-state-payment {
width: 120px;
}
/* line 231, ../sass/distribution/_index.scss */
/* line 244, ../sass/distribution/_index.scss */
.distribution-index #orders table td.column-payment div.btn-group {
width: 125px;
}
/* line 237, ../sass/distribution/_index.scss */
/* line 250, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view ul {
list-style-type: none;
margin-left: 0px;
padding-left: 15px;
}
/* line 246, ../sass/distribution/_index.scss */
/* line 259, ../sass/distribution/_index.scss */
.distribution-index #orders table tr.view .comment {
margin-top: 20px;
}
/* line 255, ../sass/distribution/_index.scss */
/* line 268, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .btn-credit {
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 {
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 {
font-size: 16px;
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 {
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 {
text-align: center;
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 {
border-right: 0px none;
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 {
padding: 5px;
padding-left: 0px;
@@ -2057,35 +2069,35 @@ termes.
border-left: 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 {
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 {
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 {
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 {
font-size: 18px;
}
/* line 308, ../sass/distribution/_index.scss */
/* line 321, ../sass/distribution/_index.scss */
.distribution-index .modal-form-order .actions-form button {
margin-left: 15px;
}
/* line 316, ../sass/distribution/_index.scss */
/* line 329, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon {
width: 50px;
}
/* line 318, ../sass/distribution/_index.scss */
/* line 331, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-icon i {
font-size: 30px;
}
/* line 322, ../sass/distribution/_index.scss */
/* line 335, ../sass/distribution/_index.scss */
.distribution-index .modal-payment .info-box .info-box-content {
margin-left: 50px;
}

+ 12
- 1
backend/web/js/vuejs/distribution-index.js 查看文件

@@ -412,7 +412,18 @@ var app = new Vue({
.then(function(response) {
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 查看文件

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

+ 2
- 1
common/helpers/Tiller.php 查看文件

@@ -76,7 +76,8 @@ class Tiller
if($this->producer_tiller) {
$ordersTiller = $this->getOrders($date) ;
$ordersOpendistrib = Order::searchAll([
'distribution.date' => $date
'distribution.date' => $date,
'order.tiller_synchronization' => 1
]) ;

$ordersOpendistribSynchro = [] ;

+ 2
- 2
common/models/Order.php 查看文件

@@ -94,8 +94,8 @@ class Order extends ActiveRecordCommon
return [
[['id_user', 'date', 'id_point_sale', 'id_distribution'], 'required', 'message' => ''],
[['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 查看文件

@@ -0,0 +1,17 @@
<?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…
取消
儲存