add editable account on reception/customer-cart, add towel handling

This commit is contained in:
2016-10-21 20:39:02 +02:00
parent 8585286150
commit 90c598f8c6
26 changed files with 649 additions and 37 deletions

View File

@@ -27,6 +27,9 @@ use yii\widgets\ActiveForm;
<div class="col-md-4">
<?php echo $form->field($model, 'number')->label("Kártya/kulcs szám") ?>
</div>
<div class='col-md-3'>
<?= $form->field($model, 'towel')->dropDownList( ['' => "Mind" , '1' => "Bérel Törölközőt"] ) ?>
</div>
</div>
<div class="form-group">

View File

@@ -38,6 +38,10 @@ $this->params['breadcrumbs'][] = $this->title;
'attribute' => 'customer_email',
'label' => 'E-mail',
],
[
'attribute' => 'towel_count',
'label' => 'Törölköző (db)',
],
// [
// 'attribute' => 'customer.name',
// 'value' => 'customer.name',
@@ -45,7 +49,7 @@ $this->params['breadcrumbs'][] = $this->title;
['class' => 'yii\grid\ActionColumn',
'template' => '{ticket} {product} {ticket_history} {keys} {contract}',
'template' => '{ticket} {product} {ticket_history} {keys} {contract} {towel}',
'buttons' => [
'ticket' => function ($url, $model, $key) {
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
@@ -61,6 +65,9 @@ $this->params['breadcrumbs'][] = $this->title;
},
'contract' => function ($url, $model, $key) {
return Html::a('Szerződések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
'towel' => function ($url, $model, $key) {
return Html::a('Törölközők', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
],
'urlCreator' => function ($action, $model, $key, $index){
@@ -75,6 +82,9 @@ $this->params['breadcrumbs'][] = $this->title;
$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']]);
}else if ( 'towel' == $action ){
$start = Yii::$app->formatter->asDatetime(strtotime('today UTC'));
$url = Url::to(['log/towel','id_card' => $model['card_id_card'] ,'LogSearch[start]' =>$start ]);
}
return $url;
}

View File

@@ -7,7 +7,7 @@ use yii\helpers\Url;
$route = \Yii::$app->controller->id .'/'. \Yii::$app->controller->action->id;
$todayDateTime = Yii::$app->formatter->asDatetime(strtotime('today UTC'));
@@ -22,6 +22,7 @@ $items = [
[ 'Szerződések', ['contract/index', 'id_card' => $card->id_card ]],
[ 'Kosár', ['transfer/customer-cart', 'id_card' => $card->id_card ]],
[ 'Kártya', ['card/info', 'id_card' => $card->id_card ]],
[ 'Törölköző Bérlés', ['log/towel', 'id_card' => $card->id_card , 'LogSearch[start]' => $todayDateTime ]],
];

View File

@@ -36,6 +36,10 @@ if ( $model->isCardWithCustomer() ){
'label' => 'Telefon',
'value' => $model->customer->phone
],
[
'label' => 'Kiadott törölközők',
'value' => $model->customer->towel_count
],
[
'label' => 'Kulcsok',
'value' =>

View File

@@ -81,5 +81,28 @@ $card = $model->card;
</div>
<?php ActiveForm::end(); ?>
<?php if ( isset($model->customer) ) { ?>
<?php $form = ActiveForm::begin([
'action' => ['customer/towel', 'number' => $model->getCardNumber()],
'method' => 'post',
]); ?>
<div class="row" style="margin-top: 6px; margin-bottom: 6px;">
<div class='col-md-12'>
<?php echo Html::hiddenInput('TowelForm[number]', $model->getCardNumber())?>
<?php echo Html::textInput('TowelForm[count]','',['class'=>"form-control", 'placeholder' =>'Törölköző darab' ,'type' => 'number']) ?>
</div>
</div>
<div class="row">
<div class='col-md-6'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Bérel'), [ 'name' => 'TowelForm[direction]', 'value' => 'out', 'class' => 'btn btn-primary btn-block']) ?>
</div>
<div class='col-md-6'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Vissza ad'), ['name' => 'TowelForm[direction]', 'value' => 'in', 'class' => 'btn btn-primary btn-block']) ?>
</div>
</div>
<?php ActiveForm::end(); ?>
<?php }?>

View File

@@ -136,4 +136,23 @@ if ( isset( $model->unpaidTickets ) ) {
}
if ( isset($model->customer)){
if ( $model->customer->towel_count > 0 ){
$towelText = "Kiadott törölközők (db):" . $model->customer->towel_count;
$towelClass = "alert alert-danger";
}else{
$towelText = "Nincs kiadott törölköző";
$towelClass = "alert alert-success";
}
echo Html::beginTag("div",['class'=> $towelClass, "role"=>"alert"]);
echo Html::beginTag("strong",[ ]);
echo $towelText;
echo Html::endTag("strong");
echo Html::endTag("div");
}
?>

View File

@@ -0,0 +1,50 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use kartik\widgets\DateTimePicker;
/* @var $this yii\web\View */
/* @var $model backend\models\LogSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<div class="log-search">
<?php $form = ActiveForm::begin([
'action' => ['towel', 'id_card' => $model->card->id_card ],
'method' => 'get',
]); ?>
<div class="row">
<div class="col-md-3">
<?= $form->field($model, 'start')->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'end') ->widget(DateTimePicker::classname(), [
'pluginOptions' => [
'autoclose'=>true,
'format' => 'yyyy.mm.dd hh:ii'
]
]) ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('common/log', 'Keresés'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\LogSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('common/log', 'Törölköző bérlés történet');
$this->params['breadcrumbs'][] = $this->title;
?>
<?php echo \frontend\components\CustomerTabWidget::widget(['card' => $searchModel->card])?>
<div class="log-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => "log_created_at",
'label' => "Dátum idő",
],
[
'attribute' => "log_type",
'label' => "Esemény",
],
[
'attribute' => "log_message",
'label' => "Db",
],
[
'attribute' => "user_username",
'label' => "Felhasználó",
],
],
]); ?>
</div>

View File

@@ -32,7 +32,13 @@ $this->registerJs ( 'new TransferCustomerCart( '. json_encode($options).');' );
<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") ?>
<?php echo $form->field($model, 'payment_method')->dropDownList( ['' => 'Aktuális fizetési mód'] + Transfer::paymentMethods())->label("Fizetése mód") ?>
<?php echo $form->field($model, 'id_account')
->dropDownList( ['' => 'Aktuális kassza'] + array_reduce( $model->hiddenAccounts, function( $result, $item ){
$result[$item->id_account] = $item->name;
return $result;
} ,array()) )
->label("Kassza") ?>
<div class="row">
<div class="col-md-4">
<span style="font-weight: bold;">Összesen:</span>