add editable account on reception/customer-cart, add towel handling
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use frontend\models\TowelForm;
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use frontend\models\ReceptionForm;
|
||||
@@ -35,7 +36,7 @@ class CustomerController extends Controller
|
||||
],
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'only' => ['create', 'update','reception','contract'],
|
||||
'only' => ['create', 'update','reception','contract','towel'],
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
@@ -91,8 +92,9 @@ class CustomerController extends Controller
|
||||
*/
|
||||
/**
|
||||
* Displays a single Customer model.
|
||||
* @param integer $id
|
||||
* @param null $number
|
||||
* @return mixed
|
||||
* @internal param int $id
|
||||
*/
|
||||
/*
|
||||
public function actionView($id)
|
||||
@@ -102,6 +104,26 @@ class CustomerController extends Controller
|
||||
]);
|
||||
}
|
||||
*/
|
||||
|
||||
public function actionTowel($number = null)
|
||||
{
|
||||
$model = new TowelForm();
|
||||
if ($model->load(Yii::$app->request->post()) ) {
|
||||
if ( $model->save() ){
|
||||
if ( $model->direction == 'in'){
|
||||
\Yii::$app->session->setFlash ( 'success', 'Törölköző(k) visszaadva!' );
|
||||
}else{
|
||||
\Yii::$app->session->setFlash ( 'success', 'Törölköző(k) kiadva!' );
|
||||
}
|
||||
}else{
|
||||
\Yii::$app->session->setFlash ( 'danger', 'Sikertelen törölköző művelet' );
|
||||
}
|
||||
}
|
||||
return $this->redirect(['customer/reception', 'number' => $number ]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new Customer model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
@@ -216,8 +238,8 @@ class CustomerController extends Controller
|
||||
$model->save(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// s
|
||||
|
||||
84
frontend/controllers/LogController.php
Normal file
84
frontend/controllers/LogController.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace frontend\controllers;
|
||||
|
||||
use Yii;
|
||||
use common\models\Log;
|
||||
use frontend\models\LogSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Card;
|
||||
use common\models\TicketInstallmentRequest;
|
||||
use common\models\Ticket;
|
||||
use common\models\Transfer;
|
||||
use common\models\Account;
|
||||
use common\components\Helper;
|
||||
use common\models\Sale;
|
||||
use common\models\Product;
|
||||
use common\models\ShoppingCart;
|
||||
use common\models\Customer;
|
||||
use frontend\models\LogForm;
|
||||
|
||||
/**
|
||||
* LogController implements the CRUD actions for Log model.
|
||||
*/
|
||||
class LogController extends Controller {
|
||||
public function behaviors() {
|
||||
return [
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'only' => ['towel'],
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'allow' => true,
|
||||
'roles' => ['@'],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Log models.
|
||||
* @param $id_card
|
||||
* @return mixed
|
||||
* @throws \Yii\web\NotFoundHttpException
|
||||
*/
|
||||
public function actionTowel($id_card) {
|
||||
$card = Card::findOne ( $id_card );
|
||||
|
||||
if (! isset ( $card ))
|
||||
throw new NotFoundHttpException ( 'A bérlet nem található' );
|
||||
|
||||
$searchModel = new LogSearch ();
|
||||
$searchModel->card = $card;
|
||||
$searchModel->customer = $card->customer;
|
||||
$dataProvider = $searchModel->search ( Yii::$app->request->queryParams );
|
||||
|
||||
return $this->render ( 'index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Finds the Log model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
*
|
||||
* @param integer $id
|
||||
* @return Log the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id) {
|
||||
if (($model = Log::findOne ( $id )) !== null) {
|
||||
return $model;
|
||||
} else {
|
||||
throw new NotFoundHttpException ( 'The requested page does not exist.' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -401,6 +401,11 @@ class TransferController extends Controller
|
||||
return $this->redirect(['account/select']);
|
||||
}
|
||||
|
||||
$hiddenAccounts = Account::find()
|
||||
->andWhere(['type' => Account::TYPE_VALUE_HIDDEN])
|
||||
->andWhere(['status' => Account::STATUS_ACTIVE])->all();
|
||||
|
||||
|
||||
$customer = null;
|
||||
$card = Card::findOne($id_card);
|
||||
if ($card != null )
|
||||
@@ -413,6 +418,7 @@ class TransferController extends Controller
|
||||
|
||||
$model = new CustomerCartForm();
|
||||
$model->customer = $customer;
|
||||
$model->hiddenAccounts = $hiddenAccounts;
|
||||
if ($model->load(Yii::$app->request->post()) && $model->payout()) {
|
||||
return $this->redirect(['customer-cart','id_card' => $model->customer->card->id_card]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user