@extends('layouts.master')
@section('title', 'Edit Role')
@section('content')
<div class="container">

    <div class="card-header bg-primary text-white py-3 mb-4">
        <h5 class="mb-0"><i class="fas fa-user-cog me-2"></i> Edit Role</h5>
    </div>

    @if ($errors->any())
        <div class="alert alert-danger">
            <ul>@foreach ($errors->all() as $error)<li>{{ $error }}</li>@endforeach</ul>
        </div>
    @endif

    <form action="{{ route('roles.update', $role->id) }}" method="POST">
        @csrf
        @method('PUT')

      <div class="row mb-3">
      <div class="col-md-6">
                            <input type="text" name="roleName" id="roleName" class="form-control shadow" placeholder="Role Name" value="{{ $role->name }}" required>
                        </div>

                        <div class="col-md-6">
                            <textarea name="description" id="description" class="form-control shadow" placeholder="Enter Your Description" rows="4" required>{{ $role->description }}</textarea>
                        </div>
    </div>

        <button type="submit" class="btn btn-primary">Update Role</button>
        <a href="{{ route('roles.index') }}" class="btn btn-secondary">Back</a>
    </form>
</div>
@endsection
