@extends('yonetim.yonetim_master')

@section('main')
    <section class="section">
        <div class="section-body">
            <div class="row">
                <div class="col-12 col-md-9 col-lg-9">


                    <div class="card">



                        <form action="{{route('admin.yonupdateson',$veriler->id)}}" method="post" enctype="multipart/form-data">
                            @csrf
                            <div class="card-body">

                                <div class="col-lg-12 mx-auto">

                                    <a href="{{route('admin.all')}}" class="btn btn-success float-right"><i class="fa fa-backward"></i> Geri Dön</a>
                                    <br>

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


                                    <div style="margin-bottom: 10px" class="form-group">

                                        <img style="height: 150px" src="{{asset($veriler->profile_image)}}">
                                        <p style="padding: 0;margin: 0">Güncel Resim</p>
                                        <input type="hidden" name="eskiresimyol" value="{{$veriler->profile_image}}">
                                    </div>

                                    <div class="form-group">
                                        <label>Resim Yükle</label>
                                        <input name="resimyol" class="form-control" type="file">


                                    </div>


                                    <div class="form-group">
                                        <label>Yönetici İsim</label>
                                        <input name="name" required class="form-control" type="text" value="{{$veriler->name}}">
                                    </div>

                                    <div class="form-group">
                                        <label>Yönetici Email</label>
                                        <input name="email" type="text" class="form-control" value="{{$veriler->email}}" required>
                                    </div>


                                    <div class="form-group">
                                        <label>Yönetici Username</label>
                                        <input type="text" class="form-control" name="username" value="{{$veriler->username}}" required>
                                    </div>

                                    <div class="form-group">
                                        <label>Yönetici Şifre</label>
                                        <input autocomplete="new-password" type="password" class="form-control" name="password" value="">
                                    </div>


                                    <div class="form-group">
                                        <label>Yönetici Yetki</label>
                                        <input name="kulyetki" type="hidden" value="{{$veriler->yetki}}">

                                        @if($veriler->yetki==2)
                                            <div class="selectgroup w-100">
                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="2" class="selectgroup-input-radio" checked="">
                                                    <span class="selectgroup-button">Kurucu Admin</span>
                                                </label>

                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="1" class="selectgroup-input-radio" disabled>
                                                    <span class="selectgroup-button">Admin</span>
                                                </label>
                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="0" class="selectgroup-input-radio" disabled>
                                                    <span class="selectgroup-button">Yetkisiz</span>
                                                </label>

                                            </div>



                                        @elseif($veriler->yetki==1)

                                            <div class="selectgroup w-100">

                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="2" class="selectgroup-input-radio" disabled>
                                                    <span class="selectgroup-button">Kurucu Admin</span>
                                                </label>


                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="1" class="selectgroup-input-radio" checked>
                                                    <span class="selectgroup-button">Admin</span>
                                                </label>
                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="0" class="selectgroup-input-radio">
                                                    <span class="selectgroup-button">Yetkisiz</span>
                                                </label>
                                            </div>

                                        @else



                                            <div class="selectgroup w-100">



                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="1" class="selectgroup-input-radio">
                                                    <span class="selectgroup-button">Admin</span>
                                                </label>

                                                <label class="selectgroup-item">
                                                    <input type="radio" name="yetkiderece" value="0" class="selectgroup-input-radio" checked>
                                                    <span class="selectgroup-button">Yetkisiz</span>
                                                </label>

                                            </div>


                                        @endif




                                    </div>

                                    <div class="card-footer text-right">
                                        <button type="submit" name="genelayarkaydet" class="btn btn-primary">Güncelle</button>



                                    </div>


                                </div>
                            </div>
                        </form>


                    </div>





                </div>

            </div>

        </div>
    </section>
@endsection
