Przeglądaj źródła

[backend] Ajout d'un warning aux commandes comprenant des produits non activés

dev
Guillaume Bourgeois 5 lat temu
rodzic
commit
66ff4f6ca0
2 zmienionych plików z 13 dodań i 4 usunięć
  1. +11
    -3
      backend/controllers/DistributionController.php
  2. +2
    -1
      backend/views/distribution/index.php

+ 11
- 3
backend/controllers/DistributionController.php Wyświetl plik

@@ -173,6 +173,15 @@ class DistributionController extends BackendController
$arrayCreditUser['credit'] = $order->user->userProducer[0]->credit ;
}
$oneProductUnactivated = false ;
foreach($order->productOrder as $productOrder) {
foreach($productsArray as $product) {
if($productOrder->id_product == $product['id'] && !$product['productDistribution'][0]['active']) {
$oneProductUnactivated = true ;
}
}
}
$order = array_merge($order->getAttributes(), [
'amount' => $order->getAmount(Order::AMOUNT_TOTAL),
'amount_paid' => $order->getAmount(Order::AMOUNT_PAID),
@@ -181,10 +190,9 @@ class DistributionController extends BackendController
'user' => (isset($order->user)) ? array_merge($order->user->getAttributes(), $arrayCreditUser) : null,
'pointSale' => ['id' => $order->pointSale->id, 'name' => $order->pointSale->name],
'productOrder' => $productOrderArray,
'creditHistory' => $creditHistoryArray
'creditHistory' => $creditHistoryArray,
'oneProductUnactivated' => $oneProductUnactivated
]) ;
}
}

+ 2
- 1
backend/views/distribution/index.php Wyświetl plik

@@ -288,6 +288,7 @@ $this->setPageTitle('Distributions') ;
</div>
</td>
<td class="column-actions">
<span v-if="order.oneProductUnactivated" class="glyphicon glyphicon-warning-sign" title="Contient un produit non activé"></span>
<button class="btn btn-default" :data-id-order="order.id" @click="orderViewClick"><span :class="'glyphicon ' + ((showViewProduct && idOrderView == order.id) ? 'glyphicon-eye-close' : 'glyphicon-eye-open')"></span></button>
<button class="btn btn-default" :data-id-order="order.id" @click="updateOrderClick"><span class="glyphicon glyphicon-pencil"></span></button>
<button class="btn btn-default" :data-id-order="order.id" @click="deleteOrderClick"><span class="glyphicon glyphicon-trash"></span></button>
@@ -408,7 +409,7 @@ $this->setPageTitle('Distributions') ;
<strong><span class="glyphicon glyphicon-menu-right"></span> Produits</strong>
<ul>
<li v-for="product in products" v-if="order.productOrder[product.id] > 0">
{{ order.productOrder[product.id] }} x {{ product.name }}
{{ order.productOrder[product.id] }} x {{ product.name }} <span v-if="product.productDistribution[0].active == 0" class="glyphicon glyphicon-warning-sign" title="Ce produit n'est pas activé"></span>
</li>
</ul>
<div v-if="order.comment && order.comment.length > 0" class="comment">

Ładowanie…
Anuluj
Zapisz