add contract
This commit is contained in:
@@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{ticket} {ticket_history} {keys}',
|
||||
'template' => '{ticket} {ticket_history} {keys} {contract}',
|
||||
'buttons' => [
|
||||
'ticket' => function ($url, $model, $key) {
|
||||
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
@@ -56,6 +56,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'keys' => function ($url, $model, $key) {
|
||||
return Html::a('Kulcsok', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'contract' => function ($url, $model, $key) {
|
||||
return Html::a('Szerződések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
],
|
||||
'urlCreator' => function ($action, $model, $key, $index){
|
||||
$url = "";
|
||||
@@ -65,6 +68,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
||||
}else if ( 'keys' == $action ){
|
||||
$url = Url::to(['key/index','id_card' => $model['card_id_card']]);
|
||||
}else if ( 'contract' == $action ){
|
||||
$url = Url::to(['contract/index','id_card' => $model['card_id_card']]);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,20 @@ $card = $model->card;
|
||||
<?php echo HtmlHelper::mkReceptionBtn($model, Yii::t( 'frontend/transfer', 'Termékeladás'), 'product/sale')?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ( $model->isCustomerWithTicket() ){
|
||||
?>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<?php echo Html::a( "Éves szerződés letöltése", [ 'customer/contract' , 'id' => $model->customer->id_customer ]);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ use yii\base\Object;
|
||||
use common\models\Ticket;
|
||||
use frontend\model\ReceptionForm;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\model\ReceptionForm */
|
||||
@@ -57,4 +58,23 @@ if ( isset($model->card)){
|
||||
echo Html::endTag("div");
|
||||
}
|
||||
|
||||
|
||||
if ( isset($model->contract)){
|
||||
if ( $model->contract->isStatusNotPaid() ){
|
||||
echo Html::beginTag("div",['class'=>"alert alert-danger", "role"=>"alert"]);
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Szerződés részlete nincs fizetve!";
|
||||
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
||||
echo Html::endTag("strong");
|
||||
echo Html::endTag("div");
|
||||
}else{
|
||||
echo Html::beginTag("div",['class'=>"alert alert-success", "role"=>"alert"]);
|
||||
echo Html::beginTag("strong",[ ]);
|
||||
echo "Érvényes szerződés!";
|
||||
echo Html::a("Szerződés részletei",Url::toRoute(['contract/view','id' => $model->contract->id_contract]));
|
||||
echo Html::endTag("strong");
|
||||
echo Html::endTag("div");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
43
frontend/views/contract/_form.php
Normal file
43
frontend/views/contract/_form.php
Normal 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>
|
||||
47
frontend/views/contract/_search.php
Normal file
47
frontend/views/contract/_search.php
Normal 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>
|
||||
21
frontend/views/contract/create.php
Normal file
21
frontend/views/contract/create.php
Normal 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>
|
||||
58
frontend/views/contract/index.php
Normal file
58
frontend/views/contract/index.php
Normal 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>
|
||||
23
frontend/views/contract/update.php
Normal file
23
frontend/views/contract/update.php
Normal 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>
|
||||
99
frontend/views/contract/view.php
Normal file
99
frontend/views/contract/view.php
Normal 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>
|
||||
24
frontend/views/customer/_contract.php
Normal file
24
frontend/views/customer/_contract.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<h1>
|
||||
Éves szerződés
|
||||
</h1>
|
||||
|
||||
|
||||
<p>
|
||||
Ez az éves szerződés szövege
|
||||
</p>
|
||||
<p>
|
||||
Kövektező bekezdés
|
||||
</p>
|
||||
<p>
|
||||
A szerződő fél neve:
|
||||
<span>
|
||||
<?php
|
||||
echo $model->name
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<span>A cég neve:</span>
|
||||
<span><?php echo \Yii::$app->params['company_name']?></span>
|
||||
</p>
|
||||
@@ -44,4 +44,7 @@ use kartik\widgets\ActiveForm;
|
||||
<div class='col-md-3 '>
|
||||
<?php echo Html::a(Yii::t('frontend/product', "Frissít"),null,[ 'class' => 'btn btn-primary btn-block' , 'onclick' => 'location.reload();']) ?>
|
||||
</div>
|
||||
<div class='col-md-3 '>
|
||||
<?php echo Html::a(Yii::t('transfer/user-cart', "Kosár részletei"),['transfer/user-cart'],[ 'class' => 'btn btn-primary btn-block' ]) ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -101,6 +101,7 @@ td,th{
|
||||
<tr>
|
||||
<th>T</th>
|
||||
<th>Kiadva</th>
|
||||
<th>F. mód</th>
|
||||
<th>Fizetve</th>
|
||||
<th>Kassza</th>
|
||||
<th>Felhasználó</th>
|
||||
@@ -117,6 +118,7 @@ td,th{
|
||||
<tr>
|
||||
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||
<td><?php echo $p['product_created_at']?> </td>
|
||||
<td><?php echo Transfer::toPaymentMethodName( $p['transfer_payment_method'] )?> </td>
|
||||
<td><?php echo $p['product_paid_at']?> </td>
|
||||
<td><?php echo $p['account_name']?> </td>
|
||||
<td><?php echo $p['user_name']?> </td>
|
||||
|
||||
13
frontend/views/transfer/_user_cart_item.php
Normal file
13
frontend/views/transfer/_user_cart_item.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md4">
|
||||
<?php echo $model->objectName;?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md4">
|
||||
<?php echo $model->transferTypeName;?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3,6 +3,7 @@ use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\ListView;
|
||||
use yii\base\Widget;
|
||||
use common\models\Transfer;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel common\models\TransferSearch */
|
||||
@@ -66,8 +67,9 @@ td.name {
|
||||
<table class="table table-bordered table-striped table-summary">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tranzakció</th>
|
||||
<th>ID</th>
|
||||
<th>Kiadva</th>
|
||||
<th>F. mód</th>
|
||||
<th>Fizetve</th>
|
||||
<th>Kassza</th>
|
||||
<th>Felhasználó</th>
|
||||
@@ -84,6 +86,7 @@ td.name {
|
||||
<tr>
|
||||
<td><?php echo "#".$p['id_transfer']?> </td>
|
||||
<td><?php echo ( $p['product_created_at'])?> </td>
|
||||
<td><?php echo Transfer::toPaymentMethodName( $p['transfer_payment_method'] )?> </td>
|
||||
<td><?php echo $p['product_paid_at']?> </td>
|
||||
<td><?php echo $p['account_name']?> </td>
|
||||
<td><?php echo $p['user_name']?> </td>
|
||||
|
||||
90
frontend/views/transfer/usercart.php
Normal file
90
frontend/views/transfer/usercart.php
Normal file
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
use yii\data\ArrayDataProvider;
|
||||
use yii\widgets\ListView;
|
||||
use yii\base\Widget;
|
||||
use yii\grid\GridView;
|
||||
use yii\widgets\ActiveForm;
|
||||
use yii\helpers\Html;
|
||||
use common\models\Transfer;
|
||||
use yii\grid\CheckboxColumn;
|
||||
use frontend\assets\TransferUserCartAsset;
|
||||
?>
|
||||
<?php
|
||||
TransferUserCartAsset::register($this);
|
||||
|
||||
$options = [];
|
||||
|
||||
$this->registerJs ( 'new TransferUserCart( '. json_encode($options).');' );
|
||||
$dp = new ArrayDataProvider(
|
||||
[
|
||||
'allModels' => $model->transfers,
|
||||
'pagination' => false
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
?>
|
||||
<h1>Kosár</h1>
|
||||
<div class="transfer-form">
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
<?php echo $form->field($model, 'payment_method')->dropDownList( ['' => 'Aktuális'] + Transfer::paymentMethods())->label("Fizetése mód") ?>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<span>Összesen:</span>
|
||||
<span class="selected-money"><?php echo $model->money ?></span>
|
||||
<span> Ft</span>
|
||||
<?php echo $form->field($model, "money" , [ ])->hiddenInput(); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
$formModel = $model;
|
||||
|
||||
echo GridView::widget([
|
||||
"dataProvider" => $dp,
|
||||
'columns' =>[
|
||||
[
|
||||
'label' => '',
|
||||
'value' => function ($model, $key, $index, $column) use (&$form, &$formModel){
|
||||
|
||||
return Html::checkbox(Html::getInputName($formModel, 'selected[]') , in_array($model->id_transfer, $formModel->selected) , [ 'data-money' => $model->money, 'class' => 'cart-item', 'value' => $model->id_transfer] );
|
||||
},
|
||||
'format' => 'raw'
|
||||
],
|
||||
[
|
||||
'value' => 'transferTypeName',
|
||||
'label' => 'Típus'
|
||||
],
|
||||
[
|
||||
'value' => 'objectName',
|
||||
'label' => 'Megnevezés'
|
||||
],
|
||||
[
|
||||
'value' => 'item_price',
|
||||
'label' => 'Egység ár'
|
||||
],
|
||||
[
|
||||
'value' => 'count',
|
||||
'label' => 'Mennyiség'
|
||||
],
|
||||
[
|
||||
'value' => 'money',
|
||||
'label' => 'Összesen'
|
||||
],
|
||||
[
|
||||
'value' => 'paymentMethodName',
|
||||
'label' => 'Fizetési mód'
|
||||
],
|
||||
]
|
||||
]);
|
||||
|
||||
|
||||
?>
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton( "Kiválasztott elemek fizetve", ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
</div>
|
||||
Reference in New Issue
Block a user