Commit cad0698f authored by nepski's avatar nepski

call view, POST and GET route

parent cd69d2d4
...@@ -23,7 +23,8 @@ class Main extends Controller { ...@@ -23,7 +23,8 @@ class Main extends Controller {
$categories = Api::get_feedback_categories()['categories']; $categories = Api::get_feedback_categories()['categories'];
$f3->set('feedback_categories', $categories); $f3->set('feedback_categories', $categories);
$f3->set("contact_id", 42); $contact_id = $f3->get('POST.contact_id');
$f3->set("contact_id", $contact_id);
//TODO: create call //TODO: create call
//TODO: start call //TODO: start call
...@@ -42,8 +43,36 @@ class Main extends Controller { ...@@ -42,8 +43,36 @@ class Main extends Controller {
} }
} }
/*
* Feedback SIP function
*/
function feedbacksip($f3, $args) { function feedbacksip($f3, $args) {
} }
/*
* call Page
* Form to call
* GET: show the form
* POST: send the form and GET feedbackform
*/
function call($f3, $args) {
//GET
if ($f3->get('VERB') == 'GET') {
//$contact_id = $f3->get('POST.contact_id');
$f3->set('contact', Api::get_contact()); //by $contact_id
$f3->set('block_content', 'call.html');
}
//POST
elseif ($f3->get('VERB') == 'POST'){
$web = new Web;
//GET feedbackform
$f3->set('VERB', 'GET');
$this->feedbackform($f3, $args);
}
}
}; };
...@@ -13,5 +13,6 @@ POST /restapi/campaign/@id/feedback/add=RestApi->feedback_add ...@@ -13,5 +13,6 @@ POST /restapi/campaign/@id/feedback/add=RestApi->feedback_add
GET /restapi/campaign/@id/arguments/@lang=RestApi->arguments GET /restapi/campaign/@id/arguments/@lang=RestApi->arguments
GET|POST @feedback:/feedback=Main->feedbackform GET|POST @feedback:/feedback=Main->feedbackform
GET|POST @call:/call=Main->call
POST @feedbacksip:/feedbacksip=Main->feedbacksip POST @feedbacksip:/feedbacksip=Main->feedbacksip
\ No newline at end of file
<h2>{{ _("Call for free") }}</h2>
<form method="post" action="/call/">
<input type="text" id="contact_id" name="contact_id" hidden="hidden" value="{{ @contact.id }}">
<p>{{ _("If you want to call for free, you must provide us with your phone number (the PiPhone will call that number to initiate the communication).") }}</p>
<p>
<label for="phone">{{_("Your phone number:") }}</label>
<input type="text" name="phone" id="phone" placeholder="+33123456789001" />
</p>
<p>
{{ _('Starting with your <a href="https://en.wikipedia.org/wiki/List_of_country_calling_codes#Zones_3-4:_Europe">country code</a>, without the initial 0') }}
</p>
<input type="submit" value="{{ _("I'm ready, call me") }}" />
</form>
<h2>{{ _("Call at your expense") }}</h2>
<p>{{ _("If you don't want to call for free, here is the number of the current MEP (you can either dial it from your phone or push the button if any VoIP client is installed on your device.") }}</p>
<a href="tel:{{ @contact.tel }}" target="_blank">☎ {{ @contact.tel }}</a>
<p><a href="/">{{ _("Cancel the call") }}</a></p>
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