source: resources/views/dashboard/settings/index.blade.php@ 79aa35c

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

added confirmation modal on userSettings

  • Property mode set to 100644
File size: 18.8 KB
RevLine 
[194a359]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">
[c6b84df]11 <a href="{{ url('/') }}">Dashboard</a>
[194a359]12 </li>
[c6b84df]13 <li class="breadcrumb-item active" aria-current="page">Settings</li>
[194a359]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">
[e6c1f87]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>
[1c17e70]26 @if(auth()->user()->hasPermission('manage_file_types'))
[c6b84df]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>
[0df7a93]28 @endif
[194a359]29 </div>
30 </div>
31 <div class="col-lg-9 col-md-12">
32 <div class="tab-content" id="v-pills-tabContent">
[e6c1f87]33 <div class="tab-pane {{$active_tab == 'account' ? 'active' : ""}}" id="account" role="tabpanel" aria-labelledby="account-tab">
[194a359]34 <div class="card">
35 <div class="card-body">
36 <h6 class="card-title">Account</h6>
[d795fa6]37 <form action="{{ route("dashboard.users.editUserData", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data' class="needs-validation" novalidate>
[194a359]38 @method("patch")
39 @csrf
40 <div class="row">
41 <div class="col-md-6">
42 <div class="form-group">
43 <label>Name</label>
[d795fa6]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>
[194a359]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>
[d795fa6]61 <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
[194a359]62 </div>
63 </div>
[24a616f]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">
[0a1fb54]72 <label></label>
[0208bbd]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
[24a616f]81 </div>
82 </div>
[194a359]83 </div>
84 <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
85 </form>
86 </div>
87 </div>
88 </div>
[e6c1f87]89 <div class="tab-pane {{$active_tab == 'security' ? 'active' : ""}}" id="security" role="tabpanel" aria-labelledby="security-tab">
[194a359]90 <div class="card">
91 <div class="card-body">
92 <form class="actionForm" action="{{ route("dashboard.settings.password") }}"
93 method="post" accept-charset="UTF-8">
94
95 @method("patch")
96 @csrf
97
98 <fieldset class="form-fieldset">
99
100 <h4 class="font-weight-normal border-bottom pb-2">Password</h4>
101
102 <h6 class="font-weight-normal text-muted">After changing your
103 password you will be logged out automatically.</h6>
104
105 <div class="row">
106
107 <div class="col-md-4">
108 <div class="form-group">
109 <label class="form-label">Current Password <span
110 class="form-required">*</span></label>
111 <input type="password" class="form-control"
112 name="current_password" autocomplete="off"
113 required>
114 </div>
115 </div>
116
117 <div class="col-md-4">
118 <div class="form-group">
119 <label class="form-label">New Password <span
120 class="form-required">*</span></label>
121 <input type="password" class="form-control"
122 name="password" autocomplete="off" required>
123 </div>
124 </div>
125
126 <div class="col-md-4">
127 <div class="form-group">
128 <label class="form-label">Repeat New Password <span
129 class="form-required">*</span></label>
130 <input type="password" class="form-control"
131 name="password_confirmation" autocomplete="off"
132 required>
133 </div>
134 </div>
135
136 <div class="col-md-12">
137 <div class="form-group mb-0 float-right">
138 <input type="submit" value="Submit"
139 class="submitBtn btn btn-primary">
140 </div>
141 </div>
142
143 </div>
144
145 </fieldset>
146
147 </form>
148 </div>
149 </div>
150
151
152 <div class="card">
153 <div class="card-body">
154
155 <h4 class="font-weight-normal border-bottom pb-2">Username</h4>
156
157 <h6 class="font-weight-normal text-muted">After changing your
158 username you will be logged out automatically.</h6>
159
160 <div class="row">
161
162 <div class="col-md-6">
163 <div class="form-group">
164 <label class="form-label">Username</label>
[ec7b69d]165 <input type="text" id="username"
[194a359]166 value="{{ old("username", $user->username) }}"
167 name="username" class="form-control">
168 </div>
169 </div>
170
171 <div class="col-md-12">
172 <div class="form-group mb-0 float-right">
[ec7b69d]173 <a href="javascript:void(0)" class="submitBtn btn btn-primary text-white" data-toggle="modal" id="submitUserName" data-target="#confirmUsernameModal">Submit</a>
[194a359]174 </div>
175 </div>
176
177 </div>
178
179 </div>
180 </div>
181
182 <div class="card">
183 <div class="card-body">
184
185 <h4 class="font-weight-normal border-bottom pb-2">E-mail</h4>
186
187 <h6 class="font-weight-normal text-muted">This is where lost
188 password requests will be sent. After changing your e-mail you
189 will be logged out automatically.</h6>
190
191 <div class="row">
192
193 <div class="col-md-4">
194 <div class="form-group">
195 <label class="form-label">E-mail</label>
196 <input type="email"
197 value="{{ old("email", $user->email) }}"
[ec7b69d]198 name="email" id="email" class="form-control">
[194a359]199 </div>
200 </div>
201
202 <div class="col-md-12">
203 <div class="form-group mb-0 float-right">
[ec7b69d]204 <a href="javascript:void(0)" class="submitBtn btn btn-primary text-white" data-toggle="modal" id="submitEmail" data-target="#confirmEmailModal">Submit</a>
[194a359]205 </div>
206 </div>
207
208 </div>
209 </div>
210 </div>
211 </div>
[c6b84df]212 <div class="tab-pane {{$active_tab == 'file-types' ? 'active' : ""}}" id="file-types" role="tabpanel" aria-labelledby="file-types-tab">
[1c17e70]213 @if(auth()->user()->hasPermission('manage_file_types'))
[194a359]214 <div class="card">
[c6b84df]215 <div class="card-body">
216 <h6 class="card-title">File validation</h6>
217 <form action="{{ route("dashboard.settings.file-types") }}" method="post" accept-charset="utf-8" enctype='multipart/form-data'>
218 @method("patch")
219 @csrf
220 <div class="row">
221 <div class="col-md-6">
222 <div class="form-group">
223 <label>Mimes</label>
224 <input type="text" name="mimes" value="{{ $fileType->mimes }}" class="form-control" placeholder="Mimes" required>
225 </div>
226 </div>
227 <div class="col-md-6">
228 <div class="form-group">
229 <label class="form-label">Max file size (in KB)</label>
230 <input type="number" name="max_size" value="{{ $fileType->max_size }}" class="form-control" placeholder="Max file size" autocomplete="off" required>
231 <p class="text-danger p-2">Note: 1 MB = 1024 KB</p>
232 </div>
233 </div>
234 </div>
235 <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
236 </form>
237 </div>
238 </div>
[ec7b69d]239 @endif
[194a359]240 </div>
241 </div>
242 </div>
243 </div>
244
245 </div>
246 </div>
247
[ec7b69d]248 <div class="modal fade" id="confirmUsernameModal" tabindex="-1" role="dialog" aria-hidden="true">
249 <div class="modal-dialog modal-dialog-centered" role="document">
250 <div class="modal-content">
251 <div class="modal-header">
252 <h5 class="modal-title" id="exampleModalCenterTitle">Update confirmation</h5>
253 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
254 <i class="ti-close"></i>
255 </button>
256 </div>
257 <div class="modal-body">
258 <form action="{{ route("dashboard.settings.username") }}" method="POST">
259
260 @method('patch')
261 @csrf
262
263 <p>Are you sure you want to update your username to <span id="user_name" class="font-weight-bold"></span>?</p>
264 <input type="hidden" id="user_name_input" value="" name="username">
265 <div class="modal-footer">
266 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
267 </button>
268 <button type="submit" class="btn btn-primary">Save changes</button>
269 </div>
270 </form>
271 </div>
272 </div>
273 </div>
274 </div>
275
276 <div class="modal fade" id="confirmEmailModal" tabindex="-1" role="dialog" aria-hidden="true">
277 <div class="modal-dialog modal-dialog-centered" role="document">
278 <div class="modal-content">
279 <div class="modal-header">
280 <h5 class="modal-title" id="exampleModalCenterTitle">Update confirmation</h5>
281 <button type="button" class="close" data-dismiss="modal" aria-label="Close">
282 <i class="ti-close"></i>
283 </button>
284 </div>
285 <div class="modal-body">
286 <form action="{{ route("dashboard.settings.email") }}" method="POST">
287
288 @method('patch')
289 @csrf
290
291 <p>Are you sure you want to update your email to <span id="user_email" class="font-weight-bold"></span>?</p>
292 <input type="hidden" id="user_email_input" value="" name="email">
293 <div class="modal-footer">
294 <button type="button" class="btn btn-secondary" data-dismiss="modal">Close
295 </button>
296 <button type="submit" class="btn btn-primary">Save changes</button>
297 </div>
298 </form>
299 </div>
300 </div>
301 </div>
302 </div>
303
[194a359]304@endsection
[e6c1f87]305
306@section('script')
[ec7b69d]307
308 <script>
309 $("#submitUserName").click(function () {
310 var name = $("#username").val();
311 $("#user_name").html(name);
312 $("#user_name_input").val(name);
313 });
314 </script>
315
[e6c1f87]316 <script>
[ec7b69d]317 $("#submitEmail").click(function () {
318 var email = $("#email").val();
319 $("#user_email").html(email);
320 $("#user_email_input").val(email);
[e6c1f87]321 });
322 </script>
323@endsection
Note: See TracBrowser for help on using the repository browser.