/** * @param $model * @param $attribute * @param array $config * @param array $fieldOptions * @return ActiveField the created ActiveField object */ public function fieldInputInt($model, $attribute, $config = [], $fieldOptions = []) { //Html::addCssClass($config, "sx-input-int"); $config['class'] = ArrayHelper::getValue($config, 'class') . "form-control sx-input-int"; /** * 'initval' => 3.00, 'min' => 0, 'max' => 100, 'step' => 0.1, 'decimals' => 2, 'boostat' => 5, 'maxboostedstep' => 10, 'prefix' => '$', */ $defaultOptions = ['pluginOptions' => ['max' => 9999999999]]; $pluginOptions = ArrayHelper::merge($defaultOptions, (array) $config); //return $this->field($model, $attribute, $fieldOptions)->textInput($config); return $this->field($model, $attribute, $fieldOptions)->widget(\kartik\touchspin\TouchSpin::className(), $pluginOptions); }
/* @var $form yii\widgets\ActiveForm */ ?> <strong><?php echo Yii::t('backend', 'Fields with <span style="color: red;">*</span> is required.'); ?> </strong> <br /><br /> <div class="col-sm-6"> <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?> <?php echo $form->field($model, 'amount_text')->widget(TouchSpin::classname(), ['pluginOptions' => ['min' => 0.25, 'max' => 9.0, 'step' => 0.25, 'decimals' => 2, 'boostat' => 1, 'maxboostedstep' => 1]])->label(Yii::t('backend', 'Amount') . ' <span style="color: red;">*</span>'); ?> <?php $unit_data = backend\models\Unit::find()->select(['unit_id', 'unit_text'])->orderBy('unit_text')->all(); $unit_list = \yii\helpers\ArrayHelper::map($unit_data, 'unit_id', 'unit_text'); echo $form->field($model, 'unit_id')->dropDownList($unit_list, ['prompt' => Yii::t('backend', 'Select...')])->label(Yii::t('backend', 'Use Unit') . ' <span style="color: red;">*</span>'); ?> <?php echo $form->field($model, 'amount_img_temp')->widget(FileInput::classname(), ['options' => ['accept' => 'image/jpeg, image/gif, image/png, image/svg+xml'], 'pluginOptions' => ['showCaption' => true, 'showRemove' => true, 'showUpload' => false, 'browseLabel' => '', 'removeLabel' => '', 'removeClass' => 'btn btn-danger', 'initialPreview' => !empty($model->amount_img) ? [Html::img($model->amount_img, ['class' => 'file-preview-image'])] : [], 'initialCaption' => !empty($model->amount_img) ? ' /' . $model->amount_img : ' ']])->label(Yii::t('backend', 'Image') . ' <span style="color: red;">*</span>'); ?> <?php echo $form->field($model, 'note')->textarea(['rows' => 6]); ?>
<div class="col-xs-6"> <?php echo $form->field($model, 'image_only')->widget(SwitchInput::classname(), ['type' => SwitchInput::CHECKBOX]); ?> </div> </div> <div class="row"> <div class="col-sm-6 "> <?php echo $form->field($model, 'time')->widget(DateTimePicker::classname(), ['options' => ['placeholder' => 'Select media time ...', 'readonly' => true], 'removeButton' => false, 'convertFormat' => true, 'pluginOptions' => ['format' => 'yyyy-MM-dd HH:i:s', 'todayHighlight' => true]]); ?> </div> <div class="col-sm-6 "> <?php echo $form->field($model, 'position')->widget(TouchSpin::classname(), ['pluginOptions' => ['min' => 0, 'max' => 20, 'step' => 1, 'handle' => 'triangle', 'tooltip' => 'always']]); ?> </div> </div> <div class="row"> <div class="col-sm-6 "> <?php if ($module->enableUpload) { echo $form->field($model, 'image')->widget(KCFinderInputWidget::className(), ['multiple' => false, 'kcfOptions' => $kcfOptions, 'kcfBrowseOptions' => ['type' => 'images', 'lng' => substr(Yii::$app->language, 0, 2)]]); } else { echo $form->field($model, 'image')->textInput(['placeholder' => Yii::t('app', 'Url of image')]); } ?> </div> <div class="col-sm-6 ">
'dopparams' => [ 'idinstallakt' => (string) filter_input(INPUT_GET, 'idinstallakt'), ], ]));*/ ?> <?php echo $form->field($model, 'id_parent')->widget(Select2::classname(), Proc::DGselect2(['model' => $model, 'resultmodel' => new app\models\Fregat\Mattraffic(), 'fields' => ['keyfield' => 'id_parent'], 'placeholder' => 'Введите инвентарный номер материальной ценности', 'fromgridroute' => 'Fregat/mattraffic/forinstallakt_matparent', 'resultrequest' => 'Fregat/tr-mat/selectinputfortrmatparent', 'thisroute' => $this->context->module->requestedRoute, 'methodquery' => 'selectinputfortrmat_parent', 'methodparams' => ['idinstallakt' => (string) filter_input(INPUT_GET, 'idinstallakt')], 'dopparams' => ['idinstallakt' => (string) filter_input(INPUT_GET, 'idinstallakt')]])); ?> <?php echo $form->field($model, 'id_mattraffic')->widget(Select2::classname(), array_merge(Proc::DGselect2(['model' => $model, 'resultmodel' => new app\models\Fregat\Mattraffic(), 'fields' => ['keyfield' => 'id_mattraffic'], 'placeholder' => 'Введите инвентарный номер материальной ценности', 'fromgridroute' => 'Fregat/mattraffic/forinstallakt_mat', 'resultrequest' => 'Fregat/tr-mat/selectinputfortrmatchild', 'thisroute' => $this->context->module->requestedRoute, 'methodquery' => 'selectinputfortrmat_child', 'methodparams' => ['idinstallakt' => (string) filter_input(INPUT_GET, 'idinstallakt')], 'dopparams' => ['foreigndo' => '1', 'idinstallakt' => (string) filter_input(INPUT_GET, 'idinstallakt')]]), ['pluginEvents' => ["select2:select" => "function() { SetMaxNumberByMaterial(); }", "select2:unselect" => "function() { UnSetMaxNumberByMaterial(); }"]]))->label('Перемещаемая материальная ценность'); ?> <?php echo $form->field($Mattraffic, 'mattraffic_number', ['inputTemplate' => '<div class="input-group">{input}<span id="mattraffic_number_max" class="input-group-addon">' . $mattraffic_number_max . '</span></div>'])->widget(TouchSpin::classname(), ['options' => ['class' => 'form-control setsession'], 'pluginOptions' => ['verticalbuttons' => true, 'min' => 0.001, 'max' => 10000000000, 'step' => 1, 'decimals' => 3, 'forcestepdivisibility' => 'none']]); ?> <div class="form-group"> <div class="panel panel-default"> <div class="panel-heading"> <?php echo Html::submitButton('<i class="glyphicon glyphicon-plus"></i> Добавить', ['class' => 'btn btn-success']); ?> </div> </div> </div> <?php ActiveForm::end();
<div class="col-md-6"> <div class="form-group"> <?php echo $form->field($model2, 'tgl_selesai')->widget(DatePicker::classname(), ['options' => ['placeholder' => 'Tanggal Kembali'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-m-d']])->label('Tangal Kembali'); ?> </div> <div class="form-group"> <?php echo $form->field($model, 'tgl_penugasan')->widget(DatePicker::classname(), ['options' => ['id' => 'tglsp', 'require' => true, 'placeholder' => 'Tanggal Penugasan'], 'pluginOptions' => ['autoclose' => true, 'format' => 'yyyy-m-d']])->label('Tanggl Penugasan'); ?> </div> <div class="form-group"> <?php echo $form->field($model, 'uang_makan')->widget(TouchSpin::classname(), ['options' => ['id' => 'idmakan', 'placeholder' => 'Masukan Jumlah Uang Makan'], 'pluginOptions' => ['buttonup_class' => 'btn btn-primary', 'buttondown_class' => 'btn btn-info', 'buttonup_txt' => '<i class="glyphicon glyphicon-plus-sign"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon-minus-sign"></i>']]); ?> </div> </div> </div> </div> <div id="step-2"> <br/> <h2 class="StepTitle">Input Data Pembiayaan</h2> <br/> <table width="1000px" class="table table-striped table-bordered"> <tr style="background-color:#4e95f4;"> <td>No</td><td>Kategori Pembiayaan</td><td style="width:130px;">Bukti Kwitansi</td><td>Volume </td><td>Harga Satuan</td><td>Jumlah</td><td>Urian Pembiyaian</td> </tr> <tbody id="container"> <!-- nanti rows nya muncul di sini -->
$mainPhoto = $model->getMainPhoto(); // print_r($mainPhoto); // return Html::img($mainPhoto->url,['class'=>'img-responsive','style'=>'width:80px;']); return Html::a(Html::img($mainPhoto->getUrl('original'), ['class' => 'img-responsive', 'style' => 'height:50px;']), ['products/view', 'product_id' => $model->product_id], ['style' => 'display:block;']); // echo Html::a( // Html::img($mainPhoto->getUrl('original'), [ 'class' => 'img-responsive', 'style' => 'max-height:120px;' ]), // [ 'products/view', 'product_id' => $model->product_id ], [ 'style' => 'display:block;' ]); }], ['class' => 'yii\\grid\\DataColumn', 'label' => '', 'headerOptions' => ['style' => 'border-left:none;border-top:1px solid #ddd;'], 'footerOptions' => ['class' => 'text-right', 'style' => 'border-bottom:1px solid #ddd;'], 'format' => 'raw', 'value' => function ($model) { return Html::a($model->name, ['products/view', 'product_id' => $model->product_id], ['style' => 'display:block;']); }], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Цена', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:0;'], 'contentOptions' => ['style' => 'border-right:0;'], 'footer' => '<span style="font-size: 22px;">Итого</span>', 'footerOptions' => ['class' => 'text-right', 'style' => 'border-right:none;border-bottom:1px solid #ddd;'], 'value' => function ($model) { return '<span style="font-size: 16px;">' . number_format($model->price, 0, '.', ' ') . '</span>'; }], ['class' => 'yii\\grid\\DataColumn', 'label' => '', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-left:0;'], 'contentOptions' => ['style' => 'border-left:0;padding-top: 10px;'], 'footerOptions' => ['style' => 'border-left:none;border-bottom:1px solid #ddd;'], 'value' => function ($model) { return '<i class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;font-size: 14px;"></i>'; }], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Количество', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;'], 'contentOptions' => ['style' => 'max-width:100px!important;'], 'footer' => '<span id="cart_quantity" style="font-size: 22px;">' . Yii::$app->cart->getCount() . '</span>', 'footerOptions' => ['style' => 'border-bottom:1px solid #ddd;'], 'format' => 'raw', 'value' => function ($model) { // return Yii::$app->cart->getPositionById($model->id)->getQuantity(); return TouchSpin::widget(['name' => 'count', 'pluginOptions' => ['verticalbuttons' => true, 'min' => 1, 'initval' => Yii::$app->cart->getPositionById($model->product_id)->getQuantity(), 'verticalupclass' => 'glyphicon glyphicon-plus', 'verticaldownclass' => 'glyphicon glyphicon-minus', 'buttonup_txt' => '<i class="glyphicon glyphicon glyphicon-plus"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon glyphicon-minus"></i>'], 'pluginEvents' => ['change' => "function() { \n\n\t\t\t\t\t\t\t// if (this.value>100) {\n\t\t\t\t\t\t\t// \t//не больше 100 штук\n\t\t\t\t\t\t\t// \tthis.value = 100;\n\t\t\t\t\t\t\t// }\n\t\t\t\t\t\t\tjQuery.ajax(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'type':'POST',\n\t\t\t\t\t\t\t'data':{'product_id':\"{$model->product_id};\",'quantity':this.value},\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t'dataType':'json',\n\t\t\t\t\t\t\t'success':function(data){\n\t\t\t\t\t\t\t\$('.cart_cost').html(data.cart_cost);\n\t\t\t\t\t\t\t\$('.cartContent').html(data.cartContent);\n\t\t\t\t\t\t\t\$('#cart_quantity').html(data.cart_quantity);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\$('#position_cost_{$model->product_id}').html(data.position_cost);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t'url':'/cart/change-quantity/',\n\t\t\t\t\t\t\t'cache':false\n\t\t\t\t\t\t\t});\n\n\t\t\t\t \t }"]]); }], ['class' => 'yii\\grid\\DataColumn', 'label' => 'Сумма', 'format' => 'raw', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:0;'], 'contentOptions' => ['style' => 'border-right:0;'], 'footer' => '<span class="cart_cost"style="color:#d2322d;font-size: 22px;">' . number_format(Yii::$app->cart->getCost(), 0, '.', ' ') . '</span>', 'footerOptions' => ['style' => 'border-right:0; border-bottom:1px solid #ddd;min-width:100px!important;'], 'value' => function ($model) { return '<span id="position_cost_' . $model->product_id . '" style="color:#d2322d;font-size: 22px;">' . number_format(Yii::$app->cart->getPositionById($model->product_id)->getCost(), 0, '.', ' ') . '</span>'; return; }], ['class' => 'yii\\grid\\DataColumn', 'label' => ' ', 'format' => 'html', 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-left:0;'], 'contentOptions' => ['style' => 'border-left:0;padding-top: 12px;'], 'footer' => '<i class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;color:#d2322d;font-size: 20px;"></i></span>', 'footerOptions' => ['style' => 'border-left:0;border-bottom:1px solid #ddd;padding-top: 12px;'], 'value' => function ($model) { return '<i id="clear" class="glyphicon-cart glyphicon-ruble" style="margin-left:20px;color:#d2322d;font-size: 20px;"></i>'; }], ['class' => '\\yii\\grid\\ActionColumn', 'header' => Html::a(Html::Tag('i', null, ['class' => 'glyphicon-cart glyphicon-remove cart-remove']), ['#'], ['id' => 'clear', 'style' => 'text-decoration:none;']), 'headerOptions' => ['style' => 'border-top:1px solid #ddd;border-right:none;'], 'contentOptions' => ['style' => 'border-right:none;'], 'footerOptions' => ['style' => 'border-right:none;'], 'template' => '{delete}', 'buttons' => ['delete' => function ($url, $model) { $url = Url::toRoute('/cart/remove/'); $jsCartRemove = <<<JS \t\t\t\$("#remove_{$model->product_id}").on('click', \t\t\t\tfunction() { \t\t\t\t\t\$.ajax({
?> <?php Modal::begin(['id' => 'edit-modal', 'header' => 'Edit', 'footer' => '<button type="button" class="confirm-btn btn btn-primary">Confirm</button>' . '<button type="button" class="btn btn-default undo-btn">Undo changes</button>' . '<button type="button" class="btn btn-default close-btn">Close</button>']); $form = ActiveForm::begin(['id' => 'edit-form', 'action' => ['connection/update'], 'enableAjaxValidation' => true]); ?> <input name="ConnectionForm[id]" value="<?php echo $conn->id; ?> " hidden> <?php $editForm = new ConnectionForm(); echo $form->field($editForm, 'acceptRelease')->widget(SwitchInput::classname(), ['pluginOptions' => ['onText' => 'Yes', 'offText' => 'No']]); echo $form->field($editForm, 'bandwidth')->widget(TouchSpin::classname(), ['pluginOptions' => ['postfix' => 'Mbps', 'verticalbuttons' => true, 'verticalupclass' => 'fa fa-plus', 'verticaldownclass' => 'fa fa-minus', 'min' => 10, 'max' => 1000000, 'step' => 10]]); echo $form->field($editForm, 'start')->widget(DateTimePicker::classname(), ['pluginOptions' => ['autoclose' => true, 'format' => 'dd/mm/yyyy hh:ii']]); echo $form->field($editForm, 'end')->widget(DateTimePicker::classname(), ['pluginOptions' => ['autoclose' => true, 'format' => 'dd/mm/yyyy hh:ii']]); ActiveForm::end(); ?> <?php Modal::end(); ?> <?php Modal::begin(['id' => 'cancel-modal', 'header' => 'Cancel', 'footer' => '<button type="button" class="btn btn-danger confirm-btn">Confirm</button>' . '<button type="button" class="btn btn-default close-btn">Close</button>']); ?> Do you want cancel this circuit?
<?php $form = ActiveForm::begin(); ?> <div class="well"> <div class="row"> <div class="col-md-6"><?= $form->field($model, 'produto_idproduto')->widget(Select2::classname(), [ 'options' => ['placeholder' => 'Selecione o produto...'], 'pluginOptions' => [ 'allowClear' => true, 'minimumInputLength' => 2, 'ajax' => [ 'url' => $url_produto, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {search:params.term}; }') ], ], ]) ?></div> <div class="col-md-6"><?= $form->field($model, 'quantidade')->widget(TouchSpin::classname(),[ 'options' => ['placeholder' => $model->getAttributeLabel('quantidade')], 'pluginOptions' => [ 'max' => 100000, 'buttonup_class' => 'btn btn-primary', 'buttondown_class' => 'btn btn-info', 'buttonup_txt' => '<i class="glyphicon glyphicon-plus-sign"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon-minus-sign"></i>' ] ]) ?></div> </div> </div> <!-- Campo 'create_at é setado automaticamente' --> <div class="form-group"> <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Cadastrar') : Yii::t('app', 'Atualizar'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
foreach (explode(",", $d->value) as $v) { $options[trim($v)] = trim($v); $deval = $deval == "" ? trim($v) : $deval; } echo '<div class="form-group"><label class="control-label">' . Html::encode($d->label) . '</label>'; echo Select2::widget(['name' => 'Orders[data][' . $d->label . ']', 'data' => $options, 'value' => $deval, 'options' => ['placeholder' => Yii::t('app', 'Select ') . $d->label, 'class' => 'item-shopcart', "id" => "data_" . str_replace(" ", "_", $d->label)]]); echo '</div>'; } else { if ($type == 1) { echo '<div class="form-group"><label class="control-label">' . Html::encode($d->label) . '</label>'; echo Html::textInput('Orders[data][' . $d->label . ']', $d->value, ["id" => "data_" . str_replace(" ", "_", $d->label), "class" => "form-control item-shopcart", "placeholder" => Yii::t("app", $d->label), "style" => "width:100%"]); echo '</div>'; } else { if ($type == 2) { echo '<div class="form-group"><label class="control-label">' . Html::encode($d->label) . '</label>'; echo TouchSpin::widget(['name' => 'Orders[data][' . $d->label . ']', 'value' => $d->value == null ? 0 : $d->value, 'options' => ["id" => "data_" . str_replace(" ", "_", $d->label), "class" => "item-shopcart"], 'pluginOptions' => ['min' => 1, 'step' => 1, 'max' => 100000000000, 'boostat' => 10, 'maxboostedstep' => 100000, 'handle' => 'triangle', 'tooltip' => 'always']]); echo '</div>'; } else { if ($type == 3) { echo '<div class="form-group"><label class="control-label">' . Html::encode($d->label) . '</label>'; echo Html::textArea('Orders[data][' . $d->label . ']', $d->value, ["id" => "data_" . str_replace(" ", "_", $d->label), "class" => "form-control item-shopcart", "placeholder" => Yii::t("app", $d->label), "style" => "width:100%"]); echo '</div>'; } else { if ($type == 4) { echo '<div class="form-group"><label class="control-label">' . $d->value . '</label>'; echo Html::hiddenInput('Orders[data][' . $d->label . ']', $d->value, ["id" => "data_" . str_replace(" ", "_", $d->label), "class" => "form-control item-shopcart"]); echo '</div>'; } else { if ($type == 5) { echo Html::hiddenInput('Orders[data][' . $d->label . ']', $d->value, ["id" => "data_" . str_replace(" ", "_", $d->label), "class" => "form-control item-shopcart"]); }
'url' => $urlLoja, 'dataType' => 'json', 'data' => new JsExpression('function(params) { return {search:params.term}; }'), //'results' => new JsExpression('function(data,page) { return {results:data.results}; }'), ], //'initSelection' => new JsExpression($initScript_loja), ], 'options' => ['prompt' => \Yii::t('app', 'Escolha a loja de destino')], ]);?> </div> <div class="col-md-4"> <?= $form->field($model, 'quantidade')->widget(TouchSpin::classname(), [ 'options' => ['placeholder' => $model->getAttributeLabel('quantidade')], 'pluginOptions' => [ 'max' => 100000, 'buttonup_class' => 'btn btn-primary', 'buttondown_class' => 'btn btn-info', 'buttonup_txt' => '<i class="glyphicon glyphicon-plus-sign"></i>', 'buttondown_txt' => '<i class="glyphicon glyphicon-minus-sign"></i>' ] ]); ?> </div> <div class="form-group"> <div class="col-md-12"> <?= Html::submitButton(Yii::t('app', 'Salvar'), ['class' => 'btn btn-success']) ?>
/* @var $model app\models\Fregat\TrMatOsmotr */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="tr-mat-osmotr-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'id_tr_mat')->widget(Select2::classname(), Proc::DGselect2(['model' => $model, 'resultmodel' => new app\models\Fregat\TrMat(), 'fields' => ['keyfield' => 'id_tr_mat'], 'placeholder' => 'Введите инвентарный номер или наименование материала', 'fromgridroute' => 'Fregat/tr-mat/fortrmatosmotr', 'resultrequest' => 'Fregat/tr-mat/selectinputfortrmatosmotr', 'thisroute' => $this->context->module->requestedRoute, 'methodquery' => 'selectinputfortrmatosmotr', 'methodparams' => ['idosmotraktmat' => (string) filter_input(INPUT_GET, 'id')], 'dopparams' => ['idosmotraktmat' => (string) filter_input(INPUT_GET, 'id')]])); ?> <?php echo $form->field($model, 'tr_mat_osmotr_number')->widget(TouchSpin::classname(), ['options' => ['class' => 'form-control setsession'], 'pluginOptions' => ['verticalbuttons' => true, 'min' => 0, 'max' => 10000000000, 'step' => 1, 'decimals' => 3, 'forcestepdivisibility' => 'none']]); ?> <?php echo $form->field($model, 'id_reason')->widget(Select2::classname(), Proc::DGselect2(['model' => $model, 'resultmodel' => new app\models\Fregat\Reason(), 'fields' => ['keyfield' => 'id_reason', 'resultfield' => 'reason_text'], 'placeholder' => 'Выберете причину неисправности', 'fromgridroute' => 'Fregat/reason/index', 'resultrequest' => 'Fregat/reason/selectinput', 'thisroute' => $this->context->module->requestedRoute])); ?> <?php echo $form->field($model, 'tr_mat_osmotr_comment')->textarea(['class' => 'form-control setsession', 'maxlength' => 1024, 'placeholder' => 'Введите дополнительную информацию о неисправности', 'rows' => 10, 'style' => 'resize: none']); ?> <div class="form-group"> <div class="panel panel-default"> <div class="panel-heading">
?> </div> </div> <div class="row"> <div class="col-lg-6"><?php echo $form->field($model, 'username')->textInput(['maxlength' => true]); ?> </div> <div class="row"> <div class="col-lg-2"> <?php echo $form->field($model, 'password')->passwordInput(['maxlength' => true]); ?> </div> <div class="col-lg-3"> <?php echo $form->field($model, 'grace_time')->widget(TouchSpin::className(), ['name' => 'grace_time', 'pluginOptions' => ['postfix' => 'days', 'min' => 2, 'max' => 30]]); ?> </div> </div> </div> <div class="row"> <div class="col-lg-6"> <?php echo $form->field($model, 'full_name')->textInput(['maxlength' => true]); ?> </div> <div class="col-lg-6"> <?php echo $form->field($contactModel, 'email')->textInput(); ?> </div> </div>
/** * @param $Form * @param $ActiveRecord * @param $FieldName * @param null $Options */ public static function FilterFieldIntCondition($Form, $ActiveRecord, $FieldName, $Options = NULL) { if (!is_array($Options)) { $Options = []; } echo '<div class="form-group"><label class="control-label" for="' . $ActiveRecord->formName() . '-' . $FieldName . '">'; echo $ActiveRecord->getAttributeLabel($FieldName); echo '</label><div class="row"><div class="col-xs-5">'; echo $Form->field($ActiveRecord, $FieldName . '_znak')->widget(Select2::classname(), ['hideSearch' => true, 'data' => ['>=' => 'Больше или равно', '<=' => 'Меньше или равно', '=' => 'Равно'], 'options' => ['placeholder' => 'Выберете знак равенства', 'class' => 'form-control', 'style' => 'width; 215px;'], 'theme' => Select2::THEME_BOOTSTRAP])->label(false); echo '</div><div class="col-xs-7">'; echo $Form->field($ActiveRecord, $FieldName)->widget(TouchSpin::classname(), ['options' => ['class' => 'form-control'], 'pluginOptions' => array_merge(['verticalbuttons' => true, 'forcestepdivisibility' => 'none'], $Options)])->label(false); echo '</div></div></div>'; }
/** * Create ActiveForm widget. * * @param \yii\widgets\ActiveForm $form * @param \yii\db\ActiveRecord $model Model * @param string $attribute Model attribute */ public function createWidget($form, $model, $attribute) { $widget = $this->getAttributeWidget($model, $attribute); $tableSchema = $model->getTableSchema(); switch ($widget) { case 'widget': echo $this->createField($form, $model, $attribute, [], 'widget'); break; case 'wysiwyg': $options = ['widgetClass' => RedactorWidget::className(), 'settings' => ['minHeight' => 200, 'plugins' => ['video', 'fullscreen']]]; if ($this->redactorImageUpload === true) { $imageOptions = ['settings' => ['imageManagerJson' => Url::to(['model/redactor-list', 'name' => $this->getModelName($model), 'attr' => $attribute]), 'imageUpload' => Url::to(['model/redactor-upload', 'name' => $this->getModelName($model), 'attr' => $attribute]), 'imageUploadErrorCallback' => new JsExpression('function(json) { alert(json.error); }'), 'plugins' => ['imagemanager']]]; $options = ArrayHelper::merge($options, $imageOptions); } if ($this->redactorFileUpload === true) { $fileOptions = ['settings' => ['fileManagerJson' => Url::to(['model/redactor-list', 'name' => $this->getModelName($model), 'attr' => $attribute, 'type' => 'file']), 'fileUpload' => Url::to(['model/redactor-upload', 'name' => $this->getModelName($model), 'attr' => $attribute, 'type' => 'file']), 'fileUploadErrorCallback' => new JsExpression('function(json) { alert(json.error); }'), 'plugins' => ['filemanager']]]; $options = ArrayHelper::merge($options, $fileOptions); } echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'date': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'date', 'clientOptions' => ['dateFormat' => 'yy-mm-dd']]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'time': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'time', 'clientOptions' => ['timeFormat' => 'HH:mm:ss', 'showSecond' => true]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'datetime': $options = ['widgetClass' => TimePicker::className(), 'mode' => 'datetime', 'clientOptions' => ['dateFormat' => 'yy-mm-dd', 'timeFormat' => 'HH:mm:ss', 'showSecond' => true]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'select': $options = ['options' => ['placeholder' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)]), 'width' => '100%'], 'pluginOptions' => ['allowClear' => true, 'width' => '100%'], 'data' => ['' => '']]; echo $this->createField($form, $model, $attribute, $options, 'select'); break; case 'selectMultiple': $options = ['options' => ['multiple' => true, 'placeholder' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)]), 'width' => '100%']]; echo $this->createField($form, $model, $attribute, $options, 'select'); break; case 'image': $options = []; if (!$model->isNewRecord && !empty($model->{$attribute})) { $className = StringHelper::basename($model->className()); $inputName = $className . '[' . $attribute . '_delete]'; $inputId = strtolower($className . '-' . $attribute . '_delete'); $url = $this->getAttributeUrl($this->getModelName($model), $attribute, $model->{$attribute}); ob_start(); echo '<div class="checkbox"><label for="' . $inputId . '"> <input type="checkbox" name="' . $inputName . '" id="' . $inputId . '" value="delete"> ' . Yii::t('ycm', 'Delete image') . ' </label></div>'; Modal::begin(['size' => Modal::SIZE_LARGE, 'header' => '<h4>' . Yii::t('ycm', 'Preview image') . '</h4>', 'toggleButton' => ['label' => Yii::t('ycm', 'Preview image'), 'class' => 'btn btn-info btn-sm']]); echo Html::img($url, ['class' => 'modal-image']); Modal::end(); $html = ob_get_clean(); $options['hint'] = $html; } echo $this->createField($form, $model, $attribute, $options, 'fileInput'); break; case 'file': $options = []; if (!$model->isNewRecord && !empty($model->{$attribute})) { $className = StringHelper::basename($model->className()); $inputName = $className . '[' . $attribute . '_delete]'; $inputId = strtolower($className . '-' . $attribute . '_delete'); $url = $this->getAttributeUrl($this->getModelName($model), $attribute, $model->{$attribute}); $html = '<div class="checkbox"><label for="' . $inputId . '"> <input type="checkbox" name="' . $inputName . '" id="' . $inputId . '" value="delete"> ' . Yii::t('ycm', 'Delete file') . ' </label></div>'; $html .= Html::a(Yii::t('ycm', 'Download file'), $url, ['class' => 'btn btn-info btn-sm']); $options['hint'] = $html; } echo $this->createField($form, $model, $attribute, $options, 'fileInput'); break; case 'text': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; echo $this->createField($form, $model, $attribute, $options, 'textInput'); break; case 'integer': $options = ['widgetClass' => TouchSpin::className(), 'pluginOptions' => ['min' => -PHP_INT_MAX, 'max' => PHP_INT_MAX]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; case 'hidden': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; $options = $this->getAttributeOptions($attribute, $options); echo Html::activeHiddenInput($model, $attribute, $options); break; case 'password': $options = ['maxlength' => $tableSchema->columns[$attribute]->size]; echo $this->createField($form, $model, $attribute, $options, 'passwordInput'); break; case 'textarea': $options = ['rows' => 6]; echo $this->createField($form, $model, $attribute, $options, 'textarea'); break; case 'radio': echo $this->createField($form, $model, $attribute, [], 'radio'); break; case 'boolean': case 'checkbox': echo $this->createField($form, $model, $attribute, [], 'checkbox'); break; case 'dropdown': $options = ['prompt' => Yii::t('ycm', 'Choose {name}', ['name' => $model->getAttributeLabel($attribute)])]; echo $this->createField($form, $model, $attribute, $options, 'dropDownList'); break; case 'listbox': $options = ['prompt' => '']; echo $this->createField($form, $model, $attribute, $options, 'listBox'); break; case 'checkboxList': echo $this->createField($form, $model, $attribute, [], 'checkboxList'); break; case 'radioList': echo $this->createField($form, $model, $attribute, [], 'radioList'); break; case 'disabled': $options = ['maxlength' => $tableSchema->columns[$attribute]->size, 'readonly' => true]; echo $this->createField($form, $model, $attribute, $options, 'textInput'); break; case 'hide': break; // Special type - model relation // Special type - model relation case 'relation': $relation = $model->getRelation($attribute); $options = ['widgetClass' => Select2::className(), 'data' => ModelHelper::getSelectChoices(new $relation->modelClass()), 'hideSearch' => false, 'options' => ['multiple' => $relation->multiple, 'placeholder' => 'Select...'], 'pluginOptions' => ['allowClear' => true]]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; // Special type - field with enum values from DB // Special type - field with enum values from DB case 'enumerate': $options = ['widgetClass' => Select2::className(), 'data' => ModelHelper::getEnumChoices($model, $attribute), 'options' => ['placeholder' => 'Select...']]; echo $this->createField($form, $model, $attribute, $options, 'widget'); break; default: $options = $this->getAttributeOptions($attribute); echo $form->field($model, $attribute)->{$widget}($options); break; } }