public function init() { $url = is_array($this->route) ? Url::to($this->route) : Url::to([$this->route, 'term' => 'QUERY']); $this->dataset = [['remote' => ['url' => $url, 'wildcard' => 'QUERY'], 'templates' => ['empty' => Html::tag('span', Yii::t('app', 'Hit enter to search'), ['class' => 'empty-search']), 'suggestion' => new JsExpression("Handlebars.compile('{$this->template}')")]]]; $this->pluginOptions = ['hint' => false]; parent::init(); }
<div class="col-lg-5"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->errorSummary($model); ?> <?php echo $form->field($model, 'id', ['template' => '{input}'])->textInput(['style' => 'display:none']); ?> <?php $template = '<div><p class="nikkes">{{value}}</p></div>'; echo $form->field($model, 'nikkes')->widget(Typeahead::classname(), ['options' => ['placeholder' => 'Ketik NIKKES yang diinginkan'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'value', 'templates' => ['notFound' => '<div class="text-danger" style="padding:0 8px"> Nikkes tidak terdaftar </div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template}')")], 'remote' => ['url' => Url::to(['peserta/get-nikkes-list']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'limit' => 10]]]); ?> <?php echo $form->field($model, 'hak_kacamata_id')->widget(Select2::classname(), ['data' => $model->hakkacamataList, 'options' => ['placeholder' => 'Please Choose One', 'disabled' => true], 'pluginOptions' => ['allowClear' => true]]); ?> <?php echo $form->field($model, 'tgl_ambil')->widget(\kartik\widgets\DatePicker::classname(), ['options' => ['placeholder' => 'Choose Tanggal Pengambilan'], 'type' => \kartik\widgets\DatePicker::TYPE_COMPONENT_APPEND, 'pluginOptions' => ['autoclose' => true, 'format' => 'dd-M-yyyy']]); ?> <div class="form-group">
<?php /** * @var string $listClass * @var array $widgetParams */ echo \kartik\widgets\Typeahead::widget($widgetParams); ?>
</script>--> <?php echo '<label class="control-label">Nama Mahasiswa</label>'; echo Typeahead::widget(['name' => 'FormIzin[nama_mahasiswa]', 'options' => ['placeholder' => 'Ketik Nama Mahasiswa', 'id' => 'nameMhs'], 'scrollable' => true, 'pluginOptions' => ['highlight' => true], 'dataset' => [['prefetch' => Url::to(['request/mahasiswalist']), 'limit' => 10]], 'pluginEvents' => ['typeahead:selected' => 'function() { var nama = $(this).val(); $.getJSON("index.php?r=aitk/request/getmahasiswa",{name:nama}, function(data) { $("#dataMahasiswa").show(); $("#namaMahasiswa").replaceWith("<p id =namaMahasiswa>"+data[0].nama_mahasiswa + "</p>"); $("#nimMahasiswa").replaceWith("<p id =nimMahasiswa>"+data[0].nim + "</p>"); $("#kelasMahasiswa").replaceWith("<p id =kelasMahasiswa>"+data[0].kelas + "</p>"); $("#semesterMahasiswa").replaceWith("<p id =semesterMahasiswa>"+data[0].semester + "</p>"); $("#waliMahasiswa").replaceWith("<p id =waliMahasiswa>"+data[0].wali + "</p>"); $(".matakuliahIzin").replaceWith("<div class=matakuliahIzin style=\\" display:none\\"> </div>"); $("#Krad").attr("checked" , false);$("#Srad").attr("checked" , false); $(".matakuliahIzin").append("<label class=\\"control-label\\" for=FormIzin[matakuliahList][]> Matakuliah Yang Tidak Di Ikuti</label> <br/> <br/>"); $.each( data[0].matakuliah, function( key, value ) { $(".matakuliahIzin").append("<input id=ck"+value.matakuliah.split(" ")[0] +" type=checkbox value ="+value.matakuliah+" name=FormIzin[matakuliahList][] class=mtkuliah ><label class=\\"control-label\\" for= "+value.matakuliah+" >"+value.matakuliah+"</label> </input>"); }); }); }']]); echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 1, 'attributes' => ['waktuKeluar' => ['label' => 'Tanggal ', 'attributes' => ['tanggal_mulai' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DateTimePicker', 'options' => ['options' => ['placeholder' => 'Time from...', 'id' => 'timeStart' . 'mulaiKeluar']]], 'tanggal_selesai' => ['type' => Form::INPUT_WIDGET, 'widgetClass' => '\\kartik\\widgets\\DateTimePicker', 'options' => ['options' => ['placeholder' => 'Time to...', 'id' => 'timeEnd' . 'Keluar']]]]], 'alasan_ijin' => ['label' => 'Alasan', 'type' => Form::INPUT_TEXTAREA, 'options' => ['placeholder' => 'Max 160 Characters', 'maxlength' => 160]], 'lampiran' => ['label' => 'Lampiran', 'type' => Form::INPUT_TEXT, 'options' => ['placeholder' => 'Enter Lampiran Code If Exist', 'maxlength' => 160]]]]); ?> <div class="panel panel-info" id="dataMahasiswa" >
<?php use yii\helpers\Html; //use yii\bootstrap\ActiveForm; use kartik\form\ActiveForm; use kartik\widgets\Typeahead; use yii\helpers\Url; ?> <div class="system-article-search"> <?php $form = ActiveForm::begin(['action' => ['index'], 'method' => 'get', 'type' => ActiveForm::TYPE_INLINE]); ?> <div class="input-group pull-right"> <span class="input-group-btn"> <?php echo Typeahead::widget(['name' => 'q', 'options' => ['placeholder' => 'search articles...'], 'scrollable' => true, 'pluginOptions' => ['highlight' => true], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'value', 'remote' => ['url' => Url::to(['article/search-list']) . '?q=%QUERY', 'wildcard' => '%QUERY']]]]); ?> </span> <?php echo Html::submitButton(Yii::t('backend', 'Search'), ['class' => 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
<div class="alert_handler"> </div> <?php echo Html::beginForm(); ?> <div class="col-md-4"> <?php echo '<label class="control-label">Search by Barcode</label>'; echo Typeahead::widget(['name' => 'barcode_search', 'options' => ['placeholder' => 'Search for Product...', 'id' => 'barcode_search'], 'pluginOptions' => ['highlight' => true], 'pluginEvents' => ["typeahead:select" => 'function(ev, suggestion) { purchaseProduct(); }'], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'value', 'remote' => ['url' => Url::to(['products/product-list-barcode']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'limit' => 10]]]); ?> </div> <div class="col-md-8"> <?php echo '<label class="control-label">Search by Name</label>'; echo Typeahead::widget(['name' => 'name_search', 'options' => ['placeholder' => 'Search for Product...', 'id' => 'name_search'], 'pluginOptions' => ['highlight' => true], 'pluginEvents' => ["typeahead:select" => 'function(ev, suggestion) { $("#barcode_search").val(suggestion.barcode); purchaseProduct(); }'], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'value', 'remote' => ['url' => Url::to(['products/product-list-name']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'limit' => 10]]]); ?> </div> <div class="clearfix"></div> <br/> <div class="col-md-12"> <div class="form-group"> <?php echo Html::submitButton('Purchase', ['class' => 'btn btn-success', 'onclick' => 'purchaseProduct()']); ?> </div> </div> <?php echo Html::endForm(); ?>
// Register the formatting script $this->registerJs($onSelectJs, View::POS_HEAD);*/ $template = '<div class="card_container record-full no-shadow no-border no-margin">' . '<div class="header-context low-margin">' . '<div class="avatar round">' . Html::img('@web/images/cards/default_avatar.png') . '</div>' . '<div class="title">' . '<div class="head second regular capitalize">{{name}}</div>' . '<div class="subhead capitalize">{{industry}}</div>' . '</div>' . '<div class="subaction">' . '<a href="' . Url::to(['/add/' . slug('{{name}}')]) . '"><i class="fa fa-shopping-cart fa-2x"></i></div>' . '</div>' . '</div>' . '</div>'; $template_ind = '<div class="card_container record-full no-shadow no-border no-margin">' . '<div class="primary-context low-margin">' . '<div class="avatar center">' . '<i class="fa {{icon}} fa-2x" style="color:{{color}}"></i>' . '</div>' . '<div class="title">' . '<div class="head second regular capitalize">{{name}}</div>' . '<div class="fs_11 gray-color capitalize">{{category}}</div>' . '</div>' . '</div>' . '</div>'; //$template_ind = '<div><p class="fs_14" style="width:100%"><i class="fa {{icon}}" style="color:{{color}}"></i> {{name}}</p></div>'; $template_act = '<div class="capitalize">{{name}}</div>'; $template_obj = '<div class="card_container record-full no-shadow no-border no-margin">' . '<div class="header-context low-margin">' . '<div class="avatar round">' . Html::img('@web/images/cards/default_avatar.png') . '</div>' . '<div class="title">' . '<div class="head second regular capitalize">{{name}}</div>' . '<div class="subhead capitalize">{{parent}}</div>' . '</div>' . '</div>' . '</div>'; $template_prod = '<div class="card_container record-full no-shadow no-border no-margin">' . '<div class="header-context low-margin">' . '<div class="avatar round">' . Html::img('@web/images/cards/default_avatar.png') . '</div>' . '<div class="title">' . '<div class="head second regular capitalize">{{name}}</div>' . '<div class="subhead capitalize">{{parent}}</div>' . '</div>' . '</div>' . '</div>'; $template_tag = '<div class="capitalize">{{name}} <i class="fa fa-caret-right"></i> <span class="fs_11 gray-color">{{service}}{{industry}}{{action}}{{object}}</span></div>'; ?> <div class="service_autocomplete_search" style=""> <?php $form = kartik\widgets\ActiveForm::begin(['action' => ['/auto/index'], 'id' => 'autocomplete-search-form']); ?> <?php echo $form->field(new \common\models\CsServicesSearch(), 'name', ['options' => ['class' => $renderIndex ? 'form-group-lg' : ''], 'addon' => ['append' => ['content' => Html::submitButton('<i class="fa fa-search"></i>', ['class' => 'btn btn-default ' . ($renderIndex ? 'btn-lg' : '')]), 'asButton' => true]]])->widget(Typeahead::classname(), ['options' => ['placeholder' => 'Pretražite usluge, predmete, delatnosti ...'], 'pluginOptions' => ['highlight' => true, 'minLength' => 2, 'accentMap' => ''], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-services']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_16 gray-color border-bottom" style="padding: 15px 15px 2px">Usluge</div>', 'notFound' => '<div class="text-danger" style="padding:0 8px">Nema rezultata za usluge.</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-services-tags']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_14 gray-color border-bottom" style="padding: 15px 15px 2px">Tagovi usluga</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_tag}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-industries']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_16 gray-color border-bottom" style="padding: 15px 15px 2px">Delatnosti</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_ind}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-industries-tags']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_14 gray-color border-bottom" style="padding: 15px 15px 2px">Tagovi delatnosti</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_tag}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-objects']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_16 gray-color border-bottom" style="padding: 15px 15px 2px">Predmeti usluga</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_obj}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-objects-tags']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_14 gray-color border-bottom" style="padding: 15px 15px 2px">Tagovi predmeta usluga</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_tag}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-products']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_16 gray-color border-bottom" style="padding: 15px 15px 2px">Proizvodi</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_prod}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-actions']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_16 gray-color border-bottom" style="padding: 15px 15px 2px">Akcije</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_act}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'display' => 'name', 'remote' => ['url' => Url::to(['/auto/list-actions-tags']) . '?q=%QUERY', 'wildcard' => '%QUERY'], 'templates' => ['header' => '<div class="fs_14 gray-color border-bottom" style="padding: 15px 15px 2px">Tagovi akcija</div>', 'suggestion' => new JsExpression("Handlebars.compile('{$template_tag}')")]]], 'pluginEvents' => ["typeahead:render" => "function(event, data) { \n\t\t\t \t\t\t\$('html,body').animate({scrollTop: \$(this).offset().top-80});\n\t\t\t \t\t\t\$(window).bind('mousewheel', function() {\n\t\t\t\t\t\t\t \$('html, body').stop();\n\t\t\t\t\t\t\t });\n\t\t\t\t\t\t}", "typeahead:select" => "function(event, data) {\n\t\t\t\t \t\tif(data.id){\n\t\t\t\t \t\t\t\$('#csservicessearch-id').val(data.id); \n\t\t\t\t \t\t} else if(data.industry_id){\n\t\t\t\t \t\t\t\$('#csservicessearch-industry_id').val(data.industry_id); \n\t\t\t\t \t\t} else if(data.action_id){\n\t\t\t\t \t\t\t\$('#csservicessearch-action_id').val(data.action_id); \n\t\t\t\t \t\t} else if(data.object_id){\n\t\t\t\t \t\t\t\$('#csservicessearch-object_id').val(data.object_id); \n\t\t\t\t \t\t} else if(data.product_id){\n\t\t\t\t \t\t\t\$('#csservicessearch-product_id').val(data.product_id); \n\t\t\t\t \t\t} else if(data.tag_id){\n\t\t\t\t \t\t\t\$('#csservicessearch-tag_id').val(data.tag_id); \n\t\t\t\t \t\t}\n\t\t\t\t \t\t\$('#autocomplete-search-form').submit();\t\t\t\t\t\t \t\t\n\t\t\t\t \t}"]])->label(false); ?> <?php echo Html::activeHiddenInput(new \common\models\CsServicesSearch(), 'id'); ?> <?php echo Html::activeHiddenInput(new \common\models\CsServicesSearch(), 'industry_id'); ?> <?php echo Html::activeHiddenInput(new \common\models\CsServicesSearch(), 'action_id'); ?> <?php echo Html::activeHiddenInput(new \common\models\CsServicesSearch(), 'object_id'); ?> <?php echo Html::activeHiddenInput(new \common\models\CsServicesSearch(), 'product_id');
<?php use yii\helpers\Html; use yii\widgets\ActiveForm; use kartik\widgets\Typeahead; use yii\web\JsExpression; /* @var $this yii\web\View */ /* @var $model backend\modules\item\ItemSearch */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="item-search"> <?php $form = ActiveForm::begin(['action' => ['index'], 'method' => 'get']); ?> <?php $name = "tes"; $description = "desc"; $template = '<div><p class="repo-language"><b>{{value}}</b></p>' . '<p class="repo-name">{{price}}</p></div>'; ?> <?php echo $form->field($model, 'id')->widget(Typeahead::classname(), ['options' => ['placeholder' => 'Filter as you type ...'], 'pluginOptions' => ['highlight' => true], 'dataset' => [['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('value')", 'local' => $itemList, 'display' => 'value', 'templates' => ['suggestion' => new JsExpression("Handlebars.compile('{$template}')")]], ['datumTokenizer' => "Bloodhound.tokenizers.obj.whitespace('price')", 'local' => $itemList, 'display' => 'price', 'templates' => ['suggestion' => new JsExpression("Handlebars.compile('{$template}')")]]], 'pluginEvents' => ["typeahead:select" => "onItemAutoComplateSelected"]])->label(false); ?> <?php ActiveForm::end(); ?> </div>
} //$labeloption = ['class'=> implode(' ', $class)]; return Html::tag('span', Html::tag('input', '', $inputoption) . ' ' . $label); }, 'itemOptions' => ['container' => ['class' => 'btn btn-primary'], 'class' => 'noicheck']]); ?> <div class="form-group" id="selected_id" style="display:none"> </div> <div class="form-group" id="selected_items"> <?php echo ListVenue::widget(['model' => $model]); ?> </div> <label class="control-label">Search Establishment / Venue</label> <?php echo Typeahead::widget(['name' => 'venue', 'id' => 'venue', 'options' => ['placeholder' => 'Type a venue or restaurant name to map with after city selection'], 'scrollable' => true, 'pluginEvents' => ['typeahead:selected' => "function(e,datum) {\n var array = \$.map(datum, function(value, index) {\n return [value];\n });\n console.log(array);\n //var reultString = array.toString();\n //var resultArray = reultString.split(',');\n //console.log(resultArray);\n var id = array[0];\n \$('#selected_items').show();\n //console.log(id);\n var radio = \$(\"input[name='" . $model->formName() . "[eventtypeselector]']:checked\").val();\n //radioTypeEst = document.getElementById('radioEstablishment').checked;\n //radioTypeVenue = document.getElementById('radioVenue').checked;\n \n if(radio != 200 && radio != 1 && radio != 2 && radio != 3 ){\n radio = 0;\n }\n \n var icon = 'fa-tag';\n \n if(radio == 0){\n icon = 'fa-cutlery';\n }\n \n var countval = \$('#venueC').val();\n \n \n\n var maData = '<div id=\"venueArray[]\"><i class=\"fa '+icon+'\"></i>'+\$('#venue').val()+'<input type=\"hidden\" value ='+id+' class=\"form-control\" name=\"" . $model->formName() . "[venue]['+countval+'][venueId]\"><input type=\"hidden\" value ='+radio+' class=\"form-control\" name=\"" . $model->formName() . "[venue]['+countval+'][venuetype]\"> <a href= \"javascript:void(0);\" class=\"delete\">Delete</a></div>'\n countval++;\n \n \$('#venueC').val(countval);\n \$('#selected_items').append(maData);\n \n \$('#venue').val(''); \n\n //\$(this).data().term = null;\n //\$('.typeahead').typeahead('val', '');.\n\n }", 'typeahead:closed' => "function(){ \$('#venue').val('');}"], 'pluginOptions' => ['highlight' => true, 'minLength' => 1], 'dataset' => [['remote' => ['url' => Url::toRoute(['event/fetch-venue']) . '?q=%QUERY', 'replace' => new JsExpression("function (url, query){ \n url = url.replace('%QUERY', query);\n var type = \$(\"input[name='" . $model->formName() . "[eventtypeselector]']:checked\").val();\n console.log('type:'+type);\n \n var city = \$('#" . Html::getInputId($model, 'cityId') . "').val();\n console.log('city:'+city);\n url = url+'&cityId='+city+'&type='+type;\n return url;\n }")], 'templates' => ['empty' => '<div class="text-error">No records found.</div>']]]]); ?> <?php //*/ ?> <p><h4 class="box-title">More Details</h4></p> <?php echo $form->field($model, 'description')->widget(CKEditor::className(), ['preset' => 'custom', 'clientOptions' => Yii::$app->params['ckeditor']['default']]); ?> <?php //$form->field($model, 'description')->textarea(['rows' => 10,'cols'=>80,'class'=>'textarea col-md-12','placeholder'=>'Please enter description here']) ?> <?php
$(document).ready (function() { $("#nameMhs").change(function () { $("#kelasDropDown").attr("disabled", false); }); }); ', yii\web\View::POS_READY); ?> <script> </script> <?php echo ' <div id=searchNama> <label class="control-label">Search By Nama</label>'; echo Typeahead::widget(['name' => 'FormSearchReport[nama_mahasiswa]', 'options' => ['placeholder' => 'Ketik Nama Mahasiswa', 'id' => 'nameMhs'], 'scrollable' => true, 'pluginOptions' => ['highlight' => true], 'dataset' => [['prefetch' => Url::to(['request/mahasiswalist']), 'limit' => 10]], 'pluginEvents' => ['typeahead:selected' => 'function() { $("#kelasDropDown").attr("disabled" , true); $("#kelasDropDown").attr("value" , ""); }']]); echo '</div>'; ?> <?php echo Form::widget(['model' => $model, 'form' => $form, 'columns' => 4, 'attributes' => ['kelas' => ['label' => 'Search By Kelas', 'type' => Form::INPUT_DROPDOWN_LIST, 'items' => ArrayHelper::map(AitkRKelas::find()->all(), 'kelas_id', 'kode_kelas'), 'options' => ['id' => 'kelasDropDown', 'prompt' => '---', 'onchange' => ' var val =(this.value); if(val!="") { $("#nameMhs").attr("disabled", true); } else { $("#nameMhs").attr("disabled", false); } ']]]]); ?>