From 8544fd0989995dd8c92b79c3c2a96709e00263e5 Mon Sep 17 00:00:00 2001 From: Andreas Granig Date: Tue, 28 Jan 2014 17:41:22 +0100 Subject: [PATCH] MT#3933 API: add form for subscriber validation. --- lib/NGCP/Panel/Field/SubscriberPbxGroup.pm | 26 ++++++++ .../Panel/Form/Subscriber/SubscriberAPI.pm | 63 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 lib/NGCP/Panel/Field/SubscriberPbxGroup.pm create mode 100644 lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm diff --git a/lib/NGCP/Panel/Field/SubscriberPbxGroup.pm b/lib/NGCP/Panel/Field/SubscriberPbxGroup.pm new file mode 100644 index 0000000000..29f269ec31 --- /dev/null +++ b/lib/NGCP/Panel/Field/SubscriberPbxGroup.pm @@ -0,0 +1,26 @@ +package NGCP::Panel::Field::SubscriberPbxGroup; +use HTML::FormHandler::Moose; +extends 'HTML::FormHandler::Field::Compound'; + +# agranig: this is just a dummy for the API, do not use in panel! + +has_field 'id' => ( + type => '+NGCP::Panel::Field::DataTable', + label => 'PBX Group', + do_label => 0, + do_wrapper => 0, + required => 1, + template => 'helpers/datatables_field.tt', + ajax_src => '/subscriber/pbx_group_ajax', + table_titles => ['#', 'Name', 'Contract #', 'Status'], + table_fields => ['id', 'name', 'contract_id', 'status'], +); + +has_field 'create' => ( + type => 'Button', + do_label => 0, + value => 'Create PBX Group', + element_class => [qw/btn btn-tertiary pull-right/], +); + +1; diff --git a/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm new file mode 100644 index 0000000000..54c3e2b091 --- /dev/null +++ b/lib/NGCP/Panel/Form/Subscriber/SubscriberAPI.pm @@ -0,0 +1,63 @@ +package NGCP::Panel::Form::Subscriber::SubscriberAPI; + +use HTML::FormHandler::Moose; +extends 'NGCP::Panel::Form::Subscriber'; + +sub build_render_list {[qw/submitid fields actions/]} +sub build_form_element_class {[qw(form-horizontal)]} + +has_field 'display_name' => ( + type => 'Text', + label => 'Display Name', +); + +has_field 'alias_numbers' => ( + type => '+NGCP::Panel::Field::AliasNumber', + setup_for_js => 1, + do_wrapper => 1, + do_label => 0, + tags => { + controls_div => 1, + }, + wrapper_class => [qw/hfh-rep/], +); + +has_field 'lock' => ( + type => '+NGCP::Panel::Field::SubscriberLockSelect', + label => 'Lock Level', +); + +has_field 'is_pbx_group' => ( + type => 'Boolean', + label => 'Is PBX Group?', + default => 0, +); + +has_field 'pbx_group' => ( + type => '+NGCP::Panel::Field::SubscriberPbxGroup', + label => 'PBX Group', +); + +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/contract domain e164 alias_number webusername webpassword username password status lock external_id administrative is_pbx_group pbx_group display_name/ ], +); + +has_block 'actions' => ( + tag => 'div', + class => [qw/modal-footer/], + render_list => [qw/save/], +); + +1; + +# vim: set tabstop=4 expandtab: