edms2023/resources/views/document-workflows/related_documents.blade.php

235 lines
11 KiB
PHP

@php
if($workflow_document->workflow_type_id == 1)
$type_para = "Incoming";
elseif($workflow_document->workflow_type_id == 2)
$type_para = "Outgoing";
else
$type_para = "Incoming";
@endphp
<div class="page-header">
<h1 class="page-title">{{ __('View Related Document') }}</h1>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="javascript: void(0);">{{ __('Dashboard') }}</a></li>
<li class="breadcrumb-item"><a href="{{ route('documents', $type_para) }}">{{ __(''.$type_para.' Documents') }}</a></li>
<li class="breadcrumb-item active">{{ __('View Related Document') }}</li>
</ol>
<div class="page-header-actions">
<a class="btn btn-dark" href="{{ route('documents', $type_para) }}">
<i class="icon wb-arrow-left" aria-hidden="true"></i>
<span class="hidden-sm-down">{{ __('Back To '.$type_para.' Document') }}</span>
</a>
</div>
</div>
<div class="page-content">
<div class="panel">
<div class="panel-body">
<div class="row">
<div class="form-group col-md-7">
<h4 class="card-title project-title">
{{ __('Lists Of Related Documents') }}
</h4>
</div>
</div>
<hr/>
<div class="row">
<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>{{ __('Topic') }}</th>
<th>{{ __('Status') }}</th>
@if($type!='Outgoing' && $type!='outgoing')
<th>{{ __('Sender') }}</th>
<th>{{ __('Sender Letter No') }}</th>
<th>{{ __('Sender Letter Date') }}</th>
@endif
<th>{{ __('Reviewer User') }}</th>
<th>{{ __('Supporter User') }}</th>
<th>{{ __('Creator') }}</th>
<th>{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@php
$sl=0;
$related_documents = json_decode($workflow_document->related_documents, true);
@endphp
@if (!empty($related_documents))
@foreach($related_documents as $key=> $related_document)
@php
$document = App\WorkflowDocument::where('id', $related_document)->first();
@endphp
<tr>
@php
$sl++;
@endphp
<td><b>{{ $sl }}</b></td>
<td><b>{{ $document->registration_number }}</b></td>
<td><b>{{ $document->registration_date != '' ? date('d/m/Y', strtotime($document->registration_date)) : '' }}</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>
@if($type!='Outgoing' && $type!='outgoing')
@php
$senders = App\WorkflowDocumentSender::where('workflow_document_id', '=', $document->id)->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
<td>
@if($senders)
@foreach($senders as $sender)
<b>{{ $sender->contact_organization_name }}</b><br>
@endforeach
@endif
</td>
<td><b>{{ $document->sender_letter_number }}</b></td>
<td><b>{{ $document->sender_letter_date != '' ? date('d/m/Y', strtotime($document->sender_letter_date)) : '' }}</b></td>
@endif
<td>
@php
$reviewer_user_name='';
$reviewer = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->orderBy('id', 'desc')->first();
if(isset($reviewer)){
$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') }}" target="_blank"><i class="icon wb-eye" aria-hidden="true"></i></a>
</td>
</tr>
@endforeach
@endif
<!-- REPLY DOCUMENT START -->
@php
$document = App\WorkflowDocument::where('reply_for', $workflow_document->id)->first();
@endphp
@if($document !== null)
<tr>
@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>{{ $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>
@if($type!='Outgoing' && $type!='outgoing')
@php
$senders = App\WorkflowDocumentSender::where('workflow_document_id', '=', $document->id)->where('status', '=', 'Y')->orderBy('id', 'asc')->get();
@endphp
<td>
@if($senders)
@foreach($senders as $sender)
<b>{{ $sender->contact_organization_name }}</b><br>
@endforeach
@endif
</td>
<td><b>{{ $document->sender_letter_number }}</b></td>
<td><b>{{ $document->sender_letter_date != '' ? date('d/m/Y', strtotime($document->sender_letter_date)) : '' }}</b></td>
@endif
<td>
@php
$reviewer_user_name='';
$reviewer = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $document->id)->orderBy('id', 'desc')->first();
if(isset($reviewer)){
$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') }}" target="_blank"><i class="icon wb-eye" aria-hidden="true"></i></a>
</td>
</tr>
@endif
@if($document === null && empty($related_documents))
<tr>
<td colspan="100%" class="text-center">{{ __('No record found') }}</td>
</tr>
@endif
</tbody>
</table>
</div>
</div>
</div>
</div>