This commit is contained in:
Roland Schneider 2016-01-07 16:31:19 +01:00
commit da29702a79
17 changed files with 255 additions and 16 deletions

View File

@ -35,10 +35,10 @@ class AdminMenuStructure{
//$today = \Yii::$app->formatter->asDate( time() );
$today = \Yii::$app->formatter->asDate( strtotime('today UTC') );
$tomorrow = \Yii::$app->formatter->asDate( ( 60 *60 *24 + time()));
$tomorrow = \Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today') );
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
$todayDatetime = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$tomorrowDatetime = \Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
/////////////////////////////

View File

@ -1,3 +1,8 @@
-0.0.18
- reception customer search
- timezone changes
- reception card read redirect changes
- fix reception ticket visiblitity
-0.0.17
- fix helper::fixascii function
- admin pdf download

View File

@ -24,8 +24,9 @@ return [
'datetimeFormat' => 'yyyy.MM.dd HH:mm',
'timeFormat' => 'HH:mm',
'locale' => 'hu-Hu',
'timeZone' => 'Europe/Budapest',
'defaultTimeZone' => 'UTC',
// 'timeZone' => 'Europe/Budapest',
'timeZone' => 'UTC',
// 'defaultTimeZone' => 'UTC',
'nullDisplay' => "-",
],
'authManager' => [

View File

@ -3,7 +3,7 @@ return [
'adminEmail' => 'rocho02@gmail.com',
'supportEmail' => 'rocho02@gmail.com',
'user.passwordResetTokenExpire' => 3600,
'version' => 'v0.0.17',
'version' => 'v0.0.18',
'company' => 'movar',//gyor
'company_name' => "Freimann Kft.",
'product_visiblity' => 'account',// on reception which products to display. account or global

View File

@ -0,0 +1,88 @@
<?php
namespace common\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use common\models\Card;
use yii\db\Query;
use yii\helpers\ArrayHelper;
/**
* CardSearch represents the model behind the search form about `common\models\Card`.
*/
class CardSearch extends Card
{
public $customerName;
/**
* @inheritdoc
*/
public function rules()
{
return [
['customerName','string','max' =>200],
['number','string','max' =>200]
];
}
/**
* @inheritdoc
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
public function attributeLabels(){
return ArrayHelper::merge(parent::attributeLabels(),
[
'card_number' => 'Kártya szám',
'customerName' => 'Vendég'
]
);
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = new Query();
$query->select(['card.number as card_number' , 'customer.name as customer_name', 'customer.email as customer_email','customer.phone as customer_phone']);
$query->from('card');
$query->innerJoin('customer','card.id_card = customer.id_customer_card');
$query->orderBy(['customer.name' => 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([
// 'lower(customer.name)' => $this->customerName
]);
$query->andFilterWhere(['like', 'customer.name', $this->customerName]);
return $dataProvider;
}
}

View File

@ -59,7 +59,7 @@ class Transfer extends \common\models\BaseFitnessActiveRecord
return ArrayHelper::merge( [
[
'class' => TimestampBehavior::className(),
'value' => function(){ return date('Y-m-d H:i:s' ); }
'value' => function(){ return date('Y-m-d H:i:s' ,\Yii::$app->formatter->asTimestamp(date('Y-d-m h:i:s')) ); }
],
[
'class' => DiscountAwareBehavior::className(),

View File

@ -23,8 +23,8 @@ class FrontendMenuStructure{
public function __construct(){
$this->menuItems = [];
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow') );
$this->start = \Yii::$app->formatter->asDatetime( strtotime('today UTC') );
$this->tomorrow = Yii::$app->formatter->asDatetime( strtotime('tomorrow UTC') );
$this->startDate = Yii::$app->formatter->asDate( strtotime('today UTC') );
$this->tomorrowDate = Yii::$app->formatter->asDate( strtotime('tomorrow UTC') );
@ -84,6 +84,8 @@ class FrontendMenuStructure{
$items[] = ['label' => Yii::t('frontend/transfer','Transfers'), 'url' => ['/transfer/index', 'TransferSearch[id_user]' =>\Yii::$app->user->id, 'TransferSearch[id_account]' => Account::readDefault(), 'TransferSearch[start]' => $this->start, 'TransferSearch[end]' => $this->tomorrow ] ];
$items[] = ['label' => Yii::t('frontend/collection','Collections'), 'url' => ['/collection/index' , 'CollectionSearch[start]' =>$this->start,'CollectionSearch[end]' => $this->tomorrow ] ];
}
$items[] = ['label' => Yii::t('frontend/card','Vendégek'), 'url' => [ '/card/index' ] ];
$this->menuItems[] = ['label' => Yii::t('frontend/account', 'Account'),

View File

@ -81,6 +81,16 @@ class CardController extends Controller
echo Json::encode ( $out );
}
public function actionIndex(){
$searchModel = new \common\models\CardSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
}

View File

@ -59,7 +59,8 @@ class CustomerController extends Controller
if ( $model->isFreeCard() ){
return $this->redirect([ 'create', 'number' => $model->card->number ]);
}else if ( $model->isCustomerWithTicket()){
return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
// return $this->redirect([ 'product/sale', 'number' => $model->card->number ]);
// return $this->redirect([ 'customer/reception', 'number' => $model->card->number ]);
}else if ( $model->isCardWithCustomer() ){
return $this->redirect([ 'ticket/create', 'number' => $model->card->number ]);
}

View File

@ -97,7 +97,7 @@ class TicketController extends FrontendController
$discounts = Discount::read();
$ticketTypes = TicketType::read(null, Account::readDefault());
$ticketTypes = TicketType::read(null, null);
$accounts = Account::readAccounts();

View File

@ -8,6 +8,7 @@ use common\models\Card;
use common\models\Customer;
use common\models\Ticket;
use common\models\Account;
use common\models\CardSearch;
/**
* ContactForm is the model behind the contact form.
@ -19,6 +20,7 @@ class ReceptionForm extends Model
public $customer;
public $tickets;
public $defaultAccount;
public $cardSearchModel;
/**
* @inheritdoc
@ -56,6 +58,8 @@ class ReceptionForm extends Model
$this->defaultAccount = Account::findOne($defaultAccount);
}
$this->cardSearchModel = new CardSearch();
}
public function getDefaultAccountName(){

View File

@ -0,0 +1,38 @@
<?php
use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model frontend\models\CollectionSearch */
/* @var $form yii\widgets\ActiveForm */
?>
<?php
?>
<div class="collection-search">
<?php $form = ActiveForm::begin([
'action' => ['index'],
'method' => 'get',
]); ?>
<div class='row'>
<div class="col-md-4">
<?php echo $form->field($model, 'customerName') ?>
</div>
<div class="col-md-4">
<?php echo $form->field($model, 'number') ?>
</div>
</div>
<div class="form-group">
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

View File

@ -0,0 +1,70 @@
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use common\components\AccountTotalWidget;
use yii\helpers\Url;
/* @var $this yii\web\View */
/* @var $searchModel frontend\models\CollectionSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
$this->title = Yii::t('frontend/collection', 'Vendégek');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="collection-index">
<h1><?= Html::encode($this->title) ?></h1>
<?php echo $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'card_number',
'label' => 'Kártyaszám',
],
[
'attribute' => 'customer_name',
'label' => 'Név',
],
[
'attribute' => 'customer_phone',
'label' => 'Tel',
],
[
'attribute' => 'customer_email',
'label' => 'E-mail',
],
// [
// 'attribute' => 'customer.name',
// 'value' => 'customer.name',
// ],
['class' => 'yii\grid\ActionColumn',
'template' => '{ticket} {ticket_history}',
'buttons' => [
'ticket' => function ($url, $model, $key) {
return Html::a('Új bérlet', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
'ticket_history' => function ($url, $model, $key) {
return Html::a('Befizetések', $url, ['class'=> 'btn btn-xs btn-success' ]) ;
},
],
'urlCreator' => function ($action, $model, $key, $index){
$url = "";
if ( 'ticket' == $action ){
$url = Url::to(['ticket/create','number' => $model['card_number']]);
}else if ( 'ticket_history' == $action ){
$url = Url::to(['ticket/index','number' => $model['card_number']]);
}
return $url;
}
],
],
]); ?>
</div>

View File

@ -6,6 +6,8 @@ use frontend\components\ReceptionCardNumberTicketsWidget;
use yii\base\Widget;
use frontend\components\ReceptionTicketWidget;
use frontend\components\ReceptionCustomerWidget;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
?>
<div class='row'>
<div class='col-md-4'>
@ -13,6 +15,19 @@ use frontend\components\ReceptionCustomerWidget;
Aktuális kassza: <?php echo $model->getDefaultAccountName();?>
</div>
</div>
<?php $form = ActiveForm::begin([
'action' => ['card/index'],
'method' => 'get',
]); ?>
<div class='col-md-3'>
<?php echo Html::textInput('CardSearch[customerName]','',['class'=>"form-control", 'placeholder' =>'Vendég neve']) ?>
</div>
<div class='col-md-3'>
<?= Html::submitButton(Yii::t('frontend/collection', 'Search'), ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>
<div class='row'>
<div class='col-md-3'>

View File

@ -26,8 +26,7 @@ if ( isset($model->card)){
}
?>
<div class="form-card-number">
<div class="form-card-number">
<?php $form = ActiveForm::begin([
'enableAjaxValidation' => false,
'method' => 'get',
@ -35,7 +34,7 @@ if ( isset($model->card)){
]); ?>
<div class="row" >
<div class='col-md-12'>
<?php echo Html::textInput("number", $number ,['class' => 'form-control'])?>
<?php echo Html::textInput("number", $number ,['class' => 'form-control', 'placeholder' => 'Kártyaszám'])?>
</div>
</div>
<div class="row" >
@ -44,7 +43,7 @@ if ( isset($model->card)){
</div>
</div>
<?php ActiveForm::end(); ?>
</div>
</div>

View File

@ -6,3 +6,9 @@ use frontend\components\ReceptionWidget;
?>
<h1>Recepció</h1>
<?php echo ReceptionWidget::widget( ['form' => $model, 'route' => ['customer/reception'] ] )?>
<?php
// echo "Timezone:" . date_default_timezone_get();
//echo date("Y-m-d H:i");
?>

View File

@ -68,7 +68,7 @@ use common\models\Account;
<div class="row">
<div class='col-md-4'>
<?php echo Html::a(Yii::t("frontend/ticket","Sell"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
<?php echo Html::a(Yii::t("frontend/ticket","Fizetve"),null,['class' => 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
</div>
<div class='col-md-4'>
<?php echo Html::a(Yii::t("frontend/ticket","To cart"),null,['class' => 'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>