diff --git a/app/Main.php b/app/Main.php index d69f992e028d7af6b87f9434859de7fd62ef8aa3..f5a4ec6ad740cd905977895cad54be381aeb9ae5 100644 --- a/app/Main.php +++ b/app/Main.php @@ -23,7 +23,8 @@ class Main extends Controller { $categories = Api::get_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: start call @@ -42,8 +43,36 @@ class Main extends Controller { } } + /* + * Feedback SIP function + */ 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); + } + } + }; diff --git a/app/routes.ini b/app/routes.ini index e93fee0dcddaf883ce9638b1ec2c02a25783b09f..e2ac8608d0aaac07973a21466ce9a9c4ee942618 100644 --- a/app/routes.ini +++ b/app/routes.ini @@ -13,5 +13,6 @@ POST /restapi/campaign/@id/feedback/add=RestApi->feedback_add GET /restapi/campaign/@id/arguments/@lang=RestApi->arguments GET|POST @feedback:/feedback=Main->feedbackform +GET|POST @call:/call=Main->call POST @feedbacksip:/feedbacksip=Main->feedbacksip \ No newline at end of file diff --git a/templates/call.html b/templates/call.html new file mode 100644 index 0000000000000000000000000000000000000000..a4655cc277d6825684365b9a3ab57b4f59b69a62 --- /dev/null +++ b/templates/call.html @@ -0,0 +1,21 @@ +

{{ _("Call for free") }}

+ +
+ +

{{ _("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).") }}

+ +

+ + +

+

+ {{ _('Starting with your country code, without the initial 0') }} +

+ +
+ +

{{ _("Call at your expense") }}

+

{{ _("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.") }}

+ ☎ {{ @contact.tel }} + +

{{ _("Cancel the call") }}