add kulcsok, add tartós beszedés, add ticket type with intallments
This commit is contained in:
109
frontend/controllers/KeyController.php
Normal file
109
frontend/controllers/KeyController.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Key;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\base\Object;
|
||||
use yii\db\Query;
|
||||
use yii\helpers\Json;
|
||||
use frontend\models\KeySearch;
|
||||
use frontend\models\ReceptionForm;
|
||||
use frontend\models\KeyToggleForm;
|
||||
use common\models\Customer;
|
||||
use common\models\Card;
|
||||
use common\models\CardKeyAssignment;
|
||||
|
||||
/**
|
||||
* KeyController implements the CRUD actions for Key model.
|
||||
*/
|
||||
class KeyController extends Controller
|
||||
{
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['post'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Key models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex( $id_card )
|
||||
{
|
||||
$card = Card::findOne($id_card);
|
||||
if ( !isset( $card ) ){
|
||||
throw new NotFoundHttpException("Vendég nem található");
|
||||
}
|
||||
|
||||
$searchModel = new KeySearch();
|
||||
$searchModel->card = $card;
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing CardKeyAssignment model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionDelete($id_key)
|
||||
{
|
||||
$key = Key::findOne($id_key);
|
||||
if ( !isset($key)){
|
||||
throw new NotFoundHttpException("Kulcs nem található");
|
||||
}
|
||||
|
||||
|
||||
CardKeyAssignment::deleteAll(['id_key' => $key->id_key]);
|
||||
|
||||
\Yii::$app->session->setFlash('success','Kulcs visszaadva');
|
||||
|
||||
return $this->redirect(['customer/reception' ]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Key models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionToggle($number = null)
|
||||
{
|
||||
// $this->findByNumber($number);
|
||||
$receptionForm = new ReceptionForm();
|
||||
$receptionForm->number = $number;
|
||||
$receptionForm->readCard ();
|
||||
|
||||
$customer = $receptionForm->customer;
|
||||
$card = $receptionForm->card;
|
||||
|
||||
|
||||
$model = new KeyToggleForm();
|
||||
$model->card = $receptionForm->card;
|
||||
$model->customer = $receptionForm->customer;
|
||||
|
||||
if ( $model->load ( Yii::$app->request->post () )) {
|
||||
$model->toggleKey();
|
||||
}
|
||||
|
||||
|
||||
return $this->redirect(['customer/reception', 'number' => $number ]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -88,6 +88,9 @@ class CustomerCreate extends \common\models\Customer
|
||||
|
||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||
|
||||
[['bank_account'], 'string', 'max' => 24],
|
||||
[['bank_name'], 'string', 'max' => 100],
|
||||
|
||||
[['phone'], 'required', 'when' => function($model) {
|
||||
return !isset( $model->email ) || empty( $model->email ) ;
|
||||
} ,
|
||||
|
||||
@@ -89,6 +89,9 @@ class CustomerUpdate extends \common\models\Customer
|
||||
|
||||
[['phone', 'tax_number', 'country'], 'string', 'max' => 20],
|
||||
|
||||
[['bank_account'], 'string', 'max' => 24],
|
||||
[['bank_name'], 'string', 'max' => 100],
|
||||
|
||||
[['phone'], 'required', 'when' => function($model) {
|
||||
return !isset( $model->email ) || empty( $model->email ) ;
|
||||
} ,
|
||||
|
||||
76
frontend/models/KeySearch.php
Normal file
76
frontend/models/KeySearch.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use common\models\Key;
|
||||
use yii\db\Query;
|
||||
|
||||
/**
|
||||
* KeySearch represents the model behind the search form about `common\models\Key`.
|
||||
*/
|
||||
class KeySearch extends Key
|
||||
{
|
||||
|
||||
public $card;
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = new Query();
|
||||
$query->select([ 'user.username as user_username', 'card.id_card as card_id_card', 'key.id_key as key_id_key', 'card.number as card_number' , 'key.number as key_number','card_key_assignment.created_at as assign_created_at'] );
|
||||
$query->from('card');
|
||||
$query->innerJoin('card_key_assignment','card.id_card = card_key_assignment.id_card' );
|
||||
$query->innerJoin('key','key.id_key = card_key_assignment.id_key' );
|
||||
$query->innerJoin('user','user.id = card_key_assignment.id_user' );
|
||||
$query->andWhere(['card_key_assignment.id_card' => $this->card->id_card]);
|
||||
$query->orderBy( ['card_key_assignment.created_at' => SORT_ASC] );
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
]);
|
||||
|
||||
$this->load($params);
|
||||
|
||||
if (!$this->validate()) {
|
||||
// uncomment the following line if you do not want to return any records when validation fails
|
||||
// $query->where('0=1');
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
$query->andFilterWhere([
|
||||
'type' => $this->type,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'number', $this->number])
|
||||
->andFilterWhere(['like', 'rfid_key', $this->rfid_key]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
}
|
||||
75
frontend/models/KeyToggleForm.php
Normal file
75
frontend/models/KeyToggleForm.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use common\models\CardKeyAssignment;
|
||||
use common\models\Key;
|
||||
use yii\helpers\ArrayHelper;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
*/
|
||||
class KeyToggleForm extends Model
|
||||
{
|
||||
public $key;
|
||||
public $card;
|
||||
public $customer;
|
||||
public $keyModel;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['key'], 'safe' ]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
|
||||
public function toggleKey(){
|
||||
$this->keyModel = Key::find()->andWhere(['rfid_key' => $this->key])->one();
|
||||
if ( isset($this->keyModel) ){
|
||||
$assignments = CardKeyAssignment::find()->andWhere(['id_key' => $this->keyModel->id_key])->all();
|
||||
if ( count($assignments) > 0){
|
||||
$this->unassign();
|
||||
}else{
|
||||
$this->assign();
|
||||
}
|
||||
}else{
|
||||
\Yii::$app->session->setFlash ( 'danger', 'Kulcs nem található!' );
|
||||
}
|
||||
}
|
||||
|
||||
public function assign(){
|
||||
if ( isset($this->card) && isset($this->customer) ){
|
||||
$assignment = new CardKeyAssignment();
|
||||
$assignment->id_card = $this->card->id_card;
|
||||
$assignment->id_key = $this->keyModel->id_key;
|
||||
$assignment->id_user = \Yii::$app->user->id;
|
||||
$assignment->save(false);
|
||||
\Yii::$app->session->setFlash ( 'success', 'Kulcs kiadva!' );
|
||||
}else{
|
||||
\Yii::$app->session->setFlash ( 'danger', 'Nincs vendég kiválasztva vagy érvénytelen kártya!' );
|
||||
}
|
||||
}
|
||||
|
||||
public function unassign(){
|
||||
CardKeyAssignment::deleteAll(['id_key' => $this->keyModel->id_key]);
|
||||
\Yii::$app->session->setFlash ( 'success', 'Kulcs visszaadva!' );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,8 @@ use common\models\Ticket;
|
||||
use common\models\Account;
|
||||
use common\models\CardSearch;
|
||||
use common\models\AccountState;
|
||||
use common\models\Key;
|
||||
use common\models\CardKeyAssignment;
|
||||
|
||||
/**
|
||||
* ContactForm is the model behind the contact form.
|
||||
@@ -23,7 +25,7 @@ class ReceptionForm extends Model
|
||||
public $defaultAccount;
|
||||
public $cardSearchModel;
|
||||
public $lastCassaState;
|
||||
|
||||
public $keys;
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
@@ -53,6 +55,7 @@ class ReceptionForm extends Model
|
||||
if ( $this->card != null ){
|
||||
$this->customer = $this->card->customer;
|
||||
$this->readValidTickets();
|
||||
$this->readAssignedKeys();
|
||||
}
|
||||
|
||||
$defaultAccount = Account::readDefault();
|
||||
@@ -65,6 +68,14 @@ class ReceptionForm extends Model
|
||||
|
||||
}
|
||||
|
||||
public function readAssignedKeys(){
|
||||
$query = Key::find();
|
||||
$query->join( 'INNER JOIN', CardKeyAssignment::tableName() , Key::tableName().".id_key = " . CardKeyAssignment::tableName() . ".id_key");
|
||||
$query->andWhere([ "card_key_assignment.id_card" => $this->card->id_card ]);
|
||||
$this->keys = $query->all();
|
||||
|
||||
}
|
||||
|
||||
public function readLastCassaState(){
|
||||
$a = Account::readDefault();
|
||||
if ( isset($a)){
|
||||
@@ -136,4 +147,23 @@ class ReceptionForm extends Model
|
||||
}
|
||||
|
||||
|
||||
public function getCardNumber(){
|
||||
if ( isset($this->card)){
|
||||
return $this->card->number;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getKeysText(){
|
||||
$keyNumbers = [];
|
||||
$result = "-";
|
||||
if ( isset($this->keys)){
|
||||
foreach ($this->keys as $k ){
|
||||
$keyNumbers[] = $k->number;
|
||||
}
|
||||
$result = implode(", ",$keyNumbers);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ use common\models\Transfer;
|
||||
use common\models\UserSoldItem;
|
||||
use common\models\ShoppingCart;
|
||||
use yii\base\Object;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
|
||||
/**
|
||||
* @property $cart string name of cart, into we put the ticket
|
||||
@@ -111,9 +112,21 @@ class TicketCreate extends Ticket{
|
||||
$this->addTransfer();
|
||||
$this->appendToUserCart();
|
||||
$this->appendToCustomerCart();
|
||||
|
||||
$this->addTicketInstallmentRequests($insert);
|
||||
|
||||
}
|
||||
|
||||
public function addTicketInstallmentRequests($insert){
|
||||
if ($insert){
|
||||
$ticketType = TicketType::findOne($this->id_ticket_type);
|
||||
if ( isset($ticketType) && $ticketType->isInstallment() ){
|
||||
$requests = TicketInstallmentRequest::createInstallments($this, $ticketType, $this->customer);
|
||||
foreach ($requests as $request){
|
||||
$request->save(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function addTransfer(){
|
||||
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
||||
|
||||
@@ -45,7 +45,7 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{ticket} {ticket_history}',
|
||||
'template' => '{ticket} {ticket_history} {keys}',
|
||||
'buttons' => [
|
||||
'ticket' => function ($url, $model, $key) {
|
||||
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
@@ -53,6 +53,9 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'ticket_history' => function ($url, $model, $key) {
|
||||
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
'keys' => function ($url, $model, $key) {
|
||||
return Html::a('Kulcsok', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
|
||||
},
|
||||
],
|
||||
'urlCreator' => function ($action, $model, $key, $index){
|
||||
$url = "";
|
||||
@@ -60,6 +63,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
$url = Url::to(['ticket/create','number' => $model['card_number']]);
|
||||
}else if ( 'ticket_history' == $action ){
|
||||
$url = Url::to(['ticket/index','number' => $model['card_number']]);
|
||||
}else if ( 'keys' == $action ){
|
||||
$url = Url::to(['key/index','id_card' => $model['card_id_card']]);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,19 @@ use yii\helpers\Html;
|
||||
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['key/toggle', 'number' => $model->getCardNumber()],
|
||||
'method' => 'post',
|
||||
]); ?>
|
||||
<div class='col-md-3'>
|
||||
<?php echo Html::hiddenInput('number', $model->getCardNumber())?>
|
||||
<?php echo Html::textInput('KeyToggleForm[key]','',['class'=>"form-control", 'placeholder' =>'Kulcs']) ?>
|
||||
|
||||
</div>
|
||||
<div class='col-md-3'>
|
||||
<?= Html::submitButton(Yii::t('frontend/collection', 'Ki/Be'), ['class' => 'btn btn-primary']) ?>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
<div class='row'>
|
||||
|
||||
@@ -36,6 +36,10 @@ if ( $model->isCardWithCustomer() ){
|
||||
'label' => 'Telefon',
|
||||
'value' => $model->customer->phone
|
||||
],
|
||||
[
|
||||
'label' => 'Kulcsok',
|
||||
'value' => $model->keysText,
|
||||
],
|
||||
[
|
||||
'label' => 'Fénykép',
|
||||
'value' => $model->customer->image1 ? Html::img( Url::base( ) . Image::thumb( $model->customer->image1->path,160,120 )) : 'Nincs kép',
|
||||
|
||||
@@ -89,6 +89,16 @@ use kartik\widgets\DatePicker;
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
@@ -83,6 +83,16 @@ use yii\base\Widget;
|
||||
<?= $form->field($model, 'tax_number')->textInput(['maxlength' => true]) ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'bank_name')->textInput(['maxlength' => true])->label("Bank neve") ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'bank_account')->textInput(['maxlength' => true])->label("Bankszámlaszám") ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-6'>
|
||||
<?= $form->field($model, 'country')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
@@ -43,6 +43,8 @@ $this->params['breadcrumbs'][] = $this->title;
|
||||
'image',
|
||||
'description',
|
||||
'tax_number',
|
||||
'bank_name',
|
||||
'bank_account',
|
||||
'country',
|
||||
'zip',
|
||||
'city',
|
||||
|
||||
29
frontend/views/key/_form.php
Normal file
29
frontend/views/key/_form.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Key */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="key-form">
|
||||
|
||||
<?php $form = ActiveForm::begin(); ?>
|
||||
|
||||
<?= $form->field($model, 'number')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<?= $form->field($model, 'status')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'type')->textInput() ?>
|
||||
|
||||
<?= $form->field($model, 'rfid_key')->textInput(['maxlength' => true]) ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton($model->isNewRecord ? Yii::t('frontend/key', 'Create') : Yii::t('frontend/key', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
39
frontend/views/key/_search.php
Normal file
39
frontend/views/key/_search.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\ActiveForm;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model frontend\models\KeySearch */
|
||||
/* @var $form yii\widgets\ActiveForm */
|
||||
?>
|
||||
|
||||
<div class="key-search">
|
||||
|
||||
<?php $form = ActiveForm::begin([
|
||||
'action' => ['index'],
|
||||
'method' => 'get',
|
||||
]); ?>
|
||||
|
||||
<?= $form->field($model, 'id_key') ?>
|
||||
|
||||
<?= $form->field($model, 'number') ?>
|
||||
|
||||
<?= $form->field($model, 'status') ?>
|
||||
|
||||
<?= $form->field($model, 'type') ?>
|
||||
|
||||
<?= $form->field($model, 'created_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'updated_at') ?>
|
||||
|
||||
<?php // echo $form->field($model, 'rfid_key') ?>
|
||||
|
||||
<div class="form-group">
|
||||
<?= Html::submitButton(Yii::t('frontend/key', 'Search'), ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::resetButton(Yii::t('frontend/key', 'Reset'), ['class' => 'btn btn-default']) ?>
|
||||
</div>
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
21
frontend/views/key/create.php
Normal file
21
frontend/views/key/create.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Key */
|
||||
|
||||
$this->title = Yii::t('frontend/key', 'Create Key');
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="key-create">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
59
frontend/views/key/index.php
Normal file
59
frontend/views/key/index.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\grid\GridView;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $searchModel frontend\models\KeySearch */
|
||||
/* @var $dataProvider yii\data\ActiveDataProvider */
|
||||
|
||||
$this->title = Yii::t('frontend/key', 'Vendéghez rendelt kulcsok');
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="key-index">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
<?php // echo $this->render('_search', ['model' => $searchModel]); ?>
|
||||
|
||||
<h2>Vendég: <?php echo $searchModel->card->customer->name ;?></h2>
|
||||
<h2>Kártyaszám: <?php echo $searchModel->card->number ;?></h2>
|
||||
<?= GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'key_number',
|
||||
'label' => 'Kulcs'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'assign_created_at',
|
||||
'label' => 'Kiadás dátuma',
|
||||
'format' => 'datetime'
|
||||
|
||||
],
|
||||
[
|
||||
'attribute' => 'user_username',
|
||||
'label' => 'Felhasználó',
|
||||
],
|
||||
|
||||
['class' => 'yii\grid\ActionColumn',
|
||||
'template' => '{delete}',
|
||||
'buttons' => [
|
||||
'delete' => function ($url, $model, $key) {
|
||||
return Html::a('Visszaad', $url, ['class'=> 'btn btn-xs btn-danger','data-method' => 'post' ]) ;
|
||||
},
|
||||
],
|
||||
'urlCreator' => function ($action, $model, $key, $index){
|
||||
$url = "";
|
||||
if ( 'delete' == $action ){
|
||||
$url = Url::to(['key/delete','id_key' => $model['key_id_key']]);
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
],
|
||||
],
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
23
frontend/views/key/update.php
Normal file
23
frontend/views/key/update.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Key */
|
||||
|
||||
$this->title = Yii::t('frontend/key', 'Update {modelClass}: ', [
|
||||
'modelClass' => 'Key',
|
||||
]) . ' ' . $model->id_key;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = ['label' => $model->id_key, 'url' => ['view', 'id' => $model->id_key]];
|
||||
$this->params['breadcrumbs'][] = Yii::t('frontend/key', 'Update');
|
||||
?>
|
||||
<div class="key-update">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<?= $this->render('_form', [
|
||||
'model' => $model,
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
41
frontend/views/key/view.php
Normal file
41
frontend/views/key/view.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use yii\helpers\Html;
|
||||
use yii\widgets\DetailView;
|
||||
|
||||
/* @var $this yii\web\View */
|
||||
/* @var $model common\models\Key */
|
||||
|
||||
$this->title = $model->id_key;
|
||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('frontend/key', 'Keys'), 'url' => ['index']];
|
||||
$this->params['breadcrumbs'][] = $this->title;
|
||||
?>
|
||||
<div class="key-view">
|
||||
|
||||
<h1><?= Html::encode($this->title) ?></h1>
|
||||
|
||||
<p>
|
||||
<?= Html::a(Yii::t('frontend/key', 'Update'), ['update', 'id' => $model->id_key], ['class' => 'btn btn-primary']) ?>
|
||||
<?= Html::a(Yii::t('frontend/key', 'Delete'), ['delete', 'id' => $model->id_key], [
|
||||
'class' => 'btn btn-danger',
|
||||
'data' => [
|
||||
'confirm' => Yii::t('frontend/key', 'Are you sure you want to delete this item?'),
|
||||
'method' => 'post',
|
||||
],
|
||||
]) ?>
|
||||
</p>
|
||||
|
||||
<?= DetailView::widget([
|
||||
'model' => $model,
|
||||
'attributes' => [
|
||||
'id_key',
|
||||
'number',
|
||||
'status',
|
||||
'type',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'rfid_key',
|
||||
],
|
||||
]) ?>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user