1 | @extends('layouts.app')
|
---|
2 |
|
---|
3 | @section("title", "User Settings")
|
---|
4 |
|
---|
5 | @section('content')
|
---|
6 |
|
---|
7 | <div class="page-header">
|
---|
8 | <nav aria-label="breadcrumb" class="d-flex align-items-start">
|
---|
9 | <ol class="breadcrumb">
|
---|
10 | <li class="breadcrumb-item">
|
---|
11 | <a href="{{ url('/') }}">Dashboard</a>
|
---|
12 | </li>
|
---|
13 | <li class="breadcrumb-item active" aria-current="page">Settings</li>
|
---|
14 | </ol>
|
---|
15 | </nav>
|
---|
16 | </div>
|
---|
17 |
|
---|
18 | <div class="row">
|
---|
19 | <div class="col-md-12">
|
---|
20 |
|
---|
21 | <div class="row">
|
---|
22 | <div class="col-lg-3 col-md-12 mb-3">
|
---|
23 | <div class="nav flex-lg-column flex-sm-row nav-pills" id="#tabMenu" role="tablist" aria-orientation="vertical">
|
---|
24 | <a class="nav-link {{$active_tab == 'account' ? 'active' : ""}}" id="account-tab" data-toggle="pill" href="#account" role="tab" aria-controls="account" aria-selected="true">Account</a>
|
---|
25 | <a class="nav-link {{$active_tab == 'security' ? 'active' : ""}}" id="security-tab" data-toggle="pill" href="#security" role="tab" aria-controls="security" aria-selected="false">Security</a>
|
---|
26 | @if(auth()->user()->hasPermission('manage_file_types'))
|
---|
27 | <a class="nav-link {{$active_tab == 'file-types' ? 'active' : ""}}" id="file-types-tab" data-toggle="pill" href="#file-types" role="tab" aria-controls="file-types" aria-selected="false">File validation</a>
|
---|
28 | @endif
|
---|
29 | </div>
|
---|
30 | </div>
|
---|
31 | <div class="col-lg-9 col-md-12">
|
---|
32 | <div class="tab-content" id="v-pills-tabContent">
|
---|
33 | <div class="tab-pane {{$active_tab == 'account' ? 'active' : ""}}" id="account" role="tabpanel" aria-labelledby="account-tab">
|
---|
34 | <div class="card">
|
---|
35 | <div class="card-body">
|
---|
36 | <h6 class="card-title">Account</h6>
|
---|
37 | <form action="{{ route("dashboard.users.editUserData", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data' class="needs-validation" novalidate>
|
---|
38 | @method("patch")
|
---|
39 | @csrf
|
---|
40 | <div class="row">
|
---|
41 | <div class="col-md-6">
|
---|
42 | <div class="form-group">
|
---|
43 | <label>Name</label>
|
---|
44 | <input type="text" name="name" value="{{ $user->name }}" minlength="2" maxlength="30" class="form-control" placeholder="Name" required>
|
---|
45 | <div class="invalid-feedback">
|
---|
46 | Please enter only letters and spaces with length between [2, 30]
|
---|
47 | </div>
|
---|
48 | </div>
|
---|
49 | </div>
|
---|
50 | <div class="col-md-6">
|
---|
51 | <div class="form-group">
|
---|
52 | <label>Surname</label>
|
---|
53 | <input type="text" name="surname" value="{{$user->surname}}" class="form-control" placeholder="Surname" required>
|
---|
54 | </div>
|
---|
55 | </div>
|
---|
56 | </div>
|
---|
57 | <div class="row">
|
---|
58 | <div class="col-md-6">
|
---|
59 | <div class="form-group">
|
---|
60 | <label class="form-label">Mobile Number</label>
|
---|
61 | <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
|
---|
62 | </div>
|
---|
63 | </div>
|
---|
64 | <div class="col-md-5">
|
---|
65 | <div class="form-group">
|
---|
66 | <label>Avatar</label>
|
---|
67 | <input type="file" name="avatar" value="{{ $user->avatar }}" class="form-control" accept="image/*">
|
---|
68 | </div>
|
---|
69 | </div>
|
---|
70 | <div class="col-md-1">
|
---|
71 | <div class="form-group">
|
---|
72 | <label></label>
|
---|
73 | <figure class="avatar avatar-sm mr-2">
|
---|
74 | @if(auth()->user()->avatar==NULL)
|
---|
75 | <img src="{{ url('assets/media/images/user.png') }}" class="rounded-circle" alt="avatar">
|
---|
76 | @else
|
---|
77 | <img src="{{url('uploads/users/' . auth()->user()->avatar)}}" class="rounded-circle" alt="avatar">
|
---|
78 | @endif
|
---|
79 | </figure>
|
---|
80 | </div>
|
---|
81 | </div>
|
---|
82 | </div>
|
---|
83 | <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
|
---|
84 | </form>
|
---|
85 | </div>
|
---|
86 | </div>
|
---|
87 | </div>
|
---|
88 | <div class="tab-pane {{$active_tab == 'security' ? 'active' : ""}}" id="security" role="tabpanel" aria-labelledby="security-tab">
|
---|
89 | <div class="card">
|
---|
90 | <div class="card-body">
|
---|
91 | <form class="actionForm" action="{{ route("dashboard.settings.password") }}"
|
---|
92 | method="post" accept-charset="UTF-8">
|
---|
93 |
|
---|
94 | @method("patch")
|
---|
95 | @csrf
|
---|
96 |
|
---|
97 | <fieldset class="form-fieldset">
|
---|
98 |
|
---|
99 | <h4 class="font-weight-normal border-bottom pb-2">Password</h4>
|
---|
100 |
|
---|
101 | <h6 class="font-weight-normal text-muted">After changing your
|
---|
102 | password you will be logged out automatically.</h6>
|
---|
103 |
|
---|
104 | <div class="row">
|
---|
105 |
|
---|
106 | <div class="col-md-4">
|
---|
107 | <div class="form-group">
|
---|
108 | <label class="form-label">Current Password <span
|
---|
109 | class="form-required">*</span></label>
|
---|
110 | <input type="password" class="form-control"
|
---|
111 | name="current_password" autocomplete="off"
|
---|
112 | required>
|
---|
113 | </div>
|
---|
114 | </div>
|
---|
115 |
|
---|
116 | <div class="col-md-4">
|
---|
117 | <div class="form-group">
|
---|
118 | <label class="form-label">New Password <span
|
---|
119 | class="form-required">*</span></label>
|
---|
120 | <input type="password" class="form-control"
|
---|
121 | name="password" autocomplete="off" required>
|
---|
122 | </div>
|
---|
123 | </div>
|
---|
124 |
|
---|
125 | <div class="col-md-4">
|
---|
126 | <div class="form-group">
|
---|
127 | <label class="form-label">Repeat New Password <span
|
---|
128 | class="form-required">*</span></label>
|
---|
129 | <input type="password" class="form-control"
|
---|
130 | name="password_confirmation" autocomplete="off"
|
---|
131 | required>
|
---|
132 | </div>
|
---|
133 | </div>
|
---|
134 |
|
---|
135 | <div class="col-md-12">
|
---|
136 | <div class="form-group mb-0 float-right">
|
---|
137 | <input type="submit" value="Submit"
|
---|
138 | class="submitBtn btn btn-primary">
|
---|
139 | </div>
|
---|
140 | </div>
|
---|
141 |
|
---|
142 | </div>
|
---|
143 |
|
---|
144 | </fieldset>
|
---|
145 |
|
---|
146 | </form>
|
---|
147 | </div>
|
---|
148 | </div>
|
---|
149 |
|
---|
150 |
|
---|
151 | <div class="card">
|
---|
152 | <div class="card-body">
|
---|
153 |
|
---|
154 | <h4 class="font-weight-normal border-bottom pb-2">Username</h4>
|
---|
155 |
|
---|
156 | <h6 class="font-weight-normal text-muted">After changing your
|
---|
157 | username you will be logged out automatically.</h6>
|
---|
158 |
|
---|
159 | <div class="row">
|
---|
160 |
|
---|
161 | <div class="col-md-6">
|
---|
162 | <div class="form-group">
|
---|
163 | <label class="form-label">Username</label>
|
---|
164 | <input type="text" id="username"
|
---|
165 | value="{{ old("username", $user->username) }}"
|
---|
166 | name="username" class="form-control">
|
---|
167 | </div>
|
---|
168 | </div>
|
---|
169 |
|
---|
170 | <div class="col-md-12">
|
---|
171 | <div class="form-group mb-0 float-right">
|
---|
172 | <a href="javascript:void(0)" class="submitBtn btn btn-primary text-white" data-toggle="modal" id="submitUserName" data-target="#confirmUsernameModal">Submit</a>
|
---|
173 | </div>
|
---|
174 | </div>
|
---|
175 |
|
---|
176 | </div>
|
---|
177 |
|
---|
178 | </div>
|
---|
179 | </div>
|
---|
180 |
|
---|
181 | <div class="card">
|
---|
182 | <div class="card-body">
|
---|
183 |
|
---|
184 | <h4 class="font-weight-normal border-bottom pb-2">E-mail</h4>
|
---|
185 |
|
---|
186 | <h6 class="font-weight-normal text-muted">This is where lost
|
---|
187 | password requests will be sent. After changing your e-mail you
|
---|
188 | will be logged out automatically.</h6>
|
---|
189 |
|
---|
190 | <div class="row">
|
---|
191 |
|
---|
192 | <div class="col-md-4">
|
---|
193 | <div class="form-group">
|
---|
194 | <label class="form-label">E-mail</label>
|
---|
195 | <input type="email"
|
---|
196 | value="{{ old("email", $user->email) }}"
|
---|
197 | name="email" id="email" class="form-control">
|
---|
198 | </div>
|
---|
199 | </div>
|
---|
200 |
|
---|
201 | <div class="col-md-12">
|
---|
202 | <div class="form-group mb-0 float-right">
|
---|
203 | <a href="javascript:void(0)" class="submitBtn btn btn-primary text-white" data-toggle="modal" id="submitEmail" data-target="#confirmEmailModal">Submit</a>
|
---|
204 | </div>
|
---|
205 | </div>
|
---|
206 |
|
---|
207 | </div>
|
---|
208 | </div>
|
---|
209 | </div>
|
---|
210 | </div>
|
---|
211 | <div class="tab-pane {{$active_tab == 'file-types' ? 'active' : ""}}" id="file-types" role="tabpanel" aria-labelledby="file-types-tab">
|
---|
212 | @if(auth()->user()->hasPermission('manage_file_types'))
|
---|
213 | <div class="card">
|
---|
214 | <div class="card-body">
|
---|
215 | <h6 class="card-title">File validation</h6>
|
---|
216 | <form action="{{ route("dashboard.settings.file-types") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
|
---|
217 | @method("patch")
|
---|
218 | @csrf
|
---|
219 | <div class="row">
|
---|
220 | <div class="col-md-6">
|
---|
221 | <div class="form-group">
|
---|
222 | <label>Mimes</label>
|
---|
223 | <input type="text" name="mimes" value="{{ $fileType->mimes }}" class="form-control" placeholder="Mimes" required>
|
---|
224 | </div>
|
---|
225 | </div>
|
---|
226 | <div class="col-md-6">
|
---|
227 | <div class="form-group">
|
---|
228 | <label class="form-label">Max file size (in KB)</label>
|
---|
229 | <input type="number" name="max_size" value="{{ $fileType->max_size }}" class="form-control" placeholder="Max file size" autocomplete="off" required>
|
---|
230 | <p class="text-danger p-2">Note: 1 MB = 1024 KB</p>
|
---|
231 | </div>
|
---|
232 | </div>
|
---|
233 | </div>
|
---|
234 | <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
|
---|
235 | </form>
|
---|
236 | </div>
|
---|
237 | </div>
|
---|
238 | @endif
|
---|
239 | </div>
|
---|
240 | </div>
|
---|
241 | </div>
|
---|
242 | </div>
|
---|
243 |
|
---|
244 | </div>
|
---|
245 | </div>
|
---|
246 |
|
---|
247 | <div class="modal fade" id="confirmUsernameModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
248 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
249 | <div class="modal-content">
|
---|
250 | <div class="modal-header">
|
---|
251 | <h5 class="modal-title" id="exampleModalCenterTitle">Update confirmation</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.settings.username") }}" method="POST">
|
---|
258 |
|
---|
259 | @method('patch')
|
---|
260 | @csrf
|
---|
261 |
|
---|
262 | <p>Are you sure you want to update your username to <span id="user_name" class="font-weight-bold"></span>?</p>
|
---|
263 | <input type="hidden" id="user_name_input" value="" name="username">
|
---|
264 | <div class="modal-footer">
|
---|
265 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
266 | </button>
|
---|
267 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
268 | </div>
|
---|
269 | </form>
|
---|
270 | </div>
|
---|
271 | </div>
|
---|
272 | </div>
|
---|
273 | </div>
|
---|
274 |
|
---|
275 | <div class="modal fade" id="confirmEmailModal" tabindex="-1" role="dialog" aria-hidden="true">
|
---|
276 | <div class="modal-dialog modal-dialog-centered" role="document">
|
---|
277 | <div class="modal-content">
|
---|
278 | <div class="modal-header">
|
---|
279 | <h5 class="modal-title" id="exampleModalCenterTitle">Update confirmation</h5>
|
---|
280 | <button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
---|
281 | <i class="ti-close"></i>
|
---|
282 | </button>
|
---|
283 | </div>
|
---|
284 | <div class="modal-body">
|
---|
285 | <form action="{{ route("dashboard.settings.email") }}" method="POST">
|
---|
286 |
|
---|
287 | @method('patch')
|
---|
288 | @csrf
|
---|
289 |
|
---|
290 | <p>Are you sure you want to update your email to <span id="user_email" class="font-weight-bold"></span>?</p>
|
---|
291 | <input type="hidden" id="user_email_input" value="" name="email">
|
---|
292 | <div class="modal-footer">
|
---|
293 | <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
|
---|
294 | </button>
|
---|
295 | <button type="submit" class="btn btn-primary">Save changes</button>
|
---|
296 | </div>
|
---|
297 | </form>
|
---|
298 | </div>
|
---|
299 | </div>
|
---|
300 | </div>
|
---|
301 | </div>
|
---|
302 |
|
---|
303 | @endsection
|
---|
304 |
|
---|
305 | @section('script')
|
---|
306 |
|
---|
307 | <script>
|
---|
308 | $("#submitUserName").click(function () {
|
---|
309 | var name = $("#username").val();
|
---|
310 | $("#user_name").html(name);
|
---|
311 | $("#user_name_input").val(name);
|
---|
312 | });
|
---|
313 | </script>
|
---|
314 |
|
---|
315 | <script>
|
---|
316 | $("#submitEmail").click(function () {
|
---|
317 | var email = $("#email").val();
|
---|
318 | $("#user_email").html(email);
|
---|
319 | $("#user_email_input").val(email);
|
---|
320 | });
|
---|
321 | </script>
|
---|
322 | @endsection
|
---|