@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-10">
            @include('commons.notifications')
            <div class="card">
                <div class="card-header">{{ __('Projects') }}</div>
                <div class="card-body">
                    @if (session('status'))
                        <div class="alert alert-success" role="alert">
                            {{ session('status') }}
                        </div>
                    @endif
                    <div class="float-end">
                        <a href="/projects/create" class="btn btn-primary btn-sm">Add Projects</a>
                    </div>
                    <table class="table">
                      <thead>
                        <tr>
                          <th scope="col">#</th>
                          <th scope="col">Name</th>
                          <th scope="col">Description</th>
                          <th scope="col">Status</th>
                          <th scope="col">Date Created</th>
                          <th scope="col">Action</th>
                        </tr>
                      </thead>
                      <tbody>
                        <?php $count = 1; ?>
                        @foreach($projects as $row)
                        <tr>
                          <th scope="row">{{ $count }}</th>
                          <td>{{ $row->name }}</td>
                          <td>{{ $row->description }}</td>
                          <td>{{ $row->status }}</td>
                          <td>{{ $row->created_at }}</td>
                          <td><a href="{{ url('project-status/add_status', $row->id)}}" class="btn btn-link">Add Status</a></td>
                        </tr>
                        <?php $count++; ?>
                        @endforeach

                      </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection
