257 lines
13 KiB
PHP
257 lines
13 KiB
PHP
@extends('layouts.list_master')
|
|
|
|
@section('pageTitle', __('My Files'))
|
|
@section('content')
|
|
<link rel="stylesheet" href="{{ asset('global/vendor/select2/select2.css') }}">
|
|
<link rel="stylesheet" href="{{ asset('global/file-upload/uploadfile.css') }}">
|
|
<script src="{{ asset('global/vendor/select2/select2.full.min.js') }}"></script>
|
|
<script src="{{ asset('global/file-upload/jquery.form.js') }}"></script>
|
|
<script src="{{ asset('global/file-upload/jquery.uploadfile.js') }}"></script>
|
|
|
|
<div class="page-header">
|
|
<h1 class="page-title">{{ __('My Files') }}</h1>
|
|
</div>
|
|
|
|
<div class="page-content">
|
|
<div class="row">
|
|
<!-- LEFT SECTION -->
|
|
<div class="col-xxl-12 col-xl-12 col-lg-12">
|
|
<div class="card">
|
|
<div class="card-heading">
|
|
<ol class="breadcrumb">
|
|
<li class="breadcrumb-item"><a href="{{ route('my-files') }}">{{ __('My Files') }}</a></li>
|
|
@if ($parent_directories)
|
|
@foreach ($parent_directories as $k=>$v)
|
|
@if ($k == $last)
|
|
<li class="breadcrumb-item">{{$v}}</li>
|
|
<li class="breadcrumb-item"><a href="#" class="actions" id="create_object" data-href="{{ route('create-my-files', base64_encode($k))}}" title="{{__('Create New Directory')}}"><i class="icon wb-plus-circle text-success" aria-hidden="true"></i></a></li>
|
|
@else
|
|
<li class="breadcrumb-item active"><a href="{{ route('my-files', base64_encode($k)) }}">{{$v}}</a></li>
|
|
@endif
|
|
@endforeach
|
|
@else
|
|
<li class="breadcrumb-item"><a href="#" class="actions" id="create_object" data-href="{{ route('create-my-files')}}" title="{{__('Create New Directory')}}"><i class="icon wb-plus-circle text-success" aria-hidden="true"></i></a></li>
|
|
@endif
|
|
|
|
</ol>
|
|
</div>
|
|
<div class="card-block">
|
|
<table class="table table-hover dataTable table-striped w-full" data-plugin="dataTable">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ __('Type') }}</th>
|
|
<th>{{ __('File / Directory') }}</th>
|
|
<th>{{ __('Description') }}</th>
|
|
<th>{{ __('Creation Date') }}</th>
|
|
<th>{{ __('Last Modified') }}</th>
|
|
<th>{{ __('Action') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if($directories)
|
|
@foreach($directories->where('file_type', 0) as $directory)
|
|
<tr>
|
|
<td><a href="{{ route('my-files', base64_encode($directory->id)) }}"><i class="icon wb-folder" aria-hidden="true" style="font-size: 39px; color: #76838f;"></i></a></td>
|
|
<td>{{ $directory->name }}</td>
|
|
<td>{{ $directory->description }}</td>
|
|
<td>{{ $directory->created_at != '' ? date('d-m-Y H:i:s', strtotime($directory->created_at)) : ''}}</td>
|
|
<td>{{ $directory->updated_at != '' ? date('d-m-Y H:i:s', strtotime($directory->updated_at)) : ''}}</td>
|
|
<td>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('my-files', base64_encode($directory->id)) }}" data-toggle="tooltip" data-original-title="{{ __('View') }}"><i class="icon wb-eye" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1 actions" data-href="{{ route('edit-my-files', ['directory'=>base64_encode($directory->id)]) }}" data-toggle="tooltip" data-original-title="{{ __('Edit') }}"><i class="icon wb-pencil" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('share-my-files', ['directory'=>base64_encode($directory->id), 'type'=>'directory']) }}" data-toggle="tooltip" data-original-title="{{ __('Share') }}"><i class="icon wb-share" aria-hidden="true"></i></a>
|
|
{{-- <a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ $directory->getPathOrg() ?? ''}}" download><i class="icon fa fa-download" aria-hidden="true"></i></a> --}}
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" data-toggle="tooltip" data-original-title="{{ __('Delete') }}" onclick="confirm('Are you sure you want to delete this record? All the related data will be deleted also.') ? '' : event.preventDefault();" href="{{ route('delete-my-file', base64_encode($directory->id)) }}"><i class="icon wb-trash" aria-hidden="true"></i></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
|
|
@foreach ($directories->where('file_type', 1) as $directory)
|
|
<tr>
|
|
<td><a href="{{ route('view-my-files', base64_encode($directory->id)) }}" target="_blank"><i class="icon wb-file" aria-hidden="true" style="font-size: 39px; color: #76838f;"></i></a></td>
|
|
<td>{{ $directory->getName() }}</td>
|
|
<td>{{ $directory->description }}</td>
|
|
<td>{{ $directory->created_at != '' ? date('d-m-Y H:i:s', strtotime($directory->created_at)) : ''}}</td>
|
|
<td>{{ $directory->updated_at != '' ? date('d-m-Y H:i:s', strtotime($directory->updated_at)) : ''}}</td>
|
|
<td>
|
|
{{-- @if(in_array(strtolower($directory->getFileType()),['jpeg','png','jpg','pdf', 'gif']))
|
|
@endif --}}
|
|
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('view-my-files', base64_encode($directory->id)) }}" data-toggle="tooltip" data-original-title="{{ __('View') }}" target="_blank" ><i class="icon wb-eye" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1 actions" data-href="{{ route('edit-my-files', base64_encode($directory->id)) }}" data-toggle="tooltip" data-original-title="{{ __('Edit') }}"><i class="icon wb-pencil" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('share-my-files', base64_encode($directory->id)) }}" data-toggle="tooltip" data-original-title="{{ __('Share') }}"><i class="icon wb-share" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('download-my-files', base64_encode($directory->id)) }}"><i class="icon fa fa-download" aria-hidden="true"></i></a>
|
|
{{-- <a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ $directory->getPathOrg() ?? ''}}" download><i class="icon fa fa-download" aria-hidden="true"></i></a> --}}
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" onclick="confirm('Are you sure you want to delete this record? All the related data will be deleted also.') ? '' : event.preventDefault();" href="{{ route('delete-my-file', base64_encode($directory->id)) }}" data-toggle="tooltip" data-original-title="{{ __('Delete') }}"><i class="icon wb-trash" aria-hidden="true"></i></a>
|
|
</td>
|
|
</tr>
|
|
@endforeach
|
|
@endif
|
|
|
|
{{-- @foreach(App\MyFile::where('directory_id', $parent_id)->where('user_id', Auth::user()->id)->where('is_temp', 0)->get() as $myfile)
|
|
@if($myfile->files_name && trim($myfile->files_name) !='' && file_exists(public_path($myfile->place_of_the_files.'/'.$myfile->files_name)))
|
|
@php
|
|
$full_file_path = '/'.$myfile->place_of_the_files.'/'.$myfile->files_name;
|
|
$type_array = explode('.', $myfile->files_name);
|
|
$type = end($type_array);
|
|
@endphp
|
|
<tr>
|
|
<td><a href="{{ route('view-my-files', base64_encode($myfile->id)) }}"><i class="icon wb-file" aria-hidden="true" style="font-size: 39px; color: #76838f;"></i></a></td>
|
|
<td>{{ $myfile->files_name }}</td>
|
|
<td>{{ $myfile->description }}</td>
|
|
<td>{{ $myfile->created_at != '' ? date('d-m-Y H:i:s', strtotime($myfile->created_at)) : ''}}</td>
|
|
<td>{{ $myfile->updated_at != '' ? date('d-m-Y H:i:s', strtotime($myfile->updated_at)) : ''}}</td>
|
|
<td>
|
|
@if(in_array(strtolower($type),['jpeg','png','jpg','pdf', 'gif']))
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" target="_blank" href="{{ route('view-my-files', base64_encode($myfile->id)) }}" data-toggle="tooltip" data-original-title="{{ __('View') }}" target="_blank" ><i class="icon wb-eye" aria-hidden="true"></i></a>
|
|
@endif
|
|
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1 actions" data-href="{{ route('edit-my-files', ['directory'=>base64_encode($myfile->id), 'type'=>'file']) }}" data-toggle="tooltip" data-original-title="{{ __('Edit') }}"><i class="icon wb-pencil" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ route('share-my-files', ['directory'=>base64_encode($myfile->id), 'type'=>'file']) }}" data-toggle="tooltip" data-original-title="{{ __('Share') }}"><i class="icon wb-share" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" href="{{ $full_file_path }}" download><i class="icon fa fa-download" aria-hidden="true"></i></a>
|
|
<a class="btn btn-sm btn-icon btn-default btn-outline btn-round m-1" onclick="confirm('Are you sure you want to delete this record? All the related data will be deleted also.') ? '' : event.preventDefault();" href="{{ route('delete-file', base64_encode($myfile->id)) }}" data-toggle="tooltip" data-original-title="{{ __('Delete') }}"><i class="icon wb-trash" aria-hidden="true"></i></a>
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
@endforeach --}}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal actions -->
|
|
<div class="modal fade right" data-keyboard="false" data-backdrop="static" id="modal-action" tabindex="-1" role="dialog" aria-labelledby="modelTitleId" aria-hidden="true">
|
|
<div class="modal-dialog modal-lg modal-dialog-scrollable" role="document">
|
|
<div class="modal-content" id="action-content">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$(".select2").select2({width: 'resolve'});
|
|
$(".add-form").validationEngine('attach',{scroll:false});
|
|
</script>
|
|
<script>
|
|
$(document).ready(function(){
|
|
|
|
$('.actions').on('click', function(){
|
|
getCreateObject($(this).data('href'));
|
|
$('#modal-action').modal('show');
|
|
});
|
|
|
|
});
|
|
|
|
function uploadFile()
|
|
{
|
|
var settings = {
|
|
url: "{{ route('store-files') }}",
|
|
method: "POST",
|
|
allowedTypes:"{{ $setting->allowed_uploaded_file_type }}",
|
|
fileName: "files",
|
|
multiple: true,
|
|
showDelete: true,
|
|
maxFileSize: eval("{{ $setting->user_file_size_limit }}") * 1024 * 1024,
|
|
returnType: "json",
|
|
dragDropStr: "<span><b>{{ __('Click Or Drop Files To Upload.') }}</b></span>",
|
|
abortStr:"{{ __('Delete') }}",
|
|
deleteStr:"<?php echo __('Delete') ?>",
|
|
|
|
uploadStr:"{{ __('Upload') }}",
|
|
onSuccess:function(files,data,xhr)
|
|
{
|
|
// console.log(data);
|
|
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>");
|
|
}
|
|
setTimeout(function(){
|
|
$("#status").html("");
|
|
}, 5000);
|
|
|
|
},
|
|
onError: function(files,status,errMsg)
|
|
{
|
|
$("#status").html("<font color='red'><?php echo __('Upload is Failed') ?></font>");
|
|
setTimeout(function(){
|
|
$("#status").html("");
|
|
}, 5000);
|
|
},
|
|
deleteCallback: function (data, pd) {
|
|
$.ajax({
|
|
cache: false,
|
|
url: "{{ route('store-files-delete') }}",
|
|
data: data[0]['data'],
|
|
type: "POST",
|
|
success: function(textStatus)
|
|
{
|
|
if(data[0]['data']['id'] !== null){
|
|
var new_id_val='';
|
|
var old_id_val = document.getElementById("file_ids").value;
|
|
var current_id = data[0]['data']['id'];
|
|
if(old_id_val.indexOf(current_id+';') > 0){
|
|
new_id_val = old_id_val.replace(current_id+';','');
|
|
}else if(old_id_val.indexOf(';'+current_id) > 0){
|
|
new_id_val = old_id_val.replace(';'+current_id,'');
|
|
}else if(old_id_val.indexOf(current_id) > 0){
|
|
new_id_val = old_id_val.replace(current_id,'');
|
|
}
|
|
document.getElementById("file_ids").value = new_id_val;
|
|
$("#status").html("<font color='red'>"+textStatus+"</font>");
|
|
setTimeout(function(){
|
|
$("#status").html("");
|
|
}, 5000);
|
|
}
|
|
}
|
|
});
|
|
pd.statusbar.hide(); //You choice.
|
|
},
|
|
}
|
|
$("#mulitplefileuploader").uploadFile(settings);
|
|
}
|
|
|
|
function getCreateObject(href_v)
|
|
{
|
|
$.ajax({
|
|
url: href_v,
|
|
method: 'GET',
|
|
cache: false,
|
|
dataType: 'json',
|
|
async: false,
|
|
success: function(result)
|
|
{
|
|
$('#action-content').html(result.data);
|
|
uploadFile();
|
|
},
|
|
error: function(result){
|
|
alert('Refresh page...');
|
|
location.reload(true);
|
|
}
|
|
});
|
|
};
|
|
|
|
|
|
</script>
|
|
@endsection
|