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

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

added fileTypes controller, notifications, excel export, edited views

  • Property mode set to 100644
File size: 23.3 KB
Line 
1@extends('layouts.app')
2
3@section("title", "SaveSpace - Folders")
4
5@section('pageTitle', 'SaveSpace - Folders')
6
7@section('content')
8
9 <div class="row app-block mb-4">
10 <div class="col-md-3 app-sidebar">
11 <div class="card">
12 <div class="card-body">
13 <a href="javascript:void(0)" class="btn btn-secondary btn-block file-upload-btn text-white" data-toggle="modal" data-target="#createModal">
14 Add folder
15 </a>
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">
66 <li class="list-inline-item mb-0">
67 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">
68 <i data-feather="plus" class="mr-1"></i>
69 Ations
70 </a>
71 <div class="dropdown-menu">
72 <a class="dropdown-item" href="javascript:void(0)" data-toggle="modal" data-target="#createModal">Add folder</a>
73 <a href="{{ route('dashboard.folders.export') }}" class="dropdown-item text-success">Export table</a>
74 </div>
75 </li>
76 <li class="list-inline-item mb-0">
77 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">Departments</a>
78 <div class="dropdown-menu">
79 @foreach($departments as $department)
80 <a class="dropdown-item d-flex justify-content-between m-5" href="{{ route("dashboard.folders.index", ["id" => $department->id]) }}">
81 {{$department->name}}
82 <span class="text-muted">{{$department->folder->count()}}</span>
83 </a>
84 @endforeach
85 </div>
86 </li>
87 <li class="list-inline-item mb-0">
88 <a href="#" class="btn btn-outline-light dropdown-toggle" data-toggle="dropdown">
89 Order by
90 </a>
91 <div class="dropdown-menu">
92 @if(Request::get('id'))
93 <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=newest" }}">Date</a>
94 <a class="dropdown-item" href="{{ URL::current()."?id=".Request::get('id')."&sort=name" }}">Name</a>
95 @else
96 <a class="dropdown-item" href="{{ URL::current()."?sort=newest" }}">Date</a>
97 <a class="dropdown-item" href="{{ URL::current()."?sort=name" }}">Name</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="createModal" tabindex="-1" role="dialog" aria-hidden="true">
243 <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
244 <div class="modal-content">
245 <div class="modal-header">
246 <h5 class="modal-title" id="exampleModalCenterTitle">Create folder</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.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
253 @csrf
254 <div class="row">
255 <div class="col-md-6">
256 <div class="form-group">
257 <label for="exampleFormControlSelect1">Department</label>
258 @if($departments->count())
259 <select class="form-control new_folder_deparment" name="department" required>
260 @foreach ($departments as $department)
261 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ (old("department") == $department->id ? "selected" : "") }}>{{ $department->name }}</option>
262 @endforeach
263 @else
264 <p>You haven't created any departments yet. <a class="text-primary" href="{{ route("dashboard.departments.create") }}">Create now.</a></p>
265 @endif
266 </select>
267 </div>
268 </div>
269 <div class="col-md-6">
270 <div class="form-group">
271 <label>Archive ID</label>
272 <input type="text" name="arch_id" value="" class="form-control" placeholder="Archive ID" required>
273 </div>
274 </div>
275 </div>
276 <div class="row">
277 <div class="col-md-6">
278 <div class="form-group">
279 <label>Name</label>
280 <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
281 </div>
282 </div>
283 <div class="col-md-6">
284 <div class="form-group">
285 <label>Note</label>
286 <textarea class="form-control" name="note" maxlength="80">{{ old('note') }}</textarea>
287 </div>
288 </div>
289 </div>
290 <div class="row">
291 <div class="col-md-6">
292 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
293 </div>
294 <div class="col-md-6">
295 <div class="form-group">
296 <div class="form-check">
297 <input class="form-check-input" type="checkbox" value=" {{ old('is_important') }} " id="is_important" name="is_important">
298 <label class="form-check-label">
299 Mark as important
300 </label>
301 </div>
302 </div>
303 </div>
304 </div>
305 <br/>
306 <div class="modal-footer">
307 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
308 </button>
309 <button type="submit" class="btn btn-primary">Save changes</button>
310 </div>
311 </form>
312 </div>
313
314 </div>
315 </div>
316 </div>
317
318 <div class="modal fade" id="deleteModal_{{$folder->id}}" tabindex="-1" role="dialog" aria-hidden="true">
319 <div class="modal-dialog modal-dialog-centered" role="document">
320 <div class="modal-content">
321 <div class="modal-header">
322 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
323 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
324 <i class="ti-close"></i>
325 </button>
326 </div>
327 <div class="modal-body">
328 <form action="{{ route("dashboard.folders.destroy", $folder->id) }}" method="POST">
329 @csrf
330 @method('DELETE')
331 <p>Are you sure you want to delete folder {{$folder->name}} with Archive ID: {{ $folder->arch_id }}?</p>
332 <div class="modal-footer">
333 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
334 </button>
335 <button type="submit" class="btn btn-primary">Save changes</button>
336 </div>
337 </form>
338 </div>
339 </div>
340 </div>
341 </div>
342 @empty
343 <div class="col-xl-3 col-lg-4 col-md-6 col-sm-12">No items found</div>
344 @endforelse
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.