implement feature 'put to cart ticket installment request'

This commit is contained in:
Roland Schneider
2019-03-26 07:29:47 +01:00
parent 3fce2c70c2
commit 8de73c0585
9 changed files with 444 additions and 203 deletions

View File

@@ -2,9 +2,11 @@
namespace backend\controllers;
use backend\components\ContractManager;
use Yii;
use common\models\TicketInstallmentRequest;
use backend\models\TicketInstallmentRequestSearch;
use yii\helpers\Url;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
@@ -58,7 +60,7 @@ class TicketInstallmentRequestController extends Controller
{
$searchModel = new TicketInstallmentRequestSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
Url::remember('',"ticket-installment-request/index");
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
@@ -84,29 +86,31 @@ class TicketInstallmentRequestController extends Controller
'dataProvider' => $dataProvider,
]);
}
public function actionAccept( $id )
/**
* @param $id
* @return \yii\web\Response
* @throws NotFoundHttpException
*/
public function actionAccept($id )
{
$model = $this->findModel($id);
if ( !$model->isStatusAccepted() ){
$model->applyStatus(TicketInstallmentRequest::$STATUS_ACCEPTED_MANUAL,true);
\Yii::$app->session->setFlash('success',"Megbízás teljesítve");
}
// else{
// }
// echo "asdff";
return $this->redirect(['ticket-installment-request/view',
'id' => $model->id_ticket_installment_request,
]);
}
/**
* Lists pending TicketInstallmentRequest models.
* @return mixed
* @throws \Exception
*/
public function actionDownloadGiro()
{
@@ -132,6 +136,7 @@ class TicketInstallmentRequestController extends Controller
* Displays a single TicketInstallmentRequest model.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionView($id)
{
@@ -163,6 +168,7 @@ class TicketInstallmentRequestController extends Controller
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionUpdate($id)
{
@@ -182,6 +188,8 @@ class TicketInstallmentRequestController extends Controller
* If deletion is successful, the browser will be redirected to the 'index' page.
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
* @throws \yii\db\StaleObjectException
*/
public function actionDelete($id)
{
@@ -192,10 +200,23 @@ class TicketInstallmentRequestController extends Controller
public function actionTest( )
{
return $this->render('test');
}
/**
* @param $id
* @return string
* @throws NotFoundHttpException
* @throws \Throwable
*/
public function actionPutToCart($id )
{
$contractManager = new ContractManager();
$contractManager->openRequestAndPutItItoCart($id);
return $this->redirect( Url::previous("ticket-installment-request/index"));
}
/**
* Finds the TicketInstallmentRequest model based on its primary key value.
* If the model is not found, a 404 HTTP exception will be thrown.