add coronavirus activate/inactivate
This commit is contained in:
@@ -2,10 +2,13 @@
|
||||
|
||||
namespace backend\controllers;
|
||||
|
||||
use backend\models\CustomerActivateForm;
|
||||
use backend\models\CustomerInactivateForm;
|
||||
use Yii;
|
||||
use common\models\Customer;
|
||||
use backend\models\CustomerSearch;
|
||||
use backend\models\CustomerCreate;
|
||||
use yii\filters\AccessControl;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
@@ -27,21 +30,71 @@ class CustomerController extends \backend\controllers\BackendController
|
||||
{
|
||||
return [
|
||||
'access' => [
|
||||
'class' => \yii\filters\AccessControl::className(),
|
||||
'class' => AccessControl::className(),
|
||||
'rules' => [
|
||||
// allow authenticated users
|
||||
[
|
||||
'actions' => ['create','index','view','update','mail'],
|
||||
'actions' => ['create','index','view','update','mail' ],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee','reception'],
|
||||
],// allow authenticated users
|
||||
[
|
||||
'actions' => ['inactivate','activate'],
|
||||
'allow' => true,
|
||||
'roles' => ['admin','employee'],
|
||||
],
|
||||
// everything else is denied
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Inactivate all card:
|
||||
* set card.status to 20 and update card.flag
|
||||
* @return string
|
||||
*/
|
||||
public function actionInactivate(){
|
||||
|
||||
$form = new CustomerInactivateForm();
|
||||
|
||||
$form->loadActiveCardCount();
|
||||
|
||||
$form->inactivateDate = date('Y.m.d');
|
||||
|
||||
|
||||
if ( $form->load(Yii::$app->request->post()) && $form->inactivate() ){
|
||||
// redirect ?
|
||||
}
|
||||
|
||||
return $this->render('inactivate', [
|
||||
'model' => $form
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate all inactive cards.
|
||||
* Set
|
||||
* ticket.end
|
||||
* card.status and card.flag
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function actionActivate(){
|
||||
|
||||
$form = new CustomerActivateForm();
|
||||
|
||||
$form->loadActiveCardCount();
|
||||
if ( Yii::$app->request->isPost && $form->activate()){
|
||||
// redirect
|
||||
}
|
||||
|
||||
return $this->render('activate', [
|
||||
'model' => $form
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all Customer models.
|
||||
* @return mixed
|
||||
|
||||
Reference in New Issue
Block a user