public function search($params)
 {
     $query = Ticket::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'type' => $this->type, 'priority' => $this->priority, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'status' => $this->status]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'customer_fullname', $this->customer_fullname])->andFilterWhere(['like', 'customer_company', $this->customer_company])->andFilterWhere(['like', 'customer_phone', $this->customer_phone])->andFilterWhere(['like', 'customer_email', $this->customer_email])->andFilterWhere(['like', 'system', $this->system])->andFilterWhere(['like', 'detail', $this->detail])->andFilterWhere(['like', 'suggestion', $this->suggestion])->andFilterWhere(['like', 'cause', $this->cause])->andFilterWhere(['like', 'solution', $this->solution])->andFilterWhere(['like', 'site', $this->site])->andFilterWhere(['like', 'hardware_type', $this->hardware_type])->andFilterWhere(['like', 'hardware_part', $this->hardware_part])->andFilterWhere(['like', 'hardware_serial', $this->hardware_serial]);
     return $dataProvider;
 }
 /**
  * Finds the Ticket model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Ticket the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if ($id !== null && ($model = Ticket::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
echo \Yii::t('ticket', 'CSR');
?>
:</small> <?php 
echo Html::encode($this->title);
?>
</h1>

				<h3><?php 
echo \Yii::t('ticket', 'Customer Information');
?>
</h3>
  				<?php 
echo DetailView::widget(['model' => $model, 'template' => "<tr><th class='col-xs-3'>{label}</th><td class='col-xs-9'>{value}</td></tr>", 'attributes' => ['customer_fullname', 'customer_company', 'customer_phone', 'customer_email:email']]);
?>
	    	<h3><?php 
echo \Yii::t('ticket', 'CSR Information');
?>
</h3>
  					<?php 
echo DetailView::widget(['model' => $model, 'template' => "<tr><th class='col-xs-3'>{label}</th><td class='col-xs-9'>{value}</td></tr>", 'attributes' => ['system', ['attribute' => 'priority', 'value' => is_null($model->priority) ? NULL : Ticket::priorityOptions($model->priority)], ['attribute' => 'detail', 'value' => kartik\markdown\Markdown::convert($model->detail), 'format' => 'html'], ['attribute' => 'suggestion', 'value' => kartik\markdown\Markdown::convert($model->suggestion), 'format' => 'html'], 'requested_at:datetime', 'replied_at:datetime', 'fixed_begin:datetime', 'fixed_end:datetime', ['attribute' => 'cause', 'value' => kartik\markdown\Markdown::convert($model->cause), 'format' => 'html'], ['attribute' => 'solution', 'value' => kartik\markdown\Markdown::convert($model->solution), 'format' => 'html'], ['attribute' => 'status', 'value' => is_null($model->status) ? NULL : Ticket::statusOptions($model->status)]]]);
?>
    <p>
        <?php 
echo Html::a(Yii::t('ticket', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']);
?>
        <?php 
echo Html::a(Yii::t('ticket', 'Delete'), ['delete', 'id' => $model->id], ['class' => 'btn btn-danger', 'data' => ['confirm' => Yii::t('ticket', 'Are you sure you want to delete this item?'), 'method' => 'post']]);
?>
    </p>
</div>
 */
$this->title = Yii::t('ticket', 'RMA');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="ticket-index">

    <h1><?php 
echo Html::encode($this->title);
?>
</h1>

    <?php 
// echo $this->render('_searchTicket', ['model' => $searchModel]);
?>

    <p>
        <?php 
echo Html::a(Yii::t('ticket', 'Create RMA'), ['create'], ['class' => 'btn btn-success']);
?>
    </p>

    <?php 
echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'title', 'customer_email:email', 'system', 'site', 'hardware_type', 'hardware_part', 'hardware_serial', ['attribute' => 'status', 'value' => function ($data) {
    return Ticket::statusOptions($data->status);
}, 'filter' => Ticket::statusOptions(), 'format' => 'html'], ['attribute' => 'priority', 'value' => function ($data) {
    return Ticket::priorityOptions($data->priority);
}, 'filter' => Ticket::priorityOptions(), 'format' => 'html'], ['class' => 'yii\\grid\\ActionColumn']]]);
?>

</div>
?>

	    <?php 
echo $form->field($model, 'hardware_part', ['options' => ['maxlength' => 255], 'addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-qrcode"></i>']]]);
?>

	    <?php 
echo $form->field($model, 'hardware_serial', ['options' => ['maxlength' => 255], 'addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-barcode"></i>']]]);
?>
	    </div>
	    <div class="col-sm-4">
	    	<?php 
echo $form->field($model, 'status', ['options' => ['maxlength' => 255], 'addon' => ['prepend' => ['content' => '<i class="glyphicon glyphicon-heart"></i>']]])->dropDownList(Ticket::statusOptions());
?>
		    <?php 
echo $form->field($model, 'priority')->radioList(Ticket::priorityOptions());
?>
	    </div>
    </div>


	    <?php 
echo $form->field($model, 'detail')->widget(kartik\markdown\MarkdownEditor::classname(), ['height' => 300]);
?>
	    <?php 
echo $form->field($model, 'suggestion')->widget(kartik\markdown\MarkdownEditor::classname(), ['height' => 300]);
?>

	<div class="row">
	    <div class="col-md-6 col-md-4">
	    	<?php 
    ?>

<?php 
}
?>

<?php 
if ($model->type == Ticket::TYPE_CSR) {
    ?>
<h2><?php 
    echo \Yii::t('ticket', 'CSR Information');
    ?>
</h2>

  					<?php 
    echo DetailView::widget(['model' => $model, 'template' => "<strong>{label}: </strong><em>{value}</em><br>", 'attributes' => ['system', ['attribute' => 'priority', 'value' => is_null($model->priority) ? NULL : Ticket::priorityOptions($model->priority)], 'requested_at:datetime', 'replied_at:datetime', 'fixed_begin:datetime', 'fixed_end:datetime', ['attribute' => 'status', 'value' => is_null($model->status) ? NULL : Ticket::statusOptions($model->status)]]]);
    ?>

					<h3><?php 
    echo Yii::t('ticket', 'Detail');
    ?>
</h3>

  					<?php 
    echo kartik\markdown\Markdown::convert($model->detail);
    ?>

  					<h3><?php 
    echo Yii::t('ticket', 'Suggestion');
    ?>
</h3>
?>

    <?php 
echo $form->field($model, 'type')->dropDownList(Ticket::typeOptions());
?>

    <?php 
echo $form->field($model, 'system')->textInput(['maxlength' => 255]);
?>

    <?php 
echo $form->field($model, 'priority')->radioList(Ticket::priorityOptions());
?>

    <?php 
echo $form->field($model, 'status')->dropDownList(Ticket::statusOptions());
?>

    <?php 
echo $form->field($model, 'detail')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'suggestion')->textarea(['rows' => 6]);
?>

    <?php 
echo $form->field($model, 'cause')->textarea(['rows' => 6]);
?>

    <?php