$this->setTitle('Bons de livraison'); | $this->setTitle('Bons de livraison'); | ||||
$this->addBreadcrumb($this->getTitle()); | $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']); | |||||
?> | ?> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th v-if="idActivePointSale > 0"> | <th v-if="idActivePointSale > 0"> | ||||
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrders" /> | |||||
<input type="checkbox" v-model="checkboxSelectAllOrders" @change="selectAllOrdersEvent" /> | |||||
</th> | </th> | ||||
<th>Origine</th> | <th>Origine</th> | ||||
<th>État</th> | <th>État</th> |
this.alert(response.data.alert.type, response.data.alert.message) ; | this.alert(response.data.alert.type, response.data.alert.message) ; | ||||
} | } | ||||
}, | }, | ||||
alert: function(type, message) { | |||||
alert: function(type, message, timeout) { | |||||
var app = this ; | var app = this ; | ||||
var index = this.alerts.length ; | var index = this.alerts.length ; | ||||
this.alerts.splice(index, 0, { | this.alerts.splice(index, 0, { | ||||
app.alerts[index].display = display ; | app.alerts[index].display = display ; | ||||
} ; | } ; | ||||
if(!timeout) { | |||||
timeout = 3000 ; | |||||
} | |||||
setTimeout(functionDisplayAlert, 500, app, index, true) ; | setTimeout(functionDisplayAlert, 500, app, index, true) ; | ||||
setTimeout(functionDisplayAlert, 3000, app, index, false) ; | |||||
setTimeout(functionDisplayAlert, timeout, app, index, false) ; | |||||
} | } | ||||
} | } |
showLoading: false, | showLoading: false, | ||||
tillerIsSynchro: false, | tillerIsSynchro: false, | ||||
checkboxSelectAllOrders: false, | checkboxSelectAllOrders: false, | ||||
messageGenerateDeliveryNoteDisplayed: false, | |||||
calendar: { | calendar: { | ||||
mode: 'single', | mode: 'single', | ||||
attrs: [], | attrs: [], | ||||
app.showLoading = false ; | app.showLoading = false ; | ||||
app.checkboxSelectAllOrders = 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() { | initCountActiveProducts: function() { | ||||
app.init() ; | app.init() ; | ||||
}) ; | }) ; | ||||
}, | }, | ||||
selectAllOrders: function(event) { | |||||
selectAllOrdersEvent: function(event) { | |||||
var bool = event.currentTarget.checked ; | var bool = event.currentTarget.checked ; | ||||
this.selectAllOrders(bool) ; | |||||
}, | |||||
selectAllOrders: function(bool) { | |||||
for(var key in this.orders) { | for(var key in this.orders) { | ||||
if(this.orders[key].id_point_sale == this.idActivePointSale) { | if(this.orders[key].id_point_sale == this.idActivePointSale) { | ||||
this.orders[key].selected = bool ; | this.orders[key].selected = bool ; | ||||
}, | }, | ||||
generateDeliveryNote: function() { | generateDeliveryNote: function() { | ||||
if(!this.oneOrderSelected()) { | |||||
this.selectAllOrders(true) ; | |||||
} | |||||
if(this.oneOrderSelected()) { | if(this.oneOrderSelected()) { | ||||
var app = this ; | var app = this ; | ||||
var idOrders = {} ; | var idOrders = {} ; |