source: resources/views/dashboard/files/index.blade.php@ 4b7e2d3

develop
Last change on this file since 4b7e2d3 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: 15.8 KB
Line 
1@extends('layouts.app')
2
3@section("title", "SaveSpace - Files")
4
5@section('head')
6 <!-- Datatable -->
7 <link rel="stylesheet" href="{{ url('vendors/dataTable/dataTables.min.css') }}" type="text/css">
8@endsection
9
10@section('content')
11
12 <div class="page-header justify-content-between">
13 <nav aria-label="breadcrumb" class="d-flex align-items-start">
14 <ol class="breadcrumb">
15 <li class="breadcrumb-item">
16 <a href="{{ url('/') }}">Dashboard</a>
17 </li>
18 <li class="breadcrumb-item active" aria-current="page">Files</li>
19 </ol>
20 </nav>
21 <div class="dropdown">
22 <a href="javascript:void(0)" data-toggle="modal" data-target="#createModal" class="btn btn-primary text-white">
23 Add files
24 </a>
25 <a href="{{ route("dashboard.departments.downloadAll") }}" class="btn btn-danger text-white">
26 <i class="fa fa-download pr-1"></i> Download all
27 </a>
28 <a href="{{ route('dashboard.files.export') }}" class="btn btn-success text-white">Export table</a>
29 </div>
30 </div>
31
32 <div class="row">
33 <div class="col-md-12">
34 <div class="card">
35 <div class="card-body">
36 <div class="table-responsive">
37 <table id="user-list" class="table table-lg">
38 <thead>
39 <tr>
40 <th>
41 </th>
42 <th>Image</th>
43 <th>Name</th>
44 <th>Created at</th>
45 <th>Updated at</th>
46 <th>Folder name</th>
47 <th>Folder archive ID</th>
48 <th>Directory</th>
49 <th>Actions</th>
50 </tr>
51 </thead>
52 <tbody>
53 @foreach($files as $file)
54 <tr>
55 <td></td>
56 <td>
57 @if(in_array(explode('.', $file->name)[1], $excelExt))
58 <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
59 <i class="fa fa-file-excel-o text-success fa-2x"></i>
60 </div>
61 @else @if(in_array(explode('.', $file->name)[1], $textExt))
62 <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
63 <i class="fa fa-file-word-o text-info fa-2x"></i>
64 </div>
65 @else @if(explode('.', $file->name)[1] == 'pdf')
66 <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
67 <i class="fa fa-file-pdf-o text-danger fa-2x"></i>
68 </div>
69 @else @if(in_array(explode('.', $file->name)[1], $imageExt))
70 <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
71 <a href="{{ url('/uploads/' . $file->location) }}" class="image-popup-gallery-item">
72 <div class="image-hover">
73 <img src="{{ url('/uploads/' . $file->location) }}" class="rounded" width="30" alt="image">
74 </div>
75 </a>
76 </div>
77 @else
78 <div class="col-xl-1 col-lg-1 col-md-1 col-sm-2">
79 <i class="fa fa-file-text-o text-warning fa-2x"></i>
80 </div>
81 @endif
82 @endif
83 @endif
84 @endif
85
86
87 </td>
88 <td>{{ $file->name }}</td>
89 <td>{{ date('d.m.Y - H:i', strtotime($file->created_at)) }}</td>
90 @if($file->updated_at==NULL)
91 <td>/</td>
92 @else
93 <td>{{ date('d.m.Y - H:i', strtotime($file->updated_at)) }}</td>
94 @endif
95 <td><a href="{{ route('dashboard.folders.files', ['id' => $file->folder_id]) }}" class="text-linkedin">{{ \App\Models\Folder::find($file->folder_id)->name }}</a></td>
96 <td>{{ \App\Models\Folder::find($file->folder_id)->arch_id }}</td>
97 <!-- Trigger -->
98 <td><button data-clipboard-text="{{$file->location}}" class="btn btn-sm btn-primary text-white" data-toggle="tooltip" data-placement="right" title="{{$file->location}}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
99 <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1v-1z"/>
100 <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5h3zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0h-3z"/>
101 </svg></button>
102 </td>
103 <td>
104 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit">
105 <i class="ti-pencil"></i>
106 </a>
107 <a href="{{ route("dashboard.files.downloadFile", ['id' => $file->id]) }}" class="text-danger ml-2"title="Download">
108 <i class="ti-download"></i>
109 </a>
110 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$file->id}}" title="Delete">
111 <i class="ti-trash"></i>
112 </a>
113 </td>
114 </tr>
115 <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
116 <div class="modal-dialog modal-dialog-centered" role="document">
117 <div class="modal-content">
118 <div class="modal-header">
119 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
120 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
121 <i class="ti-close"></i>
122 </button>
123 </div>
124 <div class="modal-body">
125 <form action="{{ route("dashboard.files.deleteFile", $file->id) }}" method="POST">
126 @csrf
127 @method('DELETE')
128 <p>Are you sure you want to delete file {{$file->name}}?</p>
129 <p>Location: <span class="pr-1">{{$file->location}}</span></p>
130 <div class="modal-footer">
131 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
132 </button>
133 <button type="submit" class="btn btn-primary">Save changes</button>
134 </div>
135 </form>
136 </div>
137
138 </div>
139 </div>
140 </div>
141
142 <div class="modal fade" id="editModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
143 <div class="modal-dialog modal-dialog-centered" role="document">
144 <div class="modal-content">
145 <div class="modal-header">
146 <h5 class="modal-title" id="exampleModalCenterTitle">Rename file</h5>
147 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
148 <i class="ti-close"></i>
149 </button>
150 </div>
151 <div class="modal-body">
152 <form action="{{ route("dashboard.files.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">
153 @method("patch")
154 @csrf
155 <div class="row">
156 <div class="col-md-12">
157 <div class="form-group">
158 <label class="form-label">Current name: {{$file->name}}</label>
159 <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" maxlength="255" title="Don't include: '\/.|'" pattern="^[^.\/|]+$" class="form-control" required>
160 </div>
161 </div>
162 </div>
163 <br/>
164 <div class="modal-footer">
165 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
166 </button>
167 <button type="submit" class="btn btn-primary">Save changes</button>
168 </div>
169 </form>
170 </div>
171
172 </div>
173 </div>
174 </div>
175 @endforeach
176
177 </tbody>
178 </table>
179
180 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
181 <div class="modal-dialog modal-dialog-centered" role="document">
182 <div class="modal-content">
183 <div class="modal-header">
184 <h5 class="modal-title" id="exampleModalCenterTitle">Add files</h5>
185 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
186 <i class="ti-close"></i>
187 </button>
188 </div>
189 <div class="modal-body">
190 <form action="{{ route("dashboard.files.store") }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
191 @csrf
192 <div class="row">
193 <div class="col-md-10">
194 <div class="form-group">
195 <label for="exampleFormControlSelect1">Folder</label>
196 @if($folders->count())
197 <select class="form-control" name="folder" required>
198 @foreach ($folders as $folder)
199 <option value="{{ $folder->id }}" {{ (old("folder") == $folder->id ? "selected" : "") }}>{{ $folder->name }}</option>
200 @endforeach
201 @else
202 <p>You haven't created any folders yet. <a class="text-primary" href="{{ route("dashboard.folders.index") }}">Create now.</a></p>
203 @endif
204 </select>
205 </div>
206 </div>
207 <div class="col-md-10">
208 <div class="form-group">
209 <label for="exampleFormControlSelect1">Uploads</label>
210
211
212 <input type="file" class="form-control" id="file-item" name="file_item[]" accept="{{ $fileTypes }}" multiple>
213 </div>
214 </div>
215 </div>
216 <br/>
217 <div class="modal-footer">
218 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
219 </button>
220 <button type="submit" class="btn btn-primary">Save changes</button>
221 </div>
222 </form>
223 </div>
224
225 </div>
226 </div>
227 </div>
228
229 </div>
230 </div>
231 </div>
232 </div>
233 </div>
234
235@endsection
236
237@section('script')
238
239 @yield('script')
240
241 <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
242 <!-- Datatable -->
243 <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
244@endsection
Note: See TracBrowser for help on using the repository browser.