Browse Source

[backend] Modification commande : correctif urls trop longues

dev
Guillaume 4 years ago
parent
commit
c7611853c5
2 changed files with 30 additions and 18 deletions
  1. +12
    -2
      backend/controllers/OrderController.php
  2. +18
    -16
      backend/web/js/vuejs/distribution-index.js

+ 12
- 2
backend/controllers/OrderController.php View File

@@ -899,9 +899,19 @@ class OrderController extends BackendController
* @param string $date
* @param string $comment
*/
public function actionAjaxUpdate(
$date, $idOrder, $idPointSale, $idUser, $username, $meanPayment = '', $products, $comment = '', $processCredit = 0)
public function actionAjaxUpdate()
{
$request = Yii::$app->request ;

$date = $request->post('date') ;
$idOrder = $request->post('idOrder') ;
$idPointSale = $request->post('idPointSale') ;
$idUser = $request->post('idUser') ;
$username = $request->post('username') ;
$meanPayment = $request->post('meanPayment') ;
$products = $request->post('products') ;
$comment = $request->post('comment') ;
$processCredit = $request->post('processCredit') ;

\Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;


+ 18
- 16
backend/web/js/vuejs/distribution-index.js View File

@@ -599,22 +599,24 @@ Vue.component('order-form',{
var app = this ;
if(this.checkForm()) {
var processCredit = event.currentTarget.getAttribute('data-process-credit') ;
axios.get(UrlManager.getBaseUrlAbsolute()+"order/ajax-update",{params: {
date: this.date.getFullYear() + '-'
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '-'
+ ('0' + this.date.getDate()).slice(-2),
idOrder: this.order.id,
idPointSale: this.order.id_point_sale,
meanPayment: this.order.mean_payment,
idUser: this.order.id_user,
username: ''+this.order.username,
products: JSON.stringify(this.order.productOrder),
comment: this.order.comment,
processCredit: processCredit
}})
.then(function(response) {
app.$emit('ordercreatedupdated') ;
}) ;

var data = new FormData();
data.append('date', this.date.getFullYear() + '-'
+ ('0' + (this.date.getMonth() +1)).slice(-2) + '-'
+ ('0' + this.date.getDate()).slice(-2));
data.append('idOrder', this.order.id) ;
data.append('idPointSale', this.order.id_point_sale) ;
data.append('meanPayment', this.order.mean_payment) ;
data.append('idUser', this.order.id_user) ;
data.append('username', ''+this.order.username) ;
data.append('products', JSON.stringify(this.order.productOrder)) ;
data.append('comment', this.order.comment) ;
data.append('processCredit', processCredit) ;

axios.post(UrlManager.getBaseUrlAbsolute()+"order/ajax-update",data)
.then(function(response) {
app.$emit('ordercreatedupdated') ;
}) ;
}
},
productQuantityClick: function(id_product, quantity) {

Loading…
Cancel
Save