Browse Source

Création des bons de livraison uniquement depuis la page des distributions

dev
Guillaume Bourgeois 4 years ago
parent
commit
03a5f9db53
4 changed files with 23 additions and 5 deletions
  1. +1
    -1
      backend/views/delivery-note/index.php
  2. +1
    -1
      backend/views/distribution/index.php
  3. +6
    -2
      backend/web/js/vuejs/alerts.js
  4. +15
    -1
      backend/web/js/vuejs/distribution-index.js

+ 1
- 1
backend/views/delivery-note/index.php View File

@@ -38,7 +38,7 @@

$this->setTitle('Bons de livraison');
$this->addBreadcrumb($this->getTitle());
$this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon glyphicon-plus"></span>', 'url' => 'delivery-note/create', 'class' => 'btn btn-primary']);
$this->addButton(['label' => 'Nouveau bon de livraison <span class="glyphicon glyphicon-plus"></span>', 'url' => ['distribution/index', 'message_generate_bl' => 1], 'class' => 'btn btn-primary']);

?>


+ 1
- 1
backend/views/distribution/index.php View File

@@ -279,7 +279,7 @@ $this->setPageTitle('Distributions') ;
<thead>
<tr>
<th v-if="idActivePointSale > 0">
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrders" />
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrdersEvent" />
</th>
<th>Origine</th>
<th>État</th>

+ 6
- 2
backend/web/js/vuejs/alerts.js View File

@@ -14,7 +14,7 @@ var appAlerts = new Vue({
this.alert(response.data.alert.type, response.data.alert.message) ;
}
},
alert: function(type, message) {
alert: function(type, message, timeout) {
var app = this ;
var index = this.alerts.length ;
this.alerts.splice(index, 0, {
@@ -27,8 +27,12 @@ var appAlerts = new Vue({
app.alerts[index].display = display ;
} ;

if(!timeout) {
timeout = 3000 ;
}

setTimeout(functionDisplayAlert, 500, app, index, true) ;
setTimeout(functionDisplayAlert, 3000, app, index, false) ;
setTimeout(functionDisplayAlert, timeout, app, index, false) ;

}
}

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

@@ -74,6 +74,7 @@ var app = new Vue({
showLoading: false,
tillerIsSynchro: false,
checkboxSelectAllOrders: false,
messageGenerateDeliveryNoteDisplayed: false,
calendar: {
mode: 'single',
attrs: [],
@@ -211,6 +212,12 @@ var app = new Vue({
app.showLoading = false ;
app.checkboxSelectAllOrders = false ;

let searchParams = new URLSearchParams(window.location.search) ;
if(searchParams.has('message_generate_bl') && !app.messageGenerateDeliveryNoteDisplayed) {
appAlerts.alert('info','Pour générer un bon de livraison, sélectionnez tout d\'abord un jour et un lieu de distribution.', 6000) ;
app.messageGenerateDeliveryNoteDisplayed = true ;
}
}) ;
},
initCountActiveProducts: function() {
@@ -440,8 +447,11 @@ var app = new Vue({
app.init() ;
}) ;
},
selectAllOrders: function(event) {
selectAllOrdersEvent: function(event) {
var bool = event.currentTarget.checked ;
this.selectAllOrders(bool) ;
},
selectAllOrders: function(bool) {
for(var key in this.orders) {
if(this.orders[key].id_point_sale == this.idActivePointSale) {
this.orders[key].selected = bool ;
@@ -458,6 +468,10 @@ var app = new Vue({
},
generateDeliveryNote: function() {

if(!this.oneOrderSelected()) {
this.selectAllOrders(true) ;
}

if(this.oneOrderSelected()) {
var app = this ;
var idOrders = {} ;

Loading…
Cancel
Save