Beispiel #1
0
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use yii\grid\GridViewAsset;
use kartik\date\DatePickerAsset;
use kartik\select2\Select2;
use kartik\touchspin\TouchSpinAsset;
use app\modules\plan_prospekt\Asset;
/**
 * @var $this View
 * @var $actionSubview string
 * @var $actionParams array
 * @var $gridParams array
 */
ActiveFormAsset::register($this);
TouchSpinAsset::register($this);
DatePickerAsset::register($this);
GridViewAsset::register($this);
Asset::register($this);
echo Html::beginTag('div', ['class' => 'planprospekt planprospekt-editor']);
echo Html::tag('h3', 'План проспект ' . Yii::$app->request->get('year'));
// workaround for kratik-select2 pjax loading bug
echo Html::tag('div', Select2::widget(['name' => 'stub']), ['class' => 'hidden']);
Modal::begin(['id' => 'modal-action', 'header' => '<h4></h4>']);
$this->registerJs('mybriop.planProspektEditor.modalDynamicOptionsInit("#modal-action");');
Pjax::begin(['id' => 'pjax-action', 'timeout' => 3500]);
if (isset($actionSubview) && isset($actionParams)) {
    $indexUrl = $actionParams['indexUrl'];
    $modalMethod = $actionParams['model'] !== null ? "show" : "hide";
    $this->registerJs('mybriop.planProspektEditor.modalHiddenHandlerInit("#modal-action", "#pjax-grid", "' . $indexUrl . '");');
    $this->registerJs('$("#modal-action").modal("' . $modalMethod . '");');
    echo $this->render($actionSubview, $actionParams);
Beispiel #2
0
 /**
  * Registers the needed client assets
  */
 public function registerAssets()
 {
     if ($this->disabled) {
         return;
     }
     $view = $this->getView();
     if (!empty($this->_langFile)) {
         DatePickerAsset::register($view)->js[] = $this->_langFile;
     } else {
         DatePickerAsset::register($view);
     }
     $id = "jQuery('#" . $this->options['id'] . "')";
     $this->options['data-datepicker-type'] = $this->type;
     if ($this->type == self::TYPE_INLINE) {
         $this->pluginEvents = ArrayHelper::merge($this->pluginEvents, ['changeDate' => 'function (e) { ' . $id . '.val(e.format());} ']);
     }
     if ($this->type === self::TYPE_INPUT) {
         $this->registerPlugin('datepicker');
     } elseif ($this->type === self::TYPE_RANGE && isset($this->form)) {
         $this->registerPlugin('datepicker', "{$id}.parent().parent()");
     } else {
         $this->registerPlugin('datepicker', "{$id}.parent()");
     }
     if ($this->removeButton !== false && $this->_hasAddon) {
         $view->registerJs("{$id}.parent().find('.kv-date-remove').on('click', function() {\n                {$id}.parent().datepicker('clearDates');\n            });");
     }
     if ($this->type === self::TYPE_RANGE) {
         \kartik\field\FieldRangeAsset::register($view);
     }
 }
 /**
  * Registers the needed client assets
  *
  * @return void
  */
 public function registerAssets()
 {
     if ($this->disabled) {
         return;
     }
     $view = $this->getView();
     if (!empty($this->_langFile)) {
         DatePickerAsset::register($view)->js[] = $this->_langFile;
     } else {
         DatePickerAsset::register($view);
     }
     $id = "jQuery('#" . $this->options['id'] . "')";
     $el = "jQuery('#" . $this->options['data-datepicker-source'] . "')";
     $this->registerPlugin($this->pluginName, $el);
     if ($this->type === self::TYPE_INLINE) {
         $view->registerJs("{$el}.on('changeDate',function(e){{$id}.val(e.format()).trigger('change')});");
     }
     if ($this->_hasAddon && $this->removeButton !== false) {
         $view->registerJs("initDPRemove('" . $this->options['id'] . "');");
     }
     if ($this->_hasAddon) {
         $view->registerJs("initDPAddon('" . $this->options['id'] . "');");
     }
     if ($this->type === self::TYPE_RANGE) {
         \kartik\field\FieldRangeAsset::register($view);
         $view->registerJs("initDPRemove('" . $this->options['id'] . "', true);");
     }
 }
Beispiel #4
0
 /**
  * Registers the needed client assets
  */
 public function registerAssets()
 {
     if ($this->disabled) {
         return;
     }
     $view = $this->getView();
     if (!empty($this->_langFile)) {
         DatePickerAsset::register($view)->js[] = $this->_langFile;
     } else {
         DatePickerAsset::register($view);
     }
     $id = "jQuery('#" . $this->options['id'] . "')";
     if ($this->type == self::TYPE_INLINE) {
         $this->pluginEvents = ArrayHelper::merge($this->pluginEvents, ['changeDate' => 'function (e) { ' . $id . '.val(e.format());} ']);
     }
     if ($this->type === self::TYPE_INPUT) {
         $this->registerPlugin('datepicker');
     } elseif ($this->type === self::TYPE_RANGE && isset($this->form)) {
         $this->registerPlugin('datepicker', "{$id}.parent().parent()");
     } else {
         $this->registerPlugin('datepicker', "{$id}.parent()");
     }
     if ($this->type === self::TYPE_RANGE) {
         \kartik\field\FieldRangeAsset::register($view);
     }
 }