$.ajax("' . Url::to(['service/search-currency']) . '&id=" + id, { dataType: "json" }).done(function(data) { callback(data.results); } ); } }')]]], 'client_order_ref', ['attribute' => 'user_id', 'header' => 'Sales Man', 'filterType' => GridView::FILTER_SELECT2, 'filterWidgetOptions' => ['pluginOptions' => ['allowClear' => true, 'minimumInputLength' => 3, 'ajax' => ['url' => $url, 'dataType' => 'json', 'data' => new JsExpression('function(term,page){return {search:term}; }'), 'results' => new JsExpression('function(data,page){ return {results:data.results}; }')], 'initSelection' => new JsExpression($script($url))]], 'filterInputOptions' => ['placeholder' => 'Sales Man'], 'value' => function ($model, $Key, $index, $column) { return $model->user->partner->name; }], 'date_order:date', ['attribute' => 'partner.name', 'header' => 'Customer'], ['attribute' => 'state', 'value' => function ($model, $key, $index, $column) { return $model->getStateAlias($model->state); }, 'filter' => app\models\SaleOrder::getStateAliases()], ['attribute' => 'amount_total', 'value' => function ($model, $key, $index, $column) { return Yii::$app->numericLib->indoStyle($model->amount_total); }], ['attribute' => 'pricelist_id', 'label' => 'SO Currency', 'value' => function ($model, $key, $index, $column) { return $model->pricelist->name; }, 'filter' => \yii\helpers\ArrayHelper::map(app\models\ProductPricelist::find()->all(), 'id', 'name')], ['label' => 'OP', 'value' => function ($model, $key, $index, $column) { $res = ''; foreach ($model->orderPreparations as $op) { if ($res) { $res .= '<br/>'; } $res .= Html::a(Html::encode($op->name), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $op->id . '&view_type=form&model=order.preparation&menu_id=529&action=498', ['class' => '_blank']) . ' (' . $op->state . ')'; } return $res; }, 'format' => 'html', 'options' => ['width' => '300']], ['label' => 'DN', 'value' => function ($model, $key, $index, $column) { $res = ''; foreach ($model->deliveryNotes as $dn) { if ($res) { $res .= '<br/>'; } $res .= Html::a(Html::encode($dn->name), 'http://192.168.9.26:10001/?db=LIVE_2014#id=' . $dn->id . '&view_type=form&model=delivery.note&menu_id=527&action=502') . ' (' . $dn->state . ')';
<?php use yii\grid\GridView; use yii\helpers\Html; ?> <div class="sale-order-tree"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], 'name', 'client_order_ref', ['attribute' => 'user_id', 'header' => 'Sales Man', 'value' => function ($model, $Key, $index, $column) { return $model['user']['partner']['name']; }], 'date_order:date', ['attribute' => 'partner.name', 'header' => 'Customer'], ['attribute' => 'amount_total', 'value' => function ($model, $key, $index, $column) { return Yii::$app->numericLib->indoStyle($model['amount_total']); }], ['attribute' => 'pricelist_id', 'label' => 'SO Currency', 'value' => function ($model, $key, $index, $column) { return $model['pricelist']['name']; }, 'filter' => \yii\helpers\ArrayHelper::map(app\models\ProductPricelist::find()->all(), 'id', 'name')]]]); ?> </div>