@extends('layouts.app')

@section('content')
<div class="container mt-5">
    <h2>{{ isset($comment) ? 'Edit comment' : 'Project Details' }}</h2>
    @include('commons.notifications')
      <input type="hidden" name="user_id" value="{{ \Auth::user()->id }}">
      @csrf
      @if (isset($comment_body))
          @method('PUT')
      @endif
      <div class="card text-dark bg-light mb-3 card w-100">
        <div class="card-body">
          <!-- <h3>Project Details/</h3> -->
          <h5 class="card-title">{{ $project->name }}</h5>
          <p class="card-text">Description : {{ $project->description }} </p>
          <p class="card-text">Date Created : {{ $project->created_at }} </p>
          <p class="card-text">Last Updated : {{ $project->updated_at }} </p>
          <a href="{{ url('projects/'. $project->id . '/edit') }}" title="Edit Project Details" class="btn btn-warning btn-sm"><i class="bi bi-pencil"></i> Edit Details</a>

        </div>
      </div>
      <hr>
      <h3>Status Updates</h3>
      <table class="table">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Status Update</th>
            <th scope="col">Current Status</th>
            <th scope="col">Date Updated</th>
          </tr>
        </thead>
        <tbody>
          <?php $count = 1; ?>
          @foreach($project->statusInfo as $row)
          <tr>
            <th scope="row">{{ $count }}</th>
            <td>{{ $row->description }}</td>
            <td>{{ $row->status }}</td>
            <td>{{ $row->created_at }}</td>
          </tr>
          <?php $count++; ?>
          @endforeach
        </tbody>
      </table>
      <a href="{{ url('project-status/add_status', $project->id)}}" class="btn btn-success btn-sm"><i class="bi bi-plus-square"></i> Add New Status Update</a>

</div>
@endsection