[c6b84df] | 1 | @extends('layouts.app')
|
---|
| 2 |
|
---|
| 3 | @section("title", "SaveSpace - Folder")
|
---|
| 4 |
|
---|
| 5 | @section('content')
|
---|
| 6 |
|
---|
| 7 | <div class="row app-block mb-4">
|
---|
| 8 | <div class="col-md-3 app-sidebar">
|
---|
| 9 | <div class="card">
|
---|
[4521f25] | 10 | <div class="card-body">
|
---|
| 11 | @if(auth()->user()->hasPermission('manage_all_files'))
|
---|
| 12 | <a href="javascript:void(0)" class="btn btn-secondary btn-block file-upload-btn text-white" data-toggle="modal" data-target="#uploadFiles_{{$folder->id}}">
|
---|
| 13 | Upload files
|
---|
| 14 | </a>
|
---|
| 15 | @endif
|
---|
| 16 | </div>
|
---|
[c6b84df] | 17 | <div class="app-sidebar-menu">
|
---|
| 18 | <div class="list-group list-group-flush">
|
---|
| 19 | <a href="{{route("dashboard.folders.index")}}" class="list-group-item d-flex align-items-center">
|
---|
| 20 | <i data-feather="folder" class="width-15 height-15 mr-2"></i>
|
---|
| 21 | Folders
|
---|
| 22 | </a>
|
---|
| 23 | @foreach($folders as $obj)
|
---|
[4521f25] | 24 | @if($obj == $folder)
|
---|
| 25 | <a href="{{ route("dashboard.folders.files", ["id" => $folder->id]) }}" class="list-group-item d-flex align-items-center" style="font-weight: bold;">
|
---|
[c6b84df] | 26 | <i data-feather="folder" class="width-15 height-15 mr-2"></i>
|
---|
[ec7b69d] | 27 | {{$folder->name}} v.{{$folder->version}}
|
---|
[4521f25] | 28 | <span class="small ml-auto">{{$folder->files->count()}}</span>
|
---|
[c6b84df] | 29 | </a>
|
---|
[4521f25] | 30 | @else
|
---|
| 31 | <a href="{{ route("dashboard.folders.files", ["id" => $obj->id]) }}" class="list-group-item d-flex align-items-center">
|
---|
| 32 | <i data-feather="folder" class="width-15 height-15 mr-2"></i>
|
---|
[ec7b69d] | 33 | {{$obj->name}} v.{{$obj->version}}
|
---|
[4521f25] | 34 | <span class="small ml-auto">{{$obj->files->count()}}</span>
|
---|
| 35 | </a>
|
---|
| 36 | @endif
|
---|
[c6b84df] | 37 | @endforeach
|
---|
| 38 | </div>
|
---|
| 39 | </div>
|
---|
| 40 | </div>
|
---|
| 41 | </div>
|
---|
| 42 | <div class="col-md-9 app-content">
|
---|
| 43 | <div class="app-content-overlay"></div>
|
---|
| 44 | <div class="app-action">
|
---|
| 45 | <div class="action-left">
|
---|
| 46 | <ul class="list-inline">
|
---|
| 47 | <li class="list-inline-item mb-0">
|
---|
[0df7a93] | 48 | @if(auth()->user()->hasPermission('download_data'))
|
---|
[c6b84df] | 49 | <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="btn btn-outline-light">
|
---|
| 50 | Download folder
|
---|
| 51 | </a>
|
---|
[0df7a93] | 52 | @endif
|
---|
[c6b84df] | 53 | </li>
|
---|
| 54 | </ul>
|
---|
| 55 | </div>
|
---|
| 56 | <div class="action-right">
|
---|
| 57 | <form action="{{ route("dashboard.folders.files", $folder->id) }}" method="get" class="d-flex mr-3">
|
---|
| 58 | <div class="input-group">
|
---|
| 59 | <input type="text" name="search" class="form-control" placeholder="Search files"
|
---|
| 60 | aria-describedby="button-addon1" required>
|
---|
| 61 | <div class="input-group-append">
|
---|
| 62 | <button class="btn btn-outline-light searchSubmitBtn" type="submit" value="Search">
|
---|
| 63 | <i data-feather="search"></i>
|
---|
| 64 | </button>
|
---|
| 65 | </div>
|
---|
| 66 | </div>
|
---|
| 67 | </form>
|
---|
| 68 | </div>
|
---|
| 69 | </div>
|
---|
| 70 |
|
---|
[4521f25] | 71 | <p>Files in {{$folder->name}}</p>
|
---|
[0a1fb54] | 72 | {{-- @dd($files)--}}
|
---|
[c6b84df] | 73 | <div class="row">
|
---|
| 74 | @forelse($files as $file)
|
---|
[0a1fb54] | 75 |
|
---|
[c6b84df] | 76 | <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">
|
---|
| 77 | <div class="card app-file-list">
|
---|
| 78 | <div class="app-file-icon">
|
---|
| 79 | @if(in_array(explode('.', $file->name)[1], $excelExt))
|
---|
| 80 | <i class="fa fa-file-excel-o text-success"></i>
|
---|
| 81 | @else @if(in_array(explode('.', $file->name)[1], $textExt))
|
---|
| 82 | <i class="fa fa-file-word-o text-info"></i>
|
---|
| 83 | @else @if(explode('.', $file->name)[1] == 'pdf')
|
---|
| 84 | <i class="fa fa-file-pdf-o text-danger"></i>
|
---|
| 85 | @else @if(in_array(explode('.', $file->name)[1], $imageExt))
|
---|
[ff5b46e] | 86 | {{-- <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">--}}
|
---|
| 87 | {{-- <a href="{{ url('/storage/' . $file->location) }}" class="image-popup-gallery-item">--}}
|
---|
| 88 | {{-- <div class="image-hover">--}}
|
---|
| 89 | {{-- <img src="{{ url('/storage/' . $file->location) }}" class="rounded" width="100" alt="image">--}}
|
---|
| 90 | {{-- </div>--}}
|
---|
| 91 | {{-- </a>--}}
|
---|
| 92 | {{-- </div>--}}
|
---|
[4521f25] | 93 | <i class="fa fa-file-image-o text-danger"></i>
|
---|
[c6b84df] | 94 | @else
|
---|
| 95 | <i class="fa fa-file-text-o text-warning"></i>
|
---|
| 96 | @endif
|
---|
| 97 | @endif
|
---|
| 98 | @endif
|
---|
| 99 | @endif
|
---|
| 100 | <div class="dropdown position-absolute top-0 right-0 mr-3">
|
---|
| 101 | <a href="#" class="btn btn-outline-light btn-sm" data-toggle="dropdown">
|
---|
| 102 | <i class="fa fa-ellipsis-h"></i>
|
---|
| 103 | </a>
|
---|
| 104 | <div class="dropdown-menu dropdown-menu-right">
|
---|
[0df7a93] | 105 | @if(auth()->user()->hasPermission('download_data'))
|
---|
[c6b84df] | 106 | <a href="{{ route("dashboard.files.downloadFile", $file->id) }}" class="dropdown-item">
|
---|
| 107 | Download
|
---|
| 108 | </a>
|
---|
[0df7a93] | 109 | @endif
|
---|
[190db9f] | 110 | @if(auth()->user()->hasPermission('delete_data'))
|
---|
[c6b84df] | 111 | <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$file->id}}">
|
---|
| 112 | Delete
|
---|
| 113 | </a>
|
---|
[0df7a93] | 114 | @endif
|
---|
[c6b84df] | 115 | </div>
|
---|
| 116 | </div>
|
---|
| 117 | </div>
|
---|
| 118 | <div class="p-2 small">
|
---|
| 119 | <div>{{$file->name}}</div>
|
---|
| 120 | <div class="text-muted">{{ $file->getSize($file->location) }} MB</div>
|
---|
[deff0bc] | 121 | <div class="text-muted">Created {{ $file->created_at->diffForHumans() }}, {{ date('d.m.Y', strtotime($file->created_at))}}</div>
|
---|
[c6b84df] | 122 | </div>
|
---|
| 123 | </div>
|
---|
| 124 | </div>
|
---|
| 125 | <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 126 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 127 | <div class="modal-content">
|
---|
| 128 | <div class="modal-header">
|
---|
| 129 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
| 130 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 131 | <i class="ti-close"></i>
|
---|
| 132 | </button>
|
---|
| 133 | </div>
|
---|
| 134 | <div class="modal-body">
|
---|
| 135 | <form action="{{ route("dashboard.files.deleteFile", $file->id) }}" method="POST">
|
---|
| 136 | @csrf
|
---|
| 137 | @method('DELETE')
|
---|
| 138 | <p>Are you sure you want to delete file {{$file->name}}?</p>
|
---|
| 139 | <div class="modal-footer">
|
---|
| 140 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 141 | </button>
|
---|
| 142 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 143 | </div>
|
---|
| 144 | </form>
|
---|
| 145 | </div>
|
---|
| 146 |
|
---|
| 147 | </div>
|
---|
| 148 | </div>
|
---|
| 149 | </div>
|
---|
| 150 |
|
---|
[4b7e2d3] | 151 | @empty
|
---|
| 152 | <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>
|
---|
| 153 | @endforelse
|
---|
| 154 |
|
---|
[c6b84df] | 155 | </div>
|
---|
| 156 |
|
---|
| 157 | @if(!Request::query('search'))
|
---|
| 158 | {{$files->appends($_GET)->links('layouts.pagination') }}
|
---|
| 159 | @endif
|
---|
| 160 |
|
---|
| 161 | </div>
|
---|
[4521f25] | 162 | <div class="modal fade" id="uploadFiles_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 163 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 164 | <div class="modal-content">
|
---|
| 165 | <div class="modal-header">
|
---|
[0a1fb54] | 166 | <h5 class="modal-title" id="exampleModalCenterTitle">Upload files to {{$folder->name}}</h5>
|
---|
[4521f25] | 167 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 168 | <i class="ti-close"></i>
|
---|
| 169 | </button>
|
---|
| 170 | </div>
|
---|
| 171 | <div class="modal-body">
|
---|
| 172 | <form action="{{ route("dashboard.files.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
|
---|
| 173 | @csrf
|
---|
| 174 | <div class="row">
|
---|
| 175 | <div class="col-md-10">
|
---|
| 176 | <div class="form-group">
|
---|
| 177 | <select class="form-control" name="folder" hidden>
|
---|
| 178 | <option value="{{ $folder->id }}" {{ (old("folder") == $folder->id ? "selected" : "") }}>{{ $folder->name }}</option>
|
---|
| 179 | </select>
|
---|
| 180 | </div>
|
---|
| 181 | </div>
|
---|
| 182 | <div class="col-md-10">
|
---|
| 183 | <div class="form-group">
|
---|
| 184 | <label for="exampleFormControlSelect1">Files</label>
|
---|
| 185 |
|
---|
[c6b84df] | 186 |
|
---|
[4521f25] | 187 | <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
|
---|
| 188 | </div>
|
---|
| 189 | </div>
|
---|
| 190 | </div>
|
---|
| 191 | <br/>
|
---|
| 192 | <div class="modal-footer">
|
---|
| 193 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 194 | </button>
|
---|
| 195 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 196 | </div>
|
---|
| 197 | </form>
|
---|
| 198 | </div>
|
---|
| 199 |
|
---|
| 200 | </div>
|
---|
| 201 | </div>
|
---|
| 202 | </div>
|
---|
[c6b84df] | 203 | </div>
|
---|
| 204 |
|
---|
| 205 | @endsection
|
---|
| 206 |
|
---|
| 207 | @yield('script')
|
---|
| 208 |
|
---|
| 209 |
|
---|