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

develop
Last change on this file since 2db8837 was 4b7e2d3, checked in by beratkjufliju <kufliju@…>, 3 years ago

bug fixes, edited export, added fileSeeder for DB testing

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