fitness-web/backend/views/contract/details.php

114 lines
2.4 KiB
PHP

<?php
use yii\grid\GridView;
use common\models\TicketInstallmentRequest;
use yii\helpers\Html;
use common\models\Contract;
use yii\widgets\DetailView;
use common\components\RoleDefinition;
?>
<h1>Szerződés részletei</h1>
<div class="row">
<div class="col-md-6">
<table class="table ">
<tr>
<th>
Vendég
</th>
<td>
<?php echo $model->customer->name ;?>
</td>
</tr>
<tr>
<th>
Kártyaszám
</th>
<td>
<?php echo $model->customer->card->number ;?>
</td>
</tr>
</table>
</div>
</div>
<div class="row">
<div class="col-md-6">
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_contract',
[
'attribute' => 'id_user',
'value' => $model->userName
],
[
'attribute' => 'id_customer',
'value' => $model->customerName
],
[
'attribute' => 'flag',
'value' => $model->flagName
],
[
'attribute' => 'status',
'value' => $model->statusName
],
'part_paid',
'part_required',
'part_count',
'started_at:datetime',
'expired_at:datetime',
'created_at:datetime',
'updated_at:datetime',
],
]) ?>
</div>
</div>
<?php
if ( RoleDefinition::isAdmin() ){
if ( $model->flag == Contract::$FLAG_ACTIVE ){
echo Html::a(Yii::t('common/contract', 'Szerződés törlése'), ['delete', 'id' => $model->id_contract], [
'class' => 'btn btn-danger',
'data' => [
'confirm' => Yii::t('common/contract', 'Biztosan szerenté törölni a bérletet?'),
'method' => 'post',
],
]);
}else{
echo "<p>Szerződés nem törölhető! </p>";
}
}
?>
<h2>Fizetési részletek</h2>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'id_ticket_installment_request' ,
'label' => 'Részlet azonosító'
],
[
'attribute' => 'request_target_time_at' ,
'label' => 'Esedékességi dátum',
'format' => 'date'
],
[
'attribute' => 'priority' ,
'label' => 'Sorszám'
],
[
'attribute' => 'status' ,
'label' => 'Státusz',
'value' => function ($model, $key, $index, $column){
return TicketInstallmentRequest::toStatusName($model->status);
}
],
]
]);
?>