<a class="btn btn-default btn-primary" v-if="idActivePointSale == 0">Tous <span class="label label-default">{{ orders.length }}</span> <span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default btn-primary" v-if="idActivePointSale == 0">Tous <span class="label label-default">{{ orders.length }}</span> <span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
<a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default" v-else>Tous <span class="label label-default">{{ orders.length }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
</li> | </li> | ||||
<li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1" @click="pointSaleClick"> | |||||
<li v-for="pointSale in pointsSale" :data-id-point-sale="pointSale.id" v-if="pointSale.pointSaleDistribution[0].delivery == 1 && (pointSale.status == 1 || countOrdersByPointSale[pointSale.id] > 0)" @click="pointSaleClick"> | |||||
<a class="btn btn-default btn-primary" v-if="idActivePointSale == pointSale.id">{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default btn-primary" v-if="idActivePointSale == pointSale.id">{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
<a class="btn btn-default" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | <a class="btn btn-default" v-else>{{ pointSale.name }} <span class="label label-default">{{ countOrdersByPointSale[pointSale.id] }}</span><span class="glyphicon glyphicon-triangle-bottom"></span></a> | ||||
</li> | </li> |
} | } | ||||
}, | }, | ||||
initPointsSale: function(idActivePointSale) { | initPointsSale: function(idActivePointSale) { | ||||
this.countOrdersByPointSale = [] ; | |||||
for(var i = 0; i < this.pointsSale.length ; i++) { | |||||
this.countOrdersByPointSale[this.pointsSale[i].id] = 0 ; | |||||
} | |||||
for(var i = 0; i < this.orders.length ; i++) { | |||||
this.countOrdersByPointSale[this.orders[i].id_point_sale] ++ ; | |||||
} | |||||
this.countActivePointsSale = 0 ; | this.countActivePointsSale = 0 ; | ||||
this.setIdActivePointSale(0) ; | this.setIdActivePointSale(0) ; | ||||
for(var i= 0; i < this.pointsSale.length; i++) { | for(var i= 0; i < this.pointsSale.length; i++) { | ||||
if(this.pointsSale[i].pointSaleDistribution[0].delivery == 1) { | |||||
this.countActivePointsSale ++ ; | |||||
this.setIdActivePointSale(this.pointsSale[i].id) ; | |||||
} | |||||
if(this.pointsSale[i].pointSaleDistribution[0].delivery == 1 && (this.pointsSale[i].status == 1 || this.countOrdersByPointSale[this.pointsSale[i].id] > 0)) { | |||||
this.countActivePointsSale ++ ; | |||||
this.setIdActivePointSale(this.pointsSale[i].id) ; | |||||
} | |||||
} | } | ||||
if(this.countActivePointsSale > 1) { | if(this.countActivePointsSale > 1) { | ||||
this.setIdActivePointSale(0) ; | this.setIdActivePointSale(0) ; | ||||
if(idActivePointSale) { | if(idActivePointSale) { | ||||
this.setIdActivePointSale(idActivePointSale) ; | this.setIdActivePointSale(idActivePointSale) ; | ||||
} | } | ||||
this.countOrdersByPointSale = [] ; | |||||
for(var i = 0; i < this.pointsSale.length ; i++) { | |||||
this.countOrdersByPointSale[this.pointsSale[i].id] = 0 ; | |||||
} | |||||
for(var i = 0; i < this.orders.length ; i++) { | |||||
this.countOrdersByPointSale[this.orders[i].id_point_sale] ++ ; | |||||
} | |||||
}, | }, | ||||
dayClicked: function(day) { | dayClicked: function(day) { | ||||
this.date = day.date ; | this.date = day.date ; |