@extends('tema.layout.home_master')
@section('title')
    <title>Hesap Ayarları</title>
@endsection
@section('cssler')



@endsection
@section('main')

    @include('tema.layout.uyebanner')


    <section style="margin-top: 50px;margin-bottom: 100px">
        <div class="container">
            <div class="row">
                @include('tema.layout.uyemenu')
                <div style="border: 1px solid #E2E2E2" class="col-md-9">
                    <div class="row">
                        <div style="background-color: white;border-right: 1px solid #E2E2E2" class="col-md-6">
                            <h3 class="mt-5 ml-4">Hesap Bilgilerim</h3>

                            @foreach ($errors->all() as $error)
                                <li style="color: red">{{ $error }}</li>
                            @endforeach


                            <form action="{{route('uye.editprofileson')}}" method="post" enctype="multipart/form-data">
                                @csrf
                                <div class="card-body">
                                    <div class="col-lg-12 mx-auto">



                                        <input type="hidden" name="eskiresimyol" value="{{$veriler->profile_image}}">


                                        <div class="form-group">
                                            <label>Resim Yükle(Zorunlu Değil)</label>
                                            <input name="resimyol" class="form-control" type="file">


                                        </div>


                                        <div class="form-group">
                                            <label>Adınız*</label>
                                            <input name="name" class="form-control" type="text" value="{{$veriler->name}}" required maxlength="255">
                                        </div>


                                        <div class="form-group">
                                            <label>Soyadınız*</label>
                                            <input name="surname" class="form-control" type="text" value="{{$veriler->surname}}" required maxlength="255">
                                        </div>





                                        <div class="form-group">
                                            <label>Tckimlik</label>
                                            <input name="tckimlik" class="form-control" type="text" value="{{$veriler->tckimlik}}" maxlength="255">
                                        </div>

                                        <div class="form-group">
                                            <label>Email Adresiniz*</label>

                                            <input name="email" type="text" class="form-control" value="{{$veriler->email}}" disabled required maxlength="255">

                                        </div>


                                        <div class="form-group">
                                            <label>Telefon*</label>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <input name="telefon" type="text" class="form-control" required maxlength="255" value="{{$veriler->telefon}}">
                                                </div>
                                            </div>

                                        </div>


                                        @if($veriler->username=="")
                                            <div class="form-group">
                                                <label>Kullanıcı Adınız*</label>
                                                <input type="text" class="form-control" name="username" value="{{$veriler->username}}" required maxlength="255">
                                            </div>

                                        @else
                                            <div class="form-group">
                                                <label>Kullanıcı Adınız*</label>
                                                <input type="text" class="form-control" name="username" value="{{$veriler->username}}" disabled>
                                            </div>

                                        @endif

                                        <div class="form-group">
                                            <label>İl</label>
                                            <input name="il" class="form-control" type="text" value="{{$veriler->il}}" required maxlength="255">
                                        </div>

                                        <div class="form-group">
                                            <label>İlçe</label>
                                            <input name="ilce" class="form-control" type="text" value="{{$veriler->ilce}}" required maxlength="255">
                                        </div>

                                        <div class="form-group">
                                            <label>Adres</label>
                                            <textarea name="adres" class="form-control" type="text" maxlength="255">{{$veriler->adres}}</textarea>
                                        </div>



                                        <div class="form-group">
                                            <label>Vergi Dairesi(Zorunlu Değil)</label>
                                            <input name="vergi_dairesi" class="form-control" type="text" value="{{$veriler->vergi_dairesi}}" maxlength="255">
                                        </div>

                                        <div class="form-group">
                                            <label>Vergi Numarası(Zorunlu Değil)</label>
                                            <input name="vergi_numarasi" class="form-control" type="text" value="{{$veriler->vergi_numarasi}}" maxlength="255">
                                        </div>



                                        <div class="">
                                            <button style="padding: 10px 0;width: 100%" type="submit" name="genelayarkaydet" class="thm-btn main-nav__btn">Güncelle</button>
                                        </div>


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

                        </div>


                        <div style="background-color: white" class="col-md-6">
                            <h3 class="mt-5 ml-4">Şifre Güncelleme</h3>


                            <form id="sifreformu" onsubmit="return false;" action="{{ route('uye.sifredegistirson') }}" method="post">
                                @csrf
                                <div class="card-body">
                                    <div class="col-lg-12 mx-auto">




                                    @if($veriler->password=="")
                                            <p style="font-size: 13px;line-height: 17px" class="text-danger">*Api servisi ile giriş yaptığınız için şifreniz bulunmamaktadır.Lütfen şifre belirleyerek hesap güvenliğinizi arttırınız</p>


                                            <div class="form-group">
                                                <label>Yeni Şifre</label>
                                                <input id="newpassword" name="newpassword" type="password" class="form-control" autocomplete="new-password">
                                            </div>


                                            <div class="form-group">
                                                <label>Yeni Şifre Tekrar</label>

                                                <input id="password" type="password" class="form-control" name="password" autocomplete="new-password">
                                                <div class="uyari"></div>

                                            </div>
                                        @else
                                            <div class="form-group">
                                                <label>Eski Şifre</label>
                                                <input autocomplete="new-password" id="oldpassword" name="oldpassword" class="form-control" type="text" value="">
                                            </div>

                                            <div class="form-group">
                                                <label>Yeni Şifre</label>
                                                <input id="newpassword" name="newpassword" type="password" class="form-control" autocomplete="new-password">
                                            </div>


                                            <div class="form-group">
                                                <label>Yeni Şifre Tekrar</label>
                                                <input id="password" type="password" class="form-control" name="password" autocomplete="new-password">
                                            </div>

                                        @endif


                                        <div class="form-group">
                                            <button style="padding: 10px 0;width: 100%" type="submit" name="genelayarkaydet" class="thm-btn main-nav__btn">Güncelle</button>
                                        </div>


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



                            <h3 class="mt-5 ml-4">Mail Doğrulama Alanı</h3>


                            <form id="sifreformu" action="{{route('uye.tokenolustur')}}" method="post">
                                @csrf
                                <div class="card-body">
                                    <div class="col-lg-12 mx-auto">




                                        @if($veriler->mailonay==0)
                                            <p style="font-size: 13px;line-height: 17px" class="text-danger">*Mail Onayı Henüz Yapmadınız, Hesap güvenliği için mail adresinizi doğrulamanız gerekmektedir.</p>



                                            <div class="form-group">
                                                <label>Email Adresiniz*</label>

                                                <input name="email" type="text" class="form-control" value="{{$veriler->email}}" disabled required maxlength="255">

                                            </div>

                                            <div class="form-group">
                                                <button style="padding: 10px 0;width: 100%" type="submit" name="genelayarkaydet" class="thm-btn main-nav__btn">Onayla</button>
                                            </div>
                                        @else
                                            <p style="font-size: 13px;line-height: 17px" class="text-danger">*Mail adresiniz Başarıyla Doğrulanmış Durumdadır.</p>

                                            <div class="form-group">
                                                <label>Email Adresiniz*</label>

                                                <input name="email" type="text" class="form-control" value="{{$veriler->email}}" disabled required maxlength="255">

                                            </div>


                                        @endif



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

                    </div>
                </div>



            </div>
        </div>
    </section>


@endsection


@section('jsler')

    <script>
        $(document).ready(function(){
            $("#sifreformu").on("keyup", function(event){
                form_kontrolu();
            });
        });

        var form_kontrolu = function(){
            var sifre1 = $("#newpassword").val();
            var sifre2 = $("#password").val();
            if (!sifre2==""){
                if ( !(sifre1 == sifre2) )
                    $('.uyari').html("Şifreler eşleşmiyor,Aynı Olmalı");
                else
                {
                    $('.uyari').empty();
                    $('#sifreformu').removeAttr('onsubmit');
                }
            }


        }
    </script>






@endsection

