@extends('layout')
@section('content')
    <!-- begin::main content -->
    <main class="main-content">

        <div class="container">

            <!-- begin::page header -->
            <div class="page-header">
                <h3>Edit Profile</h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Dashboard</a></li>
                        <li class="breadcrumb-item active" aria-current="page">Profile</li>
                    </ol>
                </nav>
            </div>
            <!-- end::page header -->

            <div class="profile m-b-20 p-30 d-lg-flex align-items-center justify-content-between"
                data-backround-image="{{ !empty($myprofile->profile_pics) ? $myprofile->profile_pics : asset('public/admin/media/image/image1.png') }}">
                <div class="d-flex align-items-center">
                    <div>
                        <figure class="avatar avatar-xl m-r-20">
                            <img src="{{ !empty($myprofile->profile_pics) ? $myprofile->profile_pics : asset('public/admin/media/image/avatar.jpg') }}"
                                class="rounded-circle" alt="...">
                        </figure>
                    </div>
                    <div class="text-white">
                        <div>
                            <h3>
                                {{ $myprofile->name }}
                            </h3>
                            <p class="m-b-0 opacity-8">{{ $myprofile->institute }}</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="row row-sm">


                <div class="col-md-6">

                    <div class="card">
                        <div class="card-body">
                            <x-flashMessage />
                            <h6 class="card-title">Edit Profile</h6>
                            <form action="{{ asset('edit-profile/') }}" enctype="multipart/form-data" method="post">
                                @csrf
                                <div class="form-group">
                                    <label for="name">Name</label>
                                    <input type="hidden" value="{{ $myprofile->id }}" name="admin_id">
                                    <input type="text" class="form-control" name="name"
                                        value="{{ !empty($myprofile->name) ? $myprofile->name : '' }}" id="name"
                                        placeholder="User Name">
                                    @if ($errors->has('name'))
                                        <div class="error">
                                            {{ $errors->first('name') }}
                                        </div>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <label for="email">Email</label>
                                    <input type="email" class="form-control" name="email"
                                        value="{{ !empty($myprofile->email) ? $myprofile->email : '' }}" id="email"
                                        placeholder="Enter Email Name">

                                    @if ($errors->has('email'))
                                        <div class="error">
                                            {{ $errors->first('email') }}
                                        </div>
                                    @endif

                                </div>

                                <div class="form-group">
                                    <label for="phone">Mobile</label>
                                    <input type="number" class="form-control" name="mobile"
                                        value="{{ !empty($myprofile->mobile) ? $myprofile->mobile : '' }}" id="phone"
                                        placeholder="Enter Phone">

                                    @if ($errors->has('phone'))
                                        <div class="error">
                                            {{ $errors->first('mobile') }}
                                        </div>
                                    @endif

                                </div>

                                {{-- <div class="form-group">
                                    <label for="institute">Institute</label>
                                    <input type="text" class="form-control" name="institute"
                                        value="{{ !empty($myprofile->institute) ? $myprofile->institute : '' }}"
                                        id="institute" placeholder="Enter Institute">
                                    @if ($errors->has('institute'))
                                        <div class="error">
                                            {{ $errors->first('institute') }}
                                        </div>
                                    @endif
                                </div> --}}

                                <div class="form-group">
                                    <label for="image">Profile image</label>
                                    <input type="file" class="form-control" name="image" id="image">
                                    @if ($errors->has('image'))
                                        <div class="error">
                                            {{ $errors->first('image') }}
                                        </div>
                                    @endif
                                </div>

                                <div class="form-group">
                                    <img src="{{ !empty($myprofile->profile_pics) ? $myprofile->profile_pics : '' }}"
                                        alt="" style="width:100px;">
                                </div>

                                <button type="submit" class="btn btn-primary">Update</button>
                            </form>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </main>
    <!-- end::main content -->
@endsection
@push('footer-script')
@endpush
