add contract

This commit is contained in:
2016-01-25 01:43:19 +01:00
parent fd4d38ab44
commit df14401b28
47 changed files with 2868 additions and 766 deletions

View File

@@ -0,0 +1,43 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="contract-form">
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_contract')->textInput() ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'id_customer')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'flag')->textInput() ?>
<?= $form->field($model, 'part_paid')->textInput() ?>
<?= $form->field($model, 'part_count')->textInput() ?>
<?= $form->field($model, 'part_required')->textInput() ?>
<?= $form->field($model, 'expired_at')->textInput() ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/contract', 'Create') : Yii::t('common/contract', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,47 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\ContractSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="contract-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<?= $form->field($model, 'id_contract') ?>
<?= $form->field($model, 'id_user') ?>
<?= $form->field($model, 'id_customer') ?>
<?= $form->field($model, 'status') ?>
<?= $form->field($model, 'flag') ?>
<?php // echo $form->field($model, 'part_paid') ?>
<?php // echo $form->field($model, 'part_count') ?>
<?php // echo $form->field($model, 'part_required') ?>
<?php // echo $form->field($model, 'expired_at') ?>
<?php // echo $form->field($model, 'created_at') ?>
<?php // echo $form->field($model, 'updated_at') ?>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/contract', 'Search'), ['class' => 'btn btn-primary']) ?>
<?= Html::resetButton(Yii::t('common/contract', 'Reset'), ['class' => 'btn btn-default']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,21 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = Yii::t('common/contract', 'Create Contract');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Contracts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-create">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,58 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\ContractSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = $searchModel->customer->name . " szerződései";
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
'id_contract',
[
'attribute' => 'id_customer',
'value' => 'customerName'
],
[
'attribute' => 'id_user',
'value' => 'userName'
],
// 'part_paid',
// 'part_count',
// 'part_required',
'expired_at:datetime',
'created_at:datetime',
// 'updated_at',
['class' => 'yii\grid\ActionColumn',
'template' => '{details}',
'buttons' => [
'details' => function ($url, $model, $key) {
return Html::a('Fizetési részletek', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
],
'urlCreator' => function ($action, $model, $key, $index){
$url = "";
if ( 'details' == $action ){
$url = Url::to(['contract/view','id' => $model->id_contract]);
}
return $url;
}
],
],
]); ?>
</div>

View File

@@ -0,0 +1,23 @@
<?php
use yii\helpers\Html;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = Yii::t('common/contract', 'Update {modelClass}: ', [
'modelClass' => 'Contract',
]) . ' ' . $model->id_contract;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Contracts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_contract, 'url' => ['view', 'id' => $model->id_contract]];
$this->params['breadcrumbs'][] = Yii::t('common/contract', 'Update');
?>
<div class="contract-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
'model' => $model,
]) ?>
</div>

View File

@@ -0,0 +1,99 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
use common\models\TicketInstallmentRequest;
/* @var $this yii\web\View */
/* @var $model common\models\Contract */
$this->title = $model->id_contract;
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/contract', 'Szerződések'), 'url' => ['index', 'id_card' => $card->id_card]];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="contract-view">
<h1><?= Html::encode($this->title) ?></h1>
<?= 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',
'expired_at:datetime',
'created_at:datetime',
],
]) ?>
<?php if ( $model->canCancel() ){?>
<div class="row">
<div class="col-md-12">
<?php
echo Html::a("Szerződés felbontása ",['contract/cancel' , 'id' => $model->id_contract], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
?>
Szerződés felbontása esetén a már megkezdett hónapokra hónaponként 3000 Ft büntetést írunk fel a vásárló kosarába
</div>
</div>
<br>
<?php }?>
<?php foreach ($intstallments as $inst) {?>
<?php
/** @var common\models\TicketInstallmentRequest $inst */
$panelClass = 'panel-info';
if ( $inst->isStatusAccepted() ){
$panelClass = "panel-success";
}else if ( $inst->isStatusRejected() ){
$panelClass = "panel-danger";
}
?>
<div class="panel panel-default <?php echo $panelClass?>">
<div class="panel-heading">Bérlet <?php echo $inst->priority?></div>
<div class="panel-body">
<table class="table table-striped">
<tr>
<td>Esedékességi dátum</td>
<td><?php echo \Yii::$app->formatter->asDate($inst->request_target_time_at)?></td>
</tr>
<tr>
<td>Fizetendő</td>
<td><?php echo ($inst->money)?></td>
</tr>
<tr>
<td>Státusz</td>
<td><?php echo ($inst->statusName)?></td>
</tr>
<tr>
<td>Bérlet vége</td>
<td><?php echo \Yii::$app->formatter->asDate($inst->ticketExpirationDate)?></td>
</tr>
</table>
<?php
if ( $inst->isStatusPending() || $inst->isStatusRejected() ){
echo Html::a("Fizetettnek jelölés és bérlet vásárló kásrba helyezése",['contract/payout' , 'id' => $inst->id_ticket_installment_request], [ 'data-method' => 'post', 'class' => 'btn btn-danger']);
}
?>
</div>
</div>
<?php }?>
</div>