Browse Source

[producer] Pouvoir afficher un produit non commandable pour faire office de titre

refactoring
Guillaume 4 years ago
parent
commit
7dfb930f13
2 changed files with 18 additions and 14 deletions
  1. +2
    -2
      common/models/Product.php
  2. +16
    -12
      producer/views/order/order.php

+ 2
- 2
common/models/Product.php View File

@@ -337,8 +337,8 @@ class Product extends ActiveRecordCommon
*/
public function getPriceWithTax()
{
return Price::getPriceWithTax($this->price, $this->taxRate->value);
$taxRateValue = $this->taxRate ? $this->taxRate->value : 0 ;
return Price::getPriceWithTax($this->price, $taxRateValue);
}

public function getTheTaxRate()

+ 16
- 12
producer/views/order/order.php View File

@@ -195,22 +195,26 @@ $this->setTitle('Commander') ;
<div class="recipe" v-if="product.recipe.length">{{ product.recipe }}</div>
</td>
<td class="price-unit">
{{ formatPrice(product.price_with_tax) }}<br /><span class="unit">{{ product.wording_unit }}</span>
<template v-if="product.price_with_tax > 0">{{ formatPrice(product.price_with_tax) }}<br /><span class="unit">{{ product.wording_unit }}</span></template>
</td>
<td class="td-quantity">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" :disabled="product.quantity_form == 0"><span class="glyphicon glyphicon-minus"></span></button>
</span>
<input type="text" v-model="product.quantity_form" class="form-control quantity" readonly="readonly" />
<span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
<span class="input-group-btn">
<button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span class="glyphicon glyphicon-plus"></span></button>
</span>
</div>
<template v-if="product.price_with_tax > 0">
<div class="input-group">
<span class="input-group-btn">
<button class="btn btn-default btn-moins" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? -1 : -parseFloat(product.step))" :disabled="product.quantity_form == 0"><span class="glyphicon glyphicon-minus"></span></button>
</span>
<input type="text" v-model="product.quantity_form" class="form-control quantity" readonly="readonly" />
<span class="input-group-addon">{{ product.unit == 'piece' ? 'p.' : product.unit }}</span>
<span class="input-group-btn">
<button class="btn btn-default btn-plus" type="button" @click="productQuantityClick(product, product.unit == 'piece' ? 1 : parseFloat(product.step))" :disabled="product.quantity_form == product.quantity_remaining && product.quantity_max > 0"><span class="glyphicon glyphicon-plus"></span></button>
</span>
</div>
</template>
</td>
<td class="price-total">
{{ formatPrice(product.price_with_tax * (product.quantity_form / product.coefficient_unit )) }}
<template v-if="product.price_with_tax > 0 && product.quantity_form > 0">
{{ formatPrice(product.price_with_tax * (product.quantity_form / product.coefficient_unit )) }}
</template>
</td>
</tr>
<tr class="total">

Loading…
Cancel
Save