Frontend support for role selection in user create, read and update.

This commit is contained in:
frederikpyt 2020-06-30 08:03:42 +02:00
parent a4ff9a3590
commit c803d12299
6 changed files with 27 additions and 11 deletions

View File

@ -57,7 +57,8 @@ form {
display: inline-flex; display: inline-flex;
} }
input { input,
select {
border: grey solid 2px; border: grey solid 2px;
border-radius: 4px; border-radius: 4px;
background-color: transparent; background-color: transparent;

View File

@ -57,7 +57,8 @@ form {
display: inline-flex; display: inline-flex;
} }
input { input,
select {
border: grey solid 2px; border: grey solid 2px;
border-radius: 4px; border-radius: 4px;
background-color: transparent; background-color: transparent;

View File

@ -37,7 +37,7 @@ form {
display: inline-flex; display: inline-flex;
} }
input{ input, select{
border: grey solid 2px; border: grey solid 2px;
border-radius: 4px; border-radius: 4px;
background-color: transparent; background-color: transparent;

View File

@ -25,6 +25,12 @@
<input type="password" id="password2" placeholder="Bekræft Password" required> <input type="password" id="password2" placeholder="Bekræft Password" required>
<label for="tel">Telefon nr:</label> <label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required> <input type="tel" name="phone" id="tel" placeholder="12345678" pattern="[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{2}" required>
<label for="role">Rolle:</label>
<select name="role" id="role" class="mb-2" required>
<option value="admin">Admin</option>
<option value="staff">Personale</option>
<option value="resident">Beboer</option>
</select>
<input type="submit" class="btn btn-dark text-white" value="Opret"> <input type="submit" class="btn btn-dark text-white" value="Opret">
</form> </form>
@endsection @endsection

View File

@ -15,17 +15,23 @@
@csrf @csrf
@method("put") @method("put")
<label for="name_first">Fornavn:</label> <label for="name_first">Fornavn:</label>
<input type="text" name="name_first" id="name_first" value="{{ $user->name_first }}" required> <input type="text" name="name_first" id="name_first" value="{{ $user->name_first }}" required>
<label for="name_last">Efternavn:</label> <label for="name_last">Efternavn:</label>
<input type="text" name="name_last" id="name_last" value="{{ $user->name_last }}" required> <input type="text" name="name_last" id="name_last" value="{{ $user->name_last }}" required>
<label for="email">Email:</label> <label for="email">Email:</label>
<input type="email" name="email" id="email" value="{{ $user->name_email }}" required> <input type="email" name="email" id="email" value="{{ $user->name_email }}" required>
<label for="password1">Password:</label> <label for="password1">Password:</label>
<input type="password" name="password" id="password1" value="" required> <input type="password" name="password" id="password1" value="" required>
<label for="password2">Confirm Password:</label> <label for="password2">Confirm Password:</label>
<input type="password" id="password2" value="" required> <input type="password" id="password2" value="" required>
<label for="tel">Telefon nr:</label> <label for="tel">Telefon nr:</label>
<input type="tel" name="phone" id="tel" value="{{ $user->phone }}" required> <input type="tel" name="phone" id="tel" value="{{ $user->phone }}" required>
<label for="role">Rolle:</label>
<select name="role" id="role" class="mb-2" required>
<option value="admin">Admin</option>
<option value="staff">Personale</option>
<option value="resident">Beboer</option>
</select>
<input type="submit" class="btn btn-dark text-white" value="Rediger"> <input type="submit" class="btn btn-dark text-white" value="Rediger">
</form> </form>
@endsection @endsection

View File

@ -16,18 +16,20 @@
<th>Efternavn</th> <th>Efternavn</th>
<th>Email</th> <th>Email</th>
<th>Tlf nr</th> <th>Tlf nr</th>
<th>Rolle</th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/pencil.svg') }}" alt="Update"></th>
<th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th> <th style="width: 1em;"><img class="w-100" src="{{ asset('/images/icons/trashcan.svg') }}" alt="Delete"></th>
</tr> </tr>
@foreach($users as $user) @foreach($users as $user)
<tr> <tr>
<td>{{ $user->name_first }}</td> <td>{{ $user->name_first }}</td>
<td>{{ $user->name_last }}</td> <td>{{ $user->name_last }}</td>
<td>{{ $user->email }}</td> <td>{{ $user->email }}</td>
<td>{{ $user->phone }}</td> <td>{{ $user->phone }}</td>
<td>{{ $user->roles }}</td>
<td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td> <td><a href="{{ route("users.edit", [ "user" => $user->id ]) }}"><img class="w-100" src="{{ asset('/images/icons/pencil-dark.svg') }}" alt="Update"></a></td>
<td><a href="{{ route("users.destroy", [ "user" => $user ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td> <td><a href="{{ route("users.destroy", [ "user" => $user ]) }}"><img class="w-100" src="{{ asset('/images/icons/trashcan-dark.svg') }}" alt="Delete"></a></td>
</tr> </tr>
@endforeach @endforeach
</table> </table>