@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
@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
{{ dataTranslation($workflow_type->name) }} {{ __('Document') }} @if($sl==2)
{{ $total_documents[0]['row_count'] }}

 

@else
{{ $active_documents[0]['row_count'] }}

{{ __('Active') }}

{{ $complete_documents[0]['row_count'] }}

{{ __('Complete') }}

@endif
@php $sl++; @endphp @endforeach
@php $my_files_count = App\MyFile::where('user_id', Auth::user()->id)->where('is_temp', 0)->count(); @endphp {{ __('PERSONAL FILES') }}
{{ $my_files_count }}

 

@php $SharedFilesCount=App\SharedFile::where('user_id', Auth::user()->id)->orWhere('department_id', Auth::user()->department_id)->count(); @endphp {{ __('SHARED FILES') }}
{{ $SharedFilesCount }}

 

{{ __('Tasks Assigned to Me:') }}

{{ __('New') }}
{{ $new_process }}

 

{{ __('In Progress') }}
{{ $active_proces_for_me }}

 

{{ __('Delayed') }}
{{ $delayed_proces_for_me }}

 

{{ __('Completed') }}
{{ $completed_proces_for_me }}

 

{{ __('Tasks Assigned by Me to Others:') }}

{{ __('In Progress') }}
{{ $active_proces_by_me }}

 

{{ __('Delayed') }}
{{ $delayed_proces_by_me }}

 

{{ __('Completed') }}
{{ $completed_proces_by_me }}

 

@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 @php $sl++; @endphp @php $senders = App\WorkflowDocumentSender::where('workflow_document_id', '=', $document->id)->where('status', '=', 'Y')->orderBy('id', 'asc')->get(); @endphp @endforeach @else @endif
# {{ __('REG. Number') }} {{ __('Registration Date') }} {{ __('Workflow Type') }} {{ __('Topic') }} {{ __('Status') }} {{ __('Reviewer User') }} {{ __('Supporter User') }} {{ __('Creator') }} {{ __('Action') }}
{{ $sl }} {{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }} {{ $document->registration_date != '' ? date('d/m/Y', strtotime($document->registration_date)) : '' }} {{ dataTranslation($workflow_type->name) }} {{ $document->topic }} @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 {{ $reviewer_user_name }} @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 {{ $supporter_user_name }} @if($key > 0)
@endif @endforeach @endif
{{ $document->creator_name }}
{{ __('No record found') }}
@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') @php $sl++; @endphp @endif @elseif(!empty($userAsSupporter)) @if(isset($last_process) && $last_process->status != 'A') @php $sl++; @endphp @endif @endif @endforeach @else @endif
# {{ __('REG. Number') }} {{ __('Registration Date') }} {{ __('Workflow Type') }} {{ __('Topic') }} {{ __('Status') }} {{ __('Reviewer User') }} {{ __('Supporter User') }} {{ __('Creator') }} {{ __('Action') }}
{{ $sl }} {{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }} {{ $document->registration_date != '' ? date('d/m/Y', strtotime($document->registration_date)) : '' }} {{ dataTranslation($workflow_type->name) }} {{ $document->topic }} @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 {{ $reviewer_user_name }} @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 {{ $supporter_user_name }} @endforeach @endif {{ $document->creator_name }}
{{ $sl }} {{ $document->registration_number != '' ? $document->registration_number : $document->temporary_registration_number }} {{ $document->registration_date != '' ? date('d-m-Y', strtotime($document->registration_date)) : '' }} {{ dataTranslation($workflow_type->name) }} {{ $document->topic }} @if($document->status=='Complete') @else @endif @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 {{ $reviewer_user_name }} @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 {{ $supporter_user_name }} @endforeach @endif {{ $document->creator_name }}
{{ __('No record found') }}
@endsection