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

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

edited user permissions

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