parent
fe580d3c53
commit
dfb25d922c
@ -0,0 +1,27 @@
|
||||
package NGCP::Panel::Field::PbxGroup;
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'HTML::FormHandler::Field::Compound';
|
||||
|
||||
has_field 'id' => (
|
||||
type => '+NGCP::Panel::Field::DataTable',
|
||||
label => 'Group',
|
||||
do_label => 0,
|
||||
do_wrapper => 0,
|
||||
required => 1,
|
||||
template => 'helpers/datatables_field.tt',
|
||||
# this is set in the form:
|
||||
#ajax_src => '/',
|
||||
table_titles => ['#', 'Name', 'Extension'],
|
||||
table_fields => ['id', 'name', 'extension'],
|
||||
);
|
||||
|
||||
has_field 'create' => (
|
||||
type => 'Button',
|
||||
do_label => 0,
|
||||
value => 'Create Group',
|
||||
element_class => [qw/btn btn-tertiary pull-right/],
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,97 @@
|
||||
package NGCP::Panel::Form::Customer::PbxAdminSubscriber;
|
||||
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'NGCP::Panel::Form::Customer::PbxSubscriber';
|
||||
|
||||
has_field 'e164' => (
|
||||
type => 'Compound',
|
||||
order => 99,
|
||||
required => 0,
|
||||
label => 'E.164 Number',
|
||||
do_label => 1,
|
||||
do_wrapper => 1,
|
||||
);
|
||||
|
||||
has_field 'e164.cc' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
class => ['ngcp_e164_cc'],
|
||||
rel => ['tooltip'],
|
||||
title => ['Country Code, e.g. 1 for US or 43 for Austria']
|
||||
},
|
||||
do_label => 0,
|
||||
do_wrapper => 0,
|
||||
);
|
||||
|
||||
has_field 'e164.ac' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
class => ['ngcp_e164_ac'],
|
||||
rel => ['tooltip'],
|
||||
title => ['Area Code, e.g. 212 for NYC or 1 for Vienna']
|
||||
},
|
||||
do_label => 0,
|
||||
do_wrapper => 0,
|
||||
);
|
||||
|
||||
has_field 'e164.sn' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
class => ['ngcp_e164_sn'],
|
||||
rel => ['tooltip'],
|
||||
title => ['Subscriber Number, e.g. 12345678']
|
||||
},
|
||||
do_label => 0,
|
||||
do_wrapper => 0,
|
||||
);
|
||||
|
||||
has_field 'domain' => (
|
||||
type => '+NGCP::Panel::Field::Domain',
|
||||
label => 'SIP Domain',
|
||||
not_nullable => 1,
|
||||
);
|
||||
|
||||
has_block 'fields' => (
|
||||
tag => 'div',
|
||||
class => [qw/modal-body/],
|
||||
render_list => [qw/group webusername webpassword e164 username domain password status external_id/ ],
|
||||
);
|
||||
|
||||
sub validate {
|
||||
my $self = shift;
|
||||
my $cc = $self->field('e164.cc')->value;
|
||||
my $sn = $self->field('e164.sn')->value;
|
||||
|
||||
if (defined $cc && $cc ne '' && (!defined $sn || $sn eq '')) {
|
||||
my $err_msg = 'Subscriber Number required if Country Code is set';
|
||||
$self->field('e164')->add_error($err_msg);
|
||||
} elsif(defined $sn && $sn ne '' && (!defined $cc || $cc eq '')) {
|
||||
my $err_msg = 'Country Code required if Subscriber Number is set';
|
||||
$self->field('e164')->add_error($err_msg);
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NGCP::Panel::Form::Subscriber
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Form to modify a subscriber.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Gerhard Jungwirth
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
This library is free software. You can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,47 @@
|
||||
package NGCP::Panel::Form::Customer::PbxExtensionSubscriber;
|
||||
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'NGCP::Panel::Form::Customer::PbxSubscriber';
|
||||
|
||||
has_field 'ext' => (
|
||||
type => 'PosInteger',
|
||||
element_attr => {
|
||||
class => ['ngcp_e164_sn'],
|
||||
rel => ['tooltip'],
|
||||
title => ['Extension Number, e.g. 101']
|
||||
},
|
||||
do_label => 0,
|
||||
do_wrapper => 0,
|
||||
required => 1,
|
||||
);
|
||||
|
||||
has_block 'fields' => (
|
||||
tag => 'div',
|
||||
class => [qw/modal-body/],
|
||||
render_list => [qw/webusername webpassword ext username password status external_id/ ],
|
||||
);
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NGCP::Panel::Form::Subscriber
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Form to modify a subscriber.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Gerhard Jungwirth
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
This library is free software. You can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -0,0 +1,141 @@
|
||||
package NGCP::Panel::Form::Customer::PbxSubscriber;
|
||||
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'HTML::FormHandler';
|
||||
use Moose::Util::TypeConstraints;
|
||||
|
||||
use HTML::FormHandler::Widget::Block::Bootstrap;
|
||||
|
||||
use NGCP::Panel::Field::PbxGroup;
|
||||
|
||||
has '+widget_wrapper' => ( default => 'Bootstrap' );
|
||||
has_field 'submitid' => ( type => 'Hidden' );
|
||||
sub build_render_list {[qw/submitid fields actions/]}
|
||||
sub build_form_element_class { [qw/form-horizontal/] }
|
||||
|
||||
has_field 'group' => (
|
||||
type => '+NGCP::Panel::Field::PbxGroup',
|
||||
label => 'Group',
|
||||
not_nullable => 1,
|
||||
);
|
||||
|
||||
has_field 'webusername' => (
|
||||
type => 'Text',
|
||||
label => 'Web Username',
|
||||
required => 0,
|
||||
element_attr => {
|
||||
rel => ['tooltip'],
|
||||
title => ['The username to log into the CSC Panel']
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'webpassword' => (
|
||||
type => 'Text',
|
||||
label => 'Web Password',
|
||||
required => 0,
|
||||
element_attr => {
|
||||
rel => ['tooltip'],
|
||||
title => ['The password to log into the CSC Panel']
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'e164' => (
|
||||
type => 'Compound',
|
||||
order => 99,
|
||||
required => 0,
|
||||
label => 'Extension Number',
|
||||
do_label => 1,
|
||||
do_wrapper => 1,
|
||||
);
|
||||
|
||||
has_field 'username' => (
|
||||
type => 'Text',
|
||||
label => 'SIP Username',
|
||||
required => 1,
|
||||
noupdate => 1,
|
||||
element_attr => {
|
||||
rel => ['tooltip'],
|
||||
title => ['The SIP username for the User-Agents']
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'password' => (
|
||||
type => 'Text',
|
||||
label => 'SIP Password',
|
||||
required => 1,
|
||||
element_attr => {
|
||||
rel => ['tooltip'],
|
||||
title => ['The SIP password for the User-Agents']
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'status' => (
|
||||
type => '+NGCP::Panel::Field::SubscriberStatusSelect',
|
||||
label => 'Status',
|
||||
not_nullable => 1,
|
||||
);
|
||||
|
||||
has_field 'external_id' => (
|
||||
type => 'Text',
|
||||
label => 'External ID',
|
||||
required => 0,
|
||||
element_attr => {
|
||||
rel => ['tooltip'],
|
||||
title => ['An external id, e.g. provided by a 3rd party provisioning']
|
||||
},
|
||||
);
|
||||
|
||||
has_field 'save' => (
|
||||
type => 'Submit',
|
||||
value => 'Save',
|
||||
element_class => [qw/btn btn-primary/],
|
||||
label => '',
|
||||
);
|
||||
|
||||
|
||||
has_block 'fields' => (
|
||||
tag => 'div',
|
||||
class => [qw/modal-body/],
|
||||
render_list => [qw/webusername webpassword username password status external_id/ ],
|
||||
);
|
||||
|
||||
has_block 'actions' => (
|
||||
tag => 'div',
|
||||
class => [qw/modal-footer/],
|
||||
render_list => [qw/save/],
|
||||
);
|
||||
|
||||
sub field_list {
|
||||
my $self = shift;
|
||||
my $c = $self->ctx;
|
||||
|
||||
my $group = $self->field('group');
|
||||
$group->field('id')->ajax_src(
|
||||
$c->uri_for_action('/customer/pbx_group_ajax', [$c->req->captures->[0]])->as_string
|
||||
);
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NGCP::Panel::Form::Subscriber
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Form to modify a subscriber.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Gerhard Jungwirth
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
This library is free software. You can redistribute it and/or modify
|
||||
it under the same terms as Perl itself.
|
||||
|
||||
=cut
|
||||
|
||||
# vim: set tabstop=4 expandtab:
|
@ -1,4 +1,4 @@
|
||||
package NGCP::Panel::Form::CustomerSubscriber;
|
||||
package NGCP::Panel::Form::Customer::Subscriber;
|
||||
|
||||
use HTML::FormHandler::Moose;
|
||||
extends 'HTML::FormHandler';
|
Loading…
Reference in new issue