source: resources/views/dashboard/files/index.blade.php@ 0df7a93

develop
Last change on this file since 0df7a93 was 0df7a93, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes

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