Browse Source

Génération des BL (via page distribution) : réarrangement des boutons pour une meilleures ergonomie #179

dev
Guillaume Bourgeois 4 years ago
parent
commit
bd61c0f68c
3 changed files with 39 additions and 20 deletions
  1. +8
    -2
      backend/controllers/DistributionController.php
  2. +9
    -4
      backend/views/distribution/index.php
  3. +22
    -14
      backend/web/js/vuejs/distribution-index.js

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

@@ -1093,7 +1093,10 @@ class DistributionController extends BackendController

return [
'return' => 'success',
'alert' => 'Bon de livraison '.($isUpdate ? 'modifié' : 'généré')
'alert' => [
'type' => 'success',
'message' => 'Bon de livraison '.($isUpdate ? 'modifié' : 'généré')
]
] ;
}
}
@@ -1101,7 +1104,10 @@ class DistributionController extends BackendController

return [
'return' => 'error',
'alert' => 'Une erreur est survenue lors de la génération du bon de livraison.',
'alert' => [
'type' => 'danger',
'message' => 'Une erreur est survenue lors de la génération du bon de livraison.'
]
];
}


+ 9
- 4
backend/views/distribution/index.php View File

@@ -180,7 +180,7 @@ $this->setPageTitle('Distributions') ;
<span class="info-box-icon bg-yellow"><i class="fa fa-euro"></i></span>
<div class="info-box-content">
<span class="info-box-text">CA (TTC)</span>
<span class="info-box-number">{{ distribution.revenues }} <span class="normal" v-if="distribution.potential_revenues != '0.00 €'">/ {{ distribution.potential_revenues }}</span></span>
<span class="info-box-number">{{ distribution.revenues }} <span class="normal" v-if="distribution.potential_revenues != '0,00 €'">/ {{ distribution.potential_revenues }}</span></span>
<span class="info-box-text">Poids</span>
<span class="info-box-number">{{ distribution.weight }} kg <span class="normal" v-if="distribution.potential_weight > 0">/ {{ distribution.potential_weight }} kg</span></span>
</div>
@@ -249,7 +249,11 @@ $this->setPageTitle('Distributions') ;

<div id="buttons-top-orders">
<div class="right">
<a v-if="typeof deliveryNotes[idActivePointSale] != 'undefined'" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+deliveryNotes[idActivePointSale].id" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-file"></span> Bon de livraison</a>
<a v-if="idActivePointSale > 0" @click="generateDeliveryNote" href="javascript:void(0);" class="btn btn-default btn-xs">
<span class="glyphicon glyphicon-plus"></span>
<span v-if="deliveryNoteExist(idActivePointSale)">Regénérer le bon de livraison</span>
<span v-else>Générer un bon de livraison</span>
</a>
<button id="btn-add-subscriptions" @click="addSubscriptions" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-plus"></span> Importer les abonnements</button>
<template v-if="producer.tiller == true">
<button v-if="tillerIsSynchro" id="btn-tiller" class="btn btn-success btn-xs" disabled><span class="glyphicon glyphicon-refresh"></span> Synchronisé avec Tiller</button>
@@ -258,14 +262,15 @@ $this->setPageTitle('Distributions') ;
<button id="btn-add-order" @click="showModalFormOrderCreate = true" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-plus"></span> Ajouter une commande</button>
</div>
<div class="left">
<div v-if="idActivePointSale > 0 && oneOrderSelected()" class="btn-group">
<a v-if="deliveryNoteExist(idActivePointSale)" :href="UrlManager.getBaseUrl()+'delivery-note/update?id='+deliveryNotes[idActivePointSale].id" class="btn btn-default btn-xs"><span class="glyphicon glyphicon-file"></span> Bon de livraison</a>
<!--<div v-if="idActivePointSale > 0" class="btn-group">
<button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Action groupée <span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a @click="generateDeliveryNote" href="javascript:void(0);">Générer un bon de livraison</a></li>
</ul>
</div>
</div>-->
</div>
<div class="clr"></div>
</div>

+ 22
- 14
backend/web/js/vuejs/distribution-index.js View File

@@ -457,22 +457,30 @@ var app = new Vue({
return false ;
},
generateDeliveryNote: function() {
var app = this ;
var idOrders = {} ;
for(var key in this.orders) {
if(this.orders[key].selected == true) {
idOrders[key] = this.orders[key].id ;

if(this.oneOrderSelected()) {
var app = this ;
var idOrders = {} ;
for(var key in this.orders) {
if(this.orders[key].selected == true) {
idOrders[key] = this.orders[key].id ;
}
}
axios.get(UrlManager.getBaseUrlAbsolute()+"distribution/ajax-generate-delivery-note",{params: {
idOrders: JSON.stringify(idOrders)
}})
.then(function(response) {
appAlerts.alertResponse(response) ;
app.init(app.idActivePointSale) ;
}) ;
}
axios.get(UrlManager.getBaseUrlAbsolute()+"distribution/ajax-generate-delivery-note",{params: {
idOrders: JSON.stringify(idOrders)
}})
.then(function(response) {
if(response.data.alert && response.data.alert.length) {
appAlerts.alert(response.data.return, response.data.alert) ;
}
app.init(app.idActivePointSale) ;
}) ;
else {
appAlerts.alert('danger','Veuillez sélectionner au moins une commande pour générer un bon de livraison') ;
}

},
deliveryNoteExist: function(idPointSale) {
return typeof this.deliveryNotes[this.idActivePointSale] != 'undefined' ;
}
},
});

Loading…
Cancel
Save