Files
streamline-emr/docker/_streamline-src/resources/views/users/index.blade.php
T

204 lines
8.1 KiB
PHP
Executable File

@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
@endpush
@section('content')
<div class="row bg-title">
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('users.user_management') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('users.dashboard') }}</a></li>
<li class="active">{{ __('users.users') }}</li>
</ol>
</div>
<!-- /.col-lg-12 -->
</div>
<!-- .row -->
<!--Flash messages at the top -->
<div>@include('flash::message')</div>
<!--<div class="white-box">-->
@if ($message = Session::get('success'))
<div class="alert alert-success">
<p>{{ $message }}</p>
</div>
@endif
@include('users.menu')
<div class="white-box">
{{ Form::open(['route' => 'find_users_by_role']) }}
<div class="row">
<div class="col-md-11">
<div class="col-md-3">
<div class="form-group">
{{ Form::label('role', __('Search by role')) }}
<select class="form-control compulsory" name="role">
@foreach($roles as $role)
<option value="{{ $role->id }}">{{ $role->name }}</option>
@endforeach
</select>
<div class="help-block with-errors"></div>
</div>
</div>
</div>
<div class="col-md-1">
{{ Form::button(__('audit_trail.search'), ['type' => 'submit', 'class' => 'btn btn-success waves-effect
waves-light m-r-10']) }}
</div>
</div>
{{ Form::close() }}
</div>
<div class="white-box">
<div class="table-responsive">
<table class="table color-table success-table">
<thead>
<tr>
<th>#</th>
<th>{{ __('users.names') }}</th>
<th>{{ __('users.username') }}</th>
<th>{{ __('users.phone_number') }}</th>
<th>{{ __('users.position') }}</th>
<th>{{ __('users.roles') }}</th>
<th>Last Logged In/Status</th>
<th>Created By</th>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@foreach ($data as $key => $user)
@php
$last_seen = Carbon\Carbon::parse($user->last_seen);
@endphp
<tr>
<td>{{ ++$i }}</td>
<td>{{ $user->first_name }} {{ $user->last_name }}</td>
<td>{{ $user->username }}</td>
<td>{{ $user->phone }}</td>
<td>{{ isset($positions[$user->position_id]) ? $positions[$user->position_id] : "N/A" }}</td>
<td>
@if(!empty($user->getRoleNames()))
@foreach($user->getRoleNames() as $v)
<span class="label label-success label-rounded badge">{{ $v }}</span>
@endforeach
@endif
</td>
<td>
@if(Cache::has('user-is-online-' . $user->id))
<span class="badge badge-success">Online</span>
@else
{{ $last_seen->diffForHumans() }}
<span class="badge badge-danger">Offline</span>
@endif
</td>
<td>{{ get_full_name($user->created_by, 'id', 'first_name', 'last_name', 'users') }} at {{ streamline_date_time($user->created_at) }}</td>
<td>
<a class="fcbtn btn btn-success btn-sm btn-1c" href="{{ route('users.show',$user->id) }}">{{ __('users.details') }}</a>
</td>
<td>
<a class="btn btn-info btn-sm" href="{{ route('users.edit',$user->id) }}">{{ __('users.edit') }}</a>
</td>
<td>
{!! Form::open(['method' => 'DELETE','route' => ['users.destroy', $user->id],'style'=>'display:inline']) !!}
{!! Form::submit(__('users.delete'), ['class' => 'btn btn-danger btn-sm']) !!}
{!! Form::close() !!}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
{{-- {!! $data->render() !!}--}}
</div>
<!-- /.row -->
@endsection
@push('scripts')
<!-- Data table javascript -->
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
<script src="{{ asset('elite/tables/js/buttons.colVis.min.js') }}"></script>
<script type="text/javascript">
$('document').ready(function () {
$('.table').DataTable({
dom: 'Bfrtip',
buttons: [
'copy',
{extend: 'csv',
message: '<?php echo __('users.list_of_users');?>',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
},
{extend: 'excel',
message: '<?php echo __('users.list_of_users');?>',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
sheetName: '<?php echo __('users.list_of_users');?>'
},
{extend: 'pdf',
message: '<?php echo __('users.list_of_users');?>',
orientation: 'portrait',
pageSize: 'LETTER',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (doc) {
doc.defaultStyle.fontSize = 10;
// doc.styles.tableHeader.alignment = 'left';
}
},
{extend: 'print',
message: '<?php echo __('users.list_of_users');?>',
exportOptions: {
columns: [0, 1, 2, 3, 4, 5, 6]
},
customize: function (win) {
$(win.document.body)
.css('font-size', '10pt')
.css('background', '#fff')
.prepend(
'<img src="<?php echo asset('uploads/logo/logo-sm.png'); ?>" style="position:absolute; top:0; right:0;" />'
);
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
}
}
]
});
$('.sorting').removeClass('sorting');//remove the sorting class
$('.sorting_asc').removeClass('sorting_asc');//remove the sorting class
});
</script>
@endpush