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">
|
---|
10 | <div class="card-body">
|
---|
11 | @if(auth()->user()->hasPermission('manage_all_folders'))
|
---|
12 | <a class="btn btn-secondary btn-block text-white" href="javascript:void(0)" data-target="#createModal{{$folder->id}}" data-toggle="modal">
|
---|
13 | Edit folder
|
---|
14 | </a>
|
---|
15 | @endif
|
---|
16 | </div>
|
---|
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)
|
---|
24 | <a href="{{ route("dashboard.folders.files", ["id" => $obj->id]) }}" class="list-group-item d-flex align-items-center">
|
---|
25 | <i data-feather="folder" class="width-15 height-15 mr-2"></i>
|
---|
26 | {{$obj->name}}
|
---|
27 | <span class="small ml-auto">{{$obj->files->count()}}</span>
|
---|
28 | </a>
|
---|
29 | @endforeach
|
---|
30 | </div>
|
---|
31 | </div>
|
---|
32 | </div>
|
---|
33 | </div>
|
---|
34 | <div class="col-md-9 app-content">
|
---|
35 | <div class="app-content-overlay"></div>
|
---|
36 | <div class="app-action">
|
---|
37 | <div class="action-left">
|
---|
38 | <ul class="list-inline">
|
---|
39 | @if(auth()->user()->hasPermission('manage_all_folders'))
|
---|
40 | <li class="list-inline-item mb-0">
|
---|
41 | <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">
|
---|
42 | Actions
|
---|
43 | </a>
|
---|
44 | <div class="dropdown-menu">
|
---|
45 | <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#editModal_{{$folder->id}}">
|
---|
46 | Edit folder
|
---|
47 | </a>
|
---|
48 | </div>
|
---|
49 | </li>
|
---|
50 | @endif
|
---|
51 | <li class="list-inline-item mb-0">
|
---|
52 | @if(auth()->user()->hasPermission('download_data'))
|
---|
53 | <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="btn btn-outline-light">
|
---|
54 | Download folder
|
---|
55 | </a>
|
---|
56 | @endif
|
---|
57 | </li>
|
---|
58 | </ul>
|
---|
59 | </div>
|
---|
60 | <div class="action-right">
|
---|
61 | <form action="{{ route("dashboard.folders.files", $folder->id) }}" method="get" class="d-flex mr-3">
|
---|
62 | <div class="input-group">
|
---|
63 | <input type="text" name="search" class="form-control" placeholder="Search files"
|
---|
64 | aria-describedby="button-addon1" required>
|
---|
65 | <div class="input-group-append">
|
---|
66 | <button class="btn btn-outline-light searchSubmitBtn" type="submit" value="Search">
|
---|
67 | <i data-feather="search"></i>
|
---|
68 | </button>
|
---|
69 | </div>
|
---|
70 | </div>
|
---|
71 | </form>
|
---|
72 | </div>
|
---|
73 | </div>
|
---|
74 |
|
---|
75 | <p>Files</p>
|
---|
76 |
|
---|
77 | <div class="row">
|
---|
78 | @forelse($files as $file)
|
---|
79 | <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">
|
---|
80 | <div class="card app-file-list">
|
---|
81 | <div class="app-file-icon">
|
---|
82 | @if(in_array(explode('.', $file->name)[1], $excelExt))
|
---|
83 | <i class="fa fa-file-excel-o text-success"></i>
|
---|
84 | @else @if(in_array(explode('.', $file->name)[1], $textExt))
|
---|
85 | <i class="fa fa-file-word-o text-info"></i>
|
---|
86 | @else @if(explode('.', $file->name)[1] == 'pdf')
|
---|
87 | <i class="fa fa-file-pdf-o text-danger"></i>
|
---|
88 | @else @if(in_array(explode('.', $file->name)[1], $imageExt))
|
---|
89 | {{-- <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">--}}
|
---|
90 | {{-- <a href="{{ url('/storage/' . $file->location) }}" class="image-popup-gallery-item">--}}
|
---|
91 | {{-- <div class="image-hover">--}}
|
---|
92 | {{-- <img src="{{ url('/storage/' . $file->location) }}" class="rounded" width="100" alt="image">--}}
|
---|
93 | {{-- </div>--}}
|
---|
94 | {{-- </a>--}}
|
---|
95 | {{-- </div>--}}
|
---|
96 | <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
|
---|
97 | <i class="fa fa-file-image-o text-danger fa-2x"></i>
|
---|
98 | </div>
|
---|
99 | @else
|
---|
100 | <i class="fa fa-file-text-o text-warning"></i>
|
---|
101 | @endif
|
---|
102 | @endif
|
---|
103 | @endif
|
---|
104 | @endif
|
---|
105 | <div class="dropdown position-absolute top-0 right-0 mr-3">
|
---|
106 | <a href="#" class="btn btn-outline-light btn-sm" data-toggle="dropdown">
|
---|
107 | <i class="fa fa-ellipsis-h"></i>
|
---|
108 | </a>
|
---|
109 | <div class="dropdown-menu dropdown-menu-right">
|
---|
110 | @if(auth()->user()->hasPermission('manage_all_files'))
|
---|
111 | <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editFileModal_{{$file->id}}">
|
---|
112 | Rename
|
---|
113 | </a>
|
---|
114 | @endif
|
---|
115 | @if(auth()->user()->hasPermission('download_data'))
|
---|
116 | <a href="{{ route("dashboard.files.downloadFile", $file->id) }}" class="dropdown-item">
|
---|
117 | Download
|
---|
118 | </a>
|
---|
119 | @endif
|
---|
120 | @if(auth()->user()->hasPermission('manage_all_files'))
|
---|
121 | <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$file->id}}">
|
---|
122 | Delete
|
---|
123 | </a>
|
---|
124 | @endif
|
---|
125 | </div>
|
---|
126 | </div>
|
---|
127 | </div>
|
---|
128 | <div class="p-2 small">
|
---|
129 | <div>{{$file->name}}</div>
|
---|
130 | <div class="text-muted">{{ $file->getSize($file->location) }} MB</div>
|
---|
131 | </div>
|
---|
132 | </div>
|
---|
133 | </div>
|
---|
134 | <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
135 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
136 | <div class="modal-content">
|
---|
137 | <div class="modal-header">
|
---|
138 | <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
|
---|
139 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
140 | <i class="ti-close"></i>
|
---|
141 | </button>
|
---|
142 | </div>
|
---|
143 | <div class="modal-body">
|
---|
144 | <form action="{{ route("dashboard.files.deleteFile", $file->id) }}" method="POST">
|
---|
145 | @csrf
|
---|
146 | @method('DELETE')
|
---|
147 | <p>Are you sure you want to delete file {{$file->name}}?</p>
|
---|
148 | <div class="modal-footer">
|
---|
149 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
150 | </button>
|
---|
151 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
152 | </div>
|
---|
153 | </form>
|
---|
154 | </div>
|
---|
155 |
|
---|
156 | </div>
|
---|
157 | </div>
|
---|
158 | </div>
|
---|
159 |
|
---|
160 | <div class="modal fade" id="editFileModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
161 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
162 | <div class="modal-content">
|
---|
163 | <div class="modal-header">
|
---|
164 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit file name</h5>
|
---|
165 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
166 | <i class="ti-close"></i>
|
---|
167 | </button>
|
---|
168 | </div>
|
---|
169 | <div class="modal-body">
|
---|
170 | <form action="{{ route("dashboard.files.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">
|
---|
171 | @method("patch")
|
---|
172 | @csrf
|
---|
173 | <div class="row">
|
---|
174 | <div class="col-md-12">
|
---|
175 | <div class="form-group">
|
---|
176 | <label class="form-label">Current name: {{$file->name}}</label>
|
---|
177 | <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" maxlength="255" title="Don't include: '\/.|'" pattern="^[^.\/|]+$" class="form-control" required>
|
---|
178 | </div>
|
---|
179 | </div>
|
---|
180 | </div>
|
---|
181 | <br/>
|
---|
182 | <div class="modal-footer">
|
---|
183 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
184 | </button>
|
---|
185 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
186 | </div>
|
---|
187 | </form>
|
---|
188 | </div>
|
---|
189 | </div>
|
---|
190 | </div>
|
---|
191 | </div>
|
---|
192 | @empty
|
---|
193 | <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>
|
---|
194 | @endforelse
|
---|
195 |
|
---|
196 | <div class="modal fade" id="editModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
197 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
198 | <div class="modal-content">
|
---|
199 | <div class="modal-header">
|
---|
200 | <h5 class="modal-title" id="exampleModalCenterTitle">Edit folder</h5>
|
---|
201 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
202 | <i class="ti-close"></i>
|
---|
203 | </button>
|
---|
204 | </div>
|
---|
205 | <div class="modal-body">
|
---|
206 | <form action="{{ route("dashboard.folders.edit", ["id" => $folder->id]) }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
|
---|
207 | @method("patch")
|
---|
208 | @csrf
|
---|
209 | <div class="row">
|
---|
210 | <div class="col-md-6">
|
---|
211 | <div class="form-group">
|
---|
212 | <label>Department</label>
|
---|
213 | <select class="form-control edit_folder_deparment" name="department" required>
|
---|
214 | @foreach ($departments as $department)
|
---|
215 | <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $folder->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>
|
---|
216 | @endforeach
|
---|
217 | </select>
|
---|
218 | </div>
|
---|
219 | </div>
|
---|
220 | <div class="col-md-6">
|
---|
221 | <div class="form-group">
|
---|
222 | <label>Archive ID</label>
|
---|
223 | <input type="text" name="arch_id" value="{{ old("arch_id", $folder->arch_id) }}" class="form-control" placeholder="Archive ID" required>
|
---|
224 | </div>
|
---|
225 | </div>
|
---|
226 | </div>
|
---|
227 | <div class="row">
|
---|
228 | <div class="col-md-6">
|
---|
229 | <div class="form-group">
|
---|
230 | <label>Name</label>
|
---|
231 | <input type="text" name="name" value="{{ old("name", $folder->name) }}" class="form-control" placeholder="Name" minlength="2" maxlength="30" required>
|
---|
232 | </div>
|
---|
233 | </div>
|
---|
234 | <div class="col-md-6">
|
---|
235 | <div class="form-group">
|
---|
236 | <label>Note</label>
|
---|
237 | <textarea class="form-control" name="note" maxlength="80">
|
---|
238 | {{ old("note", $folder->note) }}
|
---|
239 | </textarea>
|
---|
240 | </div>
|
---|
241 | </div>
|
---|
242 | </div>
|
---|
243 | <div class="row">
|
---|
244 | <div class="col-md-6">
|
---|
245 | <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
|
---|
246 | </div>
|
---|
247 | </div>
|
---|
248 | <br/>
|
---|
249 | <div class="modal-footer">
|
---|
250 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
251 | </button>
|
---|
252 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
253 | </div>
|
---|
254 | </form>
|
---|
255 | </div>
|
---|
256 |
|
---|
257 | </div>
|
---|
258 | </div>
|
---|
259 | </div>
|
---|
260 |
|
---|
261 | <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
262 | <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
---|
263 | <div class="modal-content">
|
---|
264 | <div class="modal-header">
|
---|
265 | <h5 class="modal-title" id="exampleModalCenterTitle">Create folder</h5>
|
---|
266 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
267 | <i class="ti-close"></i>
|
---|
268 | </button>
|
---|
269 | </div>
|
---|
270 | <div class="modal-body">
|
---|
271 | <form action="{{ route("dashboard.folders.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
|
---|
272 | @csrf
|
---|
273 | <div class="row">
|
---|
274 | <div class="col-md-6">
|
---|
275 | <div class="form-group">
|
---|
276 | <label for="exampleFormControlSelect1">Department</label>
|
---|
277 | @if($departments->count())
|
---|
278 | <select class="form-control new_folder_deparment" name="department" required>
|
---|
279 | @foreach ($departments as $department)
|
---|
280 | <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>
|
---|
281 | @endforeach
|
---|
282 | @else
|
---|
283 | <p>You haven't created any departments yet. <a class="text-primary" href="{{ route("dashboard.departments.create") }}">Create now.</a></p>
|
---|
284 | @endif
|
---|
285 | </select>
|
---|
286 | </div>
|
---|
287 | </div>
|
---|
288 | <div class="col-md-6">
|
---|
289 | <div class="form-group">
|
---|
290 | <label>Archive ID</label>
|
---|
291 | <input type="text" name="arch_id" value="" class="form-control" placeholder="Archive ID" required>
|
---|
292 | </div>
|
---|
293 | </div>
|
---|
294 | </div>
|
---|
295 | <div class="row">
|
---|
296 | <div class="col-md-6">
|
---|
297 | <div class="form-group">
|
---|
298 | <label>Name</label>
|
---|
299 | <input type="text" name="name" value="{{ old("name") }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
300 | </div>
|
---|
301 | </div>
|
---|
302 | <div class="col-md-6">
|
---|
303 | <div class="form-group">
|
---|
304 | <label>Note</label>
|
---|
305 | <textarea class="form-control" name="note" maxlength="80"> {{old("note")}} </textarea>
|
---|
306 | </div>
|
---|
307 | </div>
|
---|
308 | </div>
|
---|
309 | <div class="row">
|
---|
310 | <div class="col-md-6">
|
---|
311 | <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
|
---|
312 | </div>
|
---|
313 | <div class="col-md-6">
|
---|
314 | <div class="form-group">
|
---|
315 | <div class="form-check">
|
---|
316 | <input class="form-check-input" type="checkbox" value="{{old("is_important")}}" id="is_important" name="is_important">
|
---|
317 | <label class="form-check-label">
|
---|
318 | Mark as important
|
---|
319 | </label>
|
---|
320 | </div>
|
---|
321 | </div>
|
---|
322 | </div>
|
---|
323 | </div>
|
---|
324 | <br/>
|
---|
325 | <div class="modal-footer">
|
---|
326 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
327 | </button>
|
---|
328 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
329 | </div>
|
---|
330 | </form>
|
---|
331 | </div>
|
---|
332 |
|
---|
333 | </div>
|
---|
334 | </div>
|
---|
335 | </div>
|
---|
336 | </div>
|
---|
337 |
|
---|
338 | @if(!Request::query('search'))
|
---|
339 | {{$files->appends($_GET)->links('layouts.pagination') }}
|
---|
340 | @endif
|
---|
341 |
|
---|
342 | </div>
|
---|
343 |
|
---|
344 | </div>
|
---|
345 |
|
---|
346 | @endsection
|
---|
347 |
|
---|
348 | @yield('script')
|
---|
349 |
|
---|
350 |
|
---|