source: resources/views/dashboard/folders/index.blade.php@ c08466c

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

bug fixes

  • Property mode set to 100644
File size: 24.4 KB
RevLine 
[c6b84df]1@extends('layouts.app')
2
3@section("title", "SaveSpace - Folders")
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">
[0df7a93]11 @if(auth()->user()->hasPermission('manage_all_folders'))
[c6b84df]12 <a href="javascript:void(0)" class="btn btn-secondary btn-block file-upload-btn text-white" data-toggle="modal" data-target="#createModal">
13 Add folder
14 </a>
[0df7a93]15 @endif
[c6b84df]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($departments as $department)
24 <a href="{{ route("dashboard.folders.index", ["id" => $department->id]) }}" class="list-group-item d-flex align-items-center">
25 <i data-feather="folder" class="width-15 height-15 mr-2"></i>
26 {{$department->name}}
27 <span class="small ml-auto">{{$department->folder->count()}}</span>
28 </a>
29 @endforeach
30 <a href="{{ URL::current()."?sort=recent" }}" class="list-group-item">
31 <i data-feather="upload-cloud" class="width-15 height-15 mr-2"></i>
32 Recents
33 </a>
34 <a href="{{ URL::current()."?sort=important" }}" class="list-group-item d-flex align-items-center">
35 <i data-feather="star" class="width-15 height-15 mr-2"></i>
36 Important
37 <span class="small ml-auto">{{ $countImportant }}</span>
38 </a>
39 </div>
40 <div class="card-body">
41 <h6 class="mb-4">Storage Status</h6>
42 <div class="d-flex align-items-center">
43 <div class="mr-3">
44 <i data-feather="database" class="width-30 height-30"></i>
45 </div>
46 <div class="flex-grow-1">
47 <div class="progress" style="height: 10px">
48 <div class="progress-bar progress-bar-striped" role="progressbar"
49 style="width: {{$diskUse}}" aria-valuenow="10" aria-valuemin="0"
50 aria-valuemax="100"></div>
51 <span class="sr-only">{{$diskUse}}</span>
52 </div>
53 <div class="line-height-12 small text-muted mt-2">{{round($diskUsedSize,2)}} GB /
54 {{round($diskTotalSize,2)}} GB ({{$diskUse}})</div>
55 </div>
56 </div>
57 </div>
58 </div>
59 </div>
60 </div>
61 <div class="col-md-9 app-content">
62 <div class="app-content-overlay"></div>
63 <div class="app-action">
64 <div class="action-left">
65 <ul class="list-inline">
[0df7a93]66 @if(auth()->user()->hasPermission('manage_all_folders'))
[c6b84df]67 <li class="list-inline-item mb-0">
68 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">
69 <i data-feather="plus" class="mr-1"></i>
[0df7a93]70 Actions
[c6b84df]71 </a>
72 <div class="dropdown-menu">
73 <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#createModal">Add folder</a>
[0df7a93]74 @endif
75 @if(auth()->user()->hasPermission('export_data'))
[0208bbd]76 <a href="{{ route('dashboard.folders.export') }}" class="dropdown-item text-success">Export</a>
[c6b84df]77 </div>
78 </li>
[0df7a93]79 @endif
[c6b84df]80 <li class="list-inline-item mb-0">
81 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">Departments</a>
82 <div class="dropdown-menu">
83 @foreach($departments as $department)
84 <a class="dropdown-item d-flex justify-content-between m-5" href="{{ route("dashboard.folders.index", ["id" => $department->id]) }}">
85 {{$department->name}}
86 <span class="text-muted">{{$department->folder->count()}}</span>
87 </a>
88 @endforeach
89 </div>
90 </li>
91 <li class="list-inline-item mb-0">
92 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">
93 Order by
94 </a>
95 <div class="dropdown-menu">
96 @if(Request::get('id'))
97 <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=newest" }}">Date</a>
98 <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=name" }}">Name</a>
[4b7e2d3]99 <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=no_of_files" }}">Number of files</a>
[c6b84df]100 @else
101 <a class="dropdown-item" href="{{ URL::current()."?sort=newest" }}">Date</a>
102 <a class="dropdown-item" href="{{ URL::current()."?sort=name" }}">Name</a>
[4b7e2d3]103 <a class="dropdown-item" href="{{ URL::current()."?sort=no_of_files" }}">Number of files</a>
[c6b84df]104 @endif
105 </div>
106 </li>
107 </ul>
108 </div>
109 <div class="action-right">
110 <form action="{{ route("dashboard.folders.index") }}" method="get" class="d-flex mr-3">
111 <div class="input-group">
112 <input type="text" name="search" class="form-control" placeholder="Search folder"
113 aria-describedby="button-addon1" required>
114 <div class="input-group-append">
115 <button class="btn btn-outline-light searchSubmitBtn" type="submit" value="Search">
116 <i data-feather="search"></i>
117 </button>
118 </div>
119 </div>
120 </form>
121 </div>
122 </div>
123 @if(!Request::query('id'))
124 <h4>Folders</h4><br/>
125 @else
126 <h4> {{ $deptName }} - {{$deptCode}} </h4>
127 <br/>
128 @endif
129
130 <div class="row">
131 @forelse($folders as $folder)
132 <div class="col-xl-4 col-lg-6">
133 <div class="card" style="width: 20rem;">
134 <div class="card-body">
135 <i class="fa fa-folder fa-2x pr-2" aria-hidden="true">
136 </i><span class="card-title" style="font-size: 1.5rem;">{{$folder->name}}</span>
137 @if($folder->is_important)
138 <i class="fa fa-star" style="color:orange;"></i>
139 @endif
140 <div class="d-flex align-items-center">
141 <div class="dropdown ml-auto">
142 <a href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
143 <i class="fa fa-ellipsis-v" aria-hidden="true"></i>
144 </a>
145 <div class="dropdown-menu dropdown-menu-right">
146 <a href="{{ route("dashboard.folders.files", ["id" => $folder->id]) }}" class="dropdown-item">View Files</a>
[0df7a93]147 @if(auth()->user()->hasPermission('manage_all_folders'))
[c6b84df]148 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#editModal_{{$folder->id}}">Edit</a>
[0df7a93]149 @endif
150 @if(auth()->user()->hasPermission('download_data'))
[c6b84df]151 <a href="{{ route("dashboard.folders.downloadFolder", ['id' => $folder->id]) }}" class="dropdown-item">Download</a>
[0df7a93]152 @endif
153 @if(auth()->user()->hasPermission('manage_all_folders'))
154 <button class="dropdown-item action-dropdown-item"
[c6b84df]155 href="javascript:void(0)" onclick="toggleImportant({{$folder->id}})">
156 @if($folder->is_important)
157 Mark as not important
158 @else
159 Mark as important
160 @endif
161 </button>
[0df7a93]162 @endif
163 @if(auth()->user()->hasPermission('manage_all_folders'))
[c6b84df]164 <a href="javascript:void(0)" class="dropdown-item" data-toggle="modal" data-target="#deleteModal_{{$folder->id}}">Delete</a>
[0df7a93]165 @endif
[c6b84df]166 </div>
167 </div>
168 </div>
169 <div class="text-muted small mt-1 mb-3">Number of files: {{$folder->files->count()}}</div>
170 <p class="badge bg-success-bright text-success">{{$folder->arch_id}}</p>
171 <p>Note: {{$folder->note}}</p>
172 <div class="row">
173 <div class="col">
174 <div class="text-muted mb-1 small">Created</div>
175 <div> {{ $folder->created_at->diffForHumans() }}, {{ date('d.m.Y', strtotime($folder->created_at))}}</div>
176 </div>
177 </div>
178 </div>
179 <div class="card-footer">
180 <small class="text-muted">Last updated: {{ date('d.m.Y H:i', strtotime($folder->updated_at)) }}</small>
181 </div>
182 </div>
183 </div>
184
185 <form id="toggleImportant_{{ $folder->id }}"
186 action="{{ route("dashboard.folders.toggleImportant", ["id" => $folder->id]) }}"
187 method="post">
188 @csrf
189 @method("patch")
190 </form>
191
192 <div class="modal fade" id="editModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">
193 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
194 <div class="modal-content">
195 <div class="modal-header">
196 <h5 class="modal-title" id="exampleModalCenterTitle">Edit folder</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.folders.edit", ["id" => $folder->id]) }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
203 @method("patch")
204 @csrf
205 <div class="row">
206 <div class="col-md-6">
207 <div class="form-group">
208 <label>Folder</label>
209 <select class="form-control edit_folder_deparment" name="department" required>
210 @foreach ($departments as $department)
211 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $folder->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>
212 @endforeach
213 </select>
214 </div>
215 </div>
216 <div class="col-md-6">
217 <div class="form-group">
218 <label>Archive ID</label>
219 <input type="text" name="arch_id" value="{{ old("arch_id", $folder->arch_id) }}" class="form-control" placeholder="Archive ID" required>
220 </div>
221 </div>
222 </div>
223 <div class="row">
224 <div class="col-md-6">
225 <div class="form-group">
226 <label>Name</label>
227 <input type="text" name="name" value="{{ old("name", $folder->name) }}" class="form-control" placeholder="Name" minlength="2" maxlength="30" required>
228 </div>
229 </div>
230 <div class="col-md-6">
231 <div class="form-group">
232 <label>Note</label>
233 <textarea class="form-control" name="note" maxlength="80">
234 {{ old("note", $folder->note) }}
235 </textarea>
236 </div>
237 </div>
238 </div>
239 <div class="row">
240 <div class="col-md-6">
241 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
242 </div>
243 </div>
244 <br/>
245 <div class="modal-footer">
246 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
247 </button>
248 <button type="submit" class="btn btn-primary">Save changes</button>
249 </div>
250 </form>
251 </div>
252 </div>
253 </div>
254 </div>
255
[4b7e2d3]256 <div class="modal fade" id="deleteModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">
257 <div class="modal-dialog modal-dialog-centered" role="document">
258 <div class="modal-content">
259 <div class="modal-header">
260 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
261 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
262 <i class="ti-close"></i>
263 </button>
264 </div>
265 <div class="modal-body">
266 <form action="{{ route("dashboard.folders.destroy", $folder->id) }}" method="POST">
267 @csrf
268 @method('DELETE')
269 <p>Are you sure you want to delete folder {{$folder->name}} with Archive ID: {{ $folder->arch_id }}?</p>
270 <div class="modal-footer">
271 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
272 </button>
273 <button type="submit" class="btn btn-primary">Save changes</button>
274 </div>
275 </form>
276 </div>
277 </div>
278 </div>
279 </div>
280 @empty
281 <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>
282 @endforelse
283
[c6b84df]284 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
285 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
286 <div class="modal-content">
287 <div class="modal-header">
288 <h5 class="modal-title" id="exampleModalCenterTitle">Create folder</h5>
289 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
290 <i class="ti-close"></i>
291 </button>
292 </div>
293 <div class="modal-body">
294 <form action="{{ route("dashboard.folders.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
295 @csrf
296 <div class="row">
297 <div class="col-md-6">
298 <div class="form-group">
299 <label for="exampleFormControlSelect1">Department</label>
300 @if($departments->count())
301 <select class="form-control new_folder_deparment" name="department" required>
302 @foreach ($departments as $department)
303 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>
304 @endforeach
305 @else
306 <p>You haven't created any departments yet. <a class="text-primary" href="{{ route("dashboard.departments.create") }}">Create now.</a></p>
307 @endif
308 </select>
309 </div>
310 </div>
311 <div class="col-md-6">
312 <div class="form-group">
313 <label>Archive ID</label>
314 <input type="text" name="arch_id" value="" class="form-control" placeholder="Archive ID" required>
315 </div>
316 </div>
317 </div>
318 <div class="row">
319 <div class="col-md-6">
320 <div class="form-group">
321 <label>Name</label>
322 <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
323 </div>
324 </div>
325 <div class="col-md-6">
326 <div class="form-group">
327 <label>Note</label>
328 <textarea class="form-control" name="note" maxlength="80">{{ old('note') }}</textarea>
329 </div>
330 </div>
331 </div>
332 <div class="row">
333 <div class="col-md-6">
334 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
335 </div>
336 <div class="col-md-6">
337 <div class="form-group">
338 <div class="form-check">
339 <input class="form-check-input" type="checkbox" value=" {{ old('is_important') }} " id="is_important" name="is_important">
340 <label class="form-check-label">
341 Mark as important
342 </label>
343 </div>
344 </div>
345 </div>
346 </div>
347 <br/>
348 <div class="modal-footer">
349 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
350 </button>
351 <button type="submit" class="btn btn-primary">Save changes</button>
352 </div>
353 </form>
354 </div>
355
356 </div>
357 </div>
358 </div>
359
360 </div>
361 @if(!Request::query('search'))
362 {{$folders->appends($_GET)->links('layouts.pagination') }}
363 @endif
364 </div>
365
366 @endsection
367
368 @section('script')
369
370 @yield('script')
371
372 <script>
373 function toggleImportant(id) {
374 document.getElementById('toggleImportant_' + id).submit();
375 }
376 </script>
377
378@endsection
Note: See TracBrowser for help on using the repository browser.