@extends('layouts.app')

@section('content')
    <section class="page-header row">
        <h2> Analytics Events <small> View </small></h2>
        <ol class="breadcrumb">
            <li><a href="{{ url('') }}"> Dashboard </a></li>
            <li><a href="{{ url('/manage/analytics') }}"> Analytics </a></li>
            <li><a href="{{ url('/manage/analytics') }}"> Events </a></li>
            <li class="active"> View</li>
        </ol>
    </section>
    <div class="page-content row">
        <div class="page-content-wrapper no-margin">
            <div class="sbox">
                <div class="sbox-title clearfix">
                    <div class="sbox-tools pull-left">
                    </div>

                    <div class="sbox-tools">
                        <a href="{{ url('/manage/analytics/') }}" class="tips btn btn-sm  "
                           title="{{ __('core.btn_back') }}"><i class="fa  fa-times"></i></a>
                    </div>
                </div>
                <div class="sbox-content">
                    <div class="table-responsive">
                        <table class="table table-striped ">
                            <tbody>
                            @foreach($event as $property => $value)
                                <tr>
                                    <td width='30%' class='label-view text-right'>{{ $property }}</td>
                                    <td>
                                        @if(is_array($value))
                                            <table class="table table-striped ">
                                                <tbody>
                                                @foreach($value as $dataKey => $dataValue)
                                                    <tr>
                                                        <td width='30%'
                                                            class='label-view text-right'> {{$dataKey}} </td>
                                                        <td>
                                                            @if(is_array($dataValue))
                                                                @foreach($dataValue as $dataKey2 => $dataValue2)
                                                                    <br>
                                                                    {{$dataKey2}} :
                                                                    <br>
                                                                    @if(is_array($dataValue2))
                                                                        {{ json_encode($dataValue2, JSON_PRETTY_PRINT) }}
                                                                        <br>
                                                                    @else
                                                                        {{is_bool($dataValue2) ? ($dataValue2 ? 'yes' : 'no') : $dataValue2}}
                                                                        @if(!$loop->last)
                                                                            <br>
                                                                        @endif
                                                                    @endif
                                                                @endforeach
                                                            @else
                                                                {{is_bool($dataValue) ? ($dataValue ? 'yes' : 'no') : $dataValue}}
                                                                @if(!$loop->last)
                                                                    <br>
                                                                @endif
                                                            @endif
                                                        </td>
                                                    </tr>
                                                @endforeach
                                                </tbody>
                                            </table>
                                        @else
                                            @if($property == 'created_at')
                                                {{\Carbon\Carbon::parse($value)->setTimezone('Africa/Cairo')}}
                                            @else
                                                {{ $value }}
                                            @endif
                                        @endif
                                    </td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
@stop
