{{--@extends('layouts.app')--}}

{{--@section('content')--}}
{{--    <div class="container-fluid">--}}
{{--        <div class="row justify-content-center">--}}
{{--            <div class="col-md-8">--}}
{{--                <div class="card">--}}
{{--                    <div class="card-header mb-4">{{ __('View Announcements') }}</div>--}}

{{--                        <div>--}}
{{--                            @if(count($announcements) > 0)--}}
{{--                                <table width="600px">--}}
{{--                                    <thead>--}}
{{--                                        <tr>--}}
{{--                                            <!--<th width="100px">ID</th>-->--}}
{{--                                            <th width="100px">Posted By</th>--}}
{{--                                            <th width="100px">Content</th>--}}
{{--                                            <th width="100px">Created At</th>--}}
{{--                                            <th width="100px">Actions</th>--}}
{{--                                        </tr>--}}
{{--                                    </thead>--}}
{{--                                    <tbody>--}}
{{--                                        @foreach($announcements as $announcement)--}}
{{--                                            <tr>--}}
{{--                                                <!--<td>{{$announcement->id}}</td>-->--}}
{{--                                                <td class="py-4">{{$announcement->posted_by}}</td>--}}
{{--                                                <td class="py-4">{{$announcement->content}}</td>--}}
{{--                                                <td class="py-4">{{$announcement->created_at}}</td>--}}
{{--                                                <td class="py-4">--}}
{{--                                                    <span>--}}
{{--                                                        <a class="btn btn-outline-primary btn-circle" href="{{route('announcement.view', ['id' => $announcement->id])}}">--}}
{{--                                                            View--}}
{{--                                                        </a>--}}
{{--                                                    </span>--}}
{{--                                                    <span>--}}
{{--                                                        <a class="btn btn-outline-dark btn-circle" href="{{route('announcement.edit', ['id' => $announcement->id])}}">--}}
{{--                                                            Edit--}}
{{--                                                        </a>--}}
{{--                                                    </span>--}}
{{--                                                    <span>--}}
{{--                                                        <a class="btn btn-outline-danger btn-circle" href="{{route('deleteannouncement', ['id' => $announcement->id])}}">--}}
{{--                                                            Delete--}}
{{--                                                        </a>--}}
{{--                                                            <form action="{{route('announcement.delete', ['id' => $announcement->id])}}" method="post">--}}
{{--                                                                @csrf--}}
{{--                                                                {{@method_field('delete')}}--}}
{{--                                                                <button class="btn btn-danger btn-sm" title="Delete">Delete</button>--}}
{{--                                                            </form>--}}
{{--                                                    </span>--}}
{{--                                                </td>--}}
{{--                                            </tr>--}}
{{--                                        @endforeach--}}
{{--                                    </tbody>--}}
{{--                                </table>--}}
{{--                            @else--}}
{{--                                <p class="mt-5 mb-5">No Results</p>--}}
{{--                            @endif--}}
{{--                        </div>--}}

{{--                </div>--}}
{{--            </div>--}}
{{--        </div>--}}
{{--    </div>--}}
{{--@endsection--}}


@extends('layouts.announcement.app')

@section('content')
    <div class="col-md-8">
        <div class="card">
            <div class="container">
                <div class="panel panel-primary">
                    <div class="panel-heading">{{ __('View Announcements') }}</div>
                    <div class="panel-body">
                        <div class="row">

                            <div class='col-md-12'>
                                @if (session()->has('success'))
                                    <p class="text-success">{{ session('success') , session()->pull('success')}}</p>
                                @else
                                    <p class="text-danger">{{ session('error') , session()->pull('error')}}</p>
                                @endif
                            </div>

                        @if(count($announcements) > 0)
                            <center>
                            <table width="600px" cellspacing="0">
                                <thead>
                                <tr>
                                    <!--<th width="100px">ID</th>-->
                                    {{--                                            <th width="100px">Posted By</th>--}}
                                    <th width="100px">Content</th>
{{--                                    <th width="100px">Created At</th>--}}
                                    <th width="100px">Active Date</th>
                                    <th width="100px">Actions</th>
                                </tr>
                                <tr class="separator" />

                                </thead>
                                <tbody>
                                @foreach($announcements as $announcement)
                                    <tr>
                                    <!--<td>{{$announcement->id}}</td>-->
                                        {{--                                                <td class="py-4">{{$announcement->posted_by}}</td>--}}
                                        <td class="py-4">{{$announcement->content}}</td>
{{--                                        <td class="py-4">{{$announcement->created_at}}</td>--}}
                                                                                <td class="py-4"><span>{{$announcement->start_date}}</span> <span>{{$announcement->end_date}}</span></td>
                                        <td class="py-4">
                                            <!--<span>
                                                  <a class="btn btn-success btn-sm" href="{{route('announcement.view', ['id' => $announcement->id])}}">
                                                      View
                                                  </a>
                                            </span>-->

                                            <span>
                                                  <a class="btn btn-warning btn-sm" href="{{route('announcement.edit', ['id' => $announcement->id])}}">
                                                      Edit
                                                  </a>
                                            </span>

                                            <span>
                                                <form action="{{route('announcement.delete', ['id' => $announcement->id])}}" method="post">
                                                    @csrf
                                                    {{@method_field('delete')}}
                                                    <button class="btn btn-danger btn-sm" title="Delete">Delete</button>
                                                </form>
                                            </span>
                                        </td>
                                    </tr>
                                    <tr class="separator" />
                                @endforeach
                                </tbody>
                            </table>

{{--                                {{ $announcements->links() }}--}}

                            </center>
                                @else
                                <center>
                                    <p class="mt-5 mb-5">No Results</p>
                                </center>
                                @endif
                            </div>

                        <hr>
                            <center>
                                <div class='col-md-12'>
                                    <a href="{{ route('announcement.create') }}">
                                        {{ __('Create Announcement') }}
                                    </a>
                                </div>
                            </center>

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
