/** * @return \yii\db\ActiveQuery */ public function getEntriSheetDtls() { return $this->hasMany(EntriSheetDtl::className(), ['cd_esheet' => 'cd_esheet']); }
/** * @return \yii\db\ActiveQuery */ public function getEntriSheetDtls() { return $this->hasMany(EntriSheetDtl::className(), ['id_coa' => 'id_coa']); }
<div class="col-lg-7"> </div> </div> <table class ="table table-striped" id="tbl-entryheader"> <thead> <tr> <th>No</th> <th>NM Detail Entry</th> <th>Account</th> <th> <a href="#" data-action="append"><span class="glyphicon glyphicon-plus"></span></a> </th> </tr> </thead> <?php echo TabularInput::widget(['id' => 'tbl-entrydetail', 'allModels' => $model->entriSheetDtls, 'modelClass' => EntriSheetDtl::className(), 'itemView' => '_detail', 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'clientOptions' => ['afterAddRow' => new yii\web\JsExpression('biz.config.entryAfterAddRow')]]); ?> </table> <div class="box-footer"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); yii\jui\AutoCompleteAsset::register($this); yii\jui\ThemeAsset::register($this); biz\app\assets\BizAsset::register($this); $jsFunc = <<<JS function (\$row) {
\$row.find('.nm_account').autocomplete({ source: biz.master.coas, select: function (event, ui) { var \$row = \$(event.target).closest('tr'); \$row.find('.id_account').val(ui.item.id); \$row.find('.cd_account').text(ui.item.cd_coa); \$row.find('.nm_account').val(ui.item.value); return false; } }); } JS; ?> <?php echo TabularInput::widget(['id' => 'tbl-entrydetail', 'allModels' => $model->entriSheetDtls, 'modelClass' => EntriSheetDtl::className(), 'itemView' => '_detail', 'options' => ['tag' => 'tbody'], 'itemOptions' => ['tag' => 'tr'], 'clientOptions' => ['afterAddRow' => new yii\web\JsExpression($jsFunc), 'btnAddSelector' => '#append-row']]); ?> </table> <div class="panel-footer"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> </div> <?php ActiveForm::end(); ?> </div> <?php yii\jui\AutoCompleteAsset::register($this); yii\jui\ThemeAsset::register($this);