I'm working on a form that has a list of users in each row. So What I'm suppose to do is to add an email to each user by clicking on a checkbox (that part works fine). But then after clicking on Submit I'm supposse to get a new page (order-summary page) and display ONLY the users that were assigned with an email. So far I'm able to add an email to a user and after clicking on the submit button I get to the order-summary page and display the email, however my issue is that I don't know how to display not only the email but the user's name and phone number along with the email.
For example I have selected 5 users and give them emails. Here's a picture of my home page (form page)
Now, after clicking on Submit button I get this other page (order-summary page) and here's a picture
So How can I show full information for each user and not only the emails on the order-summary page? For example What I want to display on order-summary page is this:
Allie Craig 3039453156 aa@gmail.com
Voytko Liz 3038003943 bbb@gmail.com
Keanan Cypher 3038003969 cccc@gmail.com
FirstName LastName 4085121976 dddd@gmail.com
Henry Granados 3038003945 eeee@gmail.com
Can anybody tell me what I'm missing please?? Thank you so much in advance!!
Here's my code:
routes.php
<?php
// Login
Route::get('login/{one?}/{two?}/{three?}/{four?}/{five?}', 'Auth\AuthController@getLogin');
Route::post('login/{one?}/{two?}/{three?}/{four?}/{five?}', 'Auth\AuthController@postLogin');
Route::get('logout/{one?}/{two?}/{three?}/{four?}/{five?}', 'Auth\AuthController@logout');
// Home
Route::get('/', function() { return redirect('home'); });
Route::get('home', 'HomeController@home');
Route::post('home', 'HomeController@activateCustomer');
Route::get('order-summary', 'HomeController@orderingSubmission');
HomeController.php
<?php
namespace App\Http\Controllers;
use App\ABCWebServices\CDRWSRestOperations;
use App\Email\Emailer;
use App\Email\EmailTemplate;
use App\Http\Requests;
use Illuminate\Support\Facades\Input;
use DB;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redirect;
use Log;
use PhpParser\Node\Expr\Cast\Array_;
use Session;
class HomeController extends Controller
{
public function __construct()
{
$this->middleware('auth');
}
public function home()
{
require 'wsdl.php';
require 'utility.php';
$loggedInUserId = Session::get('userId');
$groupId = Session::get('groupId');
Log::debug(" Session::get('groupId')" .$groupId);
$options = array('login' => $login, 'password' => $password, 'trace' => 1);
try {
$client = new \SoapClient($wsdlCws, $options);
} catch (SoapFault $client) {
// TODO Any custom error handling needs to go in app/Exceptions/Handler.php
}
$options = array(
'trace' => 1,
'searchUserAttr' => array(
'groupName' => array(
'mode' => 'Equal To',
'value' => $groupId,
'isCaseInsensitive' => 'true'
)
)
);
// Log basic information about the request
Log::info(' wsdl: ' . $wsdlCws);
Log::info(' login: ' . $login);
Log::info(' password: ' . $password);
// Log the actual getUser request being sent
Log::info(' sending groupId request: ' . print_r($options, true));
// Send the getUser request
try {
$result = $client->search($options);
} catch (SoapFault $client) {
$errorMessage = print_r($client, true);
Log::error(' Exception caught in search call' . $errorMessage);
}
// Log the actual response received
Log::info(' received groupId response: ' . print_r($result, true));
//Convert the response object into an associative array for easier manipulation
$resultArray = object_to_array($result);
Log::info(' received groupId response: ' . print_r($resultArray, true));
return view('home', [
'userId' => $loggedInUserId,
'resultArray' => $resultArray
]);
}
public function orderingSubmission(){
$allInputFieldValues = Session::get('formEmailValues');
$firstElement = array_shift($allInputFieldValues);
unset($firstElement);
return view('order-summary', [
'message' => $allInputFieldValues
]);
}
public function activateCustomer(Request $request)
{
$techAdminFirstName = "";
$adminId = Session::get('userId');
$groupId = Session::get('groupId');
$userIpAddress = $this->getIpAddress();
$currentDateTime = date('Y-m-d H:i:s');
//$techAdminFirstName22 = $request->get('0');// getting value by attribute 'name'
$formEmailValues = Input::all();
Session::set('formEmailValues',$formEmailValues);
$techAdminLastName = $request->get('lastName');
$techAdminEmail = $request->get('techEmail');
$deliverToEmail = $request->get('deliverToEmail');
$cdrCustomerId = CDRWSRestOperations::addCdrCustomer($adminId, $techAdminFirstName, $techAdminLastName, $techAdminEmail, $deliverToEmail, $groupId, $userIpAddress, $currentDateTime);
if (isset($cdrCustomerId)) {
return redirect()->to('order-summary');
} else {
// TODO return input
return Redirect::back()->withErrors("Unable to activate your account. Please try again later or contact customer support.");
}
}
private function getIpAddress()
{
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $ip) {
$ip = trim($ip); // just to be safe
if (filter_var($ip, FILTER_VALIDATE_IP)) {
return $ip;
}
}
}
}
}
}
?>
home.blade.php
@extends( 'template' )
@section( 'content' )
{!! Form::open(array('id' => 'activateForm')) !!}
{!! csrf_field() !!}
<style>
.table-header-box {
display: inline;
height: 300px;
width: 300px;
padding: 10px 10px;
font-family: "proxima-nova", sans-serif;
}
</style>
<div>
<p class="userPortalText">Unified Communications Trial</p>
<h4 class="welcomeMessage">Order Form</h4>
<div style="padding-left: 135px; width:815px;">
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul class="login-error-messages" style="list-style-type:disc;">
@foreach ($errors->all() as $error)
<li>{!! $error !!}</li>
@endforeach
</ul>
</div>
@endif
</div>
<div class="home-rounded-border center-content" style="width:1040px;padding-left: 30px;float:left;font-family: 'proxima-nova', sans-serif;">
<p style="margin-left:-7px;padding-top:30px;width:980px;text-align: left;font-family: 'proxima-nova', sans-serif;">Please select users for
participation. Provide an email for each user where application
download instructions should be sent.</p>
<br/>
<div style="font-size:13px;padding-left:635px;width:985px;font-family: 'proxima-nova', sans-serif;">This email is for sending UC trial related
information only. Your Business VoiceEdge user email address will not be affected.
</div>
<br/>
<table style="padding: 20px;margin-left: -15px;margin-top:-38px;display: inline-block;">
<div style="padding:10px;">
<tr style="font-weight: bold">
<td align="center">Select All</td>
<td width="10"></td>
<td valign="bottom">Join</td>
<td width="440" align="center" valign="bottom">Name</td>
<td style="margin-right:20px;float: left;">Phone # / Extension</td>
<td style="padding-left: 100px;">Email</td>
</tr>
<?php $usersPhoneNumber = 0;?>
@foreach($resultArray as $key => $value)
@foreach($value as $key2 => $value2)
@if(is_array($value2))
@foreach($value2 as $key3 => $value3)
<?php
if (isset($value3['phoneNumber']))
$usersPhoneNumber = $value3['phoneNumber'];
else if (isset($value3['extension']))
$usersPhoneNumber = $value3['extension'];
?>
<tr>
@if($key3 == 0)
<td align="center"><input type="checkbox" id="checkAll" value = ""/></td>
@else
<td align="center"></td>
@endif
<td width="10"></td>
<td align="center" >
<input class="input_checkbox" type="checkbox" id="customer-name-checkbox" name=" " value="">
</td>
<td width="420" style=""> </td>
<td style="padding: 0px;" class = "usersPhoneNumber"></td>
<td style=""><input style="margin-left:-35px;float: right;" type="email" class="styled-text rounded" name="" id="customer-name-inputField" placeholder="" value=""/><br/><br/>
</td>
</tr>
@endforeach
@endif
@endforeach
@endforeach
</div>
</table>
<input type="submit" class="sign-in-button" style="text-align: center;margin-left: 365px;" value="Submit"/>
</br>
<div id="statusMsg" style="margin: 0px 40px 0px 40px; background-color: #ffffff;"></div>
<ul>
<li class="logout" style="text-align: center;padding-top: 5px; padding-right: 30px"><a href="logout"><span>Logout</span></a>
</li>
</ul>
</div>
<br/><br/>
</div>
{!! Form::close() !!}
order-summary.blade.php
@extends( 'template' )
@section( 'content' )
{!! Form::open(array('id' => 'activateForm')) !!}
{!! csrf_field() !!}
<style>
.table-header-box {
display: inline;
height: 300px;
width: 300px;
padding: 10px 10px;
}
</style>
<div>
<h4 class = "welcomeMessage">Order Form</h4>
<div class="home-rounded-border center-content" style = "width:900px;">
<br/>
<div>
<div style="margin-left: 15px;border:1px solid #cccccc;" class = "table-header-box">Name</div>
<div style="margin-left: 48px;border:1px solid #cccccc;" class = "table-header-box">Phone Number</div>
<div style="margin-left: 45px;border:1px solid #cccccc;" class = "table-header-box">Email</div>
</div>
@foreach ($message as $value)
<br>
@endforeach
<ul><li class="logout" style="text-align: center;padding-top: 5px;"><a href="logout"><span>Logout</span></a></li></ul>
</div>
@stop
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire