% include( 'elements/browse.html',
'title' => 'Hardware Classes and Types',
'name' => 'hardware classes',
'menubar' => $menubar,
'query' => { 'table' => 'hardware_class' },
'count_query' => 'SELECT COUNT(*) FROM hardware_class',
'header' => [ '#', 'Hardware class', '', 'Device types' ],
'fields' => [ 'classnum',
'classname',
'',
$types_sub,
],
'links' => [ $class_link,
$class_link,
'',
'',
],
)
%>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
die "access denied"
unless $curuser->access_right('Configuration');
my $menubar =
[ 'Hardware statuses' => $p.'browse/hardware_status.html',
'Add a hardware class' => $p.'edit/hardware_class.html',
'Add a device type', => $p.'edit/hardware_type.html', ];
my $types_sub = sub {
my $hardware_class = shift;
my @rows = map {
my $type_link = $p.'edit/hardware_type.html?'.$_->typenum;
my $num_svcs = FS::svc_hardware->count("typenum = ".$_->typenum);
$num_svcs = $num_svcs > 0 ?
mt('[_1] [numerate,_1,service]',$num_svcs) : '';
my $search_link = $p.'search/svc_hardware.cgi?typenum='.$_->typenum;
[
{ 'data' => $_->model, 'link' => $type_link },
{ 'data' => $_->revision, 'link' => $type_link },
{ 'data' => $num_svcs, 'link' => $search_link, 'size' => -1 }
]
} $hardware_class->hardware_type;
\@rows;
};
my $class_link = [ "${p}edit/hardware_class.html?", 'classnum' ];
%init>