add frontend ticket translations
This commit is contained in:
parent
11e7c85cf3
commit
fda450b801
@ -43,6 +43,7 @@ return [
|
|||||||
'.hgignore',
|
'.hgignore',
|
||||||
'.hgkeep',
|
'.hgkeep',
|
||||||
'/messages',
|
'/messages',
|
||||||
|
'node_modules'
|
||||||
],
|
],
|
||||||
|
|
||||||
// 'php' output format is for saving messages to php files.
|
// 'php' output format is for saving messages to php files.
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
return [
|
return [
|
||||||
'Bérlet kártya nem üres vagy hibás kártyaszám' => 'Bérlet kártya nem üres vagy hibás kártyaszám',
|
'Bérlet kártya nem üres vagy hibás kártyaszám' => 'Bérlet kártya nem üres vagy hibás kártyaszám',
|
||||||
'Password' => 'Jelszó',
|
'Password' => 'Jelszó',
|
||||||
'Update customer:' => 'Jelszó újra',
|
'Update customer:' => 'Vendég módosítása:',
|
||||||
'Address' => 'Cím',
|
'Address' => 'Cím',
|
||||||
'Birthdate' => 'Születésnap',
|
'Birthdate' => 'Születésnap',
|
||||||
'Card number' => 'Kártyaszám',
|
'Card number' => 'Kártyaszám',
|
||||||
|
|||||||
44
common/messages/hu/common/ticket.php
Normal file
44
common/messages/hu/common/ticket.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné a bérletet?',
|
||||||
|
'Comment' => 'Megjegyzés',
|
||||||
|
'Create' => 'Mentés',
|
||||||
|
'Create Ticket' => 'Új bérlet',
|
||||||
|
'Create and add to cart' => 'Mentés és kosárba helyezés',
|
||||||
|
'Created At' => 'Hozzáadva',
|
||||||
|
'Delete' => 'Törlés',
|
||||||
|
'End' => 'Érvényesség vége',
|
||||||
|
'Id Account' => 'Kassza',
|
||||||
|
'Id Discount' => 'Kedvezmény',
|
||||||
|
'Id Ticket' => 'Bérlet',
|
||||||
|
'Id Ticket Type' => 'Bérlet típus',
|
||||||
|
'Id User' => 'Felhasználó',
|
||||||
|
'Max Usage Count' => 'Max alkalmak',
|
||||||
|
'Price Brutto' => 'Bruttó ár',
|
||||||
|
'Reset' => '',
|
||||||
|
'Search' => 'Keresés',
|
||||||
|
'Start' => 'Érvényesség kezdete',
|
||||||
|
'Status' => 'Státusz',
|
||||||
|
'Tickets' => 'Bérletek',
|
||||||
|
'Update' => 'Módosítás',
|
||||||
|
'Update {modelClass}: ' => '{modelClass} módosítva: ',
|
||||||
|
'Updated At' => 'Módosítás',
|
||||||
|
'Usage Count' => 'Felhasznált alkalmak',
|
||||||
|
];
|
||||||
21
common/messages/hu/frontend/card.php
Normal file
21
common/messages/hu/frontend/card.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Search' => 'Keresés',
|
||||||
|
];
|
||||||
27
common/messages/hu/frontend/ticket.php
Normal file
27
common/messages/hu/frontend/ticket.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Message translations.
|
||||||
|
*
|
||||||
|
* This file is automatically generated by 'yii message' command.
|
||||||
|
* It contains the localizable messages extracted from source code.
|
||||||
|
* You may modify this file by translating the extracted messages.
|
||||||
|
*
|
||||||
|
* Each array element represents the translation (value) of a message (key).
|
||||||
|
* If the value is empty, the message is considered as not translated.
|
||||||
|
* Messages that no longer need translation will have their translations
|
||||||
|
* enclosed between a pair of '@@' marks.
|
||||||
|
*
|
||||||
|
* Message string can be used with plural forms format. Check i18n section
|
||||||
|
* of the guide for details.
|
||||||
|
*
|
||||||
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
|
*/
|
||||||
|
return [
|
||||||
|
'Cart' => 'Kosár',
|
||||||
|
'Invalid discount' => 'Érvénytelen kedvezmény',
|
||||||
|
'Invalid ticket type' => 'Érvénytelen bérlet típus',
|
||||||
|
'Invalid transfer' => 'Érvénytelen transfer',
|
||||||
|
'The requested card does not exist.' => 'A megadott bérlet kártya nem található',
|
||||||
|
'Ticket added to customer' => 'Bérlet hozzárendelve vendéghez',
|
||||||
|
'Update ticket' => 'Bérlet módosítása',
|
||||||
|
];
|
||||||
@ -17,11 +17,12 @@
|
|||||||
* NOTE: this file must be saved in UTF-8 encoding.
|
* NOTE: this file must be saved in UTF-8 encoding.
|
||||||
*/
|
*/
|
||||||
return [
|
return [
|
||||||
'Are you sure you want to delete this item?' => '',
|
'Are you sure you want to delete this item?' => 'Biztosan törölni szeretné a bérletet?',
|
||||||
|
'Reset' => '',
|
||||||
|
'Ticket' => 'Bérlet',
|
||||||
'Create' => 'Mentés',
|
'Create' => 'Mentés',
|
||||||
'Create Transfer' => 'Új pénzmozgás',
|
'Create Transfer' => 'Új pénzmozgás',
|
||||||
'Delete' => 'Törlés',
|
'Delete' => 'Törlés',
|
||||||
'Reset' => '',
|
|
||||||
'Search' => 'Keresés',
|
'Search' => 'Keresés',
|
||||||
'Termékeladás' => 'Termékeladás',
|
'Termékeladás' => 'Termékeladás',
|
||||||
'Transfers' => 'Pénzmozgások',
|
'Transfers' => 'Pénzmozgások',
|
||||||
|
|||||||
@ -92,6 +92,7 @@ class Customer extends \yii\db\ActiveRecord
|
|||||||
'created_at' => Yii::t('common/customer', 'Created At'),
|
'created_at' => Yii::t('common/customer', 'Created At'),
|
||||||
'updated_at' => Yii::t('common/customer', 'Updated At'),
|
'updated_at' => Yii::t('common/customer', 'Updated At'),
|
||||||
'customerCardNumber' => Yii::t('common/customer', 'Card number'),
|
'customerCardNumber' => Yii::t('common/customer', 'Card number'),
|
||||||
|
'cardNumber' => Yii::t('common/customer', 'Card number'),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -82,6 +82,9 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
public function getProduct(){
|
public function getProduct(){
|
||||||
return $this->hasOne( Product::className(), ["id_product" =>"id_object" ] );
|
return $this->hasOne( Product::className(), ["id_product" =>"id_object" ] );
|
||||||
}
|
}
|
||||||
|
public function getTicket(){
|
||||||
|
return $this->hasOne( Ticket::className(), ["id_ticket" =>"id_object" ] );
|
||||||
|
}
|
||||||
|
|
||||||
public function getAccount(){
|
public function getAccount(){
|
||||||
return $this->hasOne( Account::className(), ["id_account" =>"id_account" ] ) ;
|
return $this->hasOne( Account::className(), ["id_account" =>"id_account" ] ) ;
|
||||||
@ -206,14 +209,18 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
'product_name' => function ($transfer) {
|
'product_name' => function ($transfer) {
|
||||||
$result = "";
|
$result = "";
|
||||||
if ( $transfer->type == Transfer::TYPE_TICKET ){
|
if ( $transfer->type == Transfer::TYPE_TICKET ){
|
||||||
$result = $transfer->ticket->type->name;
|
$result = $transfer->ticket->ticketTypeName;
|
||||||
}else{
|
}else{
|
||||||
$result = $transfer->product->name;
|
$result = $transfer->product->name;
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
},
|
},
|
||||||
'category' => function ($transfer) {
|
'category' => function ($transfer) {
|
||||||
|
if ( $transfer->type == Transfer::TYPE_TICKET ){
|
||||||
|
return Yii::t('frontend/transfer','Ticket');
|
||||||
|
}else{
|
||||||
return $transfer->product->productCategoryName;
|
return $transfer->product->productCategoryName;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
@ -225,8 +232,8 @@ class Transfer extends \yii\db\ActiveRecord
|
|||||||
|
|
||||||
$query = Transfer::find();
|
$query = Transfer::find();
|
||||||
|
|
||||||
// $query->innerJoinWith('userSoldItem');
|
$query->innerJoinWith('userSoldItem');
|
||||||
$query->andWhere(['transfer.id_user' => $user->id ]);
|
$query->andWhere(['user_sold_item.id_user' => $user->id ]);
|
||||||
$transfers = $query->all();
|
$transfers = $query->all();
|
||||||
|
|
||||||
return $transfers;
|
return $transfers;
|
||||||
|
|||||||
@ -16,9 +16,9 @@ class m151008_065256_alter__table__ticket__add_columns extends Migration
|
|||||||
|
|
||||||
public function down()
|
public function down()
|
||||||
{
|
{
|
||||||
echo "m151008_065256_alter__table__ticket__add_columns cannot be reverted.\n";
|
// echo "m151008_065256_alter__table__ticket__add_columns cannot be reverted.\n";
|
||||||
|
|
||||||
return false;
|
// return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -22,12 +22,16 @@ class FrontendMenuStructure{
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function isLogged(){
|
||||||
|
return Yii::$app->user->isGuest;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected function addRecepcio(){
|
||||||
protected function addUserMainMenu(){
|
if ( $this->isLogged() ){
|
||||||
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
$this->menuItems[] = ['label' => 'Recepcio', 'url' => ['/customer/reception'] ];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function addLoginMainMenu(){
|
protected function addLoginMainMenu(){
|
||||||
@ -45,7 +49,7 @@ class FrontendMenuStructure{
|
|||||||
|
|
||||||
|
|
||||||
public function run(){
|
public function run(){
|
||||||
$this->addUserMainMenu();
|
$this->addRecepcio();
|
||||||
$this->addLoginMainMenu();
|
$this->addLoginMainMenu();
|
||||||
return $this->menuItems;
|
return $this->menuItems;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,19 @@ class CustomerController extends Controller
|
|||||||
'delete' => ['post'],
|
'delete' => ['post'],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'access' => [
|
||||||
|
'class' => \yii\filters\AccessControl::className(),
|
||||||
|
'only' => ['create', 'update','reception'],
|
||||||
|
'rules' => [
|
||||||
|
// allow authenticated users
|
||||||
|
[
|
||||||
|
'allow' => true,
|
||||||
|
'roles' => ['@'],
|
||||||
|
],
|
||||||
|
// everything else is denied
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,6 +64,7 @@ class CustomerController extends Controller
|
|||||||
* Lists all Customer models.
|
* Lists all Customer models.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public function actionIndex()
|
public function actionIndex()
|
||||||
{
|
{
|
||||||
$searchModel = new CustomerSearch();
|
$searchModel = new CustomerSearch();
|
||||||
@ -61,19 +75,20 @@ class CustomerController extends Controller
|
|||||||
'dataProvider' => $dataProvider,
|
'dataProvider' => $dataProvider,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Displays a single Customer model.
|
* Displays a single Customer model.
|
||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public function actionView($id)
|
public function actionView($id)
|
||||||
{
|
{
|
||||||
return $this->render('view', [
|
return $this->render('view', [
|
||||||
'model' => $this->findModel($id),
|
'model' => $this->findModel($id),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Creates a new Customer model.
|
* Creates a new Customer model.
|
||||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||||
@ -147,13 +162,14 @@ class CustomerController extends Controller
|
|||||||
* @param integer $id
|
* @param integer $id
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
public function actionDelete($id)
|
public function actionDelete($id)
|
||||||
{
|
{
|
||||||
$this->findModel($id)->delete();
|
$this->findModel($id)->delete();
|
||||||
|
|
||||||
return $this->redirect(['index']);
|
return $this->redirect(['index']);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/**
|
/**
|
||||||
* Finds the Customer model based on its primary key value.
|
* Finds the Customer model based on its primary key value.
|
||||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||||
|
|||||||
@ -107,7 +107,7 @@ class TicketController extends Controller
|
|||||||
|
|
||||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||||
Yii::$app->session->setFlash('success', Yii::t('frontend/ticket', 'Ticket added to customer') );
|
Yii::$app->session->setFlash('success', Yii::t('frontend/ticket', 'Ticket added to customer') );
|
||||||
return $this->redirect(['index', 'number' => $receptionForm->card->number]);
|
return $this->redirect(['product/sale', 'number' => $receptionForm->card->number]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$userTransfers = Transfer::modelsToArray( Transfer::readUserSoldTransfers($user) );
|
$userTransfers = Transfer::modelsToArray( Transfer::readUserSoldTransfers($user) );
|
||||||
|
|||||||
@ -6,12 +6,17 @@ use common\models\TicketType;
|
|||||||
use common\models\Account;
|
use common\models\Account;
|
||||||
use common\models\Discount;
|
use common\models\Discount;
|
||||||
use common\models\Transfer;
|
use common\models\Transfer;
|
||||||
|
use common\models\UserSoldItem;
|
||||||
|
use yii\base\Object;
|
||||||
|
|
||||||
class TicketCreate extends Ticket{
|
class TicketCreate extends Ticket{
|
||||||
|
|
||||||
public $_currency;
|
public $_currency;
|
||||||
public $_account;
|
public $_account;
|
||||||
public $_discount;
|
public $_discount;
|
||||||
|
public $_transfer;
|
||||||
|
|
||||||
|
public $cart;
|
||||||
|
|
||||||
public function rules()
|
public function rules()
|
||||||
{
|
{
|
||||||
@ -51,7 +56,11 @@ class TicketCreate extends Ticket{
|
|||||||
/////////////////////
|
/////////////////////
|
||||||
//comment
|
//comment
|
||||||
/////////////////////
|
/////////////////////
|
||||||
[['comment'], 'string', 'max' => 255]
|
[['comment'], 'string', 'max' => 255],
|
||||||
|
/////////////////////
|
||||||
|
//cart
|
||||||
|
/////////////////////
|
||||||
|
[['cart'], 'string', 'max' => 10]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,10 +87,39 @@ class TicketCreate extends Ticket{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function afterSave($insert, $changedAttributes){
|
public function afterSave($insert, $changedAttributes){
|
||||||
|
$this->addTransfer();
|
||||||
|
$this->addToCart();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addTransfer(){
|
||||||
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
$transfer = Transfer::createTicketTransfer($this->_account, $this->_discount, null, 1, $this);
|
||||||
|
$transfer->status = Transfer::STATUS_PAID;
|
||||||
|
if ( isset($this->comment)){
|
||||||
|
$transfer->comment = $this->comment;
|
||||||
|
}
|
||||||
|
$transfer->id_user = \Yii::$app->user->id;
|
||||||
|
$transfer->save();
|
||||||
|
$this->_transfer = $transfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addToCart(){
|
||||||
|
if ( $this->isAddToCart()){
|
||||||
|
$item = new UserSoldItem();
|
||||||
|
$item->id_transfer = $this->_transfer->id_transfer;
|
||||||
|
$item->id_user = \Yii::$app->user->id;
|
||||||
|
$item->save(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function isAddToCart(){
|
||||||
|
$result = false;
|
||||||
|
if ( isset( $this->cart ) && $this->cart == 'add' ){
|
||||||
|
$result = true;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -33,7 +33,7 @@ if ( isset($customer) ){
|
|||||||
<?php echo $customername; ?>
|
<?php echo $customername; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-12'>
|
<div class='col-md-12'>
|
||||||
<?php echo Html::submitButton("search",[ 'class' => 'btn btn-primary']); ?>
|
<?php echo Html::submitButton( Yii::t('frontend/card', "Search"),[ 'class' => 'btn btn-primary']); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -23,7 +23,7 @@ use kartik\widgets\DatePicker;
|
|||||||
<?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
<?php echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
<?php //echo $form->field($model, 'partnerCardNumber')->textInput() ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ use kartik\widgets\DatePicker;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php /*?>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'password_plain')->passwordInput(['maxlength' => true]) ?>
|
||||||
@ -49,7 +49,7 @@ use kartik\widgets\DatePicker;
|
|||||||
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
<?= $form->field($model, 'password_repeat')->passwordInput(['maxlength' => true]) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<?php */?>
|
||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
<?= $form->field($model, 'sex')->dropDownList(Customer::sexes()) ?>
|
||||||
|
|||||||
@ -22,13 +22,13 @@ use yii\base\Widget;
|
|||||||
<div class='row'>
|
<div class='row'>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
<?php //echo $form->field($model, 'cardNumber')->widget(CardNumberTypeahead::className(),[]) ?>
|
||||||
<label><?php echo $model->getAttributeLabel('id_customer_card')?></label>
|
<label><?php echo $model->getAttributeLabel('cardNumber')?></label>
|
||||||
<div>
|
<div>
|
||||||
<?php echo $model->customerCardNumber ?>
|
<?php echo $model->customerCardNumber ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='col-md-3'>
|
<div class='col-md-3'>
|
||||||
<?= $form->field($model, 'partnerCardNumber')->textInput() ?>
|
<?php //echo $form->field($model, 'partnerCardNumber')->textInput() ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -55,19 +55,6 @@ use yii\base\Widget;
|
|||||||
'format' => 'yyyy.mm.dd'
|
'format' => 'yyyy.mm.dd'
|
||||||
]
|
]
|
||||||
]) ?>
|
]) ?>
|
||||||
<?php
|
|
||||||
/*echo DatePicker::widget(
|
|
||||||
[
|
|
||||||
'name' => 'CustomerUpdate[birthdate]',
|
|
||||||
'value' => Yii::$app->formatter->asDate($model->birthdate),
|
|
||||||
'pluginOptions' => [
|
|
||||||
'autoclose'=>true,
|
|
||||||
'format' => 'yyyy.mm.dd'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -8,19 +8,13 @@ use frontend\components\ReceptionCardNumberWidget;
|
|||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Customer */
|
/* @var $model common\models\Customer */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->title = Yii::t('common/customer', 'Create Customer');
|
$this->title = Yii::t('common/customer', 'Create Customer');
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/customer', 'Customers'), 'url' => ['index']];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
|
||||||
|
|
||||||
$customer = $model;
|
$customer = $model;
|
||||||
$card = $customer->card;
|
$card = $customer->card;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="customer-create">
|
<div class="customer-create">
|
||||||
|
|
||||||
|
|||||||
@ -35,14 +35,14 @@ AppAsset::register($this);
|
|||||||
echo AlertBlock::widget([
|
echo AlertBlock::widget([
|
||||||
'useSessionFlash' => true,
|
'useSessionFlash' => true,
|
||||||
'type' => AlertBlock::TYPE_GROWL,
|
'type' => AlertBlock::TYPE_GROWL,
|
||||||
'delay' => '3000'
|
'delay' => '1'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$menuStruct = new FrontendMenuStructure();
|
$menuStruct = new FrontendMenuStructure();
|
||||||
$items = $menuStruct->run();
|
$items = $menuStruct->run();
|
||||||
|
|
||||||
NavBar::begin([
|
NavBar::begin([
|
||||||
'brandLabel' => 'My Company',
|
'brandLabel' => 'Web Recepció',
|
||||||
'brandUrl' => Yii::$app->homeUrl,
|
'brandUrl' => Yii::$app->homeUrl,
|
||||||
'options' => [
|
'options' => [
|
||||||
'class' => 'navbar-inverse navbar-fixed-top',
|
'class' => 'navbar-inverse navbar-fixed-top',
|
||||||
|
|||||||
@ -31,11 +31,13 @@ use kartik\widgets\DatePicker;
|
|||||||
|
|
||||||
<?php $form = ActiveForm::begin(); ?>
|
<?php $form = ActiveForm::begin(); ?>
|
||||||
|
|
||||||
|
<?= Html::activeHiddenInput($model, 'cart')?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions) ?>
|
<?= $form->field($model, 'id_ticket_type')->dropDownList($ticketTypeOptions) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
<?= $form->field($model, 'id_account')->dropDownList($accountOptions) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'id_discount')->dropDownList($discountOptions) ?>
|
<?php //echo $form->field($model, 'id_discount')->dropDownList($discountOptions) ?>
|
||||||
|
|
||||||
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
<?= $form->field($model, 'start')->widget(DatePicker::classname(), [
|
||||||
'pluginOptions' => [
|
'pluginOptions' => [
|
||||||
@ -59,7 +61,8 @@ use kartik\widgets\DatePicker;
|
|||||||
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
<?= $form->field($model, 'comment')->textarea(['maxlength' => true]) ?>
|
||||||
|
|
||||||
<div class="form-group">
|
<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']) ?>
|
<?= Html::submitButton( Yii::t('common/ticket', 'Create') , [ 'onclick' => ' $(\'#ticketcreate-cart\').val(\'\');','class' => 'btn btn-success' ]) ?>
|
||||||
|
<?= Html::submitButton( Yii::t('common/ticket', 'Create and add to cart') , [ 'onclick' => ' $(\'#ticketcreate-cart\').val(\'add\');', 'class' => 'btn btn-success' ]) ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php ActiveForm::end(); ?>
|
<?php ActiveForm::end(); ?>
|
||||||
|
|||||||
@ -5,25 +5,27 @@ use frontend\components\ReceptionMenuWidget;
|
|||||||
use frontend\components\ReceptionCardNumberWidget;
|
use frontend\components\ReceptionCardNumberWidget;
|
||||||
use frontend\assets\TicketSellAsset;
|
use frontend\assets\TicketSellAsset;
|
||||||
use common\models\TicketType;
|
use common\models\TicketType;
|
||||||
|
use yii\helpers\Url;
|
||||||
|
|
||||||
|
|
||||||
/* @var $this yii\web\View */
|
/* @var $this yii\web\View */
|
||||||
/* @var $model common\models\Ticket */
|
/* @var $model common\models\Ticket */
|
||||||
/* @var $receptionForm frotned\models\ReceptionForm */
|
/* @var $receptionForm frotned\models\ReceptionForm */
|
||||||
|
|
||||||
|
$card = $receptionForm->card;
|
||||||
|
$customer = $receptionForm->customer;
|
||||||
|
|
||||||
TicketSellAsset::register($this);
|
TicketSellAsset::register($this);
|
||||||
|
|
||||||
$this->title = Yii::t('common/ticket', 'Create Ticket');
|
$this->title = Yii::t('common/ticket', 'Create Ticket');
|
||||||
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index']];
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('common/ticket', 'Tickets'), 'url' => ['index' , 'number' => $card->number ]];
|
||||||
$this->params['breadcrumbs'][] = $this->title;
|
$this->params['breadcrumbs'][] = $this->title;
|
||||||
|
|
||||||
$card = $receptionForm->card;
|
|
||||||
$customer = $receptionForm->customer;
|
|
||||||
|
|
||||||
$options = [];
|
$options = [];
|
||||||
|
|
||||||
// $options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
// $options['lookup_product_url'] = Url::toRoute(['product/lookup']);
|
||||||
// $options['clear_list_url'] = Url::toRoute(['product/clear-list']);
|
$options['clear_cart_url'] = Url::toRoute(['product/clear-list']);
|
||||||
$options['types'] = TicketType::modelsToArray($ticketTypes);
|
$options['types'] = TicketType::modelsToArray($ticketTypes);
|
||||||
$options['transfer_list'] = $userTransfers;
|
$options['transfer_list'] = $userTransfers;
|
||||||
|
|
||||||
@ -55,8 +57,9 @@ $this->registerJs ( 'new TicketSell( '. json_encode($options).');' );
|
|||||||
]) ?>
|
]) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<h1><?php echo Yii::t('frontend/tciket', 'Cart')?></h1>
|
<h1><?php echo Yii::t('frontend/ticket', 'Cart')?></h1>
|
||||||
<?php echo $this->render( "//common/_transfer_list" ) ?>
|
<?php echo $this->render( "//common/_transfer_list" ) ?>
|
||||||
|
<?php echo Html::a(Yii::t('frontend/product', "Paid"),null,[ 'id' => 'btn_paid', 'class' => 'btn btn-primary' ]) ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -33,8 +33,10 @@ function TicketSell(o){
|
|||||||
max_usage_count: null,
|
max_usage_count: null,
|
||||||
id_account: null,
|
id_account: null,
|
||||||
price: null,
|
price: null,
|
||||||
clear_list_url: '',
|
clear_cart_url: '',
|
||||||
transfer_list: []
|
cart_paid_message: 'Tételek fizetve',
|
||||||
|
transfer_list: [],
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
init();
|
init();
|
||||||
@ -44,6 +46,7 @@ function TicketSell(o){
|
|||||||
addBehaviourTypeChangedListener();
|
addBehaviourTypeChangedListener();
|
||||||
useDefaults();
|
useDefaults();
|
||||||
createUserSoldItemsTable();
|
createUserSoldItemsTable();
|
||||||
|
addBehaviourBtnCartPaid();
|
||||||
}
|
}
|
||||||
|
|
||||||
function useDefaults(){
|
function useDefaults(){
|
||||||
@ -59,10 +62,30 @@ function TicketSell(o){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshSoldUseritems(){
|
function refreshCart(){
|
||||||
$('.transfer-list-container').transferList('option','transfers' , app.defaults.sold_items );
|
$('.transfer-list-container').transferList('option','transfers' , app.defaults.sold_items );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addBehaviourBtnCartPaid( ){
|
||||||
|
$('#btn_paid').on('click',function(){
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: app.defaults.clear_cart_url,
|
||||||
|
type: 'post',
|
||||||
|
data: {},
|
||||||
|
success: function (response) {
|
||||||
|
if ( response.code == 'success'){
|
||||||
|
app.defaults.sold_items= response.transfers;
|
||||||
|
refreshCart();
|
||||||
|
$.notify(app.defaults.cart_paid_message, { 'type' : 'success' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function addBehaviourTypeChangedListener(){
|
function addBehaviourTypeChangedListener(){
|
||||||
$(app.defaults.selector_type).change(change);
|
$(app.defaults.selector_type).change(change);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user