add changes to create ticket

This commit is contained in:
2015-10-08 10:13:29 +02:00
parent 2e906de8c2
commit c3ae414bba
21 changed files with 650 additions and 45 deletions

View File

@@ -8,6 +8,9 @@ use backend\models\TicketSearch;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use yii\filters\VerbFilter;
use common\models\Discount;
use common\models\TicketType;
use common\models\Account;
/**
* TicketController implements the CRUD actions for Ticket model.
@@ -61,12 +64,20 @@ class TicketController extends Controller
public function actionCreate()
{
$model = new Ticket();
$discounts = Discount::read();
$ticketTypes = TicketType::read();
$accounts = Account::readAccounts();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->id_ticket]);
} else {
return $this->render('create', [
'model' => $model,
'discounts' => $discounts,
'ticketTypes' => $ticketTypes,
'accounts' => $accounts,
]);
}
}