add customer ticket statistics
This commit is contained in:
@@ -12,6 +12,8 @@ use common\models\Discount;
|
||||
use common\models\TicketType;
|
||||
use common\models\Account;
|
||||
use common\models\User;
|
||||
use common\models\Customer;
|
||||
use common\models\Card;
|
||||
|
||||
/**
|
||||
* TicketController implements the CRUD actions for Ticket model.
|
||||
@@ -19,6 +21,25 @@ use common\models\User;
|
||||
class TicketController extends \backend\controllers\BackendController
|
||||
{
|
||||
|
||||
|
||||
public function behaviors()
|
||||
{
|
||||
return [
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => ['create','index','view','update','index-customer'],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Ticket models.
|
||||
* @return mixed
|
||||
@@ -40,6 +61,42 @@ class TicketController extends \backend\controllers\BackendController
|
||||
'dataProvider' => $dataProvider,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Lists all Ticket models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndexCustomer($id)
|
||||
{
|
||||
|
||||
$customer = Customer::findOne($id);
|
||||
$card = Card::findOne($id);
|
||||
|
||||
|
||||
if ( $customer == null ){
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
}
|
||||
|
||||
$searchModel = new TicketSearch();
|
||||
$searchModel->id_card = $customer->id_customer_card;
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
$searchModel->searchTotals();
|
||||
|
||||
$searchModel->users = User::read();
|
||||
$searchModel->accounts = Account::read();
|
||||
$searchModel->ticketTypes = TicketType::read();
|
||||
|
||||
|
||||
|
||||
return $this->render('index_customer', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'customer' => $customer,
|
||||
'card' => $card
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Displays a single Ticket model.
|
||||
|
||||
Reference in New Issue
Block a user