@@ -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']); | |||
?> | |||
@@ -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> |
@@ -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) ; | |||
} | |||
} |
@@ -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 = {} ; |