edms2023/resources/views/dashboard/basic.blade.php

663 lines
32 KiB
PHP

@extends('layouts.master')
@section('content')
@php
$document_user = $profile = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', Auth::user()->id)
->select('users.*', 'roles.*', 'roles.id as role_id', 'users.id as id')
->first();
$profile_department = App\Department::where('id',$profile->department_id)->first();
$profile_name = $profile->getFullName();
$workflow_documents = App\WorkflowDocument::where('is_deleted', 0)->orderBy('id', 'desc')->get();
$workflow_types = App\WorkflowType::where('id', '<>', 4)->orderBy('id', 'asc')->get();
$setting = App\Setting::first();
if(isset($setting->dashboard_data_limit) && $setting->dashboard_data_limit > 0)
{
$limit_val = $setting->dashboard_data_limit;
}
else
{
$limit_val = 10;
}
if($profile->department_id == 7){
$approved_process = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->select('workflow_document_process.*')
->where('workflow_document_process.status', 'A')
->orderBy('workflow_document_process.updated_at', 'desc')
->limit($limit_val)
->get();
}else{
$approved_process = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->join('workflow_document_users', 'workflow_documents.id', '=', 'workflow_document_users.workflow_document_id')
->select('workflow_document_process.*')
->where('workflow_document_process.status', 'A')
->where('workflow_document_users.user_id', $profile->id)
->orderBy('workflow_document_process.updated_at', 'desc')
->limit($limit_val)
->get();
}
$active_proces_for_me = DB::table('workflow_document_process')
->where('user_id', $profile->id)
->where('status', "P")
->count();
$active_proces_by_me = DB::table('workflow_document_process')
->where('assign_by', $profile->id)
->where('status', "P")
->count();
$delayed_proces_for_me = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->where('workflow_document_process.user_id', $profile->id)
->where('workflow_document_process.status', "P")
->where('workflow_documents.due_date', "<", date("Y-m-d"))
->count();
$delayed_proces_by_me = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->where('workflow_document_process.assign_by', $profile->id)
->where('workflow_document_process.status', "P")
->where('workflow_documents.due_date', "<", date("Y-m-d"))
->count();
$completed_proces_for_me = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->where('workflow_document_process.user_id', $profile->id)
->whereIn('workflow_documents.status', ['Approved','Complete'])
->count();
$completed_proces_by_me = DB::table('workflow_documents')
->join('workflow_document_process', 'workflow_documents.id', '=', 'workflow_document_process.workflow_document_id')
->where('workflow_document_process.assign_by', $profile->id)
->whereIn('workflow_documents.status', ['Approved','Complete'])
->count();
$new_process = DB::table('workflow_document_users')
->where('user_id', $profile->id)
->where('is_read', '0')
->where('status', 'Y')
->count();
@endphp
<div class="page-header">
<h1 class="page-title">{{ __('Welcome') }} {{ $profile_name }}</h1>
<ol class="breadcrumb">
<li class="breadcrumb-item active">{{ __('Basic Dashboard') }}</li>
<li class="breadcrumb-item"><a href="{{route('dashboard.advanced')}}">{{ __('Advanced Dashboard') }}</a></li>
</ol>
</div>
<div class="page-content container-fluid">
<div class="row">
<!-- PROFILE -->
<div class="col-xxl-3 col-lg-3">
<div class="user-info card card-shadow text-center">
<div class="user-base card-block">
@if($profile->profile_picture && trim($profile->profile_picture)!='' && file_exists(public_path('uploads/user_folder/'.$profile->profile_picture)))
<a class="avatar img-bordered avatar-100" href="javascript:void(0)">
<img src='{{asset(env("UPLOADS_FOLDER") . "/" . env("USER_FOLDER") . "/" . $profile->profile_picture)}}' alt="{{ __('Profile Picture') }}" id="profile_picture_preview">
</a>
@endif
<h4 class="user-name">{{ $profile_name }}</h4>
<p class="user-job">
<button type="button" class="btn btn-warning"><i class="icon wb-user-circle" aria-hidden="true"></i> <b>{{ dataTranslation($profile->name) }}</b></button>
</p>
<p class="user-location"><a href="{{ route('profile') }}"><button type="button" class="btn btn-success"><i class="icon wb-edit" aria-hidden="true"></i> {{ __('UPDATE YOUR PROFILE') }}</button></a></p>
</div>
</div>
</div>
<!-- PROFILE -->
<div class="col-xxl-9 col-lg-9">
<div class="row">
@php
$sl=0;
@endphp
@foreach($workflow_types as $workflow_type)
@php
if($workflow_type->id == 2){
$status = 'Approved';
}else{
$status = 'Complete';
}
$doc_types = json_decode($workflow_type->name, true);
$doc_type = $doc_types['en'];
$total_documents = App\WorkflowDocumentUser::join('workflow_documents', 'workflow_document_users.workflow_document_id', '=', 'workflow_documents.id')
->where('workflow_documents.workflow_type_name', 'like', '%'.$doc_type.'%')
->where('workflow_documents.is_deleted', 0)
->where('workflow_document_users.user_id', Auth::user()->id)
->where('workflow_document_users.status', 'Y')
->select(DB::raw('count(workflow_documents.id) as row_count', 'workflow_documents.id'))
->get()
->toArray();
$active_documents = App\WorkflowDocumentUser::join('workflow_documents', 'workflow_document_users.workflow_document_id', '=', 'workflow_documents.id')
->where('workflow_documents.workflow_type_name', 'like', '%'.$doc_type.'%')
->where('workflow_documents.is_deleted', 0)
->where('workflow_document_users.user_id', $profile->id)
->where('workflow_document_users.status', 'Y')
->where('workflow_documents.status','!=', $status)
->select(DB::raw('count(workflow_documents.id) as row_count', 'workflow_documents.id'))
->get()
->toArray();
$complete_documents = App\WorkflowDocumentUser::join('workflow_documents', 'workflow_document_users.workflow_document_id', '=', 'workflow_documents.id')
->where('workflow_documents.workflow_type_name', 'like', '%'.$doc_type.'%')
->where('workflow_documents.is_deleted', 0)
->where('workflow_document_users.user_id', $profile->id)
->where('workflow_document_users.status', 'Y')
->where('workflow_documents.status','=', $status)
->select(DB::raw('count(workflow_documents.id) as row_count', 'workflow_documents.id'))
->get()
->toArray();
@endphp
<div class="col-xl-4 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm {{ $sl==0 ? 'btn-warning' : $sl==1 ? 'btn-danger' : 'btn-success'}}">
<i class="icon {{ $sl==0 ? 'wb-chevron-right' : $sl==1 ? 'wb-chevron-left' : 'wb-arrow-shrink'}}"></i>
</button>
<span class="ml-15 font-weight-400 text-uppercase">{{ dataTranslation($workflow_type->name) }} {{ __('Document') }}</span>
@if($sl==2)
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $total_documents[0]['row_count'] }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
@else
<div class="row">
<div class="col-xl-6 col-md-6 info-panel">
<i class="text-danger icon wb-triangle-up font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $active_documents[0]['row_count'] }}</span>
<p class="blue-grey-400 font-weight-100 m-0">{{ __('Active') }}</p>
</div>
<div class="col-xl-6 col-md-6 info-panel">
<i class="text-success icon wb-triangle-down font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $complete_documents[0]['row_count'] }}</span>
<p class="blue-grey-400 font-weight-100 m-0">{{ __('Complete') }}</p>
</div>
</div>
@endif
</div>
</div>
</div>
@php
$sl++;
@endphp
@endforeach
</div>
<div class="row">
<div class="col-xl-6 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-user"></i>
</button>
@php
$my_files_count = App\MyFile::where('user_id', Auth::user()->id)->where('is_temp', 0)->count();
@endphp
<span class="ml-15 font-weight-400">{{ __('PERSONAL FILES') }}</span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $my_files_count }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-6 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-users"></i>
</button>
@php
$SharedFilesCount=App\SharedFile::where('user_id', Auth::user()->id)->orWhere('department_id', Auth::user()->department_id)->count();
@endphp
<span class="ml-15 font-weight-400">{{ __('SHARED FILES') }}</span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $SharedFilesCount }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xxl-12 col-lg-12">
<div class="row">
<div id="" class="col-xl-12 col-md-12">
<h3>{{ __('Tasks Assigned to Me:') }} </h3>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-order"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('New') }}</span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $new_process }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('In Progress') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $active_proces_for_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('Delayed') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $delayed_proces_for_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('Completed') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $completed_proces_for_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div id="" class="col-xl-12 col-md-12">
<h3>{{ __('Tasks Assigned by Me to Others:') }} </h3>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('In Progress') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $active_proces_by_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('Delayed') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $delayed_proces_by_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
<div class="col-xl-3 col-md-6 info-panel">
<div class="card card-shadow">
<div class="card-block bg-white p-20">
<button type="button" class="btn btn-floating btn-sm btn-primary">
<i class="icon wb-edit"></i>
</button>
<span class="ml-15 font-weight-400">{{ __('Completed') }} </span>
<div class="content-text text-center mb-0">
<i class="text-danger icon font-size-20"></i>
<span class="font-size-40 font-weight-100">{{ $completed_proces_by_me }}</span>
<p class="blue-grey-400 font-weight-100 m-0">&nbsp;</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xxl-12 col-lg-12">
<div class="card card-shadow table-row">
<div class="card-header card-header-transparent py-20">
<div class="btn-group dropdown">
<b>{{ __('RECENT APPROVED DOCUMENTS') }}</b>
</div>
</div>
<div class="card-block bg-white table-responsive">
<table class="table table-hover dataTable table-striped w-full" data-plugin="dataTable">
<thead>
<tr>
<th>#</th>
<th>{{ __('REG. Number') }}</th>
<th>{{ __('Registration Date') }}</th>
<th>{{ __('Workflow Type') }}</th>
<th>{{ __('Topic') }}</th>
<th>{{ __('Status') }}</th>
<th>{{ __('Reviewer User') }}</th>
<th>{{ __('Supporter User') }}</th>
<th>{{ __('Creator') }}</th>
<th>{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@if (!empty($approved_process))
@php
$sl=0;
@endphp
@foreach($approved_process as $key=> $process)
@php
$bg_color='';
$document = App\WorkflowDocument::where('id', $process->workflow_document_id)->first();
$unread_user = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)
->where('user_id', Auth::user()->id)
->where('is_read', '0')
->where('status', 'Y')
->first();
if(isset($unread_user) && !empty($unread_user))
{
$bg_color="background-color: rgba(135, 243, 108, 0.57)";
}
$return_user_process = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->where('user_id', Auth::user()->id)->where('status', '=', 'R')->orderBy('id', 'desc')->first();
if(isset($process)){
$parent_user_process = App\WorkflowDocumentProcess::where('id', '=', $process->parent_id)->first();
if(isset($parent_user_process) && !empty($parent_user_process) && $parent_user_process->status == 'R' && $process->status=='P')
{
$bg_color="background-color: peachpuff";
}
}
$userAsSupporter = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)->where('user_type','=','S')->where('status', '=', 'Y')->where('user_id', '=', Auth::user()->id)->first();
$workflow_type = $workflow_types->where('id', $document->workflow_type_id)->first();
@endphp
<tr style="{{ $bg_color }}">
@php
$sl++;
@endphp
<td><b>{{ $sl }}</b></td>
<td><b>{{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }}</b></td>
<td><b>{{ $document->registration_date != '' ? date('d/m/Y', strtotime($document->registration_date)) : '' }}</b></td>
<td><b>{{ dataTranslation($workflow_type->name) }}</b></td>
<td><b>{{ $document->topic }}</b></td>
<td>
<button type="button" class="btn btn-success"><i class="icon {{($document->isSigned()) ? 'wb-lock' : 'wb-stats-bars'}}" aria-hidden="true"></i> <b>{{ __('Approved') }} </b></button>
</td>
@php
$senders = App\WorkflowDocumentSender::where('workflow_document_id', '=', $document->id)->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
<td>
@php
$reviewer = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->orderBy('id', 'desc')->first();
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $reviewer->user_id)
->select('users.*', 'roles.*', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).') ';
@endphp
<b>{{ $reviewer_user_name }}</b>
</td>
<td>
@php
$supporters = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)->where('user_type','=','S')->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
@if($supporters)
@foreach($supporters as $key => $supporter)
@php
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $supporter->user_id)
->select('users.*', 'roles.*', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b>
@if($key > 0)
<br>
@endif
@endforeach
@endif
</td>
<td><b>{{ $document->creator_name }}</b></td>
<td>
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('details', base64_encode($document->id)) }}#view_document" data-toggle="tooltip" data-original-title="{{ __('View') }}" style="{{ $bg_color }}"><i class="icon wb-eye" aria-hidden="true"></i></a>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="100%" class="text-center">{{ __('No record found') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
<div class="col-xxl-12 col-lg-12">
<div class="card card-shadow table-row">
<div class="card-header card-header-transparent py-20">
<div class="btn-group dropdown">
<b>{{ __('RECENT TASK ASSIGNED') }}</b>
</div>
</div>
<div class="card-block bg-white table-responsive">
<table class="table table-hover dataTable table-striped w-full" data-plugin="dataTable">
<thead>
<tr>
<th>#</th>
<th>{{ __('REG. Number') }}</th>
<th>{{ __('Registration Date') }}</th>
<th>{{ __('Workflow Type') }}</th>
<th>{{ __('Topic') }}</th>
<th>{{ __('Status') }}</th>
<th>{{ __('Reviewer User') }}</th>
<th>{{ __('Supporter User') }}</th>
<th>{{ __('Creator') }}</th>
<th>{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@if (!empty($workflow_documents))
@php
$sl=0;
@endphp
@foreach($workflow_documents->where('status', '!=', 'Complete') as $key=> $document)
@php
if($sl > $limit_val)
{
break;
}
$bg_color='';
$unread_user = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)
->where('user_id', Auth::user()->id)
->where('is_read', '0')
->where('status', 'Y')
->first();
if(isset($unread_user) && !empty($unread_user))
{
$bg_color="background-color: rgba(135, 243, 108, 0.57)";
}
$return_user_process = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->where('user_id', Auth::user()->id)->where('status', '=', 'R')->orderBy('id', 'desc')->first();
$user_process = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->where('user_id', Auth::user()->id)->orderBy('id', 'desc')->first();
$last_process = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id) ->where('user_type', '=', 'R')->orderBy('id', 'desc')->first();
if(isset($user_process)){
$parent_user_process = App\WorkflowDocumentProcess::where('id', '=', $user_process->parent_id)->first();
if(isset($parent_user_process) && !empty($parent_user_process) && $parent_user_process->status == 'R' && $user_process->status=='P')
{
$bg_color="background-color: peachpuff";
}
}
$userAsSupporter = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)->where('user_type','=','S')->where('status', '=', 'Y')->where('user_id', '=', Auth::user()->id)->first();
$workflow_type = $workflow_types->where('id', $document->workflow_type_id)->first();
@endphp
@if(!empty($user_process) && $user_process->status=='P')
@if(isset($last_process) && $last_process->status != 'A')
<tr style="{{ $bg_color }}">
@php
$sl++;
@endphp
<td><b>{{ $sl }} </b></td>
<td><b>{{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }}</b></td>
<td><b>{{ $document->registration_date != '' ? date('d/m/Y', strtotime($document->registration_date)) : '' }}</b></td>
<td><b>{{ dataTranslation($workflow_type->name) }}</b></td>
<td><b>{{ $document->topic }}</b></td>
<td>
<button type="button" class="btn btn-warning"><i class="icon wb-stats-bars" aria-hidden="true"></i> <b>{{ __('Pending') }}</b></button>
</td>
<td>
@php
$reviewer = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->orderBy('id', 'desc')->first();
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $reviewer->user_id)
->select('users.*', 'roles.*', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).') ';
@endphp
<b>{{ $reviewer_user_name }}</b>
</td>
<td>
@php
$supporters = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)->where('user_type','=','S')->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
@if($supporters)
@foreach($supporters as $key => $supporter)
@php
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $supporter->user_id)
->select('users.*', 'roles.*', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b>
@endforeach
@endif
</td>
<td><b>{{ $document->creator_name }}</b></td>
<td>
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('details', base64_encode($document->id)) }}#view_document" data-toggle="tooltip" data-original-title="{{ __('View') }}" style="{{ $bg_color }}"><i class="icon wb-eye" aria-hidden="true"></i></a>
</td>
</tr>
@endif
@elseif(!empty($userAsSupporter))
@if(isset($last_process) && $last_process->status != 'A')
<tr style="{{ $bg_color }}">
@php
$sl++;
@endphp
<td><b>{{ $sl }}</b></td>
<td><b>{{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }}</b></td>
<td><b>{{ $document->registration_date != '' ? date('d-m-Y', strtotime($document->registration_date)) : '' }}</b></td>
<td><b>{{ dataTranslation($workflow_type->name) }}</b></td>
<td><b>{{ $document->topic }}</b></td>
<td>
@if($document->status=='Complete')
<button type="button" class="btn btn-success"><i class="icon wb-stats-bars" aria-hidden="true"></i> <b>{{ __('Complete') }}</b></button>
@else
<button type="button" class="btn btn-warning"><i class="icon wb-stats-bars" aria-hidden="true"></i> <b>{{ __('Pending') }}</b></button>
@endif
</td>
<td>
@php
$reviewer = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->orderBy('id', 'desc')->first();
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $reviewer->user_id)
->select('users.*', 'roles.name as role_name', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$reviewer_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).') ';
@endphp
<b>{{ $reviewer_user_name }}</b>
</td>
<td>
@php
$supporters = App\WorkflowDocumentUser::where('workflow_document_id', '=', $document->id)->where('user_type','=','S')->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
@if($supporters)
@foreach($supporters as $key => $supporter)
@php
$user = App\User::join('role_user', 'users.id', '=', 'role_user.user_id')
->join('roles', 'role_user.role_id', '=', 'roles.id')
->where('users.id', '=', $supporter->user_id)
->select('users.*', 'roles.name as role_name', 'roles.id as role_id', 'users.id as id')
->first();
$user_department = App\Department::where('id',$user['department_id'])->first();
if(isset($user_department))
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).', '.dataTranslation($user_department->name).' Dep.)';
else
$supporter_user_name = $user['first_name'].' '.$user['last_name'].' - ('.dataTranslation($user['role_name']).') ';
@endphp
<b>{{ $supporter_user_name }}</b>
@endforeach
@endif
</td>
<td><b>{{ $document->creator_name }}</b></td>
<td>
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('details', base64_encode($document->id)) }}#view_document" data-toggle="tooltip" data-original-title="{{ __('View') }}" style="{{ $bg_color }}"><i class="icon wb-eye" aria-hidden="true"></i></a>
</td>
</tr>
@endif
@endif
@endforeach
@else
<tr>
<td colspan="100%" class="text-center">{{ __('No record found') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection