I want to paginate in a blade file different tabs , each tabs show different collections of object but each time i go to next page in one page it redirects to the first tab and also paginate each tab not just the one i wanted to paginate.
Blade Part Where i have tabs
<div class="container">
<div class="section-bg-color">
<div class="row">
<div class="col-lg-12">
<!-- My Account Page Start -->
<div class="myaccount-page-wrapper">
<!-- My Account Tab Menu Start -->
<div class="row">
<div class="col-lg-3 col-md-4">
<div class="myaccount-tab-menu nav" role="tablist" id="myTab">
<i class="fa fa-dashboard"></i>Dashboard
<i class="fa fa-user"></i>Gestione Utenti
<i class="fa fa-book"></i>Gestione Fumetti
<i class="fa fa-map-marker"></i>Gestione Recensione
</div>
</div>
<!-- My Account Tab Menu End -->
<!-- My Account Tab Content Start -->
<div class="col-lg-9 col-md-8">
<div class="tab-content" id="myaccountContent">
<!-- Single Tab Content Start -->
<div class="tab-pane fade show active" id="dashboad" role="tabpanel">
<div class="myaccount-content">
<h5>Dashboard</h5>
<div class="welcome">
<p>Ciao, <strong>{{ $user->username }}</strong>! (Non sei <strong>{{ $user->username }}</strong>? Logout)</p>
</div>
<p class="mb-0">I tuoi dati:</p>
<p class="mb-0">E-mail: <strong>{{ $user->email }} </strong></p>
</div>
<div class="myaccount-content">
#php
$notifications = \App\Http\Controllers\NotificationController::getNotification($user->id);
#endphp
<h5>Notifiche</h5>
#if($notifications->count() < 1)
<div class="myaccount-content">
<h5>Non ci sono ancora notifiche</h5>
</div>
#else
<div class="myaccount-table table-responsive text-center">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Data</th>
<th>testo</th>
<th>stato</th>
<th>Action</th>
</tr>
</thead>
<tbody>
#foreach($notifications as $notification)
<tr>
<td>{{ $notification->date }}</td>
<td>
#if(strlen($notification->notification_text) > 50 )
#php
$subnotification = substr($notification->notification_text, 0, 50)
#endphp
{{ $subnotification }}...
#else
{{ $notification->notification_text }}
#endif
</td>
#if($notification->state == 1)
<td>
Letto
</td>
<td>
View
</td>
#else
<td>
Non letto
</td>
<td>
View
</td>
#endif
</tr>
#endforeach
</tbody>
</table>
</div>
#endif
</div>
</div>
<!-- Single Tab Content End -->
#if(session('message'))
{{session('message')}}
#endif
<!-- Single Tab Content Start -->
<div class="tab-pane fade" id="users" role="tabpanel">
<div class="myaccount-content">
<h5>Utenti</h5>
<div class="myaccount-table table-responsive text-center">
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Nickname</th>
<th>Phone</th>
<th>Email</th>
<th>Tipologia</th>
<th>Elimina</th>
</tr>
</thead>
<tbody>
#foreach($users as $user)
<tr>
<td>{{$user->username}}</td>
<td>{{$user->phone_number}}</td>
<td>{{$user->email}}</td>
#if($user->hasGroup('il gruppo degli utenti'))
<td>Utente</td>
#else
<td>Venditore</td>
#endif
<td><a class="btn btn-danger" onclick="return myFunction();" href="{{route('user-delete', $user->id)}}"><i class="fa fa-trash"></i></a></td>
<script>
function myFunction() {
if(!confirm("Sei sicuro di voler eliminare questo utente"))
event.preventDefault();
}
</script>
</tr>
#endforeach
{{ $users->links() }}
</tbody>
</table>
</div>
</div>
</div>
<!-- Single Tab Content End -->
<!-- Single Tab Content Start -->
<div class="tab-pane fade" id="comics" role="tabpanel">
<div class="myaccount-content">
<h5>Fumetti</h5>
<div class="myaccount-table table-responsive text-center">
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th>Titolo</th>
<th>ISBN</th>
<th>Quantità</th>
<th>Utente</th>
<th>Elimina</th>
</tr>
</thead>
<tbody>
#foreach($comics as $comic)
#php
$userNeed = App\User::where('id','=',$comic->user_id)->first();
#endphp
<tr>
<td>{{$comic->comic_name}}</td>
<td>{{$comic->ISBN}}</td>
<td>{{$comic->quantity}}</td>
<td>{{$userNeed->username}}</td>
<td><a class="btn btn-danger" onclick="return myFunction();" href="{{route('comic-delete', $comic->id)}}"><i class="fa fa-trash"></i></a></td>
<script>
function myFunction() {
if(!confirm("Sei sicuro di voler eliminare questo fumetto"))
event.preventDefault();
}
</script>
</tr>
#endforeach
{{ $comics->links() }}
</tbody>
</table>
</div>
</div>
</div>
<!-- Single Tab Content End -->
<!-- Single Tab Content Start -->
<div class="tab-pane fade" id="reviews" role="tabpanel">
<div class="myaccount-content">
<h5>Recensione</h5>
<div class="myaccount-table table-responsive text-center">
<table class="table table-bordered">
<thead class="thead-dark">
<tr>
<th>Titolo</th>
<th>Fumetto</th>
<th>Recensore</th>
<th>Elimina</th>
</tr>
</thead>
<tbody>
#foreach($reviews as $review)
#php
$userReview = App\User::where('id','=',$review->user_id)->first();
$comicReview = App\Comic::where('id','=',$review->comic_id)->first();
#endphp
<tr>
<td>{{$review->review_title}}</td>
<td>{{$comicReview->comic_name}}</td>
<td>{{$userReview->username}}</td>
<td><a class="btn btn-danger" onclick="return myFunction();" href="{{route('review-delete-local', $review->id)}}"><i class="fa fa-trash"></i></a></td>
<script>
function myFunction() {
if(!confirm("Sei sicuro di voler eliminare questa recensione"))
event.preventDefault();
}
</script>
</tr>
#endforeach
{{ $reviews->links() }}
</tbody>
</table>
</div>
</div>
</div>
</div>
</div> <!-- My Account Tab Content End -->
</div>
</div> <!-- My Account Page End -->
</div>
</div>
</div>
</div>
</div>
And this is my route
Route
Route::get('/adminArea', function () {
$user = \Illuminate\Support\Facades\Auth::user();
$users = \App\User::where('username','!=','admin')->orderBy('username', 'asc')->paginate(12);
$comics =Comic::orderBy('comic_name', 'asc')->paginate(12);
$reviews = \App\Review::orderBy('review_title', 'asc')->paginate(12);
return view('adminPanel')
->with(compact('user'))
->with(compact('users'))
->with(compact('comics'))
->with(compact('reviews'));
})->name('AdminAccount');
In the end what i want to do is to paginate each tab differently meaning if a put the next on the comics i don't want to show also in the user tab the second page of user. The problem is that it use the same pagination url for each tabs so i was wondering if the solution is to give each tab an indipendent url
It redirects to the first tab because you use javascript tabs with active class added to first tab. To resolve problem with tabs you need to change for each tabs nav to:
<a href="#dashboad" class="{{ (Route::currentRouteName() == 'YOUR-ROUTE-NAME) ? 'active' : '' }}" ...
Also here:
<!-- Single Tab Content Start -->
<div class="tab-pane fade show {{ (Route::currentRouteName() == 'YOUR-ROUTE-NAME) ? 'active' : '' }}"...
But your problems with paginations will remain.
Here are 2 solutions:
Use JS tabs and get data via Ajax request.
Use 4 separated routes for each collection and add routes to tabs corresponding above example.
I hope it was clear.
Solution look like this.
Navigation code:
<div class="myaccount-tab-menu nav" role="tablist" id="myTab">
<i class="fa fa-dashboard"></i>Dashboard
<i class="fa fa-user"></i>Gestione Utenti
<i class="fa fa-book"></i>Gestione Fumetti
<i class="fa fa-map-marker"></i>Gestione Recensione
</div>
Also for each tab add, don't forget to change route name for each:
<!-- Single Tab Content Start -->
<div class="tab-pane fade show {{ (Route::currentRouteName() == 'dashboard') ? 'active' : '' }}" id="dashboad" role="tabpanel">
Route code:
Route::get('/dashboard', function () {
$user = \Illuminate\Support\Facades\Auth::user();
return view('adminPanel')->with(compact('user'));
})->name('dashboard');
Route::get('/users', function () {
$users = \App\User::where('username','!=','admin')->orderBy('username', 'asc')->paginate(12);
return view('adminPanel')->with(compact('users'));
})->name('users');
Route::get('/comics', function () {
$comics =Comic::orderBy('comic_name', 'asc')->paginate(12);
return view('adminPanel')->with(compact('comics'));
})->name('comics');
Route::get('/reviews', function () {
$reviews = \App\Review::orderBy('review_title', 'asc')->paginate(12);
return view('adminPanel')->with(compact('reviews'));
})->name('reviews');
Related
i have data returned from conntroller by ajax response in json format and I can print data in console.
but I want to display it in a table, how can I display it?
i made a search for solution but all solution write HTML code in controller function and return it as response, so is there any other solution
my controller
<?php
namespace App\Http\Controllers\backend;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Category;
class CategoryCtrl extends Controller
{
//function search - show categories live search
public function index(Request $request)
{
if($request->ajax())
{
$categories = Category::where('name','LIKE','%'.$request->cat_search."%")->orderBY('created_at','DESC')->get();
return Response()->json($categories);
}
else {
$categories = Category::orderBY('created_at','DESC')->get();
return view('backend.category.list')->withcategories($categories);
}
}
}
view
#extends('backend.layouts.app')
#section('content')
<input class="form-control" type="text" name="search" id="cat_search" placeholder="Category Search..." />
<table id="CategoriesTable" class="table table-striped table-vcenter js-dataTable-simple">
<thead>
<tr>
<th class="text-center w-5">#</th>
<th class="text-center">Name</th>
<th class="text-center hidden-xs">Icon</th>
<th class="text-center hidden-xs">Order</th>
<th class="text-center w-15">Status</th>
<th class="text-center">Created At</th>
<th class="text-center">Last Update</th>
<th class="text-center" style="width: 15%;">Actions</th>
</tr>
</thead>
<tbody>
#foreach ($categories as $key=>$category)
<tr>
<td class="text-center">{{ $key+1 }}</td>
<td class="text-center text-capitalize">{{ $category->name }}</td>
<td class="text-center hidden-xs"><i class="{{ $category->icon }} fa-lg"></i></td>
<td class="text-center hidden-xs">{{ $category->order }}</td>
<td class="text-center text-capitalize">
<span class="btn btn-sm btn-pill #if($category->status == 'active') btn-primary #else btn-warning #endif">{{ $category->status }}</span>
</td>
<td class="text-center">{{ $category->created_at->format("Y-m-d g:i a") }}</td>
<td class="text-center">{{ $category->updated_at->format("Y-m-d g:i a") }}</td>
<td class="text-center">
<div class="btn-group">
Edit
<button class="btn btn-app" data-toggle="modal" data-target="#{{ $category->name.$category->id }}">Delete</button>
</div>
<!-- Modal -->
<div class="modal fade" id="{{ $category->name.$category->id }}" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-card-header">
<div class="row">
<h4 class="col-md-10">Delete Category</h4>
<ul class="card-actions col-md-2">
<li>
<button data-dismiss="modal" type="button"><i class="ion-close"></i></button>
</li>
</ul>
</div>
</div>
<div class="card-block">
<p>Are you sure, you want to delete category (<span class="text-capitalize">{{ $category->name }}</span>) ?</p>
<p>If you delete category, you will delete all category's products too.</p>
<p>Notice: if you want to hide category, you can update it's status to not active instad of delete it.</p>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
{!! Form::Open(['url' => route('category.delete', ['id' => $category->id]) ]) !!}
<button class="btn btn-app" type="submit" data-dismiss="modal"> Delete</button>
{!! Form::Close() !!}
</div>
</div>
</div>
</div>
<!-- End Modal -->
</td>
</tr>
#endforeach
</tbody>
</table>
#endsection
ajax code
<!-- Ajax code for category live search -->
<script type="text/javascript">
$('#cat_search').on('keyup',function(){
$value = $(this).val();
$.ajax({
type : 'get',
url : '{{ route('category.index') }}',
data:{'cat_search':$value},
dataType: 'json',
success:function(response){
//console.log(response);
});
});
})
</script>
the best way i can tell is to make a blade for that table and in controller just as usual return data to that view:
return view('your-blade-just-for-table')->with('data', $data);
and in your blade again as usual you render your data with laravel in your table
so laravel will return a blade to your ajax-success method
and in your success method you can do something like:
success: function (data) {
$('.list-group').html(data);
},
and wherever you want your table to be just put this div:
<div class="list-group" id="myFileContainer"></div>
I am stuck on my button "delete" when I try to delete a recording nothing happens.
In my StudentController I have that:
public function destroy($id)
{
$student = Student::find($id);
$student->delete();
return redirect()->route('student.index')
->with('success', 'Deleted successfully');
}
And in my index.blade.php I have that:
#section('content')
<div class="px-content">
<div class="page-header">
<div class="row">
<div class="col-md-4 text-xs-center text-md-left text-nowrap">
<h1><i class="px-nav-icon ion-android-apps"></i>List </h1>
</div>
<hr class="page-wide-block visible-xs visible-sm">
<!-- Spacer -->
<div class="m-b-2 visible-xs visible-sm clearfix"></div>
</div>
</div>
<div class="row">
<div class="panel">
<div class="panel-body">
<div class="table-responsive">
<table class="table">
<a class="btn btn-sm btn-success" href="{{ route('student.create') }}">Create</a>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
</thead>
#foreach($students as $student)
<tr>
<td> {{$student->firstname}}</td>
<td> {{$student->lastname}} </td>
<td>
<a class="btn btn-sm btn-warning" href="{{route('student.edit',$student->id)}}">Edit</a>
#csrf
#method('DELETE')
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</td>
</tr>
#endforeach
</table>
</div>
</div>
</div>
</div>
{!! $students->links() !!}
</div>
#endsection
For the folder route
Auth::routes();
route::resource('student','AdminController');
Route::PATCH('/update/{id}','AdminController#update');
I don't understand where is the problem ? I would like to know my error because I don't have of error message in fact.
Thank you in advance.
You are missing the form so surround your button with a form tag like this:
<form method="POST" action="{{ route('student.destroy', $student) }} ">
#csrf
#method('DELETE')
<button type="submit" class="btn btn-sm btn-danger">Delete</button>
</form>
The following is my controller Wordings_test.php code
The issue is I am not able to print #wording.product. Even though, I can print #wording.template_name.
Thanks
class Wordings_test extends Controller{
function show($f3)
{
$wordings = Wordings::all()->orderBy('id')->select()->toArray();
foreach ($wordings as $wording) {
$wording['product'] = ProductTypes::where(['id' =>
$wording['product_type_id']])->select()->getAttribute('name');
}
$f3->set('wordings',$wordings);
$this->render('admin/wordings/view')
}
The following is the template code view.html
<i class="fa fa-user-plus"></i> Add New Brokerage Head Group
<div class="row">
<div class="form-group">
<div class="tab-content">
<div id="brokerageheadlist" class="active in tab-pane fade">
<table class="table table-bordered adminTable" id="brokerageheadList">
<thead>
<tr>
<th>Wording</th>
<th>Product Type</th>
<th style="width:140px;">Controls</th>
</tr>
</thead>
<tbody>
<repeat group="{{ #wordings }}" value="{{ #wording }}">
<tr>
<td>{{ #wording.template_name }}</td>
<td>
{{ #wording.product }}
</td>
<td>
<a class="btn btn-sm btn-info showLoader" href="/admin/wordings/edit-wordings/{{ #wording.id }}">Edit</a>
<button type="button" class="btn btn-danger btn-sm" data-toggle="modal" data-target="#myModal{{#brokeragehead.id}}">Delete</button>
<div id="myModal{{#brokeragehead.id}}" class="modal fade" role="dialog">
<div class="modal-dialog">
My pagination works correctly, but when use search component it display only first page of result.
My page URL without search looks like:
http://localhost:8000/dictionary-management/postcode?page=2
And it's work correctly.
My first page URL with search:
http://localhost:8000/dictionary-management/postcode/search
and it's work correctly.
My second page URL with search:
http://localhost:8000/dictionary-management/postcode/search?page=2
and the is nothing to show, only blank page.
This is my Controller Search method:
public function search(Request $request) {
$constraints = [
'postcode' => $request['postcode'],
'address' => $request['address']
];
$postcodes = $this->doSearchingQuery($constraints);
return view('dictionary-mgmt/postcode/index', ['postcodes' => $postcodes, 'searchingVals' => $constraints]);
}
private function doSearchingQuery($constraints) {
$query = Postcode::query();
$fields = array_keys($constraints);
$index = 0;
foreach ($constraints as $constraint) {
if ($constraint != null) {
$query = $query->where( $fields[$index], 'like', '%'.$constraint.'%');
}
$index++;
}
return $query->Paginate(5);
}
This is my route :
Route::resource('dictionary-management/postcode', 'PostCodeController');
Route::post('dictionary-management/postcode/search', PosstCodeController#search')->name('postcode.search');
This is my index view :
#extends('dictionary-mgmt.postcode.base')
#section('action-content')
<!-- Main content -->
<section class="content">
<div class="box">
<div class="box-header">
<div class="row">
<div class="col-sm-8">
<h3 class="box-title">List kodów pocztowych</h3>
</div>
<div class="col-sm-4">
<a class="btn btn-primary pull-right" href="{{ route('postcode.create') }}">Dodaj nowy kod pocztowy</a>
</div>
</div>
</div>
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="col-sm-6"></div>
<div class="col-sm-6"></div>
</div>
<form method="POST" action="{{ route('postcode.search') }}">
{{ csrf_field() }}
#component('layouts.search', ['title' => 'Szukaj'])
#component('layouts.two-cols-search-row', ['items' => ['postcode', 'address'], 'title' => ['Kod','Adres'],
'oldVals' => [isset($searchingVals) ? $searchingVals['postcode'] : '', isset($searchingVals) ? $searchingVals['address'] : '']])
#endcomponent
#endcomponent
</form>
<div id="example2_wrapper" class="dataTables_wrapper form-inline dt-bootstrap">
<div class="row">
<div class="col-sm-12">
<table id="example2" class="table table-bordered table-hover dataTable" role="grid" aria-describedby="example2_info">
<thead>
<tr role="row">
<th width="5%">Kod pocztowy</th>
<th width="40%">Adres</th>
<th width="10%">Miejscowość</th>
<th width="10%">Województwo</th>
<th width="10%">Powiat</th>
<th>Akcja</th>
</tr>
</thead>
<tbody>
#foreach ($postcodes as $postcode)
<tr role="row" class="odd">
<td>{{ $postcode->postcode }}</td>
<td>{{ $postcode->address }}</td>
<td>{{ $postcode->city }}</td>
<td>{{ $postcode->voivodeship }}</td>
<td>{{ $postcode->county }}</td>
<td>
<form class="row" method="POST" action="{{ route('postcode.destroy', ['id' => $postcode->id]) }}" onsubmit = "return confirm('Czy napewno usunąć?')">
<input type="hidden" name="_method" value="DELETE">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<a href="{{ route('postcode.edit', ['id' => $postcode->id]) }}" class="btn btn-warning col-sm-3 col-xs-5 btn-margin">
Edytuj
</a>
<button type="submit" class="btn btn-danger col-sm-3 col-xs-5 btn-margin">
Usuń
</button>
</form>
</td>
</tr>
#endforeach
</tbody>
<tfoot>
<tr>
<th width="5%">Kod pocztowy</th>
<th width="40%">Adres</th>
<th width="10%">Miejscowość</th>
<th width="10%">Województwo</th>
<th width="10%">Powiat</th>
<th>Akcja</th>
</tr>
</tfoot>
</table>
</div>
</div>
<div class="row">
<div class="col-sm-5">
</div>
<div class="col-sm-7">
<div class="dataTables_paginate paging_simple_numbers" id="example2_paginate">
{{ $postcodes->links() }}
</div>
</div>
</div>
</div>
</div>
<!-- /.box-body -->
</div>
</section>
<!-- /.content -->
</div>
#endsection
And this is my search component:
<div class="row">
#php
$index = 0;
#endphp
#foreach ($items as $item)
<div class="col-md-6">
<div class="form-group">
#php
$stringFormat = strtolower(str_replace(' ', '', $item));
#endphp
<label for="input<?=$stringFormat?>" class="col-sm-3 control-label">{{$title[$index]}}</label>
<div class="col-sm-9">
<input value="{{isset($oldVals) ? $oldVals[$index] : ''}}" type="text" class="form-control" name="<?=$stringFormat?>" id="input<?=$stringFormat?>" placeholder="{{$title[$index]}}">
</div>
</div>
</div>
#php
$index++;
#endphp
#endforeach
</div>
Please help, I don't know where is my mistake...
Try this
{{ $postcodes->appends(request()->input())->links()}}
instead of {{ $postcodes->links() }}
I am using the button to display the details of the particular person using the data-toggle="modal" but the button is not performing any action. When I click the button I am not able to display any details of the user.
Route:
Route::get('document', 'PatientController#show');
Controller:
public function show()
{
$patient_user=patient_user::all();
return view('document')->with('patient_user',$patient_user);
}
View:
<form id="myForm" method="get">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="panel-body">
<table class="table table-striped table-bordered table-hover table-full-width" id="sample_1">
<thead>
<tr>
<th>Patient ID</th>
<th>Patient Name</th>
<th>Full Name</th>
<th>DOB</th>
<th>Ref. Name</th>
<th>Payment</th>
<th>Doc Status</th>
<th>Appointment</th>
<th>Action</th>
</tr>
</thead>
#foreach($patient_user as $key=>$row)
<tbody>
<tr>
<td>{{$row->patient_id}}</td>
<td>{{$row->patient_firstname}}</td>
<td>{{$row->patient_firstname}} {{$row->patient_lastname}}</td>
<td>{{$row->dob}}</td>
<td>{{$row->refering_physician_name}}</td>
<td>{{$row->dob}} </td>
<td>{{$row->dob}}</td>
<td>{{$row->app_date}}</td>
<td class="center">
<div class="visible-md visible-lg hidden-sm hidden-xs">
<i class="fa fa-edit"></i>
<i class="fa fa-eye"></i>
<i class="fa fa-times fa fa-white"></i>
</div>
</td>
</tr>
</tbody>
#endforeach
</table>
</div>
<div id="static" class="modal fade" tabindex="-1" data-backdrop="static" data-keyboard="false" style="display: none;">
<div class="modal-body">
<h4><i>Patient Details</i></h4>
</div>
<div class="modal-body">
<div class="col-md-12">
<div class="col-md-6">First Name</div>
<div class="col-md-5" id="fname"> {{ $row->patient_firstname}} </div>
</div>
<br>
<div class="col-md-12">
<div class="col-md-6">Middle Name</div>
<div class="col-md-5" id="mname"> {{ $row->middle_name}} </div>
</div>
<br>
<div class="col-md-12">
<div class="col-md-6">Last Name</div>
<div class="col-md-5" id="lname"> {{ $row->patient_lastname}} </div>
</div>
</div>
</div>
</form>
jquery:
<script type="text/javascript">
$('#static').on('show', function(e)
{
e.preventDefault();
var link = e.relatedTarget(),
modal = $(this),
patient_firstname = link.data("patient_firstname"),
middle_name = link.data(middle_name),
patient_lastname = link.data("patient_lastname"),
modal.find("#fname").val(patient_firstname);
modal.find("#mname").val(middle_name);
modal.find("#lname").val(patient_lastname);
});
</script>
where #static is my modal Id and the value within find are the id's of the particular fields and val are the database values.
The problem is that you're requesting data from attributes that are not set.
patient_firstname = link.data("patient_firstname"),
The above part is trying to retrieve the value of the attribute data-patient_firstname. Since the original link does not have this attribute there won't be any data.
Change
<i class="fa fa-eye"></i>
Into
<a href='#' data-toggle="modal"
data-patient_firstname="{{$row->patient_firstname}}" <-- do this for all requested vars
class="btn btn-xs btn-green tooltips" data-id="{{ $row->patient_id}}" data-target="static" onclick="pat_det{{ $row->patient_id }}" data-placement="top" data-original-title="View" id="pat_det"><i class="fa fa-eye"></i></a>
That way the data-* attributes will be availble.