瀏覽代碼

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

refactoring
Guillaume Bourgeois 5 年之前
父節點
當前提交
b62e085566
共有 2 個文件被更改,包括 10 次插入3 次删除
  1. +8
    -1
      backend/controllers/DistributionController.php
  2. +2
    -2
      backend/views/distribution/index.php

+ 8
- 1
backend/controllers/DistributionController.php 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存