<?php use yii\widgets\ActiveForm; use yii\helpers\Html; $this->registerCss(".ui-menu .ui-menu-item:hover,.ui-menu .ui-state-active {background:#4f99c6}"); ?> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'name'); ?> <?php echo $form->field($model, 'description'); ?> <?php //echo $form->field($model, 'rule_name') echo $form->field($model, 'rule_name')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => array_keys(\Yii::$app->authManager->getRules())], 'options' => ['class' => 'form-control']]); echo $form->field($model, 'data')->textarea(['rows' => 6]); ?> <?php echo Html::submitButton('Save', ['class' => 'btn btn-success btn-block']); ?> <?php ActiveForm::end();
use yii\helpers\Html; use yii\helpers\Url; use yii\jui\AutoComplete; $this->title = ''; if ($locale) { $this->title = \Locale::getDisplayName($locale, Yii::$app->language) . ', ' . Html::encode($locale) . ' - '; } $this->title .= 'PHP intl extension, ICU data tables'; ?> <?php echo Html::beginForm(['site/index'], 'get', ['class' => 'form-horizontal']); ?> <div class="input-group"> <?php echo AutoComplete::widget(['name' => 'locale', 'value' => $locale, 'options' => ['class' => 'form-control', 'placeholder' => 'Enter locale code such as "en" or "en_US"', 'autofocus' => true], 'clientOptions' => ['source' => Url::toRoute(['site/suggest-locale'])]]); ?> <span class="input-group-btn"> <?php echo Html::submitButton('Find', ['class' => 'btn btn-primary']); ?> </span> </div> <?php echo Html::endForm(); ?> <?php if ($locale) { ?>
public function autocompleteJui($opts) { $id = $this->getInputId(); $options = array_merge_recursive(['id' => $id . '_autoComplete', 'clientOptions' => ['select' => new JsExpression("function( event, ui ) { \$( '#{$id}' ).val( ui.item.id ); }"), 'change' => new JsExpression("function(){ if( \$( '#{$id}' ).val() <= 0 ){ \$(this).val(null); }}"), 'search' => new JsExpression("function(){ \$( '#{$id}' ).val(null); }")]], $opts); $hidden = Html::activeHiddenInput($this->model, $this->attribute); $autocomplete = AutoComplete::widget($options); Yii::$app->getView()->registerJs("\$('body').on('autocompletecreate', 'input', function(e, ui){" . "\$(this).addClass('form-control') });", View::POS_END, 'autocompletecreate'); $this->parts['{input}'] = $hidden . $autocomplete; return $this; }
?> </div> <div class="col-sm-8"> <?php echo $form->field($model, 'tags')->widget(Select2::classname(), ['options' => ['placeholder' => Yii::t('app', 'Put additional tags, usefull for Helper Ledger ...')], 'data' => $model->getTags(), 'pluginOptions' => ['tags' => true, 'tokenSeparators' => [',', ' ']]]); ?> </div> </div> <div class="row"> <div class="col-sm-9"> <?php echo $form->field($model, 'title')->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//cap/transaction/template")], 'clientEvents' => ['select' => 'function(event, ui) { var id = ui.item.value; var url = "' . Yii::$app->urlManager->createUrl('//cap/transaction/template') . '?id="+id; $.ajax(url, { success: function (xhr) { xhr = JSON.parse(xhr); if (xhr != null) { var t = JSON.parse(xhr.json); var total = parseFloat($("#transaction-total").val()); for (k in t) { if (k == "total") {
echo $form->field($model, 'status')->widget(Select2::classname(), ['data' => $model->itemAlias('status'), 'options' => ['placeholder' => Yii::t('app', 'Select shipping status...')], 'pluginOptions' => ['allowClear' => false], 'pluginEvents' => []]); ?> </div> </div> <?php $field = $form->field($model, "city"); //$field->template = "{input}"; echo $field->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//yes/shipping/index?format=json&arraymap=city")], 'clientEvents' => ['select' => 'function(event, ui) { console.log(event,ui,"tes"); }'], 'options' => ['class' => 'form-control required', 'maxlength' => 255, 'placeholder' => Yii::t('app', 'City name that use by shipping provider')]]); ?> <?php $field = $form->field($model, "area"); //$field->template = "{input}"; echo $field->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl("//yes/shipping/index?format=json&arraymap=area")], 'clientEvents' => ['select' => 'function(event, ui) { console.log(event,ui,"tes"); }'], 'options' => ['class' => 'form-control required', 'maxlength' => 255, 'placeholder' => Yii::t('app', 'Wider area of the city like province and state, ex: Jakarta, Indonesia')]]); ?> </div> <div class="col-sm-6"> <div class="well data"> <h4><?php echo Yii::t('app', 'Shipping Data'); ?> <small class="pull-right"><?php echo Yii::t('app', 'list of carrier/provider that available to reach the city'); ?> <a id="data-add" class="btn btn-sm btn-default">Add Data</a></small></h4> <br>
echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]id"); echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]congress_id"); echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]meeting_id"); echo Html::activeHiddenInput($modelMeetingSchedule, "[{$i}]ol_attendee_id"); ?> <?php if (!is_object($modelMeetingSchedule->olattendee)) { $olAttendeeModel = new OlAttendees(); } else { $olAttendeeModel = $modelMeetingSchedule->olattendee; } $atNameField = $form->field($olAttendeeModel, "[{$i}]name")->textInput(['maxlength' => true, 'readonly' => true]); ?> <?php if ($modelMeetingSchedule->isNewRecord) { $atNameField->widget(\yii\jui\AutoComplete::classname(), ['options' => ['class' => 'form-control input'], 'clientOptions' => ['source' => "index.php?r=ajax/auto"]]); } echo $atNameField; ?> <div class="row"> <div class="col-sm-6"> <?php echo $form->field($olAttendeeModel, "[{$i}]ol_phone_no")->textInput(['maxlength' => true, 'readonly' => true, 'class' => "form-control intp telnumber"]); ?> </div> <div class="col-sm-6"> <?php echo $form->field($olAttendeeModel, "[{$i}]ol_bio")->textInput(['maxlength' => true, 'readonly' => true]); ?> </div> </div><!-- .row -->
/** * @param ActiveRecord $model - profile model * @param $field - profile fields model item * @param $htmlOptions - htmlOptions * @return string */ public function editAttribute($model, $field, $htmlOptions = []) { /** @var ActiveRecord $modelName */ $modelName = $this->params['modelName']; $list = []; if (isset($this->params['emptyFieldValue'])) { $list[] = ['id' => $this->params['emptyFieldValue'], 'label' => $this->params['emptyFieldLabel']]; } $models = $modelName->find()->all(); foreach ($models as $m) { if ($this->params['optionName']) { $list[] = ['label' => $m->getAttribute($this->params['optionName']), 'id' => $m->id]; } else { $list[] = ['label' => $m->id, 'id' => $m->id]; } } if (!isset($htmlOptions['id'])) { $htmlOptions['id'] = $field->varname; } $id = $htmlOptions['id']; $relation = $this->params['relationName']; /** @var ActiveRecord $modelName */ $modelName = $this->params['modelName']; if ($relation && method_exists($model, $relation)) { $m = $model->__get($this->params['relationName']); } else { $m = $modelName::findOne($model->getAttribute($field->varname)); } if ($m) { $default_value = $this->params['optionName'] ? $m->getAttribute($this->params['optionName']) : $m->id; } else { $default_value = ''; } $htmlOptions['value'] = $default_value; $options['source'] = $list; $options['minLength'] = $this->params['minLength']; //$options['showAnim'] = 'fold'; $options['select'] = "js:function(event, ui) { \$('#" . get_class($model) . "_" . $field->varname . "').val(ui.item.id);}"; $options = Json::encode($options); /** @var \yii\widgets\ActiveField $form */ $form = $htmlOptions['formField']; unset($htmlOptions['formField']); $return = $form->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => $options]); return $return; }
echo $form->field($user, 'name'); ?> <label class="control-label" style="margin-top: 14px;">Email</label> <?php echo $form->field($user, 'email'); ?> <label class="control-label" style="margin-top: 14px;">Тип користувача</label> <?php echo $form->field($user, 'ac_type')->dropDownList(['0' => 'Користувач', '10' => 'Редактор', '11' => 'Адмін']); ?> <label class="control-label" style="margin-top: 14px;">Країна</label> <?php echo $form->field($user, 'country')->widget(\yii\jui\AutoComplete::classname(), ['name' => 'User[country]', 'id' => 'user-country', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $countries, 'autoFill' => true, 'minLength' => '2', 'style' => 'font-size: 0.8em']]); ?> <label class="control-label" style="margin-top: 14px;">Місто</label> <?php echo $form->field($user, 'city'); ?> <label class="control-label" style="margin-top: 14px;">Адреса</label> <?php echo $form->field($user, 'address'); ?> <label class="control-label" style="margin-top: 14px;">Робота</label> <?php echo $form->field($user, 'work'); ?> <label class="control-label" style="margin-top: 14px;">Стать</label>
/** * @inheritdoc */ public function init() { parent::init(); Html::addCssClass($this->options, 'form-control'); if (!array_key_exists('onfocus', $this->options)) { $this->options['onfocus'] = 'jQuery(this).autocomplete(\'search\');'; } $this->clientOptions = array_merge($this->clientOptions, ['source' => $this->source, 'minLength' => $this->minLength]); }
/** * Register the js scripts including the required assets and the options in * `$clientOptions` */ protected function registerScript() { $view = $this->getView(); if (isset($this->clientOptions['autocomplete_url'])) { if (class_exists('yii\\jui\\AutoComplete')) { \yii\jui\AutoComplete::register($view); } else { throw new InvalidConfigException('To use autocomplete functionality you need to install the ' . ' JUI Extension for Yii 2. ' . 'http://www.yiiframework.com/doc-2.0/ext-jui-index.html'); } } $clientOptions = empty($this->clientOptions) ? '' : Json::encode($this->clientOptions); JqueryTagsAsset::register($view); $view->registerJs("jQuery('#{$this->options["id"]}').tagsInput({$clientOptions});"); }
public function init(){ $this->clientOptions =[ 'source' => $this->url, 'minLength' => 1, 'select' => new JsExpression('function(event, data) {$("#'.$this->id.'").val(data.item.name);$(this).attr("data-id",data.item.id);return false;}'), 'focus' => new JsExpression('function(event,data){$(this).val(data.item.name);$(this).attr("data-id",data.item.id);return false;}'), ]; $this->renderItem = new JsExpression('.autocomplete("instance")._renderItem = function( ul, item ) { return $("<li></li>") .data("item.autocomplete", item) .append("<a>" + item.name + "<br><img src =" + "http://localhost/Auction/auction/web/uploads/products/thumbs/index1441177480.jpeg" + "></img></a>") .appendTo(ul); };' ); parent::init(); }
/** * @inheritdoc */ public function init() { parent::init(); if (!isset($this->visibleOptions["id"])) { $this->visibleOptions["id"] = $this->options["id"] . "-visible"; } if (empty($this->clientOptions['select'])) { $this->clientOptions['select'] = new JsExpression("function(event, ui) {\n\n var hiddenVal = ui.item.id ? ui.item.id : ui.item.value;\n\n \$('#{$this->options["id"]}').val(hiddenVal);\n\n }"); } if (empty($this->clientOptions['change'])) { $this->clientOptions['change'] = new JsExpression("function(event, ui) {\n\n var val = \$(event.currentTarget).val();\n\n if(!val)\n \$('#{$this->options["id"]}').val('');\n\n }"); } if ($this->liveSync) { $this->view->registerJs("\n\n \$('#{$this->visibleOptions["id"]}').on('keyup', function(){\n\n \$('#{$this->options["id"]}').val(\$(this).val());\n\n });\n\n "); } if ($this->hasModel() and $this->visibleAttribute === null) { $this->visibleAttribute = $this->attribute; } elseif ($this->visibleValue === null) { $this->visibleValue = $this->value; } }
<?php $form = ActiveForm::begin(['action' => ['reportkpi'], 'method' => 'get']); ?> <div class="col-md-12"> <?php /*echo $form->field($model, 'partner_id')->widget(Select2::classname(), [ 'data' => ArrayHelper::map(ResPartner::find()->all(),'id','display_name'), 'options' => ['placeholder' => 'Filter as you type ...'], ])->label('Address Name')*/ ?> <?php $data = ResPartner::find()->select(['display_name as value', 'display_name as label', 'id as id'])->asArray()->all(); ?> <?php echo $form->field($model, 'partner_id')->widget(\yii\jui\AutoComplete::classname(), ['clientOptions' => ['source' => $data]])->textInput()->label('Address Name'); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'month_tanggal')->dropDownList(['1' => 'Januari', '2' => 'Februari', '3' => 'Maret', '4' => 'April', '5' => 'Mei', '6' => 'Juni', '7' => 'Juli', '8' => 'Agustus', '9' => 'September', '10' => 'Oktober', '11' => 'November', '12' => 'Desember'], ['prompt' => ''])->label('Bulan Kirim'); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'year_tanggal')->textInput()->label('Tahun Kirim'); ?> </div> <div class="col-md-6"> <?php echo $form->field($model, 'month_po')->dropDownList(['1' => 'Januari', '2' => 'Februari', '3' => 'Maret', '4' => 'April', '5' => 'Mei', '6' => 'Juni', '7' => 'Juli', '8' => 'Agustus', '9' => 'September', '10' => 'Oktober', '11' => 'November', '12' => 'Desember'], ['prompt' => ''])->label('Bulan PO');
_form_container" class="token-form <?php echo $this->context->getStatusIndicator($model); ?> "> <?php $form = (include \Yii::getAlias("@nitm/views/layouts/form/header.php")); ?> <?php echo Html::label('User', 'usersearch', []); ?> <?php if (!$model->isNewRecord) { echo Html::tag('h4', \nitm\module\models\User::getFullName($model->user_id)); } else { echo \yii\jui\AutoComplete::widget(['name' => 'name', 'attribute' => 'name', 'options' => ['class' => 'form-control', 'id' => 'usersearch', 'role' => 'autocompleteSelect', 'data-select' => \yii\helpers\Json::encode(["value" => "unique", "label" => "name", "container" => "token-user_id"])], 'clientOptions' => ['source' => '/autocomplete/user']]); } ?> <?php echo Html::activeHiddenInput($model, 'user_id'); ?> <?php echo $form->field($model, 'active')->checkbox(); ?> <?php echo $form->field($model, 'revoked')->checkbox(); ?> <?php echo $form->field($model, 'level')->dropDownList($model->getLevels());
<?php echo Html::label('Print Count:'); ?> <br> <?php echo Html::input('text', 'jml', '10', ['id' => 'jml', 'style' => 'width:80px;']); ?> </td> </tr> </tbody> </table> </div> <div class="form-group" style="padding: 15px; padding-top: 0px;"> <label for="product">Product :</label> <?php echo AutoComplete::widget(['name' => 'product', 'id' => 'product', 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'select' => new JsExpression('yii.master.onProductSelect'), 'delay' => 100], 'options' => ['class' => 'form-control', 'style' => 'width:60%;']]); ?> <?php echo Html::hiddenInput('barcodeValue', '', ['id' => 'barcodeValue']); ?> </div> </div> <div class="box-footer"> <?php echo Html::button(' Generate', ['onclick' => 'generateBarcode();', 'class' => 'btn btn-warning fa fa-qrcode']); ?> <?php echo Html::button(' Print', ['onclick' => 'print();', 'class' => 'btn btn-info fa fa-print']); ?> </div> </div>
<div class="col-xs-3"> <?php // Estado $lista = ArrayHelper::map(\backend\models\Estado::find()->asArray()->all(), 'estadoid', 'estado'); echo $form->field($model, 'estado_id')->dropDownList($lista)->label('Estatus'); ?> </div> </div> <div class="row"> <div class="col-xs-3"> <?php // Cuenta $data = \backend\models\Cuentas::find()->select(['cuenta'])->distinct()->asArray()->createCommand()->queryColumn(); //echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data],]); echo $form->field($model, 'cuenta')->widget(\yii\jui\AutoComplete::className(), ['options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data]])->label('Dependencia / Entidad'); ?> </div> </div> <div class="row"> <div class="col-xs-3"> <?php // Siglas echo $form->field($model, 'siglas')->textInput(['maxlength' => true])->textInput(); ?> </div> </div>
/** * Config for attribute widgets (ycm) * * @return array */ public function attributeWidgets() { /** * You should configure attribute widget as: ['field', 'widget']. * * If you need to pass additional configuration to the widget, add them as: ['field', 'widget', 'key' => 'value']. * The first two items are sliced from the array, and then it's passed to the widget as: ['key' => 'value']. * * There are couple of exceptions to this slicing: * If you use 'hint', 'hintOptions', 'label' or 'labelOptions' the widget will render hint and/or label and * then it will unset those keys and pass the array to the widget. * * If you use 'widget', you must also set 'widgetClass'. * * Check each widget to see what options you can override/set. */ // example data $data = ['One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten']; return [['field_widget', 'widget', 'widgetClass' => \yii\jui\AutoComplete::classname(), 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => $data], 'hint' => 'Type: t', 'label' => 'Autocomplete'], ['field_wysiwyg', 'wysiwyg'], ['field_date', 'date'], ['field_time', 'time'], ['field_datetime', 'datetime'], ['field_select', 'select'], ['field_selectMultiple', 'selectMultiple'], ['field_image', 'image'], ['field_file', 'file'], ['field_text', 'text'], ['field_hidden', 'hidden'], ['field_password', 'password'], ['field_textarea', 'textarea'], ['field_radio', 'radio'], ['field_boolean', 'boolean'], ['field_checkbox', 'checkbox'], ['field_dropdown', 'dropdown'], ['field_listbox', 'listbox'], ['field_checkboxList', 'checkboxList'], ['field_radioList', 'radioList'], ['field_disabled', 'disabled'], ['field_hide', 'hide'], ['field_html5', 'text', 'input' => 'number', 'min' => 1, 'max' => 5, 'hint' => 'Number between 1 - 5.']]; }
<section class="content"> <?php echo \common\widgets\Alert::widget(); ?> <div class="box box-primary"> <div class="box-body"> <h1><?php echo Html::encode($this->title); ?> </h1> <p> <?php if (\Yii::$app->user->can('create-product')) { ?> <?php echo Html::a(Yii::t('app', 'Create Product'), ['create'], ['class' => 'btn btn-success']); ?> <?php } ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'emptyText' => 'You don\'t have any products', 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'title', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'title', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('title')]])], ['attribute' => 'ui', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'ui', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => Product::getAutoCompleteItems('ui')]])], ['class' => '\\pheme\\grid\\ToggleColumn', 'attribute' => 'active', 'enableAjax' => false, 'filter' => [1 => Yii::t('yii', 'Yes'), 0 => Yii::t('yii', 'No')]], ['class' => 'yii\\grid\\ActionColumn', 'template' => Product::getGridButtonsTemplate(), 'buttons' => ['delete' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-confirm' => 'Are you sure you want to delete this item?', 'data-method' => 'post', 'data-pjax' => '0']; return Html::a('<span class="glyphicon glyphicon-trash"></span>', $url, $options); }]]]]); ?> </div> </div> </section>
</div> </div> <!-- VINCULACION CON LOS PLANES --> <div class="panel panel-primary"> <div class="panel-heading"> <span>VINCULACION CON LOS PLANES</span> </div> <div class="panel-body"> <?php echo $form->field($model, 'objetivo_general')->hiddenInput(); ?> <div class="form-group"> <?php echo AutoComplete::widget(['model' => $model, 'name' => 'general', 'options' => ['class' => 'form-control', 'placeholder' => 'Escriba para buscar'], 'clientOptions' => ['source' => $objetivo_general, 'autoFill' => true, 'select' => new JsExpression("function(event, ui) {\n \$('#proyecto-objetivo_general').val(ui.item.id);\n }")]]); ?> </div> <?php echo $form->field($model, 'objetivo_estrategico_institucional')->textarea(['rows' => 6]); ?> </div> </div> <!-- LOCALIZACION DEL PROYECTO--> <div class="panel panel-primary"> <div class="panel-heading"> <span>LOCALIZACIÓN DEL PROYECTO</span> </div> <div class="panel-body">
<?php use yii\web\JsExpression; use yii\jui\AutoComplete; ?> <div class="box box-info"> <div class="box-header"> <div class="form-group" style="padding: 15px;"> <label for="product">Product :</label> <?php echo AutoComplete::widget(['name' => 'product', 'id' => 'product', 'clientOptions' => ['source' => new JsExpression('yii.global.sourceProduct'), 'select' => new JsExpression('yii.pos.onSelectProduct'), 'delay' => 500], 'options' => ['class' => 'form-control']]); ?> </div> <div class="box-body" style="text-align: right; padding-top: 0px; padding-bottom: 0px;"> <input type="hidden" id="h-total-price"><h2>Rp<span id="total-price"></span></h2> </div> </div> <table id="detail-grid" class="table table-striped no-padding" style="padding: 0px;"> <thead style="display: none"> <tr> <td style="width: 50px"> <a data-action="delete" title="Delete" href="#"><span class="glyphicon glyphicon-trash"></span></a> <input type="hidden" data-field="price"><input type="hidden" data-field="id_uom"> <input type="hidden" data-field="id_product"> </td> <td> <ul class="nav nav-list"> <li class="item"> <span data-text="nm_product"></span> </li> <li class="qty">
use app\models\Tour; $this->title = 'Расширенный поиск'; $this->params['breadcrumbs'][] = ['label' => 'Туры', 'url' => ['index']]; $this->params['breadcrumbs'][] = $this->title; $listdata = Tour::find()->select(['name as value', 'name as label'])->where(['status' => 1])->asArray()->all(); ?> <div class="add-tour"> <?php $form = ActiveForm::begin(['action' => 'result', 'method' => 'get']); ?> <?php echo $form->field($model, 'search')->widget(AutoComplete::className(), ['clientOptions' => ['source' => $listdata], 'options' => ['class' => 'form-control']]); ?> <?php echo $form->field($model, 'category')->dropDownList(['name' => 'Название', 'org' => 'Организация', 'address' => 'Адрес', 'info' => 'Информация', 'tel' => 'Телефон']); ?> <?php echo $form->field($model, 'sort')->dropDownList(['name' => 'Названию', 'date' => 'Дате', 'address' => 'Адресу']); ?> <div class="form-group"> <?php echo Html::submitButton('Поиск', ['class' => 'btn btn-primary']); ?>
</div> <div class="col-lg-10"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'minititle')->textInput(); ?> <?php echo $form->field($upload, 'file')->fileInput(); ?> <?php echo $form->field($model, 'source_title')->widget(\yii\jui\AutoComplete::className(), ['clientOptions' => ['source' => $data, 'minLength' => '3', 'autoFill' => true], 'options' => ['class' => 'form-control']]); ?> <?php if (!$redactor) { ?> <?php echo $form->field($model, 'body')->textarea(['rows' => 5, 'cols' => 5, 'id' => 'my-textarea-id']); ?> <?php } else { ?> <?php echo $form->field($model, 'body')->widget(Widget::classname(), ['settings' => ['lang' => 'ru', 'minHeight' => 300, 'pastePlainText' => true, 'buttonSource' => true, 'plugins' => ['clips', 'fullscreen'], 'imageUpload' => Url::to(['/articles/image-upload'])]]); ?>
<?php use yii\web\JsExpression; use yii\jui\AutoComplete; use yii\helpers\Html; use biz\models\TransferDtl; use biz\tools\Helper; ?> <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.transfer.onProductSelect'), 'delay' => 100]]); ?> </div> <table id="detail-grid" class="table table-striped"> <?php /** * * @param TransferDtl $model * @param integer $index * @return string */ function renderRow($model, $index) { ob_start(); ob_implicit_flush(false); ?> <tr> <td style="width: 50px">
<?php $form = ActiveForm::begin(); ?> <?php //echo $form->field($model, 'date_create')->textInput() ?> <?php //echo $form->field($model, 'date_confirm')->textInput() ?> <?php //echo $form->field($model, 'status')->textInput() ?> <?php echo $form->field($model, 'employee_name')->widget(AutoComplete::className(), ['clientOptions' => ['source' => Employees::arraySnpId(), 'minLength' => '1', 'autoFill' => true, 'select' => new JsExpression("function( event, ui ) {\n \$('#employee_id_hidd').val(ui.item.id);\n }")], 'options' => ['class' => 'form-control']]); ?> <?php echo $form->field($model, 'employee_id')->hiddenInput(['id' => 'employee_id_hidd'])->label(false); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Редактировать', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?>
public function init() { $url = Url::to($this->route); $this->clientOptions['source'] = new JsExpression("function(request, response) {\n \$.getJSON('{$url}', {\n search: request.term\n }, response);\n }"); parent::init(); }
<br> <?php $field = $form->field($model, "customer_id[address]"); $field->template = "{input}"; echo $field->textArea(["class" => "form-control", "placeholder" => Yii::t("app", "Shipping address")]); ?> </div> <div class="form-group"> <?php echo Html::label(Yii::t("app", "City")); ?> <?php $field = $form->field($model, "data[city]"); $field->template = "{input}"; echo $field->widget(AutoComplete::classname(), ['clientOptions' => ['source' => Yii::$app->urlManager->createUrl(["//yes/shipping/index", "ShippingSearch[status]" => "> 0", "format" => "json", "arraymap" => "label:cityArea,value:Obj"])], 'clientEvents' => ['focus' => 'function(event, ui) { //console.log(JSON.parse(ui.item.value)); renderShip(ui.item.value); }', 'close' => 'function(event, ui) { var val = $("#order-data-city").val(); try{ val = JSON.parse(val); $("#order-data-city").val(val.city+" ("+val.area+")"); } catch (e) { //console.log("hapus"); resetShip(); } }', 'change' => 'function(event, ui) { var cek = $(".radio-shipping-cost").html();
/** * @param \yii\widgets\ActiveForm $form */ public function echoFieldList($form, $fields = null) { /** @var \yii\widgets\ActiveField $object */ $model = $this; if (is_null($fields)) { $fields = static::$fields; } foreach ($fields as $field) { if (isset($field['draw'])) { $method = $field['draw']; $object = call_user_func($method, $form, $this, $field); } else { $object = $form->field($model, $field[0])->label($field[1]); if (isset($field[self::POS_HINT])) { if ($field[self::POS_HINT] != '') { $object->hint($field[self::POS_HINT]); } } if (isset($field['widget'])) { $class = $field['widget'][0]; $object->widget($class::className(), ArrayHelper::getValue($field, 'widget.1', [])); } if (isset($field[self::POS_RULE])) { if ($field[self::POS_RULE] != '') { if ($field[self::POS_RULE] == 'file') { $object->widget(FileUpload::className()); } } } if (isset($field[self::POS_RULE])) { if ($field[self::POS_RULE] != '') { if ($field[self::POS_RULE] == 'boolean') { $object->checkbox(); } } } if (isset($field[self::POS_RULE])) { if ($field[self::POS_RULE] != '') { if ($field[self::POS_RULE] == 'date') { $object->widget(DatePicker::classname(), ['dateFormat' => 'php:d.m.Y', 'options' => ['class' => 'form-control']]); } } } if (ArrayHelper::keyExists('type', $field)) { $options = []; if (is_array($field['type'])) { $name = $field['type'][0]; if (isset($field['type'][1])) { $options = $field['type'][1]; } } else { $name = $field['type']; } switch ($name) { case 'checkbox': $object->checkbox(); break; case 'textarea': $object->textarea($options); break; case 'listBox': $object->listBox($options); break; case 'RadioList': $object->widget(\cs\Widget\RadioList\RadioList::className(), $options); break; case 'CheckBox': $object->widget(\cs\Widget\CheckBox\CheckBox::className(), $options); break; case 'radioList': $object->radioList($options); break; case 'place': $object->widget(Place::className(), $options); break; case 'hidden': $options['id'] = strtolower($this->formName()) . '-' . $field[self::POS_DB_NAME]; $object = Html::hiddenInput($this->formName() . '[' . $field[self::POS_DB_NAME] . ']', null, $options); break; case 'autoComplete': $options['clientOptions']['select'] = new JsExpression("function( event, ui ) {" . "\$('#" . strtolower($model->formName()) . "-" . $field[self::POS_DB_NAME] . "').val(ui.item.id);" . "}"); $attr = $object->attribute; if ($model->{$attr} != '') { echo Html::hiddenInput($model->formName() . '[' . $field[self::POS_DB_NAME] . ']', $model->{$attr}, ['id' => strtolower($model->formName()) . '-' . $field[self::POS_DB_NAME]]); } else { echo Html::hiddenInput($model->formName() . '[' . $field[self::POS_DB_NAME] . ']', $model->{$attr}, ['id' => strtolower($model->formName()) . '-' . $field[self::POS_DB_NAME]]); } $object->attribute = $field[self::POS_DB_NAME] . '_name'; $object->widget(\yii\jui\AutoComplete::classname(), $options); break; } } } echo $object; } }
$form = ActiveForm::begin(); ?> <h4><?php echo Yii::t('app', 'Route'); ?> </h4> <?php echo $form->field($model, 'charge_city_id')->widget(AutoComplete::className(), ['clientOptions' => ['source' => Url::to(['site/autocomplete']), 'autoFill' => true, 'minLength' => '3', 'select' => new JsExpression("function(event, ui) {\n this.value = ui.item.label;\n \$('#city_input1').val(ui.item.value);\n return false;\n }")], 'options' => ['id' => 'charge_city', 'class' => 'form-control', 'placeholder' => Yii::t('app', 'Start typing the name')]]); ?> <?php echo $form->field($model, 'charge_city_id')->hiddenInput(['id' => 'city_input1'])->label(false); ?> <?php echo $form->field($model, 'discharge_city_id')->widget(AutoComplete::className(), ['clientOptions' => ['source' => Url::to(['site/autocomplete']), 'autoFill' => true, 'minLength' => '3', 'select' => new JsExpression("function(event, ui) {\n this.value = ui.item.label;\n \$('#city_input2').val(ui.item.value);\n return false;\n }")], 'options' => ['id' => 'discharge_city', 'class' => 'form-control', 'placeholder' => Yii::t('app', 'Start typing the name')]]); ?> <?php echo $form->field($model, 'discharge_city_id')->hiddenInput(['id' => 'city_input2'])->label(false); ?> <br> <h4><?php echo Yii::t('app', 'Goods'); ?> </h4> <?php echo $form->field($model, 'name')->textInput(); ?> <?php
</h1> <p> <?php if (Yii::$app->user->can(User::PERMISSION_CREATE)) { ?> <?php echo Html::a('Create User', ['create'], ['class' => 'btn btn-success']); ?> <?php } ?> </p> <?php echo GridView::widget(['dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => [['class' => 'yii\\grid\\SerialColumn'], ['attribute' => 'auth', 'value' => 'auth.item_name', 'label' => 'Role', 'filter' => Html::activeDropDownList($searchModel, 'auth', \common\models\AuthAssignment::getRoles(), ['class' => 'form-control', 'prompt' => ''])], ['attribute' => 'username', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'username', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => User::getAutoCompleteItems('username')]])], ['attribute' => 'email', 'format' => 'email', 'filter' => AutoComplete::widget(['model' => $searchModel, 'attribute' => 'email', 'options' => ['class' => 'form-control'], 'clientOptions' => ['source' => User::getAutoCompleteItems('email')]])], ['attribute' => 'last_login', 'filter' => false, 'format' => 'date'], ['class' => 'yii\\grid\\ActionColumn', 'template' => '{update}{delete}', 'buttons' => ['update' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'Update'), 'aria-label' => Yii::t('yii', 'Update'), 'data-method' => 'post', 'data-pjax' => '0']; if (Yii::$app->user->can(User::PERMISSION_UPDATE) && Yii::$app->user->can(User::PERMISSION_CAN_CUD, $model)) { return Html::a('<span class="glyphicon glyphicon-pencil"></span>', Url::toRoute(['user/update', 'id' => $model->id]), $options); } return ''; }, 'delete' => function ($url, $model, $key) { $options = ['title' => Yii::t('yii', 'Delete'), 'aria-label' => Yii::t('yii', 'Delete'), 'data-method' => 'post', 'data-confirm' => 'Are you sure you want to delete this item?', 'data-pjax' => '0']; if (Yii::$app->user->can(User::PERMISSION_DELETE) && Yii::$app->user->can(User::PERMISSION_CAN_CUD, $model)) { return Html::a('<span class="glyphicon glyphicon-trash"></span>', Url::toRoute(['user/delete', 'id' => $model->id]), $options); } return ''; }]]]]); ?> </div> </div>
use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\helpers\ArrayHelper; use yii\jui\AutoComplete; use yii\web\JsExpression; use common\models\EdgeCourse; $courseAr = ArrayHelper::map(EdgeCourse::find(["status" => "active"])->all(), "course_id", "name"); $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'course_id')->dropDownList($courseAr, ["prompt" => "Choose..."]); ?> <div class="form-group"> <label for="edgevolunteer-reference_id" class="control-label">Student Name</label> <?php echo AutoComplete::widget(['name' => 'State', 'id' => 'edgevolunteer-reference_id', 'options' => ["class" => "form-control"], 'clientOptions' => ['source' => new JsExpression("function(request, response) {\n \t\t\t\t\$.getJSON('/admin/edge/getstudentforen/'+jQuery('#edgevolunteer-course_id').val(), {\n \t\t\t\tterm: jQuery('#edgevolunteer-reference_id').val()\n \t\t\t\t}, response);\n\t\t\t\t}"), 'minLength' => "3", 'select' => new JsExpression("function( event, ui ) {\n \t\tvar text = '<div class=\\'col-xs-3\\'><div class=\\'checkbox\\'><label><input type=\\'checkbox\\' value=\\''+ui.item.id+'\\' name=\\'enrollStudent[]\\'>'+ui.item.label+'</label></div></div>';\n jQuery('#assignS').show().append(text);\n jQuery('#edgevolunteer-reference_id').val('');\n return false;\n \t\t}")]]); ?> </div> <div class="row" id="" style=""> </div> <div class="row" id="assignS" style="display: none;"> <div class='col-xs-12'><a href="javascript:void(0)" onclick="Util._checkAll('assignS')">Check All</a> <a href="javascript:void(0)" onclick="Util._unCheckAll('assignS')">Uncheck All</a></div> </div> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Enroll Student' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();