Skip to content

Commit

Permalink
Added link on server/index to navigate to parts/index
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverFire committed Mar 29, 2019
1 parent 4adc953 commit 678f4c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/messages/ru/hipanel:server.php
Expand Up @@ -307,4 +307,5 @@
'Block sending mail' => 'Блокировать отправку почты',
'Mail settings have been changed successfully' => 'Настройки почты были успешно изменены',
'Number of mailboxes' => 'Количество почтовых ящиков',
'View parts' => 'Смотреть детали',
];
16 changes: 16 additions & 0 deletions src/views/server/index.php
Expand Up @@ -12,6 +12,8 @@
use yii\bootstrap\Modal;
use yii\helpers\Html;
use hipanel\widgets\AjaxModalWithTemplatedButton;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;

/**
Expand Down Expand Up @@ -58,6 +60,20 @@
<?php $page->endContent() ?>

<?php $page->beginContent('bulk-actions') ?>
<?php if ($uiModel->representation === 'hardware'
&& Yii::getAlias('@part', false)
&& Yii::$app->user->can('part.read')
): ?>
<?php
$partsDetailsLink = Json::htmlEncode(Url::to(\hipanel\helpers\Url::toSearch('part')));
echo Html::button(Yii::t('hipanel:server', 'View parts'), [
'class' => 'btn btn-sm btn-default',
'onClick' => new JsExpression(<<<JS
const selection = jQuery('div[role="grid"]').yiiGridView('getSelectedRows');
window.location.href = $partsDetailsLink + '?' + jQuery.param({PartSearch: {dst_id_in: selection}});
JS
)]) ?>
<?php endif ?>
<?php if (Yii::$app->user->can('server.sell')): ?>
<?= AjaxModal::widget([
'id' => 'bulk-sale-modal',
Expand Down

0 comments on commit 678f4c5

Please sign in to comment.