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

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

added validation to blades

  • Property mode set to 100644
File size: 7.9 KB
Line 
1@extends('layouts.app')
2
3@section("title", "Users - Edit user")
4
5@section('pageTitle', 'Edit user')
6
7@section('content')
8
9 <div class="page-header">
10 <nav aria-label="breadcrumb" class="d-flex align-items-start">
11 <ol class="breadcrumb">
12 <li class="breadcrumb-item">
13 <a href="{{ url('dashboard/users') }}">Users</a>
14 </li>
15 <li class="breadcrumb-item active" aria-current="page">Edit user</li>
16 </ol>
17 </nav>
18 </div>
19
20 <div class="row">
21 <div class="col-md-12">
22
23 <div class="row">
24 <div class="col-lg-12 col-md-12">
25 <div class="tab-content" id="v-pills-tabContent">
26 <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab">
27 <div class="card">
28 <div class="card-body">
29 <h6 class="card-title">User account data</h6>
30 <form action="{{ route("dashboard.users.edit", ["id" =>$user->id]) }}" method="post" accept-charset="utf-8" enctype='multipart/form-data' class="needs-validation" novalidate>
31 @method("patch")
32 @csrf
33 <div class="row">
34 <div class="col-md-6">
35 <div class="form-group">
36 <label>Name</label>
37 <input type="text" name="name" value="{{ $user->name }}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Name" required>
38 <div class="invalid-feedback">
39 Please enter only letters and spaces with length between [2, 30]
40 </div>
41 </div>
42 </div>
43 <div class="col-md-6">
44 <div class="form-group">
45 <label>Surname</label>
46 <input type="text" name="surname" value="{{$user->surname}}" minlength="2" maxlength="30" pattern="[a-zA-Zа-шА-Ш._\s]+" class="form-control" placeholder="Surname" required>
47 <div class="invalid-feedback">
48 Please enter only letters and spaces with length between [2, 30]
49 </div>
50 </div>
51 </div>
52 </div>
53 <div class="row">
54 <div class="col-md-6">
55 <div class="form-group">
56 <label class="form-label">Username</label>
57 <input type="text" name="username" value="{{ $user->username }}" minlength="5" maxlength="30" class="form-control" placeholder="Username" required>
58 <div class="invalid-feedback">
59 Please enter characters with length between [5, 30]
60 </div>
61 </div>
62 </div>
63 <div class="col-md-6">
64 <div class="form-group">
65 <label class="form-label">Role</label>
66
67 <select class="form-control" name="userRole" required>
68 @foreach($roles as $role)
69 <option value="{{ $role->id }}" {{ $user->role_id == $role->id ? "selected" : "" }}>{{ $role->name }}</option>
70 @endforeach
71 </select>
72 </div>
73 </div>
74 </div>
75 <div class="row">
76 <div class="col-md-6">
77 <div class="form-group">
78 <label>Email</label>
79 <input type="email" name="email" value="{{ $user->email }}" maxlength="50" class="form-control" placeholder="E-mail" required>
80 <div class="invalid-feedback">
81 Please enter a valid email address with length <=50
82 </div>
83 </div>
84 </div>
85 <div class="col-md-6">
86 <div class="form-group">
87 <label class="form-label">Phone Number</label>
88 <input type="text" name="phone_number" value="{{ $user->phone_number }}" class="form-control" placeholder="Phone number" autocomplete="off" required>
89 <div class="invalid-feedback">
90 Please enter your phone number
91 </div>
92 </div>
93 </div>
94 </div>
95 <div class="row">
96 <div class="col-md-5">
97 <div class="form-group">
98 <label>Avatar</label>
99 <input type="file" name="avatar" value="{{ $user->avatar }}" class="form-control" accept="image/*">
100 <div class="invalid-feedback">
101 Please upload a valid image file
102 </div>
103 </div>
104 </div>
105 <div class="col-md-1">
106 <div class="form-group">
107 <label>Current</label>
108 @include('dashboard.partials.avatar')
109 </div>
110 </div>
111 </div>
112 <input type="submit" value="Save changes" class="submitBtn btn btn-primary pull-right m-10">
113 </form>
114 </div>
115 </div>
116 </div>
117 </div>
118 </div>
119 </div>
120 </div>
121 </div>
122@endsection
Note: See TracBrowser for help on using the repository browser.