add admin edit ticket date
This commit is contained in:
@@ -20,6 +20,11 @@ use common\components\TicketSale;
|
||||
use common\models\Contract;
|
||||
use common\components\giro\GiroDETSTATetel;
|
||||
use common\components\DetStatTetelProcessor;
|
||||
use yii\helpers\VarDumper;
|
||||
use backend\models\TicketUpdate;
|
||||
use yii\helpers\Url;
|
||||
use frontend\components\HtmlHelper;
|
||||
use common\components\Helper;
|
||||
|
||||
/**
|
||||
* TicketController implements the CRUD actions for Ticket model.
|
||||
@@ -143,6 +148,8 @@ class TicketController extends \backend\controllers\BackendController {
|
||||
$searchModel->accounts = Account::read ();
|
||||
$searchModel->ticketTypes = TicketType::read ();
|
||||
|
||||
Url::remember(Url::current(),"ticket_index_customer");
|
||||
|
||||
return $this->render ( 'index_customer', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
@@ -199,9 +206,28 @@ class TicketController extends \backend\controllers\BackendController {
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionUpdate($id) {
|
||||
$model = $this->findModel ( $id );
|
||||
$model = TicketUpdate::findOne( $id );
|
||||
|
||||
|
||||
$model->startDate = substr( $model->start ,0 ,10 );
|
||||
$model->endDate = substr( $model->end ,0 ,10 );
|
||||
|
||||
$model->startDate = \Yii::$app->formatter->asDate($model->startDate);
|
||||
$model->endDate = \Yii::$app->formatter->asDate($model->endDate);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if ($model->load ( Yii::$app->request->post () ) && $model->save ()) {
|
||||
|
||||
Helper::flash("success", "Bérlet sikeresen módosítva");
|
||||
|
||||
$url = Url::previous("ticket_index_customer");
|
||||
|
||||
if ( isset($url) ){
|
||||
return $this->redirect($url);
|
||||
}
|
||||
return $this->redirect ( [
|
||||
'view',
|
||||
'id' => $model->id_ticket
|
||||
@@ -211,6 +237,8 @@ class TicketController extends \backend\controllers\BackendController {
|
||||
'model' => $model
|
||||
] );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user