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

264 lines
12 KiB
PHP

@php
if($workflow_document->workflow_type_id == 1)
$type_para = "Incoming";
elseif($workflow_document->workflow_type_id == 2)
$type_para = "Outgoing";
elseif($workflow_document->workflow_type_id == 3)
$type_para = "Internal";
else
$type_para = "Incoming";
@endphp
<div class="page-header">
<h1 class="page-title">{{ __('View 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 '.$type_para.' 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="row">
<!-- LEFT SECTION -->
@if(in_array($workflow_document->workflow_type_id,['2','3']))
@php
$last_process = App\WorkflowDocumentProcess::where('workflow_document_id', '=', $workflow_document->id)->orderBy('id', 'desc')->first();
@endphp
<div class="col-xxl-8 col-xl-8 col-lg-12">
<div class="panel">
<div class="panel-body">
@if($workflow_document->is_workflow_free !=1)
<table class="table table-hover table-striped w-full">
<thead>
<tr>
<th>#</th>
<th>{{ __('Version') }}</th>
<th>{{ __('Status') }}</th>
<th>{{ __('Date') }}</th>
<th>{{ __('Action') }}</th>
</tr>
</thead>
<tbody>
@php
$workflow_files = App\WorkflowDocumentFile::where('workflow_document_id', $workflow_document->id)->where('is_signed',0)->orderBy('id', 'desc')->get();
@endphp
@if(!empty($workflow_files))
@php
$sl=0;
@endphp
@foreach($workflow_files as $key => $workflow_file)
@if($workflow_file->document_name && trim($workflow_file->document_name)!='' && file_exists(public_path($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name)))
@php
$sl++;
$file_url = $workflow_file->place_of_the_documents.'/'.$workflow_file->document_name;
if($key == 0)
{
$top_version = $workflow_file->version;
}
@endphp
<tr>
<td>{{ $sl }}</td>
<td>{{ __('Version') }} {{ $workflow_file->version }}</td>
<td>
@if($workflow_document->is_rejected =='1')
<button type="button" class="btn btn-danger"><b>{{ __('Rejected') }}</b></button>
@elseif(($last_process->status=='A' || $workflow_document->status == 'Complete' || $workflow_document->status=='Approved') && $top_version == $workflow_file->version )
<button type="button" class="btn btn-success"><i class="icon {{($workflow_document->isSigned()) ? 'wb-lock' : 'wb-stats-bars'}}" aria-hidden="true"></i> <b>{{ __('Approved') }} </b></button>
@elseif($workflow_file->status=='Y')
<button type="button" class="btn btn-success"><b>{{ __('Active') }}</b></button>
@else
<button type="button" class="btn btn-warning"><b>{{ __('Inactive') }}</b></button>
@endif
</td>
<td><b>{{ $workflow_file->created_at != '' ? date('d/m/Y', strtotime($workflow_file->created_at)) : '' }}</b></td>
<td>
<a class="btn btn-primary" href="{{ asset($file_url) }}" download>
<i class="icon wb-download" aria-hidden="true"></i>
</a>
@php
$prv_path = (file_exists(public_path($workflow_file->place_of_the_documents . '/' . pathinfo($workflow_file->document_name, PATHINFO_FILENAME) . '.pdf'))) ? $workflow_file->place_of_the_documents . '/' . pathinfo($workflow_file->document_name, PATHINFO_FILENAME) . '.pdf' : '';
@endphp
<a class="btn btn-primary" href="{{ asset($prv_path) }}" target="_blank">
<i class="fa fa-eye" aria-hidden="true"></i>
</a>
</td>
</tr>
@endif
@endforeach
@else
<tr>
<td colspan="100%" class="text-center">{{ __('No record found') }}</td>
</tr>
@endif
</tbody>
</table>
@endif
@if($last_process->status=='A')
@php
$signed_workflow_files = App\WorkflowDocumentFile::where('workflow_document_id', $workflow_document->id)->where('is_signed',1)->orderBy('id', 'desc')->get();
@endphp
<div class="row">
<div class="col-md-12">
<h3 class="mt-4">{{ __('Signed Document') }}:</h3>
<div class="row">
@if(!empty($signed_workflow_files))
@foreach($signed_workflow_files as $key => $workflow_file)
@if($workflow_file->document_name && trim($workflow_file->document_name)!='' && file_exists(public_path($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name)))
@php
$type_array=explode('.',$workflow_file->document_name);
$type=end($type_array);
@endphp
@if(in_array(strtolower($type),['jpeg','png','jpg']))
<a class="col-6" href="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" download>
<img src="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" class="img-bordered " style="max-width:100%">
</a>
@elseif(in_array(strtolower($type),['pdf']))
<object data="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" type="application/pdf" width="100%" height="800"></object>
@else
<a class="col-6" href="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" download>
<span class="hidden-sm-down">{{ $workflow_file->document_name }}</span>&nbsp;&nbsp;
<i class="icon wb-download" aria-hidden="true"></i>
</a>
@endif
@endif
@endforeach
@endif
</div>
@if(check_permissions(3) === true ) <!-- Upload Scanned version of Outgoing Document -->
<form method="post" action="{{ route('store-signed-documents', base64_encode($workflow_document->id)) }}" id="add-form" autocomplete="off" enctype="multipart/form-data">
@csrf
<div class="row">
<div class="form-group col-md-12">
<div id="signed_documents">Upload</div>
<div id="status"></div>
<div>
<input type="text" name="file_ids" value="" id="file_ids" class="validate[required]" style="visibility: hidden;">
</div>
</div>
</div>
<div class="form-group">
<button type="submit" class="btn btn-success" id="uploadBtn"><i class="icon wb-check" aria-hidden="true"></i> {{ __('SAVE') }}</button>
</div>
</form>
<script>
$(document).ready(function(){
var settings = {
url: "{{ route('store-process-files') }}",
method: "POST",
allowedTypes:"{{ $setting->allowed_uploaded_file_type }}",
fileName: "files",
multiple: true,
showDelete: true,
returnType: "json",
dragDropStr: "<span><b>{{ __('Click Or Drop Files To Upload.') }}</b></span>",
abortStr:"{{ __('Delete') }}",
deleteStr:"<?php echo __('Delete') ?>",
uploadStr:"<?php echo __('Upload') ?>",
onSuccess:function(files,data,xhr)
{
var pre_id_val = document.getElementById("file_ids").value;
if(data && data.length > 0)
{
$.each(data, function(key, val){
if(pre_id_val != '')
{
pre_id_val += ";" + val.data.id ;
}
else
{
pre_id_val = val.data.id ;
}
});
}
document.getElementById("file_ids").value = pre_id_val;
if(data!="")
{
$("#status").html("<font color='green'><?php echo __('Upload is success') ?></font>");
}
else
{
$("#status").html("<font color='red'><?php echo __('Upload is Failed') ?></font>");
}
},
onError: function(files,status,errMsg)
{
$("#status").html("<font color='red'><?php echo __('Upload is Failed') ?></font>");
},
deleteCallback: function (data, pd) {
$.ajax({
cache: false,
url: "{{ route('store-process-files-delete') }}",
data: data[0]['data'],
type: "POST",
success: function(textStatus)
{
alert(textStatus);
}
});
pd.statusbar.hide(); //You choice.
},
}
$("#signed_documents").uploadFile(settings);
});
</script>
@endif
</div>
</div>
@endif
</div>
</div>
</div>
@else
<div class="col-xxl-8 col-xl-8 col-lg-12">
@php
$workflow_files = App\WorkflowDocumentFile::where('workflow_document_id', $workflow_document->id)->where('status', 'Y')->get();
@endphp
<div class="row">
@if(!empty($workflow_files))
@foreach($workflow_files as $key => $workflow_file)
@if($workflow_file->document_name && trim($workflow_file->document_name)!='' && file_exists(public_path($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name)))
@php
$type_array=explode('.',$workflow_file->document_name);
$type=end($type_array);
@endphp
@if(in_array(strtolower($type),['jpeg','png','jpg']))
<a class="col-12" href="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" download>
<span class="hidden-sm-down">{{ $workflow_file->document_name }}</span>&nbsp;&nbsp;
<i class="icon wb-download" aria-hidden="true"></i>
</a>
<img src="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" class="img-bordered " style="max-width:100%">
@elseif(file_exists(public_path($workflow_file->place_of_the_documents . '/' . pathinfo($workflow_file->document_name, PATHINFO_FILENAME) . '.pdf')))
<a class="col-6" href="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" download>
<span class="hidden-sm-down">{{ $workflow_file->document_name }}</span>&nbsp;&nbsp;
<i class="icon wb-download" aria-hidden="true"></i>
</a>
<object data="{{ asset($workflow_file->place_of_the_documents.'/'. pathinfo($workflow_file->document_name, PATHINFO_FILENAME) . '.pdf') }}" type="application/pdf" width="100%" height="800"></object>
@else
<a class="col-12" href="{{ asset($workflow_file->place_of_the_documents.'/'.$workflow_file->document_name) }}" download>
<span class="hidden-sm-down">{{ $workflow_file->document_name }}</span>&nbsp;&nbsp;
<i class="icon wb-download" aria-hidden="true"></i>
</a>
<img src="{{ asset('global/no-preview.png') }}" class="col-md-12 img-bordered " style="max-width:100%">
@endif
@endif
@endforeach
@endif
</div>
</div>
@endif
<!-- LEFT SECTION -->
<!-- RIGHT SECTION -->
@include('document-workflows.view_reply_right_section')
<!-- RIGHT SECTION -->
</div>
</div>