You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcp-panel/lib/NGCP/Panel/Widget/Plugin/AdminResellerOverview.pm

56 lines
1.3 KiB

package NGCP::Panel::Widget::Plugin::AdminResellerOverview;
use Moose::Role;
has 'template' => (
is => 'ro',
isa => 'Str',
default => 'widgets/admin_reseller_overview.tt'
);
has 'type' => (
is => 'ro',
isa => 'Str',
default => 'dashboard_widgets',
);
has 'priority' => (
is => 'ro',
isa => 'Int',
default => 10,
);
around handle => sub {
my ($foo, $self, $c) = @_;
$c->stash(
resellers => $c->model('DB')->resultset('resellers')->search_rs({
status => { '!=' => 'terminated' },
}),
domains => $c->model('DB')->resultset('domain_resellers')->search_rs({}),
customers => $c->model('DB')->resultset('contracts')->search_rs({
status => { '!=' => 'terminated' },
'product.class' => { 'not in' => [ 'reseller', 'sippeering', 'pstnpeering' ] },
}, {
join => { 'billing_mappings' => 'product' },
}),
subscribers => $c->model('DB')->resultset('voip_subscribers')->search_rs({
status => { '!=' => 'terminated' },
}),
);
return;
};
sub filter {
my ($self, $c, $type) = @_;
return $self if(
$type eq $self->type &&
$c->user->roles eq 'admin' &&
ref $c->controller eq 'NGCP::Panel::Controller::Dashboard'
);
return;
}
1;
# vim: set tabstop=4 expandtab: