add admin edit ticket date

This commit is contained in:
2016-04-10 20:05:18 +02:00
parent 440b7bb787
commit 1d95d37373
13 changed files with 210 additions and 50 deletions

View File

@@ -1,7 +1,8 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DatePicker;
use common\models\Ticket;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
@@ -12,34 +13,35 @@ use yii\widgets\ActiveForm;
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'id_user')->textInput() ?>
<?= $form->field($model, 'id_ticket_type')->textInput() ?>
<div class="row">
<div class="col-md-4">
<?=$form->field ( $model, 'startDate' )
->widget ( DatePicker::classname (), [ 'pluginOptions' => [ 'autoclose' => true,'format' => 'yyyy.mm.dd' ] ] )?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?=$form->field ( $model, 'endDate' )->widget ( DatePicker::classname (), [ 'pluginOptions' => [ 'autoclose' => true,'format' => 'yyyy.mm.dd' ] ] )?>
</div>
</div>
<?= $form->field($model, 'id_account')->textInput() ?>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'status')->dropDownList(Ticket::statuses())?>
</div>
</div>
<div class="row">
<div class="col-md-4">
<?= $form->field($model, 'comment')->textInput(['maxlength' => true])?>
</div>
</div>
<?= $form->field($model, 'id_discount')->textInput() ?>
<?= $form->field($model, 'start')->textInput() ?>
<?= $form->field($model, 'end')->textInput() ?>
<?= $form->field($model, 'max_usage_count')->textInput() ?>
<?= $form->field($model, 'usage_count')->textInput() ?>
<?= $form->field($model, 'status')->textInput() ?>
<?= $form->field($model, 'price_brutto')->textInput() ?>
<?= $form->field($model, 'comment')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'created_at')->textInput() ?>
<?= $form->field($model, 'updated_at')->textInput() ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket', 'Create') : Yii::t('common/ticket', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? Yii::t('common/ticket', 'Create') : Yii::t('common/ticket', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary'])?>
</div>
<?php ActiveForm::end(); ?>

View File

@@ -134,10 +134,12 @@ $this->params['breadcrumbs'][] = "Befizetések";
// 'usage_count',
['class' => 'yii\grid\ActionColumn',
'template' => '{view}' ,
'template' => '{view} {update}' ,
'urlCreator' => function($action, $model, $key, $index){
if ( $action == 'view' ){
return Url::toRoute( [ 'ticket/view' , 'id' => $model['ticket_id_ticket' ] ] );
}else if ( $action == 'update' ){
return Url::toRoute( [ 'ticket/update' , 'id' => $model['ticket_id_ticket' ] ] );
}
return null;
},

View File

@@ -1,13 +1,12 @@
<?php
use yii\helpers\Html;
use yii\widgets\DetailView;
/* @var $this yii\web\View */
/* @var $model common\models\Ticket */
$this->title = Yii::t('common/ticket', 'Update {modelClass}: ', [
'modelClass' => 'Ticket',
]) . ' ' . $model->id_ticket;
$this->title = Yii::t('common/ticket', 'Bérlet módosítása');
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->id_ticket, 'url' => ['view', 'id' => $model->id_ticket]];
$this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
@@ -15,9 +14,51 @@ $this->params['breadcrumbs'][] = Yii::t('common/ticket', 'Update');
<div class="ticket-update">
<h1><?= Html::encode($this->title) ?></h1>
<?= $this->render('_form', [
<?= $this->render('_form', [
'model' => $model,
]) ?>
<?= DetailView::widget([
'model' => $model,
'attributes' => [
'id_ticket',
[
'attribute' => 'id_user',
'value' => $model->user->username,
],
[
'attribute' => 'id_ticket_type',
'value' => $model->ticketTypeName,
],
[
'attribute' => 'id_account',
'value' => $model->accountName,
],
[
'attribute' => 'id_discount',
'value' => $model->discountName,
],
'start:datetime',
'end:datetime',
'max_usage_count',
'usage_count',
[
'attribute' => 'status',
'value' => $model->statusName
],
'price_brutto',
'comment:raw',
'created_at',
'updated_at',
],
]) ?>
</div>