Browse Source

[Administration] Distributions : mise en avant des dépassements de quantités #1186

feature/souke
Guillaume Bourgeois 1 year ago
parent
commit
dbcb472c83
2 changed files with 17 additions and 3 deletions
  1. +6
    -2
      backend/views/distribution/index.php
  2. +11
    -1
      backend/web/js/vuejs/distribution-index.js

+ 6
- 2
backend/views/distribution/index.php View File

:users="users" :users="users"
:products="products" :products="products"
:order="ordersUpdate[key]" :order="ordersUpdate[key]"
:orders="ordersUpdate"
:producer="producer" :producer="producer"
:loading-update-product-order="loadingUpdateProductOrder" :loading-update-product-order="loadingUpdateProductOrder"
@close="showModalFormOrderUpdate = false" @close="showModalFormOrderUpdate = false"
</div> </div>
</td> </td>
<td class="quantity-remaining infinite" v-if="product.quantity_remaining === null || order.productOrder[product.id].unit != product.unit">&infin;</td> <td class="quantity-remaining infinite" v-if="product.quantity_remaining === null || order.productOrder[product.id].unit != product.unit">&infin;</td>
<td class="quantity-remaining negative" v-else-if="product.quantity_remaining <= 0">{{ product.quantity_remaining }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
<td class="quantity-remaining has-quantity" v-else>{{ product.quantity_remaining }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
<td class="quantity-remaining negative" v-else-if="getProductQuantityRemaining(product) <= 0">
{{ getProductQuantityRemaining(product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}
<span class="glyphicon glyphicon-alert" v-if="getProductQuantityRemaining(product) < 0"></span>
</td>
<td class="quantity-remaining has-quantity" v-else>{{ getProductQuantityRemaining(product) }} {{ order.productOrder[product.id].unit == 'piece' ? ' p.' : ' '+(order.productOrder[product.id].unit == 'g' || order.productOrder[product.id].unit == 'kg') ? 'kg' : 'litre(s)' }}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

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

}); });


Vue.component('order-form', { Vue.component('order-form', {
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'producer', 'loadingUpdateProductOrder'],
props: ['date', 'dateFormat', 'pointsSale', 'idActivePointSale', 'meansPayment', 'users', 'products', 'order', 'orders', 'producer', 'loadingUpdateProductOrder'],
emits: ['updateProductPrice', 'updateInvoicePrices'], emits: ['updateProductPrice', 'updateInvoicePrices'],
data: function () { data: function () {
return { return {
} else { } else {
this.vatMode = 'all'; this.vatMode = 'all';
} }
},
getProductQuantityRemaining: function(product) {
var app = this;
var productQuantityOrder = 0;

for(key in app.orders) {
var order = app.orders[key];
productQuantityOrder += order.productOrder[product.id].quantity;
}
return product.productDistribution[0].quantity_max - productQuantityOrder;
} }
} }
}); });

Loading…
Cancel
Save