Implement subscriber creation mock.

agranig/1_0_subfix
Andreas Granig 12 years ago
parent b8a6b6b9f1
commit 8eabbecde9

@ -0,0 +1,54 @@
package NGCP::Panel::Controller::Subscriber;
use Sipwise::Base;
use namespace::sweep;
BEGIN { extends 'Catalyst::Controller'; }
use NGCP::Panel::Utils::Contract;
use NGCP::Panel::Form::Subscriber;
use Data::Printer;
=head1 NAME
NGCP::Panel::Controller::Subscriber - Catalyst Controller
=head1 DESCRIPTION
Catalyst Controller.
=head1 METHODS
=cut
sub auto :Does(ACL) :ACLDetachTo('/denied_page') :AllowedRole(admin) :AllowedRole(reseller) {
my ($self, $c) = @_;
$c->log->debug(__PACKAGE__ . '::auto');
return 1;
}
sub master :Chained('/') :PathPart('subscriber') {
my ($self, $c, $subscriber_id) = @_;
$c->stash(
template => 'subscriber/master.tt',
edit_flag => 1,
form => NGCP::Panel::Form::Subscriber->new,
);
}
=head1 AUTHOR
Andreas Granig,,,
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
__PACKAGE__->meta->make_immutable;
1;
# vim: set tabstop=4 expandtab:

@ -0,0 +1,26 @@
package NGCP::Panel::Field::Domain;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler::Field::Compound';
has_field 'id' => (
type => '+NGCP::Panel::Field::DataTable',
label => 'Domain',
do_label => 0,
do_wrapper => 0,
required => 1,
template => 'share/templates/helpers/datatables_field.tt',
ajax_src => '/domain/ajax',
table_titles => ['#', 'Domain'],
table_fields => ['id', 'domain'],
);
has_field 'create' => (
type => 'Button',
label => 'or',
value => 'Create Domain',
element_class => [qw/btn btn-tertiary/],
);
1;
# vim: set tabstop=4 expandtab:

@ -0,0 +1,129 @@
package NGCP::Panel::Form::Subscriber;
use HTML::FormHandler::Moose;
extends 'HTML::FormHandler';
use Moose::Util::TypeConstraints;
use HTML::FormHandler::Widget::Block::Bootstrap;
use NGCP::Panel::Field::Domain;
has '+widget_wrapper' => ( default => 'Bootstrap' );
sub build_render_list {[qw/fields actions/]}
sub build_form_element_class { [qw/form-horizontal/] }
has_field 'webusername' => (
type => 'Text',
label => 'Web Username',
);
has_field 'webpassword' => (
type => 'Password',
label => 'Web Password',
);
has_field 'e164' => (
type => 'Compound',
order => 99,
label => 'E164 Number',
do_label => 1,
do_wrapper => 1,
);
has_field 'e164.cc' => (
type => 'PosInteger',
label => 'cc:',
element_attr => { class => ['e164_cc'] },
do_label => 0,
do_wrapper => 0,
);
has_field 'e164.ac' => (
type => 'PosInteger',
label => 'ac:',
element_attr => { class => ['e164_ac'] },
do_label => 0,
do_wrapper => 0,
);
has_field 'e164.sn' => (
type => 'PosInteger',
label => 'sn:',
element_attr => { class => ['e164_sn'] },
do_label => 0,
do_wrapper => 0,
);
has_field 'sipusername' => (
type => 'Text',
label => 'SIP Username',
noupdate => 1,
);
has_field 'sipdomain' => (
type => '+NGCP::Panel::Field::Domain',
label => 'SIP Domain',
not_nullable => 1,
);
has_field 'sippassword' => (
type => 'Password',
label => 'SIP Password',
);
has_field 'administrative' => (
type => 'Boolean',
label => 'Administrative',
);
has_field 'external_id' => (
type => 'Text',
label => 'External ID',
);
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 e164 sipusername sipdomain sippassword administrative external_id/],
);
has_block 'actions' => (
tag => 'div',
class => [qw/modal-footer/],
render_list => [qw/save/],
);
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:

@ -22,6 +22,7 @@
<link rel="stylesheet" href="/css/ui-lightness/jquery-ui-1.8.21.custom.css">
<link rel="stylesheet" href="/css/application.css">
<link rel="stylesheet" href="/css/pages/pricing.css">
<link rel="stylesheet" href="/css/ngcp.css">
<script src="/js/libs/modernizr-2.5.3.min.js"></script>
<script src="/js/libs/jquery-1.7.2.min.js"></script>

@ -0,0 +1,9 @@
input.e164_cc {
width: 4em;
}
input.e164_ac {
width: 4em;
}
input.e164_sn {
width: 15em;
}

@ -26,6 +26,8 @@
<div class="ngcp-separator"></div>
<h3>TODO: Contract Details?</h3>
<h3>Subscribers</h3>
<table class="table table-bordered table-striped table-highlight table-hover">
@ -59,7 +61,7 @@
</tbody>
</table>
<h3>Account Balance</h3>
<h3>Contract Balance</h3>
<table class="table table-bordered table-striped table-highlight table-hover">
<thead>

@ -0,0 +1,27 @@
[% site_config.title = 'Subscriber' -%]
[% IF messages -%]
<div class="row">
[% FOREACH m IN messages -%]
<div class="alert alert-[% m.type %]">[% m.text %]</div>
[% END -%]
</div>
[% END -%]
<div class="ngcp-separator"></div>
<h3>Master Data</h3>
[% IF edit_flag == 1 -%]
[%
PROCESS "helpers/modal.tt";
modal_header(m.create_flag=0,
m.name = "Subscriber Master Data");
form.render;
modal_footer();
modal_script(m.close_target = close_target);
-%]
[% END -%]
[% # vim: set tabstop=4 syntax=html expandtab: -%]
Loading…
Cancel
Save