diff --git a/backend/components/AdminMenuStructure.php b/backend/components/AdminMenuStructure.php index 918a8c2..1a3bb1e 100644 --- a/backend/components/AdminMenuStructure.php +++ b/backend/components/AdminMenuStructure.php @@ -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') ); ///////////////////////////// diff --git a/changelog.txt b/changelog.txt index 40d21cd..30d726f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/common/config/main.php b/common/config/main.php index 0c3dd4d..5ceae8a 100644 --- a/common/config/main.php +++ b/common/config/main.php @@ -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' => [ diff --git a/common/config/params.php b/common/config/params.php index bb9dfb9..d095cd1 100644 --- a/common/config/params.php +++ b/common/config/params.php @@ -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 diff --git a/common/models/CardSearch.php b/common/models/CardSearch.php new file mode 100644 index 0000000..414462b --- /dev/null +++ b/common/models/CardSearch.php @@ -0,0 +1,88 @@ +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; + } +} diff --git a/common/models/Transfer.php b/common/models/Transfer.php index b219313..57c6030 100644 --- a/common/models/Transfer.php +++ b/common/models/Transfer.php @@ -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(), diff --git a/frontend/components/FrontendMenuStructure.php b/frontend/components/FrontendMenuStructure.php index 16b5687..485ebbf 100644 --- a/frontend/components/FrontendMenuStructure.php +++ b/frontend/components/FrontendMenuStructure.php @@ -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'), diff --git a/frontend/controllers/CardController.php b/frontend/controllers/CardController.php index b1ce3bf..e370207 100644 --- a/frontend/controllers/CardController.php +++ b/frontend/controllers/CardController.php @@ -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, + ]); + } + } diff --git a/frontend/controllers/CustomerController.php b/frontend/controllers/CustomerController.php index cb18e55..8ba9b92 100644 --- a/frontend/controllers/CustomerController.php +++ b/frontend/controllers/CustomerController.php @@ -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 ]); } diff --git a/frontend/controllers/TicketController.php b/frontend/controllers/TicketController.php index 073a9b1..9306887 100644 --- a/frontend/controllers/TicketController.php +++ b/frontend/controllers/TicketController.php @@ -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(); diff --git a/frontend/models/ReceptionForm.php b/frontend/models/ReceptionForm.php index 04af117..5d4159e 100644 --- a/frontend/models/ReceptionForm.php +++ b/frontend/models/ReceptionForm.php @@ -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(){ diff --git a/frontend/views/card/_search.php b/frontend/views/card/_search.php new file mode 100644 index 0000000..9222da1 --- /dev/null +++ b/frontend/views/card/_search.php @@ -0,0 +1,38 @@ + + + + diff --git a/frontend/views/card/index.php b/frontend/views/card/index.php new file mode 100644 index 0000000..b1a2409 --- /dev/null +++ b/frontend/views/card/index.php @@ -0,0 +1,70 @@ +title = Yii::t('frontend/collection', 'Vendégek'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + + + + $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; + } + ], + ], + ]); ?> + +
diff --git a/frontend/views/common/_reception.php b/frontend/views/common/_reception.php index 72eb2ea..1f9d128 100644 --- a/frontend/views/common/_reception.php +++ b/frontend/views/common/_reception.php @@ -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; ?>
@@ -13,6 +15,19 @@ use frontend\components\ReceptionCustomerWidget; Aktuális kassza: getDefaultAccountName();?>
+ ['card/index'], + 'method' => 'get', + ]); ?> +
+ "form-control", 'placeholder' =>'Vendég neve']) ?> + +
+
+ 'btn btn-primary']) ?> +
+ +
diff --git a/frontend/views/common/_reception_form_card_number.php b/frontend/views/common/_reception_form_card_number.php index d551fbf..89285a7 100644 --- a/frontend/views/common/_reception_form_card_number.php +++ b/frontend/views/common/_reception_form_card_number.php @@ -26,8 +26,7 @@ if ( isset($model->card)){ } ?> - -
+
false, 'method' => 'get', @@ -35,7 +34,7 @@ if ( isset($model->card)){ ]); ?>
- 'form-control'])?> + 'form-control', 'placeholder' => 'Kártyaszám'])?>
@@ -44,7 +43,7 @@ if ( isset($model->card)){
-
+
diff --git a/frontend/views/customer/reception.php b/frontend/views/customer/reception.php index 1f4295c..2c82a29 100644 --- a/frontend/views/customer/reception.php +++ b/frontend/views/customer/reception.php @@ -6,3 +6,9 @@ use frontend\components\ReceptionWidget; ?>

Recepció

$model, 'route' => ['customer/reception'] ] )?> + + diff --git a/frontend/views/ticket/_form.php b/frontend/views/ticket/_form.php index 6ef8532..04ec43c 100644 --- a/frontend/views/ticket/_form.php +++ b/frontend/views/ticket/_form.php @@ -68,7 +68,7 @@ use common\models\Account;
- 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?> + 'btn btn-danger btn-block', 'id' => 'btn_sell'] );?>
'btn btn-success btn-block', 'id' => 'btn_add_to_user_cart'] );?>