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