@extends('layouts.app')

@section('content')
<div class="container">
    <div class="row justify-content-center">
        <div class="col-md-12">
            @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"><i class="bi bi-plus-circle"></i> Add Project</a>
                    <hr>
                    </div>
                    
                    <table class="table">
                      <thead>
                        <tr>
                          <th class="col-1">#</th>
                          <th class="col-2">Name</th>
                          <th class="col-4">Description</th>
                          <th class="col-1">Status</th>
                          <th class="col-2">Date Created</th>
                          <th class="col-2">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('projects', $row->id)}}" title="View Project Details" class="btn btn-info btn-sm"><i class="bi bi-eye"></i></a>
                                <a href="{{ url('projects/'. $row->id . '/edit') }}" title="Edit Project Details" class="btn btn-warning btn-sm"><i class="bi bi-pen"></i></a>
                                 <a href="{{ url('project-status/add_status', $row->id)}}" title="Add New Status" class="btn btn-success btn-sm"><i class="bi bi-plus-square"></i></a>
                            </td>
                        </tr>
                        <?php $count++; ?>
                        @endforeach

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