[c6b84df] | 1 | @extends('layouts.app')
|
---|
| 2 |
|
---|
| 3 | @section("title", "SaveSpace - Files")
|
---|
| 4 |
|
---|
| 5 | @section('head')
|
---|
[169fcc8] | 6 |
|
---|
[c6b84df] | 7 | @endsection
|
---|
| 8 |
|
---|
| 9 | @section('content')
|
---|
| 10 |
|
---|
| 11 | <div class="page-header justify-content-between">
|
---|
| 12 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
| 13 | <ol class="breadcrumb">
|
---|
| 14 | <li class="breadcrumb-item">
|
---|
| 15 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
| 16 | </li>
|
---|
[aab55f4] | 17 | <li class="breadcrumb-item active" aria-current="page">Departments</li>
|
---|
[c6b84df] | 18 | </ol>
|
---|
| 19 | </nav>
|
---|
| 20 | <div class="dropdown">
|
---|
[0df7a93] | 21 | @if(auth()->user()->hasPermission('manage_all_files'))
|
---|
[aab55f4] | 22 | <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">Add</a>
|
---|
[0df7a93] | 23 | @endif
|
---|
| 24 | @if(auth()->user()->hasPermission('download_data'))
|
---|
[aab55f4] | 25 | <a href="{{ route("dashboard.departments.downloadAll") }}" class="btn btn-danger text-white">Download</a>
|
---|
[0df7a93] | 26 | @endif
|
---|
| 27 | @if(auth()->user()->hasPermission('export_data'))
|
---|
[aab55f4] | 28 | <a href="{{ route('dashboard.files.export') }}" class="btn btn-success text-white">Export</a>
|
---|
[0df7a93] | 29 | @endif
|
---|
[c6b84df] | 30 | </div>
|
---|
| 31 | </div>
|
---|
| 32 |
|
---|
| 33 | <div class="row">
|
---|
| 34 | <div class="col-md-12">
|
---|
| 35 | <div class="card">
|
---|
| 36 | <div class="card-body">
|
---|
| 37 | <div class="table-responsive">
|
---|
| 38 | <table id="user-list" class="table table-lg">
|
---|
| 39 | <thead>
|
---|
| 40 | <tr>
|
---|
| 41 | <th>
|
---|
| 42 | </th>
|
---|
| 43 | <th>Image</th>
|
---|
| 44 | <th>Name</th>
|
---|
| 45 | <th>Created at</th>
|
---|
| 46 | <th>Updated at</th>
|
---|
| 47 | <th>Folder name</th>
|
---|
| 48 | <th>Folder archive ID</th>
|
---|
| 49 | <th>Directory</th>
|
---|
| 50 | <th>Actions</th>
|
---|
| 51 | </tr>
|
---|
| 52 | </thead>
|
---|
| 53 | <tbody>
|
---|
| 54 | @foreach($files as $file)
|
---|
| 55 | <tr>
|
---|
| 56 | <td></td>
|
---|
| 57 | <td>
|
---|
| 58 | @if(in_array(explode('.', $file->name)[1], $excelExt))
|
---|
| 59 | <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
|
---|
| 60 | <i class="fa fa-file-excel-o text-success fa-2x"></i>
|
---|
| 61 | </div>
|
---|
| 62 | @else @if(in_array(explode('.', $file->name)[1], $textExt))
|
---|
| 63 | <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
|
---|
| 64 | <i class="fa fa-file-word-o text-info fa-2x"></i>
|
---|
| 65 | </div>
|
---|
| 66 | @else @if(explode('.', $file->name)[1] == 'pdf')
|
---|
| 67 | <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
|
---|
| 68 | <i class="fa fa-file-pdf-o text-danger fa-2x"></i>
|
---|
| 69 | </div>
|
---|
| 70 | @else @if(in_array(explode('.', $file->name)[1], $imageExt))
|
---|
[ff5b46e] | 71 | {{-- <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">--}}
|
---|
| 72 | {{-- <a href="{{ url('/storage/' . $file->location) }}" class="image-popup-gallery-item">--}}
|
---|
| 73 | {{-- <div class="image-hover">--}}
|
---|
| 74 | {{-- <img src="{{ url('/storage/' . $file->location) }}" class="rounded" width="30" alt="image">--}}
|
---|
| 75 | {{-- </div>--}}
|
---|
| 76 | {{-- </a>--}}
|
---|
| 77 | {{-- </div>--}}
|
---|
[4521f25] | 78 | <i class="fa fa-file-image-o text-danger"></i>
|
---|
[c6b84df] | 79 | @else
|
---|
[4521f25] | 80 | <i class="fa fa-file-text-o text-warning"></i>
|
---|
[c6b84df] | 81 | @endif
|
---|
| 82 | @endif
|
---|
| 83 | @endif
|
---|
| 84 | @endif
|
---|
| 85 |
|
---|
| 86 |
|
---|
| 87 | </td>
|
---|
| 88 | <td>{{ $file->name }}</td>
|
---|
| 89 | <td>{{ date('d.m.Y - H:i', strtotime($file->created_at)) }}</td>
|
---|
| 90 | @if($file->updated_at==NULL)
|
---|
| 91 | <td>/</td>
|
---|
| 92 | @else
|
---|
| 93 | <td>{{ date('d.m.Y - H:i', strtotime($file->updated_at)) }}</td>
|
---|
| 94 | @endif
|
---|
| 95 | <td><a href="{{ route('dashboard.folders.files', ['id' => $file->folder_id]) }}" class="text-linkedin">{{ \App\Models\Folder::find($file->folder_id)->name }}</a></td>
|
---|
| 96 | <td>{{ \App\Models\Folder::find($file->folder_id)->arch_id }}</td>
|
---|
| 97 | <!-- Trigger -->
|
---|
| 98 | <td><button data-clipboard-text="{{$file->location}}" class="btn btn-sm btn-primary text-white" data-toggle="tooltip" data-placement="right" title="{{$file->location}}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
|
---|
| 99 | <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
|
---|
| 100 | <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
|
---|
| 101 | </svg></button>
|
---|
| 102 | </td>
|
---|
[0df7a93] | 103 | @if(auth()->user()->hasPermission('manage_all_files'))
|
---|
[c6b84df] | 104 | <td>
|
---|
[4521f25] | 105 | <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit">
|
---|
| 106 | <i class="ti-pencil"></i>
|
---|
| 107 | </a>
|
---|
[c6b84df] | 108 | <a href="{{ route("dashboard.files.downloadFile", ['id' => $file->id]) }}" class="text-danger ml-2"title="Download">
|
---|
| 109 | <i class="ti-download"></i>
|
---|
| 110 | </a>
|
---|
| 111 | <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$file->id}}" title="Delete">
|
---|
| 112 | <i class="ti-trash"></i>
|
---|
| 113 | </a>
|
---|
| 114 | </td>
|
---|
[0df7a93] | 115 | @else
|
---|
| 116 | <td></td>
|
---|
| 117 | @endif
|
---|
[c6b84df] | 118 | </tr>
|
---|
| 119 | <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 120 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 121 | <div class="modal-content">
|
---|
| 122 | <div class="modal-header">
|
---|
| 123 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
| 124 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 125 | <i class="ti-close"></i>
|
---|
| 126 | </button>
|
---|
| 127 | </div>
|
---|
| 128 | <div class="modal-body">
|
---|
| 129 | <form action="{{ route("dashboard.files.deleteFile", $file->id) }}" method="POST">
|
---|
| 130 | @csrf
|
---|
| 131 | @method('DELETE')
|
---|
| 132 | <p>Are you sure you want to delete file {{$file->name}}?</p>
|
---|
| 133 | <p>Location: <span class="pr-1">{{$file->location}}</span></p>
|
---|
| 134 | <div class="modal-footer">
|
---|
| 135 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 136 | </button>
|
---|
| 137 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 138 | </div>
|
---|
| 139 | </form>
|
---|
| 140 | </div>
|
---|
| 141 |
|
---|
| 142 | </div>
|
---|
| 143 | </div>
|
---|
| 144 | </div>
|
---|
| 145 |
|
---|
[4521f25] | 146 | <div class="modal fade" id="editModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 147 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 148 | <div class="modal-content">
|
---|
| 149 | <div class="modal-header">
|
---|
| 150 | <h5 class="modal-title" id="exampleModalCenterTitle">Rename file</h5>
|
---|
| 151 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 152 | <i class="ti-close"></i>
|
---|
| 153 | </button>
|
---|
| 154 | </div>
|
---|
| 155 | <div class="modal-body">
|
---|
| 156 | <form action="{{ route("dashboard.files.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">
|
---|
| 157 | @method("patch")
|
---|
| 158 | @csrf
|
---|
| 159 | <div class="row">
|
---|
| 160 | <div class="col-md-12">
|
---|
| 161 | <div class="form-group">
|
---|
| 162 | <label class="form-label">Current name: {{$file->name}}</label>
|
---|
| 163 | <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" maxlength="255" title="Don't include: '\/.|'" pattern="^[^.\/|]+$" class="form-control" required>
|
---|
| 164 | </div>
|
---|
| 165 | </div>
|
---|
| 166 | </div>
|
---|
| 167 | <br/>
|
---|
| 168 | <div class="modal-footer">
|
---|
| 169 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 170 | </button>
|
---|
| 171 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 172 | </div>
|
---|
| 173 | </form>
|
---|
| 174 | </div>
|
---|
| 175 |
|
---|
| 176 | </div>
|
---|
| 177 | </div>
|
---|
| 178 | </div>
|
---|
[c6b84df] | 179 | @endforeach
|
---|
| 180 |
|
---|
| 181 | </tbody>
|
---|
| 182 | </table>
|
---|
| 183 |
|
---|
[9b4689a] | 184 | </div>
|
---|
| 185 | </div>
|
---|
| 186 | </div>
|
---|
| 187 | </div>
|
---|
| 188 | </div>
|
---|
[c6b84df] | 189 |
|
---|
[9b4689a] | 190 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
| 191 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
| 192 | <div class="modal-content">
|
---|
| 193 | <div class="modal-header">
|
---|
| 194 | <h5 class="modal-title" id="exampleModalCenterTitle">Upload</h5>
|
---|
| 195 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
| 196 | <i class="ti-close"></i>
|
---|
| 197 | </button>
|
---|
| 198 | </div>
|
---|
| 199 | <div class="modal-body">
|
---|
| 200 | <form action="{{ route("dashboard.files.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
|
---|
| 201 | @csrf
|
---|
| 202 | <div class="row">
|
---|
| 203 | <div class="col-md-10">
|
---|
| 204 | <div class="form-group">
|
---|
| 205 | <label for="exampleFormControlSelect1">Folder</label>
|
---|
| 206 | @if($folders->count())
|
---|
| 207 | <select class="form-control" name="folder" required>
|
---|
| 208 | @foreach ($folders as $folder)
|
---|
| 209 | <option value="{{ $folder->id }}" {{ (old("folder") == $folder->id ? "selected" : "") }}>{{ $folder->name }}</option>
|
---|
| 210 | @endforeach
|
---|
| 211 | @else
|
---|
| 212 | <p>You haven't created any folders yet. <a class="text-primary" href="{{ route("dashboard.folders.index") }}">Create now.</a></p>
|
---|
| 213 | @endif
|
---|
| 214 | </select>
|
---|
| 215 | </div>
|
---|
| 216 | </div>
|
---|
| 217 | <div class="col-md-10">
|
---|
| 218 | <div class="form-group">
|
---|
| 219 | <label for="exampleFormControlSelect1">Uploads</label>
|
---|
[c6b84df] | 220 |
|
---|
| 221 |
|
---|
[9b4689a] | 222 | <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
|
---|
[c6b84df] | 223 | </div>
|
---|
| 224 | </div>
|
---|
| 225 | </div>
|
---|
[9b4689a] | 226 | <br/>
|
---|
| 227 | <div class="modal-footer">
|
---|
| 228 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
| 229 | </button>
|
---|
| 230 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
| 231 | </div>
|
---|
| 232 | </form>
|
---|
[c6b84df] | 233 | </div>
|
---|
[9b4689a] | 234 |
|
---|
[c6b84df] | 235 | </div>
|
---|
| 236 | </div>
|
---|
| 237 | </div>
|
---|
| 238 |
|
---|
| 239 | @endsection
|
---|
| 240 |
|
---|
| 241 | @section('script')
|
---|
| 242 |
|
---|
| 243 | @yield('script')
|
---|
| 244 |
|
---|
| 245 | <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
|
---|
| 246 | @endsection
|
---|