From 8fe9c0b06d822925939ac28d814ba468b65c133b Mon Sep 17 00:00:00 2001 From: Irina Peshinskaya Date: Tue, 17 Feb 2015 12:27:10 +0200 Subject: [PATCH] MT#5585 Add details about cdr record (cherry picked from commit f1e3602b3eb54c622ef49872f62758f375b9187c) Change-Id: I68655171f13e06a7c1566ae82b58341ccdbb12fb --- lib/NGCP/Panel/Controller/Subscriber.pm | 11 ++++++ share/templates/subscriber/call_details.tt | 5 +++ .../subscriber/call_details_wrapper.tt | 37 +++++++++++++++++++ share/templates/subscriber/master.tt | 31 +++++++++++++++- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 share/templates/subscriber/call_details.tt create mode 100644 share/templates/subscriber/call_details_wrapper.tt diff --git a/lib/NGCP/Panel/Controller/Subscriber.pm b/lib/NGCP/Panel/Controller/Subscriber.pm index 669ed6f980..ac1c602c02 100644 --- a/lib/NGCP/Panel/Controller/Subscriber.pm +++ b/lib/NGCP/Panel/Controller/Subscriber.pm @@ -2044,6 +2044,7 @@ sub master :Chained('base') :PathPart('details') :CaptureArgs(0) { my ($self, $c) = @_; my $call_cols = [ + { name => "id", title => $c->loc('#') }, { name => "source_user", search => 1, title => $c->loc('Caller') }, { name => "destination_user", search => 1, title => $c->loc('Callee') }, { name => "call_status", search => 1, title => $c->loc('Status') }, @@ -3048,6 +3049,16 @@ sub ajax_calls :Chained('master') :PathPart('calls/ajax') :Args(0) { $c->detach( $c->view("JSON") ); } +sub ajax_call_details :Chained('master') :PathPart('calls/ajax') :Args(1) { + my ($self, $c, $call_id) = @_; + my $call = $c->model('DB')->resultset('cdr')->search_rs({ + id => $call_id, + }); + $c->stash( + template => 'subscriber/call_details.tt', + call => { $call->first->get_inflated_columns } ); + $c->detach( $c->view('TT') ); +} sub ajax_registered :Chained('master') :PathPart('registered/ajax') :Args(0) { my ($self, $c) = @_; diff --git a/share/templates/subscriber/call_details.tt b/share/templates/subscriber/call_details.tt new file mode 100644 index 0000000000..1ef47061bd --- /dev/null +++ b/share/templates/subscriber/call_details.tt @@ -0,0 +1,5 @@ + diff --git a/share/templates/subscriber/call_details_wrapper.tt b/share/templates/subscriber/call_details_wrapper.tt new file mode 100644 index 0000000000..fd732609bc --- /dev/null +++ b/share/templates/subscriber/call_details_wrapper.tt @@ -0,0 +1,37 @@ + + diff --git a/share/templates/subscriber/master.tt b/share/templates/subscriber/master.tt index d21a210c36..7579014bb7 100644 --- a/share/templates/subscriber/master.tt +++ b/share/templates/subscriber/master.tt @@ -164,13 +164,36 @@ ((c.user.roles == 'admin' || c.user.roles == 'reseller') && c.user.call_data) || c.user.roles == 'subscriberadmin' -%] + + +
- + +[%PROCESS 'subscriber/call_details_wrapper.tt' %] [% helper.name = 'Calls'; helper.dt_columns = calls_dt_columns; @@ -179,10 +202,14 @@ helper.ajax_uri = c.uri_for_action('/subscriber/ajax_calls', [c.req.captures.0]); helper.show_footer = 1; - IF (c.user.roles == "admin" || c.user.roles == "reseller") && c.config.features.callflow; + IF (c.user.roles == "admin" || c.user.roles == "reseller"); + IF c.config.features.callflow; helper.dt_buttons = [ { name = c.loc('Call Flow'), uri = "/callflow/'+encodeURIComponent(full.call_id)+'/callmap", class = 'btn-small btn-primary', icon = 'icon-random' }, ]; + END; + details_button = { name = c.loc('Call Details'), uri = "javascript:showCallDetails(\\''+encodeURIComponent(full.id)+'\\');void(0);" , class = 'btn-small btn-primary', icon = 'icon-edit' }; + helper.dt_buttons.push( details_button ); END; PROCESS 'helpers/datatables.tt';