Bladeren bron

[Administration] Distribution > édition commande : alerte si quantité max d'un produit dépassée #1023

feature/souke
Guillaume Bourgeois 1 jaar geleden
bovenliggende
commit
2ee6a67b88
2 gewijzigde bestanden met toevoegingen van 21 en 4 verwijderingen
  1. +7
    -3
      backend/views/distribution/index.php
  2. +14
    -1
      backend/web/js/vuejs/distribution-index.js

+ 7
- 3
backend/views/distribution/index.php Bestand weergeven

@@ -107,7 +107,9 @@ $this->setPageTitle('Distributions') ;
<span class="info-box-icon bg-yellow"><i class="fa fa-clone"></i></span>
<div class="info-box-content">
<span class="info-box-text">
{{ countActiveProducts }} Produits<br /><br />
{{ countActiveProducts }} Produits<br />
<template v-if="isOneProductMaximumQuantityExceeded()"><span class="glyphicon glyphicon-alert"></span> Quantités max dépassées<br /></template>
<br />
<button class="btn btn-default" @click="showModalProducts = true">Configurer</button>
</span>
</div>
@@ -134,13 +136,15 @@ $this->setPageTitle('Distributions') ;
<button class="btn btn-default" v-else data-active-product="0" :data-id-product="product.id" @click="productActiveClick"><span class="glyphicon glyphicon-remove"></span></button>
</td>
<td>{{ product.name }}</td>
<td class="quantity-ordered">{{ product.quantity_ordered ? product.quantity_ordered + ' '+ ((product.unit == 'piece') ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') : '&empty;' }}</td>
<td class="quantity-ordered">
<span v-if="isProductMaximumQuantityExceeded(product)" class="glyphicon glyphicon-alert"></span>
{{ product.quantity_ordered ? product.quantity_ordered + ' '+ ((product.unit == 'piece') ? ' p.' : ' '+(product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') : '&empty;' }}
</td>
<td class="quantity-max">
<div class="input-group">
<input type="text" class="form-control quantity-max" placeholder="&infin;" :data-id-product="product.id" v-model="product.productDistribution[0].quantity_max" @keyup="productQuantityMaxChange" />
<span class="input-group-addon">{{ (product.unit == 'piece') ? 'p.' : ' '+((product.unit == 'g' || product.unit == 'kg') ? 'kg' : 'litre(s)') }}</span>
</div>

</td>
</tr>
</tbody>

+ 14
- 1
backend/web/js/vuejs/distribution-index.js Bestand weergeven

@@ -298,7 +298,20 @@ var app = new Vue({
}
}
this.initCountActiveProducts() ;
},
isOneProductMaximumQuantityExceeded: function() {
for(var i= 0; i < this.products.length; i++) {
if(this.isProductMaximumQuantityExceeded(this.products[i])) {
return true;
}
}

return false;
},
isProductMaximumQuantityExceeded: function(product) {
return product.productDistribution[0].quantity_max
&& product.quantity_ordered
&& product.quantity_ordered > product.productDistribution[0].quantity_max;
},
pointSaleActiveClick: function(event) {
var idPointSale = event.currentTarget.getAttribute('data-id-point-sale') ;

Laden…
Annuleren
Opslaan