Browse Source

[Backend] Affichage du bon crédit utilisateur dans la modal de paiement des commandes

refactoring
Guillaume Bourgeois 6 years ago
parent
commit
b62e085566
2 changed files with 10 additions and 3 deletions
  1. +8
    -1
      backend/controllers/DistributionController.php
  2. +2
    -2
      backend/views/distribution/index.php

+ 8
- 1
backend/controllers/DistributionController.php View File

@@ -167,16 +167,23 @@ class DistributionController extends BackendController
] ;
}
$arrayCreditUser = [] ;
if(isset($order->user) && isset($order->user->userProducer)) {
$arrayCreditUser['credit'] = $order->user->userProducer[0]->credit ;
}
$order = array_merge($order->getAttributes(), [
'amount' => $order->getAmount(Order::AMOUNT_TOTAL),
'amount_paid' => $order->getAmount(Order::AMOUNT_PAID),
'amount_remaining' => $order->getAmount(Order::AMOUNT_REMAINING),
'amount_surplus' => $order->getAmount(Order::AMOUNT_SURPLUS),
'user' => (isset($order->user)) ? $order->user->getAttributes() : null,
'user' => (isset($order->user)) ? array_merge($order->user->getAttributes(), $arrayCreditUser) : null,
'pointSale' => ['id' => $order->pointSale->id, 'name' => $order->pointSale->name],
'productOrder' => $productOrderArray,
'creditHistory' => $creditHistoryArray
]) ;
}
}

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

@@ -294,10 +294,10 @@ $this->setPageTitle('Distributions') ;
</div>
<div class="info-box">
<span class="info-box-icon bg-yellow"><i class="fa fa-user"></i></span>
<span :class="'info-box-icon ' +((order.user.credit > 0) ? 'bg-green' : 'bg-red')"><i class="fa fa-user"></i></span>
<div class="info-box-content">
<span class="info-box-text">Crédit utilisateur</span>
<span class="info-box-number">24,00 €</span>
<span class="info-box-number">{{ order.user.credit.toFixed(2).replace(/(\d)(?=(\d{3})+(?:\.\d+)?$)/g, "$1,")+' €' }}</span>
</div>
</div>

Loading…
Cancel
Save