コード例 #1
0
ファイル: view.php プロジェクト: Razzwan/dotplant2
                    <div class="col-xs-6">
                        <label for="add-product"><?php 
echo Yii::t('app', 'Add a new product to order');
?>
</label>
                    </div>
                </div>
                <div class="row form-inline">
                    <div class="col-xs-12 form-group">
                        <?php 
echo Html::dropDownList('parentId', [], ['0' => Yii::t('app', 'Select a parent order item')] + \yii\helpers\ArrayHelper::map($model->items, 'id', function ($element) {
    return !is_null($element->product) ? $element->product->name : Yii::t('app', 'Product not found');
}), ['class' => 'form-control input-group-addon col-xs-3', 'id' => 'add-product-parent']);
?>
                        <?php 
echo \app\widgets\AutoCompleteSearch::widget(['template' => '<p><a href="{{url}}">{{name}}</a></p>', 'options' => ['class' => 'form-control col-xs-9'], 'id' => 'add-product', 'name' => 'add-product', 'route' => ['auto-complete-search', 'orderId' => $model->id, 'term' => 'QUERY']]);
?>
                    </div>
                </div>
            </div>
            <?php 
BackendWidget::end();
?>

            <?php 
BackendWidget::begin(['icon' => 'dollar', 'title' => Yii::t('app', 'Order transactions')]);
?>
            <?php 
echo \app\modules\shop\widgets\OrderTransaction::widget(['viewFile' => 'order-transaction/backend', 'model' => $model, 'immutable' => $orderIsImmutable, 'additional' => ['transactionsDataProvider' => $transactionsDataProvider]]);
?>
            <?php 
コード例 #2
0
<?php

/** @var bool $autocomplete */
/** @var bool $useFontAwesome */
use kartik\widgets\ActiveForm;
use yii\helpers\Html;
$form = ActiveForm::begin(['action' => ['/default/search'], 'id' => 'search-form', 'method' => 'get', 'type' => ActiveForm::TYPE_INLINE, 'options' => ['class' => 'search-form']]);
$model = new \app\models\Search();
$model->load(Yii::$app->request->get());
$icon = $useFontAwesome ? \kartik\icons\Icon::show('search') : Html::tag('span', '', ['class' => 'icon-search-field']);
$field = $form->field($model, 'q', ['options' => ['placeholder' => Yii::t('app', 'Search')], 'addon' => ['append' => ['content' => $icon, 'options' => ['class' => 'search-append']]]]);
if ($autocomplete === true) {
    echo $field->widget(\app\widgets\AutoCompleteSearch::className(), ['id' => 'search-autocomplete-' . uniqid()]);
} else {
    echo $field;
}
ActiveForm::end();
$js = <<<JS
\$(".search-form input[type=text]").blur(function(){
    \$(this).removeClass('active');
});
\$(".search-form .search-append").click(function(){
    \$(".search-form input[type=text]").addClass('active').focus();
    return false;
});
JS;
$this->registerJs($js);
?>