source: resources/views/dashboard/folders/files.blade.php@ a8346eb

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