if ($credit_historique->load(Yii::$app->request->post()) && $credit_historique->validate()) | if ($credit_historique->load(Yii::$app->request->post()) && $credit_historique->validate()) | ||||
{ | { | ||||
$credit_historique->id_user = $user->id ; | $credit_historique->id_user = $user->id ; | ||||
$credit_historique->id_user_action = Yii::$app->user->identity->id ; | |||||
$credit_historique->id_etablissement = Yii::$app->user->identity->id_etablissement ; | $credit_historique->id_etablissement = Yii::$app->user->identity->id_etablissement ; | ||||
if($credit_historique->type == CreditHistorique::TYPE_DEBIT && $credit_historique->montant > 0) | if($credit_historique->type == CreditHistorique::TYPE_DEBIT && $credit_historique->montant > 0) | ||||
$credit_historique->montant = - $credit_historique->montant ; | $credit_historique->montant = - $credit_historique->montant ; | ||||
} | } | ||||
$historique = CreditHistorique::find() | $historique = CreditHistorique::find() | ||||
->with('commande') | |||||
->with(['commande','userAction']) | |||||
->where([ | ->where([ | ||||
'id_user' => $user->id, | 'id_user' => $user->id, | ||||
'id_etablissement' => Yii::$app->user->identity->id_etablissement, | 'id_etablissement' => Yii::$app->user->identity->id_etablissement, |
</div> | </div> | ||||
<div class="col-md-12"> | <div class="col-md-12"> | ||||
<h2>Historique</h2> | |||||
<h2>Historique <span class="the-credit"><?= number_format($user->getCredit($etablissement->id), 2); ?> €</span></h2> | |||||
<table class="table table-bordered"> | <table class="table table-bordered"> | ||||
<thead> | <thead> | ||||
<tr> | <tr> | ||||
<th>Date</th> | <th>Date</th> | ||||
<th>Utilisateur</th> | |||||
<th>Type</th> | <th>Type</th> | ||||
<th>Montant</th> | <th>Montant</th> | ||||
<th>Paiement</th> | <th>Paiement</th> | ||||
<?php foreach($historique as $ch): ?> | <?php foreach($historique as $ch): ?> | ||||
<tr> | <tr> | ||||
<td><?= date('d/m/Y à H:i:s',strtotime($ch->date)) ?></td> | <td><?= date('d/m/Y à H:i:s',strtotime($ch->date)) ?></td> | ||||
<td><?php if(isset($ch->userAction)): echo Html::encode($ch->userAction->nom. ' '.$ch->userAction->prenom) ; else: echo 'Administrateur' ;endif; ?></td> | |||||
<td> | <td> | ||||
<?php if($ch->type == CreditHistorique::TYPE_CREDIT_INITIAL): ?>Crédit initial<?php endif; ?> | <?php if($ch->type == CreditHistorique::TYPE_CREDIT_INITIAL): ?>Crédit initial<?php endif; ?> | ||||
<?php if($ch->type == CreditHistorique::TYPE_CREDIT): ?>Crédit<?php endif; ?> | <?php if($ch->type == CreditHistorique::TYPE_CREDIT): ?>Crédit<?php endif; ?> |
text-align: center; | text-align: center; | ||||
} | } | ||||
/* line 1175, ../sass/screen.scss */ | |||||
.user-credit .the-credit { | |||||
float: right; | |||||
font-weight: bold; | |||||
background-color: #BB8757; | |||||
color: white; | |||||
-moz-border-radius: 8px; | |||||
-webkit-border-radius: 8px; | |||||
border-radius: 8px; | |||||
padding: 3px 10px; | |||||
padding-top: 7px; | |||||
position: relative; | |||||
top: -12px; | |||||
} | |||||
/* facturation */ | /* facturation */ | ||||
/* line 1176, ../sass/screen.scss */ | |||||
/* line 1190, ../sass/screen.scss */ | |||||
#estimation-facture { | #estimation-facture { | ||||
padding: 20px; | padding: 20px; | ||||
background-color: #F9F9F9; | background-color: #F9F9F9; | ||||
} | } | ||||
/* line 1180, ../sass/screen.scss */ | |||||
/* line 1194, ../sass/screen.scss */ | |||||
#estimation-facture h2 { | #estimation-facture h2 { | ||||
font-family: "myriadpro-it"; | font-family: "myriadpro-it"; | ||||
} | } | ||||
/* line 1184, ../sass/screen.scss */ | |||||
/* line 1198, ../sass/screen.scss */ | |||||
#estimation-facture .montant span { | #estimation-facture .montant span { | ||||
font-size: 25px; | font-size: 25px; | ||||
color: white; | color: white; | ||||
padding-top: 7px; | padding-top: 7px; | ||||
font-family: "myriadpro-regular"; | font-family: "myriadpro-regular"; | ||||
} | } | ||||
/* line 1195, ../sass/screen.scss */ | |||||
/* line 1209, ../sass/screen.scss */ | |||||
#estimation-facture label { | #estimation-facture label { | ||||
text-transform: uppercase; | text-transform: uppercase; | ||||
font-family: "myriadpro-light"; | font-family: "myriadpro-light"; | ||||
font-size: 20px; | font-size: 20px; | ||||
} | } | ||||
/* line 1200, ../sass/screen.scss */ | |||||
/* line 1214, ../sass/screen.scss */ | |||||
#estimation-facture label span { | #estimation-facture label span { | ||||
font-size: 16px; | font-size: 16px; | ||||
} | } | ||||
/* line 1205, ../sass/screen.scss */ | |||||
/* line 1219, ../sass/screen.scss */ | |||||
#estimation-facture #etablissement-prix_libre { | #estimation-facture #etablissement-prix_libre { | ||||
width: 100px; | width: 100px; | ||||
height: 60px; | height: 60px; |
} | } | ||||
} | } | ||||
.user-credit { | |||||
.the-credit { | |||||
float: right ; | |||||
font-weight: bold ; | |||||
background-color: $color1 ; | |||||
color: white ; | |||||
@include border-radius(8px) ; | |||||
padding: 3px 10px ; | |||||
padding-top: 7px ; | |||||
position: relative ; | |||||
top: -12px ; | |||||
} | |||||
} | |||||
/* facturation */ | /* facturation */ | ||||
#estimation-facture { | #estimation-facture { |