/** * * @param View $view * @param array $data */ public static function bizConfig($view, $config = [], $position = View::POS_BEGIN) { $default = ['delay' => 1000, 'limit' => 20, 'checkStock' => false, 'debug' => YII_ENV == 'dev', 'pullUrl' => \yii\helpers\Url::to(['/master/sources/pull'])]; $js = "\n var biz = biz || {};" . "\n biz.config = " . Json::encode(ArrayHelper::merge($default, $config)) . ";\n"; $view->registerJs($js, $position); BizAsset::register($view); }
?> </div> </div> </div> <div class="col-lg-6"> <style> .tab-content { border: 1px #e0e0e0 solid; border-top: none; padding: 20px; } </style> <?php Pjax::begin(['id' => 'pjax', 'enablePushState' => false, 'clientOptions' => ['url' => \yii\helpers\Url::canonical()]]); ?> <?php echo Html::beginForm('', 'post', ['id' => 'input-form', 'data-pjax' => '#pjax']); ?> <?php echo Html::hiddenInput('action'); ?> <?php echo Tabs::widget(['items' => [['label' => 'Uoms', 'content' => $this->render('_form_uom', ['model' => $model]), 'active' => $active == 'uom'], ['label' => 'Barcode', 'content' => $this->render('_form_barcode', ['model' => $model]), 'active' => $active == 'barcode']]]); ?> </div> <?php echo Html::endForm(); Pjax::end(); \biz\app\assets\BizAsset::register($this);
<?php echo $form->field($model, 'nmProduct')->widget('yii\\jui\\AutoComplete', ['id' => 'product', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'delay' => 100]]); ?> <?php echo $form->field($model, 'id_uom')->dropDownList(ArrayHelper::map(Uom::find()->all(), 'id_uom', 'nm_uom'), ['style' => 'width:200px;']); ?> <?php echo $form->field($model, 'isi')->textInput(); ?> </div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div> <?php BizAsset::register($this); AppHelper::bizConfig($this, ['masters' => ['products', 'barcodes']]); $js_ready = <<<JS JS; $this->registerJs($js_ready);
/** * * @param View $view * @param array $data */ public static function register($view, $data = [], $position = View::POS_BEGIN) { $default = ['config' => ['delay' => 1000, 'limit' => 20, 'checkStock' => false, 'debug' => YII_ENV == 'dev']]; $js = "\n biz = " . Json::encode(ArrayHelper::merge($default, $data)) . ";\n"; $view->registerJs($js, $position); BizAsset::register($view); }