diff --git a/backend/assets/ProcurementCreateAsset.php b/backend/assets/ProcurementCreateAsset.php new file mode 100644 index 0000000..bb82517 --- /dev/null +++ b/backend/assets/ProcurementCreateAsset.php @@ -0,0 +1,29 @@ + + * @since 2.0 + */ +class ProcurementCreateAsset extends AssetBundle +{ + public $basePath = '@webroot'; + public $baseUrl = '@web'; + public $css = [ + ]; + public $js = [ + 'js/app.js', + 'js/procurement.create.js', + ]; + public $depends = [ + 'backend\assets\AppAsset', + ]; +} diff --git a/backend/controllers/ContractController.php b/backend/controllers/ContractController.php index 6991f97..e8780ea 100644 --- a/backend/controllers/ContractController.php +++ b/backend/controllers/ContractController.php @@ -10,6 +10,8 @@ use yii\web\NotFoundHttpException; use yii\filters\VerbFilter; use backend\models\ContractCustomerSearch; use common\models\Customer; +use yii\db\Query; +use backend\models\ContractRequestSearch; /** * ContractController implements the CRUD actions for Contract model. @@ -124,6 +126,31 @@ class ContractController extends Controller return $this->redirect(['index']); } + + + public function actionDetails( $id ) + { + $contract = Contract::findOne($id); + //ticket_installment_request + + + if ( !isset($contract)){ + throw new NotFoundHttpException('The requested page does not exist.'); + } + + $searchModel = new ContractRequestSearch( + ['contract' => $contract] + ); + +// $searchModel->contract = $contract; + + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('details', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } /** * Finds the Contract model based on its primary key value. diff --git a/backend/models/ContractRequestSearch.php b/backend/models/ContractRequestSearch.php new file mode 100644 index 0000000..72ca6ac --- /dev/null +++ b/backend/models/ContractRequestSearch.php @@ -0,0 +1,58 @@ +andWhere( ['ticket_installment_request.id_contract' => $this->contract->id_contract ]); + + $dataProvider = new ActiveDataProvider([ + 'query' => $query, + ]); + + return $dataProvider; + } +} diff --git a/backend/views/contract/details.php b/backend/views/contract/details.php new file mode 100644 index 0000000..d526232 --- /dev/null +++ b/backend/views/contract/details.php @@ -0,0 +1,36 @@ + +Részletek + + $dataProvider, + 'columns' => [ + [ + 'attribute' => 'id_ticket_installment_request' , + 'label' => 'Részlet azonosító' + ], + [ + 'attribute' => 'request_target_time_at' , + 'label' => 'Esedékességi dátum', + 'format' => 'date' + ], + [ + 'attribute' => 'priority' , + 'label' => 'Sorszám' + ], + [ + 'attribute' => 'status' , + 'label' => 'Státusz', + 'value' => function ($model, $key, $index, $column){ + return TicketInstallmentRequest::toStatusName($model->status); + } + ], + ] + ]); + + ?> \ No newline at end of file diff --git a/backend/views/contract/index.php b/backend/views/contract/index.php index 634bc47..94aa537 100644 --- a/backend/views/contract/index.php +++ b/backend/views/contract/index.php @@ -3,6 +3,7 @@ use yii\helpers\Html; use yii\grid\GridView; use common\models\Contract; +use yii\helpers\Url; /* @var $this yii\web\View */ /* @var $searchModel backend\models\ContractSearch */ @@ -79,6 +80,23 @@ $this->params['breadcrumbs'][] = $this->title; 'label' =>'Lejárat', 'format' => 'date' ], + [ + 'class' => 'yii\grid\ActionColumn', + 'template' =>'{details}', + 'urlCreator' => function ($action, $model, $key, $index){ + $result = ""; + if ( $action == 'details' ){ + $result = Url::toRoute(['contract/details','id' => $model['contract_id_contract']]); + } + return $result; + }, + 'buttons' => [ + 'details' => function ($url, $model, $key) { + return Html::a('Részletek', $url , ['class' => 'btn btn-primary btn-xs' ]) ; + }, + + ], + ], ], ]); ?> diff --git a/backend/views/procurement/create.php b/backend/views/procurement/create.php index 936a858..adec3e6 100644 --- a/backend/views/procurement/create.php +++ b/backend/views/procurement/create.php @@ -1,6 +1,7 @@ title = Yii::t('common/procurement', 'Create Procurement'); $this->params['breadcrumbs'][] = ['label' => Yii::t('common/procurement', 'Procurements'), 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; + +ProcurementCreateAsset::register($this); + +$this->registerJs(' new ProcurementCreate( { } );'); + ?>