Commit f7c7cc33 authored by okhin's avatar okhin 🚴

More work on the feedback page, fixed the stream system for the call, etc

parent 5c33a33c
Pipeline #765 failed with stage
......@@ -74,7 +74,7 @@ class Main extends Controller {
$client = new GuzzleHttp\Client(['base_uri' => SIP_API]);
try {
$res = $client->get("calls/$call_id", ['query' => $data]);
return ($res->getBody());
return (GuzzleHttp\Psr7\copy_to_string($res->getBody()));
} catch (RequestException $e) {
echo Psr7\str($e->getRequest());
if ($e->hasResponse()) {
......@@ -104,7 +104,10 @@ class Main extends Controller {
// to load the callee and retrieve its number.
$contact = Api::get_contact($args['id']);
$f3->set('contact', $contact);
$data = array('api' => 'piphone', 'caller' => $f3->get('POST.phone'), 'callee' => $contact['phone'], 'token' => $token);
$data = array('api' => 'piphone',
'caller' => $f3->get('POST.phone'),
'callee' => $contact['phone'],
'token' => $token);
// We want to generate a UNIQUE-ID (doesn't need to be cryptogaphically unique though
$call_id = uniqid();
$f3->set('CALL_ID', $call_id);
......@@ -113,13 +116,13 @@ class Main extends Controller {
$client = new GuzzleHttp\Client(['base_uri' => SIP_API]);
try {
$res = $client->post("calls/$call_id", ['query' => $data]);
$f3->set('call', json_decode($res->getBody()));
$f3->set('VERB', 'GET');
$f3->set('call', GuzzleHttp\Psr7\copy_to_string($res->getBody()));
$f3->set('VERB', 'GET');
$this->feedbackform($f3, $args);
} catch (RequestException $e) {
echo Psr7\str($e->getRequest());
print_r(Psr7\str($e->getRequest()));
if ($e->hasResponse()) {
echo Psr7\str($e->getResponse());
print_r(Psr7\str($e->getResponse()));
}
}
}
......
......@@ -6,7 +6,7 @@ AUTOLOAD=app/
UI=templates/
; Cache
CACHE = true
;CACHE = false
; Debug level
DEBUG=3
......
<section>
<repeat group="{{ @arguments }}" value="{{ @argument }}">
<h3>{{ @argument.title }}</h3>
<p>{{ @argument.text }}</p>
</repeat>
</section>
<div class="panel-group" id="arguments" role="tablist" aria-multiselectable="true">
<repeat group="{{ @arguments }}" value="{{ @argument }}" counter="{{ @key }}">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="args_h{{ @key }}">
<h4 class="panel-title">
<a role="button" class="collapsed" data-toggle="collapse" data-parent="#arguments" href="#args_c{{ @key }}" aria-expanded="false" aria-controls="args_c{{ @key }}">
{{ @argument.title }}
</a>
</h4>
</div>
<div id="args_c{{ @key }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="args_h{{ @key }}">
<div class="panel-body">
{{ @argument.text }}
</div>
</div>
</div>
</repeat>
</div>
<h2>{{ _(@campaign.title) }}</h2>
<include href="argumentation.html">
<h2>{{ _("Feedback Form") }}</h2>
<!-- Form in order to feedback your call -->
<p>{{ _("Please tell us what happened if you was able to talk to someone. Your feedback is important to us.") }}</p>
<form method="post" action="/feedback/" >
<input type="text" id="contact_id" name="contact_id" hidden="hidden" value="{{ @contact_id }}" />
<repeat group="{{ @feedback_categories }}" value="{{ @feedback_category }}">
<input type="radio" name="feedback_category" value="{{ @feedback_category.id }}" />
{{ @feedback_category.name }}
</repeat>
<p>
<textarea id="feedback" name="feedback"></textarea>
</p>
<input type="submit" name="go" value="{{ _("Send my feedback") }}" />
</form>
<!-- Let's split this page in two -->
<div class="container">
<div class="row">
<div class="col-md-6">
<include href="argumentation.html">
</div>
<div class="col-md-6">
<div class="panel panel-default">
<div class="panel-heading">
<h4>{{ _("Currently calling") }}</h4>
</div>
<div class="panel-body">
<div>
<p class="text-center">{{ @contact.first_name }} {{ @contact.last_name }}</p>
<p class="lead text-center">
<abbr title="{{ _("Phone number") }}">{{ _("Phone number") }}:</abbr> <a href="tel: {{ @contact.phone }}">{{ @contact.phone }}</a>
</p>
<dl class="dl-horizontal hidden-xs">
<repeat group="{{ @contact.groups }}" value="{{ @group }}">
<check if="{{ @group.type!='committee' }}">
<dt>{{ @group.type }}:</dt>
<dd><a href="#">{{ @group.name }}</a></dd>
</check>
</repeat>
</dl>
<ul class="list-inline">
<repeat group="{{ @contact.groups }}" value="{{ @group }}">
<check if="{{ @group.type=='committee' }}">
<li><abbr title="{{ @group.name }}" class="initialism"><ahref="https://memopol.lqdn.fr/europe/parliament/committee/{{ @group.name }}/"><div class="well well-sm">{{ @group.name }}</div></a></abbr></li>
</check>
</repeat>
</ul>
</div>
</div>
</div>
<!-- Form in order to feedback your call -->
<p>{{ @call }}</p>
<p>{{ _("Please tell us what happened if you were able to talk to someone. Your feedback is important to us.") }}</p>
<h2>{{ _("Feedback Form") }}</h2>
<form method="post" action="/feedback/" >
<input type="text" id="contact_id" name="contact_id" hidden="hidden" value="{{ @contact_id }}" />
<repeat group="{{ @feedback_categories }}" value="{{ @feedback_category }}">
<input type="radio" name="feedback_category" value="{{ @feedback_category.id }}" />
{{ @feedback_category.name }}
</repeat>
<p> <textarea id="feedback" name="feedback"></textarea> </p>
<input type="submit" name="go" value="{{ _("Send my feedback") }}" />
</form>
</div>
</div>
</div>
......@@ -14,11 +14,11 @@
<script src="/static/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"></script>
</head>
<body>
<section id="header">
<div class="container" id="header">
<img src="/static/img/piphone.png" />
<h1>{{ _("PiPhone") }}</h1>
<h2>{{ _("Call Contact for free - and make yourself heard") }}</h2>
</section>
</div>
<!--
No translation yet
<section id="languages">
......@@ -30,7 +30,7 @@ No translation yet
<include href="toolbar.html" />
<section>
<div class="container">
<h3>{{ @campaign.title }}</h3>
<p>{{ @campaign.description }}</p>
</section>
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment