@extends('yonetim.yonetim_master')

@section('cssler')

@endsection


@section('main')
    <section class="section">
        <div class="section-body">

            <div class="row">


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


                    <div class="border bg-white p-3">



                                @foreach($mesajlar as $mesaj)
                                <div class="row">
                                    <div class="col-md-12">
                                        @if($mesaj->yonetim_mi==1)
                                            <div style="border-radius: 5px;border: 1px solid rgba(95,135,227,0.49)" class="mt-4">

                                                <div style="border-radius: 10px" class="p-2">

                                                    <div style="border: 1px solid rgba(54,231,216,0.05);border-radius: 5px;background-color: rgba(68,105,213,0.87)" class="p-1">
                                                        <div class="row">
                                                            <div class="col-md-6">

                                                                <h6><i class="fa fa-user-plus"></i> Yönetici : {{$mesaj->adminadi->name}}</h6>
                                                            </div>
                                                            <div class="col-md-6">
                                                                <p style="text-align: right;font-size: 14px"> <span>  {{ \Carbon\Carbon::parse($mesaj->created_at)->format('d.m.Y H:i:s') }}</span></p>
                                                            </div>
                                                        </div>

                                                    </div>
                                                </div>


                                                <div style="padding: 2px 15px">


                                                <p style="color: black">{{$mesaj->icerik}}</p>
                                                </div>

                                            </div>





                                        @else


                                            <div style="border-radius: 5px" class="border mt-4">


                                                <div style="border-radius: 10px" class="p-2">

                                                    <div style="border: 1px solid rgba(0,0,0,0.05);border-radius: 5px" class="bg-light p-2">
                                                        <div class="row">
                                                            <div class="col-md-6">

                                                                <h6 style="color: black"><i class="fa fa-user"></i> Müşteri Adı :   <a target="_blank" href="{{route('uyeler.uyedetay',$mesaj->useradi->id)}}">{{$mesaj->useradi->name }} {{ $mesaj->useradi->surname}}</a></h6>


                                                            </div>
                                                            <div class="col-md-6">
                                                                <p style="text-align: right;font-size: 14px;color: black"> <span>  {{ \Carbon\Carbon::parse($mesaj->created_at)->format('d.m.Y H:i:s') }}</span></p>
                                                            </div>
                                                        </div>

                                                    </div>
                                                </div>
                                                <div style="padding: 2px 15px">
                                                    <p style="color: black">{{$mesaj->icerik}}</p>
                                                </div>



                                            </div>






                                        @endif
                                    </div>

                                </div>


                                @endforeach



                        <div class="row mt-5 p-1">
                            <div class="col-md-12">
                                <form method="post" action="{{route('talepler.mesajgonderson')}}">
                                    @csrf

                                    <input type="hidden" name="talepid" value="{{$talepveri->id}}">
                                    <input type="hidden" name="talepstatu" value="{{$talepveri->statu}}">
                                    <input type="hidden" name="gonderenid" value="{{$talepveri->kullanici_id}}">


                                    <textarea class="form-control" style="min-height: 100px" name="icerik"></textarea>

                                    @if($talepveri->statu==4)
                                        <button type="submit" style="margin-top: 10px;margin-bottom: 10px" class="btn btn-warning">Kapatıldı-Tekrar Aç</button>

                                    @else
                                        <button type="submit" style="margin-top: 10px;margin-bottom: 10px" class="btn btn-primary">Gönder</button>

                                    @endif
                                </form>



                                <form style="float: right" method="post" action="{{route('talepler.talepkapatson')}}">
                                    @csrf

                                    <input type="hidden" name="talepid" value="{{$talepveri->id}}">
                                    <input type="hidden" name="gonderenid" value="{{$talepveri->kullanici_id}}">

                                    <button type="submit" style="margin-top: 10px;margin-bottom: 10px" class="btn btn-danger">Talebi Sonlandır</button>
                                </form>
                            </div>

                        </div>

                    </div>
                </div>



                </div>

            </div>



        </div>
    </section>
@endsection
