source: resources/views/dashboard/documents/edit.blade.php@ ea7b12a

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

added files crud in table

  • Property mode set to 100644
File size: 15.0 KB
Line 
1@extends('layouts.app')
2
3@section("title", "Documents - Edit document")
4
5@section('pageTitle', 'Edit document')
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">
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/documents') }}">Documents</a>
19 </li>
20 <li class="breadcrumb-item active" aria-current="page">Edit document</li>
21 </ol>
22 </nav>
23 </div>
24
25 <div class="row">
26 <div class="col-md-12">
27
28 <div class="row">
29 <div class="col-lg-12 col-md-12">
30 <div class="tab-content" id="v-pills-tabContent">
31 <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
32 <div class="card">
33 <div class="card-body">
34 <h6 class="card-title">Documents</h6>
35 <form action="{{ route("dashboard.documents.edit", ["id" => $document->id]) }}" method="post" accept-charset="utf-8" enctype="multipart/form-data">
36 @method("patch")
37 @csrf
38 <div class="row">
39 <div class="col-md-6">
40 <div class="form-group">
41 <label for="exampleFormControlSelect1">Department</label>
42 <select class="form-control edit_document_deparment" name="department" required>
43 @foreach ($departments as $department)
44 <option value="{{ $department->id }}" data-dept-code="{{ $department->code }}" {{ old("department", $document->department->id) == $department->id ? "selected" : "" }}>{{ $department->name }}</option>
45 @endforeach
46 </select>
47 </div>
48 </div>
49 <div class="col-md-6">
50 <div class="form-group">
51 <label>Archive ID</label>
52 <input type="text" name="arch_id" value="{{ old("arch_id", $document->arch_id) }}" class="form-control" placeholder="Archive ID" required>
53 </div>
54 </div>
55 </div>
56 <div class="row">
57 <div class="col-md-6">
58 <div class="form-group">
59 <label>Name</label>
60 <input type="text" name="name" value="{{ old("name", $document->name) }}" class="form-control" placeholder="Name" required>
61 </div>
62 </div>
63 <div class="col-md-6">
64 <div class="form-group">
65 <label>Description</label>
66 <textarea class="form-control" name="description" rows="3">
67 {{ old("description", $document->description) }}
68 </textarea>
69 </div>
70 </div>
71 </div>
72 <div class="row">
73 <div class="col-md-6">
74 <input type="file" class="form-control" id="file-item" name="file_item[]" multiple>
75 </div>
76 </div>
77
78 <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
79 </form>
80 </div>
81 </div>
82 </div>
83 </div>
84 </div>
85 </div>
86
87 </div>
88
89 <div class="col-md-12">
90 <div class="card">
91 <div class="card-body">
92 <div class="table-responsive">
93 <table id="user-list" class="table table-lg">
94 <thead>
95 <tr>
96 <th></th>
97 <th>ID</th>
98 <th>Size</th>
99 <th>Name</th>
100 <th>Created at</th>
101 <th>Location</th>
102 <th>Actions</th>
103 </tr>
104 </thead>
105 <tbody>
106 @foreach($files as $file)
107 <tr>
108 <td></td>
109 <td>{{ $file->id }}</td>
110 <td>{{ $file->getSize($file->location) }} MB</td>
111 <td>{{ $file->name }}</td>
112 <td>{{ date('d.m.Y - H:i', strtotime($file->created_at)) }}</td>
113 <!-- Trigger -->
114 <td> <span id="copy_{{$department->id}}"></span>
115 <button class="btn btn-sm btn-primary text-white" data-clipboard-target="#copy_{{ $department->id }}"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-clipboard" viewBox="0 0 16 16">
116 <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"/>
117 <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"/>
118 </svg></button>
119 </td>
120 <td>
121 <a href="javascript:void(0)" class="text-secondary" data-toggle="modal" data-target="#editModal_{{$file->id}}" title="Edit">
122 <i class="ti-pencil"></i>
123 </a>
124 <a href="{{ route("dashboard.documents.downloadFile", $file->id) }}" class="text-secondary" title="Edit">
125 <i class="ti-download"></i>
126 </a>
127 <a href="javascript:void(0)" class="text-danger ml-2" data-toggle="modal" data-target="#deleteModal_{{$file->id}}" title="Delete">
128 <i class="ti-trash"></i>
129 </a>
130 </td>
131 </tr>
132 <div class="modal fade" id="deleteModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
133 <div class="modal-dialog modal-dialog-centered" role="document">
134 <div class="modal-content">
135 <div class="modal-header">
136 <h5 class="modal-title" id="exampleModalCenterTitle">Delete confirmation</h5>
137 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
138 <i class="ti-close"></i>
139 </button>
140 </div>
141 <div class="modal-body">
142 <form action="{{ route("dashboard.documents.deleteFile", $file->id) }}" method="POST">
143 @csrf
144 @method('DELETE')
145 <p>Are you sure you want to delete file {{$file->name}}?</p>
146 <div class="modal-footer">
147 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
148 </button>
149 <button type="submit" class="btn btn-primary">Save changes</button>
150 </div>
151 </form>
152 </div>
153
154 </div>
155 </div>
156 </div>
157
158 <div class="modal fade" id="editModal_{{$file->id}}" tabindex="-1" role="dialog" aria-hidden="true">
159 <div class="modal-dialog modal-dialog-centered" role="document">
160 <div class="modal-content">
161 <div class="modal-header">
162 <h5 class="modal-title" id="exampleModalCenterTitle">Edit department</h5>
163 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
164 <i class="ti-close"></i>
165 </button>
166 </div>
167 <div class="modal-body">
168 <form action="{{ route("dashboard.documents.renameFile", ["id" =>$file->id]) }}" method="post" accept-charset="utf-8">
169 @method("patch")
170 @csrf
171 <div class="row">
172 <div class="col-md-6">
173 <div class="form-group">
174 <label class="form-label">Name</label>
175 <input type="text" name="name" value="{{ explode('.', $file->name)[0] }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
176 </div>
177 </div>
178 </div>
179 <input type="submit" value="Save changes" class="btn btn-primary pull-right m-10">
180 </form>
181 </div>
182
183 </div>
184 </div>
185 </div>
186 @endforeach
187
188 <div class="modal fade" id="createModal" tabindex="-1" role="dialog" aria-hidden="true">
189 <div class="modal-dialog modal-dialog-centered" role="document">
190 <div class="modal-content">
191 <div class="modal-header">
192 <h5 class="modal-title" id="exampleModalCenterTitle">Create department</h5>
193 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
194 <i class="ti-close"></i>
195 </button>
196 </div>
197 <div class="modal-body">
198 <form action="{{ route("dashboard.departments.store") }}" method="post" accept-charset="utf-8">
199 @csrf
200 <div class="row">
201 <div class="col-md-6">
202 <div class="form-group">
203 <label>Name</label>
204 <input type="text" name="name" value="{{ old('name') }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
205 </div>
206 </div>
207 <div class="col-md-6">
208 <div class="form-group">
209 <label>Code</label>
210 <input type="text" name="code" value="{{ old('code') }}" minlength="2" maxlength="30" class="form-control" placeholder="Code" required>
211 </div>
212 </div>
213 </div>
214 <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
215 </form>
216 </div>
217
218 </div>
219 </div>
220 </div>
221
222 </tbody>
223 </table>
224 </div>
225 </div>
226 </div>
227 </div>
228 </div>
229
230@endsection
231
232@section('script')
233 <script src="{{ url('assets/js/examples/pages/user-list.js') }}"></script>
234 <!-- Datatable -->
235 <script src="{{ url('vendors/dataTable/dataTables.min.js') }}"></script>
236@endsection
Note: See TracBrowser for help on using the repository browser.