use yii\jui\AutoComplete; use biz\inventory\models\TransferDtl; use mdm\widgets\TabularInput; use biz\app\assets\BizDataAsset; use biz\master\components\Helper as MasterHelper; ?> <div class="box box-info"> <div class="box-header" style="padding: 10px;"> Product : <?php echo AutoComplete::widget(['name' => 'product', 'id' => 'product', 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'select' => new JsExpression('yii.transfer.onProductSelect'), 'delay' => 100], 'options' => ['class' => 'form-control']]); ?> </div> <div class="box-body no-padding"> <table class="table table-striped"> <?php echo TabularInput::widget(['id' => 'detail-grid', 'allModels' => $model->transferDtls, 'modelClass' => TransferDtl::className(), 'itemView' => '_item_detail', 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'clientOptions' => ['initRow' => new JsExpression('yii.transfer.initRow')]]); ?> </table> </div> </div> <?php $js = $this->render('_script', [], $this->context); $this->registerJs($js, yii\web\View::POS_END); BizDataAsset::register($this, ['master' => MasterHelper::getMasters('product, barcode, product_stock')]); $js_ready = <<<JS \$("#product").data("ui-autocomplete")._renderItem = yii.global.renderItem; yii.transfer.onReady(); JS; $this->registerJs($js_ready);
public function getDataMaster() { return Helper::getMasters(['product', 'price', 'barcode']); }
public function actionPull(array $masters) { \Yii::$app->response->format = Response::FORMAT_JSON; return MasterHelper::getMasters($masters); }
?> <div class="col-lg-9" style="padding-left: 0px;"> <div class="panel panel-info"> <div class="panel-heading"> Product : <?php echo AutoComplete::widget(['name' => 'product', 'id' => 'product', 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'select' => new JsExpression('yii.standart.onProductSelect'), 'delay' => 100]]); ?> </div> <div class="panel-body" style="text-align: right;"> <h2>Rp<span id="total-price"></h2></span> <?php echo Html::activeHiddenInput($model, 'sales_value', ['id' => 'total-price-inp']); ?> </div> <table class="table table-striped"> <?php echo TabularInput::widget(['id' => 'detail-grid', 'allModels' => $model->salesDtls, 'modelClass' => SalesDtl::className(), 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'itemView' => '_item_detail', 'clientOptions' => ['initRow' => new JsExpression('yii.standart.initRow')]]); ?> </table> </div> </div> <?php $js = $this->render('_script', ['price' => $price], $this->context); $this->registerJs($js, \yii\web\View::POS_END); BizDataAsset::register($this, ['master' => MasterHelper::getMasters('product, barcode, price, customer'), 'config' => ['price_ct' => $price]]); $js_ready = <<<JS yii.standart.onReady(); JS; $this->registerJs($js_ready);
public function getDataMaster() { return MasterHelper::getMasters('product, barcode, product_stock'); }