@extends('layouts.admin_master')
@section('page-title')
    Admin | All Activities
@endsection

@section('page-css')
    <!-- third party css -->
    <link href="{{ url('public/assets/css/vendor/dataTables.bootstrap4.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{ url('public/assets/css/vendor/responsive.bootstrap4.css')}}" rel="stylesheet" type="text/css" />
    <!-- third party css end -->
@endsection

@section('page-content')
{{-- Alert --}}
@include('layouts.alert')

<div class="row">
    <div class="col-12">
        <div class="hpanel">
            <div class="panel-heading">Admin Activity Log <br>
            <div class="clearfix"></div>
            </div>
            <div class="panel-body">
                <div class="table-responsive">
                    <table cellpadding="1" cellspacing="1" class="table table-bordered table-striped" >
                        <thead class="">
                            <tr class="">
                                <th>Admin Name</th>
                                <th>Description</th>
                                <th>Date Created</th>
                            </tr>
                        </thead>
                        <tbody>
                            @forelse ($activities as $activity)
                            <tr class="bg" style="color: #000;">
                               
                                <td class="table-user">
                                    <a href="javascript:void(0);" class="text-bodys font-weight-semibold" style="color: #000;">{{ $activity->admin->name }}</a>
                                </td>
                                <td>
                                    <span class="font-weight-semibold">
                                        <!-- {{ $activity->description }} -->
                                        <?php 
                                            $activity_arr = json_decode($activity->description, true);
                                            // dump($activity->description);
                                         ?>
                                         {{ $activity_arr['title'] }} : {{ $activity_arr['data'] }}
                                    </span>
                                </td>
                                <td>
                                     {{ Carbon\Carbon::parse($activity->created_at)->format('F dS Y') }}
                                </td>
                            </tr>
                            @empty
                                <td colspan="3">No Data</td>
                            @endforelse 
                        </tbody>
                    </table>

                    {{ $activities->links() }}
                </div>
            </div> <!-- end card-body-->
        </div> <!-- end card-->
    </div> <!-- end col -->
</div>
<!-- end row -->

@endsection


@section('page-js')

@endsection