diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 6fbc974037..44e5bc4e73 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -231,17 +231,19 @@ sub preferences :Chained('base') :PathPart('preferences') :Args(0) { my $prov_subscriber = $c->stash->{subscriber}->provisioning_voip_subscriber; my $cfs = {}; + my $mappings = {}; for my $type(qw/cfu cfna cft cfb/) { - $c->stash('cf_mappings_'.$type => $prov_subscriber->voip_cf_mappings - ->find({ type => $type })); - if(defined $c->stash->{'cf_mappings_'.$type}) { - $cfs->{$type} = [ $c->stash->{'cf_mappings_'.$type} + $mappings->{$type} = $prov_subscriber->voip_cf_mappings + ->find({ type => $type }); + if(defined $mappings->{$type}) { + $cfs->{$type} = [ $mappings->{$type} ->destination_set ->voip_cf_destinations->search({}, { order_by => { -asc => 'priority' }} )->all ]; } } + $c->stash(cf_mappings => $mappings); $c->stash(cf_destinations => $cfs); my $ringtimeout_preference = $c->model('DB')->resultset('voip_preferences')->search({ attribute => 'ringtimeout', 'usr_pref' => 1, @@ -446,18 +448,22 @@ sub preferences_callforward :Chained('base') :PathPart('preferences/callforward' cf_description => $cf_desc, cf_form => $cf_form, ); +} +sub preferences_callforward_delete :Chained('base') :PathPart('preferences/callforward/delete') :Args(1) { + my ($self, $c, $cfmap_id) = @_; + try { + $c->model('DB')->resultset('voip_cf_mappings')->find($cfmap_id)->delete; + $c->flash(messages => [{type => 'success', text => 'Successfully deleted Call Forward'}]); + } catch($e) { + $c->log->error("failed to delete call forward mapping: $e"); + $c->flash(messages => [{type => 'error', text => 'Failed to deleted Call Forward'}]); + } - - - - - - + $c->response->redirect($c->uri_for_action('/subscriber/preferences', [$c->req->captures->[0]])); } - sub load_preference_list :Private { my ($self, $c) = @_; diff --git a/lib/NGCP/Panel/Form/SubscriberCFSimple.pm b/lib/NGCP/Panel/Form/SubscriberCFSimple.pm index 13651131cd..38c5afb092 100644 --- a/lib/NGCP/Panel/Form/SubscriberCFSimple.pm +++ b/lib/NGCP/Panel/Form/SubscriberCFSimple.pm @@ -7,7 +7,15 @@ extends 'HTML::FormHandler'; has '+widget_wrapper' => (default => 'Bootstrap'); has_field 'id' => (type => 'Hidden'); -has_field 'destination' => (type => 'Text', required => 1,); +has_field 'destination' => ( + type => 'Text', + required => 1, + element_attr => { + rel => ['tooltip'], + title => ['Either a number (e.g. “431234”), a SIP user (e.g. “peter” or a full SIP URI (e.g. “sip:peter@example.org”)'] + }, +); + has_field 'save' => (type => 'Submit', element_class => [qw(btn btn-primary)],); has_block 'fields' => ( tag => 'div', diff --git a/lib/NGCP/Panel/Form/SubscriberCFTSimple.pm b/lib/NGCP/Panel/Form/SubscriberCFTSimple.pm index d3a4534aa8..f1a038f985 100644 --- a/lib/NGCP/Panel/Form/SubscriberCFTSimple.pm +++ b/lib/NGCP/Panel/Form/SubscriberCFTSimple.pm @@ -8,6 +8,10 @@ has_field 'ringtimeout' => ( type => 'PosInteger', required => 1, label => 'after ring timeout', + element_attr => { + rel => ['tooltip'], + title => ['Seconds to wait for pick-up until engaging Call Forward (e.g. “10”)'] + }, ); has_block 'fields' => ( tag => 'div', diff --git a/share/templates/subscriber/preferences.tt b/share/templates/subscriber/preferences.tt index d22972bab1..ba14061562 100644 --- a/share/templates/subscriber/preferences.tt +++ b/share/templates/subscriber/preferences.tt @@ -58,7 +58,7 @@ { type = "cfna", desc = "Unavailable" } ] -%]