@extends('web.layouts.layout')
@section('content')


    <main>


        <!-- ---------- Start breadcrumb ----------- -->
        @include('web.pages.components.header.header')




        <section class="profile-pg pb-4">
            <div class="container">
                <div class="row">
                    <div class="col-lg-3">
                        @include('web.pages.profile.layout.sidebar')
                    </div>
                    <div class="col-lg-9">
                        <div class="adress-tab">
                            <div class="line-title mb-4"> <h5 class="bg-white pe-3"> <i class="far fa-map-marker small me-2"></i> {{__('web.all_addresses')}} </h5> </div>
                            <div class="gray-box adress-info p-4 bg-light1">

                                @foreach($addresses as $row)
                                    <div class="adress-item {{$user->address_id == $row->id ? 'selected' : ''}}">
                                        <h6 class="mb-3"> <i class="fas fa-map-marker cr-blue me-1"></i> <span> {{__('web.addresses_status.'.$row->delivery_status)}} </span> @if($user->address_id == $row->id) <span class="butn sm-butn rounded-3 ms-2"> {{__('web.default')}} </span>  @endif </h6>
                                        <div class="fs-6 mb-2"> {{__('web.delivery_to')}} {{$row->name}} </div>
                                        <div class="text"> {{$row->address}} </div>
                                        <div class="text"> {{__('web.phone')}}: +{{$row->phone}} </div>
                                        <div class="btns">
                                            <a href="{{route('address.edit',$row->id)}}"  class="edit-btn cr-blue"> <i class="fal fa-pen me1"></i> <span class="txt"> {{__('web.edit')}} </span> </a>
                                            <a href="#" onclick="deleteAddress(this)" action-id="{{route('address.destroy',$row->id)}}" class="clt-btn cr-red"> <i class="fal fa-trash me1"></i> <span class="txt"> {{__('web.delete')}} </span> </a>
                                        </div>
                                    </div>
                                @endforeach
                                <a href="{{route('address.create')}}" class="butn butn-line col-lg-4">
                                    <span> <i class="far fa-plus me-2"></i> {{__('web.add_new_address')}} </span>
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>




    </main>

@endsection
@section('inject_js')
    <script src="{{url('')}}/assets/web/js/custom/address.js"></script>
@endsection
