add contract controller(s) changes

This commit is contained in:
Roland Schneider
2018-09-10 07:40:50 +02:00
parent dd0d6c50c9
commit 792d0caab5
7 changed files with 266 additions and 74 deletions

View File

@@ -60,11 +60,13 @@ class ContractController extends Controller {
'dataProvider' => $dataProvider
] );
}
/**
* Lists all Contract models.
*
* @return mixed
*/
/**
* Lists all Contract models.
*
* @return mixed
* @throws NotFoundHttpException
*/
public function actionIndexCustomer($id) {
$model = Customer::findOne ( $id );
@@ -82,13 +84,14 @@ class ContractController extends Controller {
'dataProvider' => $dataProvider
] );
}
/**
* Displays a single Contract model.
*
* @param integer $id
* @return mixed
*/
/**
* Displays a single Contract model.
*
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionView($id) {
return $this->render ( 'view', [
'model' => $this->findModel ( $id )
@@ -115,14 +118,15 @@ class ContractController extends Controller {
] );
}
}
/**
* Updates an existing Contract model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
* @return mixed
*/
/**
* Updates an existing Contract model.
* If update is successful, the browser will be redirected to the 'view' page.
*
* @param integer $id
* @return mixed
* @throws NotFoundHttpException
*/
public function actionUpdate($id) {
$model = $this->findModel ( $id );
@@ -217,7 +221,13 @@ class ContractController extends Controller {
'index'
] );
}
public function actionDetails($id) {
/**
* @param $id
* @return string
* @throws NotFoundHttpException
*/
public function actionDetails($id) {
$contract = Contract::findOne ( $id );
// ticket_installment_request

View File

@@ -2,6 +2,7 @@
namespace backend\models;
use common\components\Helper;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
@@ -15,6 +16,7 @@ class ContractSearch extends Contract
{
public $customer_name;
public $card_number;
/**
* @inheritdoc
@@ -23,7 +25,7 @@ class ContractSearch extends Contract
{
return [
[['id_contract', 'id_customer', 'status', 'flag', 'part_paid', 'part_count', 'part_required', 'id_ticket_type'], 'integer'],
[['customer_name' ], 'safe'],
[['customer_name' ,'card_number'], 'safe'],
];
}
@@ -65,7 +67,8 @@ class ContractSearch extends Contract
$query->from('contract');
$query->innerJoin('user' ,'user.id = contract.id_user');
$query->innerJoin('customer' ,'customer.id_customer = contract.id_customer');
$query->leftJoin('card as card' ,'card.id_card = customer.id_customer_card');
$dataProvider = new ActiveDataProvider([
'query' => $query,
@@ -133,6 +136,9 @@ class ContractSearch extends Contract
// $query->where('0=1');
return $dataProvider;
}
if ( isset($this->card_number)){
$this->card_number = Helper::fixAsciiChars($this->card_number);
}
$query->andFilterWhere([
'contract.id_contract' => $this->id_contract,
@@ -147,6 +153,7 @@ class ContractSearch extends Contract
'contract.created_at' => $this->created_at,
'contract.updated_at' => $this->updated_at,
'contract.id_ticket_type' => $this->id_ticket_type,
'card.number' => $this->card_number,
]);
$query->andFilterWhere(['like', 'customer.name', $this->customer_name]);

View File

@@ -26,6 +26,7 @@ use yii\widgets\ActiveForm;
<?= $form->field($model, 'customer_name')->label('Vendég neve') ?>
</div>
<div class="col-md-3">
<?= $form->field($model, 'card_number')->label('Kártyaszám') ?>
</div>
</div>