@extends('layouts.admin') @section('content')
<div class="row mb-3">
    <div class="col-10">
        <div class="card mb-3">
            <div class="card-header">
                <div class="row flex-between-end">
                    <div class="col-auto align-self-center">
                    <a href="{{ url()->previous() }}" class="btn btn-primary btn-sm"><i class="fas fa-arrow-circle-left"></i> Back</a>
                    <a href='{{ url("/member_profile", $beneficiary->member->id)}}' class="btn btn-primary btn-sm"><i class="fas fa-user"></i> {{$beneficiary->member->name}} {{$beneficiary->member->surname}}'s Profile</a>
                   <br><br> 
                        <h5 class="mb-0" data-anchor="data-anchor">Edit beneficiary</h5>
                    </div>
                </div>
            </div>
            <div class="card-body bg-light">
                <form class="form-material" method="POST" action="{{ url ('/beneficiary')}}/{{$beneficiary->id}}">
                    @csrf
                    @method ('PUT')
                    @if(count($errors->all()))
                    @foreach ($errors->all() as $error)
                    <div class="alert alert-danger alert-dismissable"> <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a> <strong>Alert!</strong> {{ $error }} </div> @endforeach @endif
                    <div class="row">
                        <div class="col-sm-6">
                             <input type="text" required class="form-control" id="name" name="name" value="{{$beneficiary->name}}" placeholder="Name">
                        </div>
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="surname" name="surname" value="{{$beneficiary->surname}}" placeholder="">
                            <br>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-sm-6">
                            <select name="gender" class="form-control">
                                <option>{{$beneficiary->gender}}</option>
                                <option>Female</option>
                                <option>Male</option>
                            </select>
                        </div>
                        <div class="col-sm-6">
                            <input type="number" required class="form-control" id="national_id" name="national_id" value="{{$beneficiary->national_id}}" placeholder="National ID">
                        </div>
                    </div><br>
                    <div class="row">
                        <div class="col-sm-6">
                            <input type="text" required minlength="12" maxlength="12" class="form-control" id="cell_number" name="cell_number" value="{{$beneficiary->cell_number}}" placeholder="Cell Number">
                        </div>
                    </div><br>
                    <div class="row">
                        <div class="col-sm-6">
                            <input type="date" required class="form-control" id="date_of_birth" name="date_of_birth" value="{{$beneficiary->date_of_birth}}"><br>
                        </div>
                        <div class="col-sm-6">
                            <input type="text" required class="form-control" id="relationship" name="relationship" value="{{$beneficiary->relationship}}" placeholder="Relationship">
                            <br>
                        </div>
                    </div>
                    <div class="text-center">
                        <br><button type="submit" class="btn btn-primary btn-sm"><i class="far fa-save"></i> Edit</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
@endsection