public static function defaultColumns()
 {
     return ['fqdn' => ['attribute' => 'fqdn', 'value' => function ($model) {
         return $model->fqdn;
     }], 'type' => ['value' => function ($model) {
         return strtoupper($model->type);
     }], 'value' => ['value' => function ($model) {
         return $model->getValueText();
     }], 'zone' => ['class' => MainColumn::className(), 'label' => Yii::t('hipanel:dns', 'Zone'), 'attribute' => 'name'], 'actions' => ['class' => ActionColumn::className(), 'template' => '{update} {delete}', 'visibleButtonsCount' => 2, 'options' => ['style' => 'width: 15%'], 'buttons' => ['update' => function ($url, $model, $key) {
         if ($model->is_system) {
             return Html::tag('div', Html::a('<i class="fa fa-pencil"></i> ' . Yii::t('hipanel', 'Update'), null, ['class' => 'btn btn-default btn-xs disabled']), ['data-placement' => 'top', 'data-toggle' => 'tooltip', 'title' => Yii::t('hipanel:dns', 'This record was created by hosting panel automatically and cannot be updated'), 'style' => 'display: inline-block; cursor: not-allowed;']);
         }
         $data = Html::a('<i class="fa fa-pencil"></i> ' . Yii::t('hipanel', 'Update'), null, ['class' => 'btn btn-default btn-xs edit-dns-toggle', 'data' => ['record_id' => $model->id, 'hdomain_id' => $model->hdomain_id, 'load-url' => Url::to(['@dns/record/update', 'hdomain_id' => $model->hdomain_id, 'id' => $model->id])]]);
         $progress = Json::htmlEncode("<tr><td colspan='5'>" . Progress::widget(['id' => 'progress-bar', 'percent' => 100, 'barOptions' => ['class' => 'active progress-bar-striped', 'style' => 'width: 100%']]) . '</td></tr>');
         Yii::$app->view->registerJs("\n                            \$('.edit-dns-toggle').click(function () {\n                                var record_id = \$(this).data('id');\n                                var hdomain_id = \$(this).data('hdomain_id');\n\n                                var currentRow = \$(this).closest('tr');\n                                var newRow = \$({$progress});\n\n                                \$(newRow).data({'record_id': record_id, hdomain_id: hdomain_id});\n                                \$('tr').filter(function () { return \$(this).data('id') == record_id; }).find('.btn-cancel').click();\n                                \$(newRow).insertAfter(currentRow);\n\n                                jQuery.ajax({\n                                    url: \$(this).data('load-url'),\n                                    type: 'GET',\n                                    timeout: 0,\n                                    error: function() {\n\n                                    },\n                                    success: function(data) {\n                                        newRow.find('td').html(data);\n                                        newRow.find('.btn-cancel').on('click', function (event) {\n                                            event.preventDefault();\n                                            newRow.remove();\n                                        });\n                                    }\n                                });\n\n                            });\n                        ");
         return $data;
     }, 'delete' => function ($url, $model, $key) {
         if ($model->type === 'ns' && $model->is_system) {
             return Html::tag('div', Html::a('<i class="fa text-danger fa-trash-o"></i> ' . Yii::t('hipanel', 'Delete'), null, ['class' => 'btn btn-default btn-xs disabled']), ['data-placement' => 'top', 'data-toggle' => 'tooltip', 'title' => Yii::t('hipanel:dns', 'This record is important for the domain zone viability and can not be deleted'), 'style' => 'display: inline-block; cursor: not-allowed;']);
         }
         return ModalButton::widget(['model' => $model, 'scenario' => 'delete', 'submit' => ModalButton::SUBMIT_PJAX, 'form' => ['action' => Url::to('@dns/record/delete')], 'button' => ['class' => 'btn btn-default btn-xs', 'label' => '<i class="fa text-danger fa-trash-o"></i> ' . Yii::t('hipanel', 'Delete')], 'modal' => ['header' => Html::tag('h4', Yii::t('hipanel:dns', 'Confirm DNS record deleting')), 'headerOptions' => ['class' => 'label-danger'], 'footer' => ['label' => Yii::t('hipanel:dns', 'Delete record'), 'data-loading-text' => Yii::t('hipanel:dns', 'Deleting record...'), 'class' => 'btn btn-danger']], 'body' => function ($model) {
             echo Html::activeHiddenInput($model, 'hdomain_id');
             echo Yii::t('hipanel:dns', 'Are you sure, that you want to delete record {name}?', ['name' => $model->fqdn]);
         }]);
     }]]];
 }
 public static function defaultColumns()
 {
     return ['bill' => ['class' => MainColumn::class, 'attribute' => 'bill', 'filterAttribute' => 'bill_like'], 'time' => ['format' => 'html', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap'], 'value' => function ($model) {
         list($date, $time) = explode(' ', $model->time, 2);
         return $time === '00:00:00' ? Yii::$app->formatter->asDate($date) : Yii::$app->formatter->asDateTime($model->time);
     }], 'sum' => ['class' => CurrencyColumn::class, 'attribute' => 'sum', 'colors' => ['danger' => 'warning'], 'headerOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model) {
         return ['class' => 'text-right' . ($model->sum > 0 ? ' text-bold' : '')];
     }], 'sum_editable' => ['class' => CurrencyColumn::class, 'attribute' => 'sum', 'colors' => ['danger' => 'warning'], 'headerOptions' => ['class' => 'text-right'], 'urlCallback' => function ($model, $key) {
         return Url::to(['bill/update', 'id' => $model->id]);
     }, 'contentOptions' => function ($model) {
         return ['class' => 'text-right' . ($model->sum > 0 ? ' text-bold' : '')];
     }], 'balance' => ['class' => CurrencyColumn::class, 'headerOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model, $key, $index) {
         return ['class' => 'text-right' . ($index ? '' : ' text-bold')];
     }], 'gtype' => ['attribute' => 'gtype'], 'type_label' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:finance', 'format' => 'raw', 'gtype' => Yii::$app->user->can('support') ? 'type,bill' : 'type,bill,deposit', 'filterAttribute' => 'gtype', 'headerOptions' => ['class' => 'text-right'], 'filterOptions' => ['class' => 'text-right'], 'contentOptions' => function ($model) {
         return ['class' => 'text-right'];
     }, 'value' => function ($model) {
         static $colors = ['correction' => 'normal', 'exchange' => 'warning', 'deposit' => 'success'];
         $color = $colors[$model->gtype] ?: 'muted';
         return Html::tag('b', Yii::t('hipanel:finance', $model->type_label), ['class' => "text-{$color}"]);
     }], 'description' => ['attribute' => 'descr', 'format' => 'raw', 'value' => function ($model) {
         $descr = $model->descr ?: $model->label;
         $text = mb_strlen($descr) > 70 ? ArraySpoiler::widget(['data' => $descr]) : $descr;
         $tariff = $model->tariff ? Html::tag('span', Yii::t('hipanel', 'Tariff') . ': ' . Html::a($model->tariff, ['@tariff/view', 'id' => $model->tariff_id]), ['class' => 'pull-right']) : '';
         $amount = static::billQuantity($model);
         $object = $model->object ? implode(':&nbsp;', [$model->class_label, static::objectLink($model)]) : '';
         return $tariff . $amount . ' ' . implode('<br>', array_filter([$object, $text]));
     }], 'tariff' => ['attribute' => 'tariff']];
 }
 public static function defaultColumns()
 {
     return ['ip' => ['class' => MainColumn::class, 'filterAttribute' => 'ip_like'], 'tags' => ['format' => 'raw', 'attribute' => 'tag', 'header' => Yii::t('hipanel:hosting', 'Tags'), 'visible' => Yii::$app->user->can('admin'), 'filter' => function ($column, $model) {
         return Html::activeDropDownList($model, 'tag_in', array_merge(['' => Yii::t('hipanel', '---')], static::$ipTags), ['class' => 'form-control']);
     }, 'value' => function ($model) {
         $labels = [];
         foreach ($model->tags as $tag) {
             $labels[] = IpTag::widget(['tag' => $tag]);
         }
         return implode(' ', $labels);
     }], 'counters' => ['format' => 'html', 'header' => Yii::t('hipanel:hosting', 'Counters'), 'value' => function ($model) {
         $html = '';
         foreach ($model->objects_count as $count) {
             if ($count['type'] === 'hdomain') {
                 $url['ok'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip]];
                 $url['deleted'] = ['@hdomain', (new HdomainSearch())->formName() => ['ip_like' => $model->ip, 'state' => 'deleted']];
                 $type = function ($count) {
                     return Yii::t('hipanel:hosting', '{0, plural, one{domain} other{domains}}', (int) $count);
                 };
             } else {
                 throw new InvalidParamException('The object type is not supported', $model);
             }
             if ($count['ok']) {
                 $html .= Html::a((int) $count['ok'] . '&nbsp;' . FontIcon::i('fa-check') . ' ' . $type($count['ok']), $url['ok'], ['class' => 'btn btn-success btn-xs']);
             }
             $html .= ' ';
             if ($count['deleted'] > 0) {
                 $html .= Html::a((int) $count['deleted'] . '&nbsp;' . FontIcon::i('fa-trash') . ' ' . $type($count['deleted']), $url['deleted'], ['class' => 'btn btn-xs btn-warning']);
             }
         }
         return $html;
     }], 'links' => ['format' => 'html', 'value' => function ($model) {
         $items = [];
         foreach ($model->links as $link) {
             $item = Html::a($link->device, ['@server/view', 'id' => $link->device_id]);
             if ($link->service_id) {
                 $item .= '&nbsp;' . FontIcon::i('fa-long-arrow-right');
                 $item .= '&nbsp;' . Html::a($link->service ?: $link->soft, ['@service/view', 'id' => $link->service_id]);
             }
             $items[] = $item;
         }
         return ArraySpoiler::widget(['data' => $items, 'visibleCount' => 3]);
     }], 'services' => ['attribute' => 'links', 'format' => 'html', 'label' => Yii::t('hipanel:server', 'Services'), 'value' => function ($model) {
         return ArraySpoiler::widget(['data' => $model->links, 'formatter' => function ($link) {
             if (Yii::$app->user->can('support') && Yii::getAlias('@service', false)) {
                 return Html::a($link->service, ['@service/view', 'id' => $link->service_id]);
             }
             return $link->service;
         }]);
     }], 'actions' => ['class' => MenuColumn::class, 'menuClass' => IpActionsMenu::class], 'ptr' => ['options' => ['style' => 'width: 40%'], 'format' => 'raw', 'value' => function ($model) {
         if ($model->canSetPtr()) {
             return XEditable::widget(['model' => $model, 'attribute' => 'ptr', 'pluginOptions' => ['url' => Url::to('@ip/set-ptr')]]);
         }
         return null;
     }]];
 }
 public function actions()
 {
     return ['set-orientation' => ['class' => OrientationAction::class, 'allowedRoutes' => ['@client/index']], 'index' => ['class' => IndexAction::class, 'on beforePerform' => function ($event) {
         if (!Yii::$app->user->can('support')) {
             Yii::$app->response->redirect(Url::to(['@client/view', 'id' => Yii::$app->user->id]))->send();
         }
     }, 'data' => function ($action) {
         return ['types' => $this->getRefs('type,client', 'hipanel:client'), 'states' => $this->getRefs('state,client', 'hipanel:client')];
     }, 'filterStorageMap' => ['login_like' => 'client.client.login_like', 'state' => 'client.client.state', 'type' => 'client.client.type', 'seller' => 'client.client.seller']], 'search' => ['class' => SearchAction::class], 'create' => ['class' => SmartCreateAction::class, 'success' => Yii::t('hipanel:client', 'Client was created')], 'update' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Client was updated')], 'delete' => ['class' => SmartDeleteAction::class, 'success' => Yii::t('hipanel:client', 'Client was deleted')], 'enable-block' => ['class' => SmartPerformAction::class, 'success' => 'Client was blocked successfully', 'error' => 'Error during the client account blocking'], 'disable-block' => ['class' => SmartPerformAction::class, 'success' => 'Client was unblocked successfully', 'error' => 'Error during the client account unblocking'], 'change-password' => ['class' => SmartUpdateAction::class, 'view' => '_changePasswordModal', 'POST' => ['save' => true, 'success' => ['class' => RenderJsonAction::class, 'return' => function ($action) {
         return ['success' => !$action->collection->hasErrors()];
     }]]], 'set-tmp-password' => ['class' => SmartUpdateAction::class, 'view' => '_setTmpPasswordModal', 'success' => Yii::t('hipanel:client', 'Temporary password was sent on your email'), 'error' => Yii::t('hipanel:client', 'Error during temporary password setting')], 'view' => ['class' => ViewAction::class, 'on beforePerform' => function ($event) {
         $action = $event->sender;
         $action->getDataProvider()->query->addSelect(array_filter(['last_seen', 'contacts_count', Yii::getAlias('@domain', false) ? 'domains_count' : null, Yii::getAlias('@ticket', false) ? 'tickets_count' : null, Yii::getAlias('@server', false) ? 'servers_count' : null, Yii::getAlias('@hosting', false) ? 'hosting_count' : null]))->joinWith('contact')->joinWith(['purses' => function ($query) {
             $query->joinWith('contact')->joinWith('requisite')->joinWith('files');
         }]);
     }], 'validate-form' => ['class' => ValidateFormAction::class], 'set-credit' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Credit changed')], 'set-note' => ['class' => SmartUpdateAction::class, 'success' => Yii::t('hipanel:client', 'Note changed'), 'error' => Yii::t('hipanel:client', 'Failed to change note')], 'bulk-enable-block' => ['class' => SmartUpdateAction::class, 'scenario' => 'enable-block', 'success' => Yii::t('hipanel:client', 'Clients were blocked successfully'), 'error' => Yii::t('hipanel:client', 'Error during the clients blocking'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class]], 'on beforeSave' => function (Event $event) {
         /** @var \hipanel\actions\Action $action */
         $action = $event->sender;
         $type = Yii::$app->request->post('type');
         $comment = Yii::$app->request->post('comment');
         if (!empty($type)) {
             foreach ($action->collection->models as $model) {
                 $model->setAttributes(['type' => $type, 'comment' => $comment]);
             }
         }
     }], 'bulk-enable-block-modal' => ['class' => PrepareBulkAction::class, 'scenario' => 'enable-block', 'view' => '_bulkEnableBlock', 'data' => function ($action, $data) {
         return array_merge($data, ['blockReasons' => $this->getBlockReasons()]);
     }], 'bulk-disable-block' => ['class' => SmartUpdateAction::class, 'scenario' => 'disable-block', 'success' => Yii::t('hipanel:client', 'Clients were unblocked successfully'), 'error' => Yii::t('hipanel:client', 'Error during the clients unblocking'), 'POST html' => ['save' => true, 'success' => ['class' => RedirectAction::class]], 'on beforeSave' => function (Event $event) {
         /** @var \hipanel\actions\Action $action */
         $action = $event->sender;
         $comment = Yii::$app->request->post('comment');
         if (!empty($type)) {
             foreach ($action->collection->models as $model) {
                 $model->setAttribute('comment', $comment);
             }
         }
     }], 'bulk-disable-block-modal' => ['class' => PrepareBulkAction::class, 'scenario' => 'disable-block', 'view' => '_bulkDisableBlock'], 'ip-restrictions' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,access', 'view' => '_ipRestrictionsModal'], 'domain-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,domain_defaults', 'view' => '_domainSettingsModal', 'on beforePerform' => function (Event $event) {
         $action = $event->sender;
         foreach (['registrant', 'admin', 'billing', 'tech'] as $key) {
             if (!$action->model->{$key}) {
                 unset($action->model->{$key});
             }
         }
     }], 'mailing-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,mailing', 'view' => '_mailingSettingsModal'], 'ticket-settings' => ['class' => ClassValuesAction::class, 'valuesClass' => 'client,ticket_settings', 'view' => '_ticketSettingsModal'], 'pincode-settings' => ['class' => SmartUpdateAction::class, 'view' => '_pincodeSettingsModal', 'on beforeFetch' => function ($event) {
         /** @var \hipanel\actions\SearchAction $action */
         $action = $event->sender;
         $dataProvider = $action->getDataProvider();
         $dataProvider->query->addSelect('pincode_enabled');
     }, 'data' => function ($action, $data) {
         $apiData = $this->getRefs('type,question', 'hipanel:client');
         $questionList = array_merge(Client::makeTranslateQuestionList($apiData), ['own' => Yii::t('hipanel:client', 'Own question')]);
         return array_merge(['questionList' => $questionList], $data);
     }]];
 }
 public static function defaultColumns()
 {
     $typeOptions = self::$typeOptions;
     return ['name' => ['class' => MainColumn::class, 'filterAttribute' => 'name_like', 'format' => 'html', 'value' => function ($model) {
         return Html::a($model->name, ['@' . $model->object . '/view', 'id' => $model->id], ['class' => 'bold']);
     }], 'main' => ['attribute' => 'name', 'filterAttribute' => 'name_like', 'format' => 'raw', 'value' => function ($model) {
         return Html::a($model->name, ['@backuping/view', 'id' => $model->id], ['class' => 'bold']) . ' ' . Html::a(ObjectLabelWidget::widget(compact('model')), ['@' . $model->object . '/view', 'id' => $model->id]);
     }], 'account' => ['attribute' => 'account_id', 'class' => AccountColumn::class], 'server' => ['attribute' => 'server_id', 'class' => ServerColumn::class], 'object' => ['filter' => false, 'format' => 'raw', 'value' => function ($model) {
         return ObjectLabelWidget::widget(compact('model'));
     }], 'backup_count' => ['filter' => false], 'type' => ['attribute' => 'type', 'format' => 'raw', 'filter' => false, 'enableSorting' => false, 'value' => function ($model) use($typeOptions) {
         return XEditable::widget(['model' => $model, 'attribute' => 'type', 'pluginOptions' => ['type' => 'select', 'source' => $typeOptions, 'url' => Url::to('update')]]);
     }], 'state_label' => ['filter' => false, 'enableSorting' => false], 'backup_last' => ['filter' => false, 'format' => 'raw', 'value' => function ($model) {
         return Html::tag('nobr', Yii::$app->formatter->asDate($model->backup_last)) . ' ' . Html::tag('nobr', Yii::$app->formatter->asTime($model->backup_last));
     }], 'total_du' => ['filter' => false, 'format' => 'html', 'value' => function ($model) {
         return Yii::$app->formatter->asShortSize($model->total_du, 2);
     }]];
 }
 public static function defaultColumns()
 {
     return ['hdomain' => ['class' => MainColumn::class, 'filterAttribute' => 'domain_like', 'attribute' => 'domain'], 'hdomain_with_aliases' => ['format' => 'raw', 'attribute' => 'domain', 'filterAttribute' => 'domain_like', 'value' => function ($model) {
         $aliases = (array) $model->getAttribute('aliases');
         $html = Html::a($model->domain, ['view', 'id' => $model->id], ['class' => 'bold']) . '&nbsp;';
         $html .= ArraySpoiler::widget(['data' => $aliases, 'visibleCount' => 0, 'delimiter' => '<br />', 'button' => ['label' => Yii::t('hipanel', '+{0, plural, one{# alias} other{# aliases}}', count($aliases)), 'class' => 'badge progress-bar-info', 'popoverOptions' => ['html' => true]], 'formatter' => function ($value, $key) {
             return Html::a($value, ['view', 'id' => $key]);
         }]);
         return $html;
     }], 'account' => ['class' => AccountColumn::class], 'server' => ['class' => ServerColumn::class], 'ip' => ['enableSorting' => false, 'filter' => false, 'format' => 'raw', 'value' => function ($model) {
         $vhost = $model->getAttribute('vhost');
         $html = $vhost['ip'];
         if (isset($vhost['port']) && $vhost['port'] !== 80) {
             $html .= ':' . $vhost['port'];
         }
         if ($model->isProxied) {
             $backend = $vhost['backend'];
             $html .= ' ' . Html::tag('i', '', ['class' => 'fa fa-long-arrow-right']) . ' ' . $backend['ip'];
             if ($backend['port'] !== 80) {
                 $html .= ':' . $backend['port'];
             }
         }
         return $html;
     }], 'service' => ['label' => Yii::t('hipanel', 'Service'), 'value' => function ($model) {
         return $model->getAttribute('vhost')['service'];
     }], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:hosting', 'format' => 'raw', 'value' => function ($model) {
         $html = '';
         if ($model->dns_on && empty($model->dns_hdomain_id)) {
             $html .= Label::widget(['color' => 'success', 'label' => Yii::t('hipanel', 'DNS'), 'tag' => 'span', 'labelOptions' => ['title' => Yii::t('hipanel:hosting', 'DNS is enabled')]]);
         }
         $html .= ' ' . State::widget(compact('model'));
         return $html;
     }, 'gtype' => 'state,hdomain'], 'dns_on' => ['format' => 'raw', 'value' => function ($model) {
         return $model->dns_on ? Yii::t('hipanel', 'Enabled') : Yii::t('hipanel', 'Disabled');
     }], 'dns_switch' => ['attribute' => 'dns_on', 'label' => Yii::t('hipanel:hosting', 'DNS'), 'format' => 'raw', 'value' => function ($model) {
         if (empty($model->dns_hdomain_id)) {
             return XEditable::widget(['model' => $model, 'attribute' => 'dns_on', 'pluginOptions' => ['type' => 'select', 'title' => Yii::t('hipanel:hosting', 'Toggles DNS records upload on NS server'), 'source' => ['' => Yii::t('hipanel', 'Disabled'), '1' => Yii::t('hipanel', 'Enabled')], 'url' => Url::to('set-dns-on'), 'placement' => 'bottom'], 'linkOptions' => ['style' => ['word-break' => 'break-all']]]);
         } else {
             return Yii::t('hipanel:hosting', 'Belongs to {link}', ['link' => Html::a($model->dns_hdomain_domain, Url::to(['@hdomain/view', 'id' => $model->dns_hdomain_id]))]);
         }
     }], 'aliases' => ['label' => Yii::t('hipanel', 'Aliases'), 'format' => 'raw', 'value' => function ($model) {
         return ArraySpoiler::widget(['data' => (array) $model->getAttribute('aliases'), 'delimiter' => '<br />', 'button' => ['popoverOptions' => ['html' => true]]]);
     }], 'backups_widget' => ['label' => Yii::t('hipanel:hosting', 'Backups'), 'format' => 'raw', 'value' => function ($model) {
         return BackupGridRow::widget(['model' => $model]);
     }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {delete}']];
 }
 public static function defaultColumns()
 {
     $osImages = self::$osImages;
     return ['server' => ['class' => MainColumn::class, 'attribute' => 'name', 'filterAttribute' => 'name_like', 'note' => Yii::$app->user->can('support') ? 'label' : 'note', 'noteOptions' => ['url' => Yii::$app->user->can('support') ? Url::to('set-label') : Url::to('set-note')], 'badges' => function ($model) {
         $badges = '';
         if (Yii::$app->user->can('support')) {
             if ($model->wizzarded) {
                 $badges .= Label::widget(['label' => 'W', 'tag' => 'sup', 'color' => 'success']);
             }
             /*if ($model->state === 'disabled') {
                   $badges .= ' ' . Label::widget(['label' => 'Panel OFF', 'tag' => 'sup', 'color' => 'danger', 'type' => 'text']);
               }*/
         }
         return $badges;
     }], 'dc' => ['attribute' => 'dc', 'filter' => false], 'state' => ['class' => RefColumn::class, 'i18nDictionary' => 'hipanel:server', 'format' => 'raw', 'gtype' => 'state,device', 'value' => function ($model) {
         $html = State::widget(compact('model'));
         if ($model->status_time) {
             $html .= ' ' . Html::tag('nobr', Yii::t('hipanel:server', 'since {date}', ['date' => Yii::$app->formatter->asDate($model->status_time)]));
         }
         return $html;
     }], 'panel' => ['attribute' => 'panel', 'format' => 'text', 'contentOptions' => ['class' => 'text-uppercase'], 'value' => function ($model) {
         return $model->panel ? Yii::t('hipanel:server:panel', $model->panel) : Yii::t('hipanel:server:panel', 'No control panel');
     }], 'os' => ['attribute' => 'os', 'format' => 'raw', 'value' => function ($model) use($osImages) {
         return OSFormatter::widget(['osimages' => $osImages, 'imageName' => $model->osimage]);
     }], 'os_and_panel' => ['attribute' => 'os', 'format' => 'raw', 'value' => function ($model) use($osImages) {
         $html = OSFormatter::widget(['osimages' => $osImages, 'imageName' => $model->osimage]);
         $html .= ' ' . $model->panel ?: '';
         return $html;
     }], 'discount' => ['attribute' => 'discount', 'label' => Yii::t('hipanel:server', 'Discount'), 'format' => 'raw', 'headerOptions' => ['style' => 'width: 1em'], 'value' => function ($model) {
         return DiscountFormatter::widget(['current' => $model->discounts['fee']['current'], 'next' => $model->discounts['fee']['next']]);
     }], 'expires' => ['filter' => false, 'format' => 'raw', 'headerOptions' => ['style' => 'width: 1em'], 'value' => function ($model) {
         return Expires::widget(compact('model'));
     }], 'tariff' => ['format' => 'raw', 'filterAttribute' => 'tariff_like', 'value' => function ($model) {
         return self::formatTariff($model);
     }], 'tariff_and_discount' => ['attribute' => 'tariff', 'filterAttribute' => 'tariff_like', 'format' => 'raw', 'value' => function ($model) {
         return self::formatTariff($model) . ' ' . DiscountFormatter::widget(['current' => $model->discounts['fee']['current'], 'next' => $model->discounts['fee']['next']]);
     }], 'ip' => ['filter' => false], 'mac' => ['filter' => false], 'ips' => ['format' => 'raw', 'attribute' => 'ips', 'filter' => false, 'value' => function ($model) {
         return ArraySpoiler::widget(['data' => ArrayHelper::getColumn($model->ips, 'ip'), 'delimiter' => '<br />', 'visibleCount' => 3, 'button' => ['popoverOptions' => ['html' => true]]]);
     }], 'sale_time' => ['attribute' => 'sale_time', 'format' => 'datetime'], 'note' => ['class' => XEditableColumn::class, 'pluginOptions' => ['url' => Url::to('set-note')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']]], 'label' => ['class' => XEditableColumn::class, 'visible' => Yii::$app->user->can('support'), 'pluginOptions' => ['url' => Url::to('set-label')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']]], 'type' => ['format' => 'html', 'filter' => false, 'value' => function ($model) {
         return $model->type_label;
     }], 'rack' => ['format' => 'html', 'filter' => false, 'value' => function ($model) {
         return $model->switches['rack']['switch'];
     }], 'net' => ['format' => 'html', 'filter' => false, 'value' => function ($model) {
         return static::renderSwitchPort($model->switches['net']);
     }], 'kvm' => ['format' => 'html', 'filter' => false, 'value' => function ($model) {
         return static::renderSwitchPort($model->switches['kvm']);
     }], 'pdu' => ['format' => 'html', 'filter' => false, 'value' => function ($model) {
         return static::renderSwitchPort($model->switches['pdu']);
     }], 'ipmi' => ['format' => 'raw', 'filter' => false, 'value' => function ($model) {
         $ipmi = $model->switches['ipmi']['device_ip'];
         $link = $ipmi ? Html::a($ipmi, "http://{$ipmi}/", ['target' => '_blank']) . ' ' : '';
         return $link . static::renderSwitchPort($model->switches['ipmi']);
     }], 'nums' => ['label' => '', 'format' => 'raw', 'value' => function ($model) {
         $ips_num = $model->ips_num;
         $ips = $ips_num ? Html::a("{$ips_num} ips", IpController::getSearchUrl(['server' => $model->name])) : 'no ips';
         $act_acs_num = $model->acs_num - $model->del_acs_num;
         $del_acs_num = $model->del_acs_num;
         $acs_num = $act_acs_num . ($del_acs_num ? "+{$del_acs_num}" : '');
         $acs = $acs_num ? Html::a("{$acs_num} acc", AccountController::getSearchUrl(['server' => $model->name])) : 'no acc';
         return Html::tag('nobr', $ips) . ' ' . Html::tag('nobr', $acs);
     }], 'actions' => ['class' => ActionColumn::class, 'template' => '{view} {rrd} {switch-graph}', 'buttons' => ['switch-graph' => function ($url, $model) {
         return Html::a('<i class="fa fa-fw fa-area-chart"></i>' . Yii::t('hipanel:server', 'Switch graphs'), ['@switch-graph/view', 'id' => $model->id]);
     }, 'rrd' => function ($url, $model) {
         return Html::a('<i class="fa fa-fw fa-signal"></i>' . Yii::t('hipanel:server', 'Resources usage graphs'), ['@rrd/view', 'id' => $model->id]);
     }]]];
 }
?>
    <?php 
if ($model->isRelationPopulated('answers')) {
    ?>
        <hr class="no-panel-padding-h panel-wide padding-bottom">
        <div class="widget-article-comments tab-pane panel no-padding no-border fade in active">
            <?php 
    echo $this->render('_comments', ['model' => $model, 'client' => $client]);
    ?>
        </div>
        <?php 
    if ($model->isRelationPopulated('answers')) {
        ?>
            <hr class="no-panel-padding-h panel-wide padding-bottom md-mb-0">
            <?php 
        echo Html::button(Yii::t('hipanel:ticket', 'Answer'), ['class' => 'message-block-move-btn btn btn-default']);
        ?>
        <?php 
    }
    ?>
    <?php 
}
?>

    <?php 
$actionUrl = Json::encode(Url::to(['update-answer-modal']));
echo AjaxModal::widget(['id' => 'update-answer-modal', 'header' => Html::tag('h4', Yii::t('hipanel:ticket', 'Message editing'), ['class' => 'modal-title']), 'scenario' => 'update-answer', 'actionUrl' => ['update-answer-modal'], 'size' => Modal::SIZE_LARGE, 'toggleButton' => false, 'clientEvents' => ['show.bs.modal' => new JsExpression("function(e) {\n                var button = e.relatedTarget;\n                var id = \$(button).attr('data-thread-id');\n                var answer_id = \$(button).attr('data-answer-id');\n                \$.ajax({\n                    url: {$actionUrl},\n                    data: {id: id, answer_id: answer_id},\n                    success: function (data) {\n                        \$('#update-answer-modal .modal-body').html(data);\n                    }\n                });\n            }")]]);
?>

<?php 
$box->end();
示例#9
0
use hipanel\helpers\Url;
use hipanel\modules\stock\widgets\combo\DestinationCombo;
use hipanel\modules\stock\widgets\combo\PartnoCombo;
use hipanel\modules\stock\widgets\combo\SourceCombo;
use hipanel\widgets\Box;
use hipanel\widgets\DynamicFormWidget;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
$this->title = Yii::t('hipanel:stock', 'Replace');
$this->params['breadcrumbs'][] = ['label' => Yii::t('hipanel:stock', 'Parts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>

<?php 
$form = ActiveForm::begin(['id' => 'repair-form', 'enableClientValidation' => true, 'validateOnBlur' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => reset($models)->scenario])]);
?>

<?php 
DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper', 'widgetBody' => '.container-items', 'widgetItem' => '.item', 'limit' => count($models), 'min' => count($models), 'insertButton' => '.add-item', 'deleteButton' => '.remove-item', 'model' => reset($models), 'formId' => 'dynamic-form', 'formFields' => ['partno', 'src_id', 'dst_id', 'serials', 'move_type', 'supplier', 'order_no', 'move_descr']]);
?>
<div class="container-items">
    <?php 
foreach ($models as $i => $model) {
    ?>
        <?php 
    echo Html::activeHiddenInput($model, "[{$i}]id");
    ?>
        <div class="item">
            <?php 
    Box::begin();
 public static function resolveConfig()
 {
     return Yii::$app->user->can('manage') ? ['class' => XEditableColumn::class, 'filter' => false, 'contentOptions' => ['class' => 'text-right'], 'widgetOptions' => ['class' => RemoteFormatXEditable::class, 'linkOptions' => ['data-currency' => 'usd']], 'pluginOptions' => ['url' => '@client/set-credit', 'title' => Yii::t('hipanel:finance', 'Set credit'), 'ajaxUrl' => Url::to('/format/currency'), 'data-display-value' => function ($column, $options) {
         return Yii::$app->formatter->format(array_shift($column->pluginOptions['value']), ['currency', 'USD']);
     }, 'ajaxDataOptions' => ['currency' => 'currency']]] : ['class' => CurrencyColumn::class, 'contentOptions' => ['class' => 'text-right']];
 }
 public static function defaultColumns()
 {
     return ['id' => ['class' => ClientColumn::class, 'attribute' => 'id', 'nameAttribute' => 'login', 'label' => Yii::t('hipanel', 'Client')], 'login' => ['class' => MainColumn::class, 'attribute' => 'login', 'filterAttribute' => 'login_like', 'format' => 'raw', 'note' => Yii::$app->user->can('manage') ? 'note' : null, 'noteOptions' => ['url' => Url::to('set-note')]], 'note' => ['class' => XEditableColumn::class, 'pluginOptions' => ['url' => Url::to('set-note')], 'widgetOptions' => ['linkOptions' => ['data-type' => 'textarea']], 'visible' => Yii::$app->user->can('manage')], 'name' => ['filterAttribute' => 'name_like'], 'state' => ['class' => RefColumn::class, 'filterAttribute' => 'states', 'format' => 'raw', 'gtype' => 'state,client', 'i18nDictionary' => 'hipanel:client', 'value' => function ($model) {
         return ClientState::widget(compact('model'));
     }], 'type' => ['class' => RefColumn::class, 'filterAttribute' => 'types', 'format' => 'raw', 'gtype' => 'type,client', 'i18nDictionary' => 'hipanel:client', 'value' => function ($model) {
         return ClientType::widget(compact('model'));
     }], 'balance' => ['class' => BalanceColumn::class], 'credit' => CreditColumn::resolveConfig(), 'country' => ['attribute' => 'contact', 'label' => Yii::t('hipanel:client', 'Country'), 'format' => 'html', 'value' => function ($model) {
         return Html::tag('span', '', ['class' => 'flag-icon flag-icon-' . $model->contact['country']]) . '&nbsp;&nbsp;' . $model->contact['country_name'];
     }], 'create_date' => ['attribute' => 'create_time', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap']], 'create_time' => ['attribute' => 'create_time', 'format' => 'datetime', 'filter' => false], 'update_date' => ['attribute' => 'update_time', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap']], 'update_time' => ['attribute' => 'update_time', 'format' => 'datetime', 'filter' => false], 'last_seen' => ['attribute' => 'last_seen', 'format' => 'date', 'filter' => false, 'contentOptions' => ['class' => 'text-nowrap'], 'value' => ''], 'tickets' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Tickets'), 'value' => function ($model) {
         $num = $model->count['tickets'];
         $url = Url::toSearch('ticket', ['client_id' => $model->id]);
         return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# ticket} other{# tickets}}', $num), $url) : '';
     }], 'servers' => ['format' => 'raw', 'visible' => Yii::getAlias('@server', false) !== false, 'label' => Yii::t('hipanel', 'Servers'), 'value' => function ($model) {
         /** @var Client $model */
         $num = $model->count['servers'];
         $url = Url::toSearch('server', ['client_id' => $model->id]);
         return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# server} other{# servers}}', $num), $url) : '';
     }], 'domains' => ['format' => 'html', 'visible' => Yii::getAlias('@domain', false) !== false, 'label' => Yii::t('hipanel', 'Domains'), 'value' => function ($model) {
         /** @var Client $model */
         $num = $model->count['domains'];
         $url = Url::toSearch('domain', ['client_id' => $model->id]);
         return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# domain} other{# domains}}', $num), $url) : '';
     }], 'domains_spoiler' => ['format' => 'raw', 'visible' => Yii::getAlias('@domain', false) !== false, 'label' => Yii::t('hipanel', 'Domains'), 'value' => function ($model) {
         /** @var Client $model */
         return ArraySpoiler::widget(['data' => $model->domains, 'visibleCount' => 1, 'button' => ['label' => '+' . ($model->count['domains'] - 1), 'popoverOptions' => ['html' => true]], 'formatter' => function ($item, $key) use($model) {
             static $index = 0;
             ++$index;
             $value = Html::a($item->domain, ['@domain/view', 'id' => $item->id]);
             if ($model->count['domains'] > count($model->domains) && $index === count($model->domains)) {
                 $text = Yii::t('hipanel:client', 'and {n} more', ['n' => $model->count['domains'] - count($model->domains)]);
                 $value .= ' ' . Html::a($text, Url::toSearch('domain', ['client_id' => $model->id]), ['class' => 'border-bottom-dashed']);
             }
             return $value;
         }]);
     }], 'servers_spoiler' => ['format' => 'raw', 'label' => Yii::t('hipanel', 'Servers'), 'value' => function ($model) {
         return ArraySpoiler::widget(['data' => $model->servers, 'visibleCount' => 1, 'button' => ['label' => '+' . ($model->count['servers'] - 1), 'popoverOptions' => ['html' => true]], 'formatter' => function ($item, $key) use($model) {
             static $index;
             ++$index;
             $value = Html::a($item->name, ['@server/view', 'id' => $item->id]);
             if ($model->count['servers'] > count($model->servers) && $index === count($model->servers)) {
                 $text = Yii::t('hipanel:client', 'and {n} more', ['n' => $model->count['servers'] - count($model->servers)]);
                 $value .= ' ' . Html::a($text, Url::toSearch('server', ['client_id' => $model->id]), ['class' => 'border-bottom-dashed']);
             }
             return $value;
         }]);
     }], 'contacts' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Contacts'), 'value' => function ($model) {
         $num = $model->count['contacts'];
         $url = Url::toSearch('contact', ['client_id' => $model->id]);
         return $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# contact} other{# contacts}}', $num), $url) : '';
     }], 'hosting' => ['format' => 'html', 'label' => Yii::t('hipanel', 'Hosting'), 'value' => function ($model) {
         $res = '';
         $num = $model->count['accounts'];
         $url = Url::toSearch('account', ['client_id' => $model->id]);
         $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# account} other{# accounts}}', $num), $url) : '';
         $num = $model->count['hdomains'];
         $url = Url::toSearch('hdomain', ['client_id' => $model->id]);
         $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# domain} other{# domains}}', $num), $url) : '';
         $num = $model->count['dbs'];
         $url = Url::toSearch('db', ['client_id' => $model->id]);
         $res .= $num ? Html::a(Yii::t('hipanel', '{0, plural, one{# database} other{# databases}}', $num), $url) : '';
         return $res;
     }], 'actions' => ['class' => MenuColumn::class, 'menuClass' => ClientActionsMenu::class]];
 }
示例#12
0
<?php

use hipanel\helpers\Url;
use hipanel\modules\client\models\Client;
use hipanel\modules\client\widgets\combo\SellerCombo;
use hipanel\widgets\PasswordInput;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
$form = ActiveForm::begin(['id' => 'client-form', 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => $model->isNewRecord ? 'create' : 'update'])]);
?>

<?php 
echo $form->field($model, '[0]login')->textInput(['autocomplete' => 'off']);
echo $form->field($model, '[0]email')->textInput(['autocomplete' => 'off']);
echo $form->field($model, '[0]password')->widget(PasswordInput::class);
echo $form->field($model, '[0]type')->dropDownList(Client::getTypeOptions());
echo $form->field($model, '[0]seller_id')->widget(SellerCombo::class);
?>

<?php 
echo Html::submitButton(Yii::t('hipanel', 'Save'), ['class' => 'btn btn-success']);
?>
    &nbsp;
<?php 
echo Html::button(Yii::t('hipanel', 'Cancel'), ['class' => 'btn btn-default', 'onclick' => 'history.go(-1)']);
$form->end();
示例#13
0
$page->beginContent('bulk-actions');
?>
        <div class="dropdown" style="display: inline-block">
            <button type="button" class="btn btn-default dropdown-toggle btn-sm" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <?php 
echo Yii::t('hipanel:stock', 'Bulk actions');
?>
&nbsp;
                <span class="caret"></span>
            </button>
            <?php 
echo Dropdown::widget(['encodeLabels' => false, 'items' => [['label' => Yii::t('hipanel:stock', 'Repair'), 'url' => '#', 'linkOptions' => ['data-action' => 'repair']], ['label' => Yii::t('hipanel:stock', 'Copy'), 'url' => '#', 'linkOptions' => ['data-action' => 'copy']], ['label' => Yii::t('hipanel:stock', 'Replace'), 'url' => '#', 'linkOptions' => ['data-action' => 'replace']], ['label' => Yii::t('hipanel:stock', 'Reserve'), 'url' => '#', 'linkOptions' => ['data-action' => 'reserve']], ['label' => Yii::t('hipanel:stock', 'Unreserve'), 'url' => '#', 'linkOptions' => ['data-action' => 'unreserve']], ['label' => Yii::t('hipanel:stock', 'RMA'), 'url' => '#', 'linkOptions' => ['data-action' => 'rma']], '<li role="presentation" class="divider"></li>', ['label' => Yii::t('hipanel:stock', 'Update'), 'url' => '#', 'linkOptions' => ['data-action' => 'update']], ['label' => Yii::t('hipanel:stock', 'Move'), 'url' => '#', 'linkOptions' => ['data-action' => 'move']], ['label' => Yii::t('hipanel:stock', 'Move by one'), 'url' => '#', 'linkOptions' => ['data-action' => 'move-by-one']]]]);
?>
        </div>
        <?php 
echo AjaxModal::widget(['bulkPage' => true, 'id' => 'set-serial-modal', 'scenario' => 'set-serial', 'actionUrl' => ['bulk-set-serial'], 'handleSubmit' => Url::toRoute('set-serial'), 'size' => Modal::SIZE_LARGE, 'header' => Html::tag('h4', Yii::t('hipanel:stock', 'Set serial'), ['class' => 'modal-title']), 'toggleButton' => ['label' => Yii::t('hipanel:stock', 'Set serial'), 'class' => 'btn btn-default btn-sm']]);
?>
        <?php 
echo AjaxModal::widget(['bulkPage' => true, 'id' => 'bulk-set-price-modal', 'scenario' => 'bulk-set-price', 'actionUrl' => ['bulk-set-price'], 'size' => Modal::SIZE_LARGE, 'header' => Html::tag('h4', Yii::t('hipanel:stock', 'Set price'), ['class' => 'modal-title']), 'toggleButton' => ['label' => Yii::t('hipanel:stock', 'Set price'), 'class' => 'btn btn-default btn-sm']]);
?>
        <?php 
echo $page->renderBulkButton(Yii::t('hipanel:stock', 'Trash'), 'trash', 'danger');
?>
    <?php 
$page->endContent();
?>

    <?php 
$page->beginContent('table');
?>
        <?php 
<?php

use hipanel\helpers\Url;
use hipanel\modules\client\widgets\combo\ContactCombo;
use hipanel\modules\domain\models\Domain;
use hipanel\widgets\ArraySpoiler;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
$unchangeableZones = [];
$form = ActiveForm::begin(['id' => 'bulk-set-contact-form', 'action' => Url::toRoute('bulk-set-contacts'), 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-set-contacts-form', 'scenario' => 'bulk-set-contacts'])]);
?>


<div class="panel panel-default">
    <div class="panel-heading"><?php 
echo Yii::t('hipanel:domain', 'Affected domains');
?>
</div>
    <div class="panel-body">
        <?php 
echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) use(&$unchangeableZones) {
    if (!$model->isContactChangeable()) {
        $unchangeableZones[] = $model->domain;
    }
    return $model->domain;
}, 'delimiter' => ',&nbsp; ']);
?>
    </div>
</div>

<?php 
<?php

use hipanel\helpers\Url;
use hipanel\widgets\ArraySpoiler;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
?>

<?php 
$form = ActiveForm::begin(['id' => 'bulk-set-ips', 'action' => Url::toRoute('update'), 'validateOnBlur' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'update'])]);
?>

<div>

    <!-- Nav tabs -->
    <ul class="nav nav-tabs" role="tablist">
        <li role="presentation" class="active"><a href="#bulk" aria-controls="home" role="tab" data-toggle="tab"><?php 
echo Yii::t('hipanel', 'Set for all');
?>
</a></li>
        <li role="presentation"><a href="#by-one" aria-controls="profile" role="tab" data-toggle="tab"><?php 
echo Yii::t('hipanel', 'Set by one');
?>
</a></li>
    </ul>

    <!-- Tab panes -->
    <div class="tab-content">
        <div role="tabpanel" class="tab-pane active" id="bulk">
            <div class="row" style="margin-top: 15pt;">
                <div class="col-md-12">
示例#16
0
<?php

use hipanel\helpers\Url;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
?>

<?php 
$form = ActiveForm::begin(['id' => 'set-serial-form', 'action' => Url::toRoute('set-serial'), 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'set-serial'])]);
?>

<?php 
foreach ($models as $model) {
    ?>
    <?php 
    echo Html::activeHiddenInput($model, "[{$model->id}]id");
    ?>
    <div class="row">
        <div class="col-md-6">
            <?php 
    echo $form->field($model, "[{$model->id}]partno")->textInput(['disabled' => true]);
    ?>
        </div>
        <div class="col-md-6">
            <?php 
    echo $form->field($model, "[{$model->id}]serial");
    ?>
        </div>
    </div>
<?php 
}
示例#17
0
<?php

use hipanel\helpers\Url;
use hipanel\widgets\ArraySpoiler;
use hipanel\widgets\AmountWithCurrency;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
?>

<?php 
$form = ActiveForm::begin(['id' => 'set-price-form', 'action' => Url::toRoute('set-price'), 'validateOnBlur' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'set-price'])]);
?>

<div class="panel panel-default">
    <div class="panel-heading"><?php 
echo Yii::t('hipanel:stock', 'Set price');
?>
</div>
    <div class="panel-body">
        <?php 
echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) {
    return $model->partno . sprintf(' (%s)', $model->serial);
}, 'delimiter' => ',&nbsp; ']);
?>
    </div>
</div>

<?php 
foreach ($models as $model) {
    ?>
    <?php 
示例#18
0
<?php

use hipanel\helpers\Url;
use hipanel\modules\dns\models\Record;
use hipanel\widgets\ModalButton;
use yii\bootstrap\ActiveForm;
use yii\bootstrap\Html;
use yii\web\View;
/*
 * @var $model Record
 * @var $this View
 */
?>

<?php 
$form = ActiveForm::begin(['id' => 'dynamic-form-' . ($model->id ?: time()), 'action' => '@dns/record/' . $model->scenario, 'enableAjaxValidation' => true, 'options' => ['data-pjax' => true, 'data-pjaxPush' => false], 'validationUrl' => Url::toRoute(['@dns/record/validate-form', 'scenario' => $model->isNewRecord ? $model->scenario : 'update'])]);
?>
    <div class="panel panel-default">
        <div class="panel-body">

            <div class="row record-item">
                <?php 
if ($id = $model->id) {
    echo Html::activeHiddenInput($model, "[{$id}]id");
} else {
    $id = 0;
}
echo Html::activeHiddenInput($model, "[{$id}]hdomain_id");
?>
                <div class="col-lg-3 col-md-4">
                    <?php 
示例#19
0
            anchorItem.find('.l-box').append(loadingHtml);
            anchorItem.find( ".my-dynamic-content" ).load( '{$dynamicUrl}', {'subFormName': subFornName, 'itemNumber': itemNumber}, function (response, status, xhr) {
                anchorItem.find('.overlay').remove();
                if ( status == "error" ) {
                    var msg = "Sorry but there was an error";
                    console.log(msg);
                }
            });
        });
JS
, View::POS_READY);
}
?>

<?php 
$form = ActiveForm::begin(['id' => 'dynamic-form', 'enableClientValidation' => true, 'validateOnBlur' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => reset($models)->isNewRecord ? 'create' : 'update'])]);
?>

<?php 
DynamicFormWidget::begin(['widgetContainer' => 'dynamicform_wrapper', 'widgetBody' => '.container-items', 'widgetItem' => '.item', 'limit' => 99, 'min' => 1, 'insertButton' => '.add-item', 'deleteButton' => '.remove-item', 'model' => reset($models), 'formId' => 'dynamic-form', 'formFields' => ['type', 'brand', 'profile', 'model', 'partno', 'short', 'descr', 'url']]);
?>
<div class="container-items"><!-- widgetContainer -->
    <?php 
foreach ($models as $i => $model) {
    ?>
        <div class="item">
            <?php 
    Box::begin(['options' => ['class' => 'l-box']]);
    ?>
            <div class="row">
                <div class="col-lg-offset-10 col-md-offset-10 col-sm-offset-10 col-xs-offset-6 col-sm-2 col-xs-6 text-right">
<?php

use hipanel\helpers\Url;
use hipanel\widgets\ArraySpoiler;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
$form = ActiveForm::begin(['id' => 'bulk-enable-block-form', 'action' => Url::toRoute('bulk-enable-block'), 'enableAjaxValidation' => false]);
?>

    <div class="panel panel-default">
        <div class="panel-heading"><?php 
echo Yii::t('hipanel:client', 'Affected clients');
?>
</div>
        <div class="panel-body">
            <?php 
echo ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) {
    return $model->login;
}, 'delimiter' => ',&nbsp; ']);
?>
        </div>
    </div>

<?php 
foreach ($models as $item) {
    ?>
    <?php 
    echo Html::activeHiddenInput($item, "[{$item->id}]id");
    ?>
    <?php 
    echo Html::activeHiddenInput($item, "[{$item->id}]login");
示例#21
0
use hipanel\helpers\Url;
use hipanel\modules\domain\models\Domain;
use hipanel\widgets\ArraySpoiler;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
/**
 * @var Domain $model
 * @var Domain[] $models
 * @var bool $hasPincode
 */
$unPushable = [];
?>

<?php 
$form = ActiveForm::begin(['id' => 'push-domain-form', 'action' => Url::toRoute('push'), 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-push-form', 'scenario' => $hasPincode ? 'push-with-pincode' : 'push'])]);
?>

<div class="alert alert-info alert-dismissible fade in" role="alert">
    <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span>
    </button>

    <h4><i class="fa fa-info-circle"></i>&nbsp;&nbsp;<?php 
echo Yii::t('hipanel', 'Notice');
?>
</h4>

    <p>
        <?php 
echo Yii::t('hipanel:domain', 'This operation pushes the domain to another user irrevocably. You can not bring it back.');
?>
示例#22
0
<?php

use hipanel\helpers\Url;
use hipanel\modules\stock\widgets\combo\DestinationCombo;
use hipanel\modules\stock\widgets\combo\SourceCombo;
use hipanel\widgets\ArraySpoiler;
use hipanel\widgets\Box;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
$scenario = $this->context->action->scenario;
$this->title = Yii::t('hipanel:stock', 'Bulk move');
$this->params['breadcrumbs'][] = ['label' => Yii::t('hipanel:stock', 'Parts'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
$form = ActiveForm::begin(['id' => 'dynamic-form', 'enableClientValidation' => true, 'validateOnBlur' => true, 'enableAjaxValidation' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'move'])]);
?>

<div class="container-items">
    <?php 
foreach ($models as $src_id => $group) {
    ?>
        <?php 
    Box::begin();
    ?>
        <?php 
    $model = reset($group);
    ?>
        <div class="row">
            <div class="col-lg-12">
                <div class="row">
                    <div class="col-lg-2">
                        <label><?php 
示例#23
0
/**
 * @var View
 */
use hipanel\helpers\Url;
use yii\web\View;
$this->title = Yii::t('merchant', 'Payment result');
?>
<h1 class="text-center">
    <i class="fa fa-refresh fa-spin"></i>
    <?php 
echo Yii::t('merchant', 'Waiting for confirmation from the payment system...');
?>
</h1>

<?php 
$options = \yii\helpers\Json::encode(['url' => Url::to('check-return'), 'data' => ['transactionId' => $transactionId]]);
$this->registerJs(<<<JS
    function checkPaymentStatus(options) {
        \$.ajax({
            type: 'get',
            dataType: 'json',
            url: options.url,
            data: options.data,
            success: function (result) {
                if (result.status !== null) {
                    window.location = result.url;
                } else {
                    setTimeout(function() {
                        checkPaymentStatus(options);
                    }, 1000);
                }
示例#24
0
</div>
                        <div class="panel-body">
                            <?php 
echo \hipanel\widgets\ArraySpoiler::widget(['data' => $models, 'visibleCount' => count($models), 'formatter' => function ($model) {
    return $model->domain;
}, 'delimiter' => ',&nbsp; ']);
?>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <div role="tabpanel" class="tab-pane" id="by-one">
            <?php 
$form = ActiveForm::begin(['id' => 'bulk-set-nss', 'action' => Url::toRoute('set-nss'), 'enableAjaxValidation' => true, 'validateOnBlur' => true, 'validationUrl' => Url::toRoute(['validate-form', 'scenario' => 'OLD-set-ns'])]);
?>
            <div class="row" style="margin-top: 15pt;">
                <?php 
foreach ($models as $model) {
    ?>
                    <div class="col-md-4 text-right" style="line-height: 34px;">
                        <?php 
    echo Html::activeHiddenInput($model, "[{$model->id}]id");
    ?>
                        <?php 
    echo $model->domain;
    ?>
                    </div>
                    <!-- /.col-md-6 -->
                    <div class="col-md-8">
                    <div class="alert alert-warning alert-dismissible fade in" role="alert">
                        <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                                aria-hidden="true">×</span></button>
                        <strong><?php 
    echo Yii::t('hipanel/domainchecker', 'There are no available domain zones');
    ?>
!</strong>
                    </div>
                <?php 
}
?>
                <div class="box box-solid">
                    <!-- /.box-header -->
                    <div class="box-body">
                        <?php 
$form = ActiveForm::begin(['id' => 'check-domain', 'action' => Url::to(['@domainchecker/check-domain']), 'method' => 'get', 'options' => ['data-pjax' => false], 'fieldConfig' => ['template' => "{beginWrapper}\n{input}\n{hint}\n{error}\n{endWrapper}"]]);
?>
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <?php 
echo $form->field($model, 'domain')->textInput(['placeholder' => Yii::t('hipanel/domainchecker', 'Domain name'), 'class' => 'form-control input-lg', 'name' => 'domain']);
?>
                                </div>
                            </div>
                            <!-- /.col-md-8 -->
                            <div class="col-md-4">
                                <div class="form-group">
                                    <?php 
echo $form->field($model, 'zone')->widget(StaticCombo::classname(), ['data' => $dropDownZonesOptions, 'hasId' => true, 'inputOptions' => ['value' => $model->zone !== null ? $model->zone : $model::DEFAULT_ZONE, 'class' => 'form-control input-lg', 'name' => 'zone']]);
?>
use hipanel\helpers\HtmlHelper;
use hipanel\helpers\Url;
use hipanel\widgets\Gravatar;
use yii\helpers\Html;
use yii\widgets\Pjax;
Pjax::begin(array_merge(Yii::$app->params['pjax'], ['id' => 'ticketSubscribeButton', 'enablePushState' => false, 'clientOptions' => ['type' => 'POST', 'data' => ["{$model->formName()}[id]" => $model->id]]]));
if (is_array($model->watchers)) {
    echo Html::tag('p', Yii::t('hipanel:ticket', 'Watchers'), ['class' => 'lead', 'style' => 'border-bottom: 1px solid #E1E1E1; margin-bottom: 0.5em;']);
    ?>
    <div class="margin-bottom">
        <?php 
    foreach ($model->watchers as $watcherId => $watcher) {
        $piece = explode(' ', $watcher);
        $watcherEmailHash = array_pop(explode(' ', $watcher));
        if ($watcherEmailHash) {
            echo Html::beginTag('a', ['href' => Url::toRoute(['@client/view', 'id' => $watcherId])]);
            echo Gravatar::widget(['emailHash' => $watcherEmailHash, 'options' => ['class' => 'img-circle', 'title' => reset($piece), 'alt' => reset($piece)], 'size' => 32]);
            echo Html::endTag('a');
        }
    }
    ?>
    </div>
<?php 
}
$subscribed = array_key_exists(Yii::$app->user->identity->id, $model->watchers ?: []);
if ($subscribed) {
    $action = ['unsubscribe', 'id' => $model->id];
    $label = '<i class="fa fa-eye-slash"></i>&nbsp;&nbsp;' . Yii::t('hipanel:ticket', 'Unsubscribe');
} else {
    $action = ['subscribe', 'id' => $model->id];
    $label = '<i class="fa fa-eye"></i>&nbsp;&nbsp;' . Yii::t('hipanel:ticket', 'Subscribe');