@extends('layouts.master')

@section('style')
<style>
    .task-color{
        color: green;
    }
</style>
@endsection

@section('content')
<!-- Main content -->
<section class="content">
    <!-- Main row -->
    <div class="row">
        <div class="col-md-12">
        <table class="table">
            @foreach($all as $info)
                <tr>
                    <td colspan="3">
                        <h3>{{$info->name}}</h3>
                    </td>
                </tr>
                <?php 
                $pen = App\Models\Task::where('user_id',$info->id)->where('status',1)->get();
                ?>
                @if(count($pen) > 0)
                    <tr>
                        <td></td>
                        <td colspan="2">
                            <b>Pending Task:</b> 
                        </td>
                    </tr>
                    @foreach($pen as $p) 
                        <tr>
                            <td></td>
                            <td></td>
                            <td>
                               <span class="task-color">{{$p->name}}</span> 
                               (Assign: {{date("d-m-Y H:i", strtotime($p->assign_time))}} # Estimated: {{$p->estimated_time}} )
                            </td>
                        </tr>
                    @endforeach
                @endif

                <?php 
                $in_proecss = App\Models\Task::where('user_id',$info->id)->where('status',2)->get();
                ?>
                @if(count($in_proecss) > 0)
                    <tr>
                        <td></td>
                        <td colspan="2">
                            <b>Inprocess Task:</b> 
                        </td>
                    </tr>
                    @foreach($in_proecss as $p) 
                        <tr>
                            <td></td>
                            <td></td>
                            <td>
                               <span class="task-color">{{$p->name}}</span> ( 
                               Start: {{date("d-m-Y H:i", strtotime($p->start_time))}} # Estimated: {{$p->estimated_time}} )
                            </td>
                        </tr>
                    @endforeach
                @endif
                <?php 
                $completed = App\Models\Task::where('user_id',$info->id)
                            ->where('status',6)->whereDate('closing_time', '=', date('Y-m-d'))->get();
                ?>
                @if(count($completed) > 0)
                    <tr>
                        <td></td>
                        <td colspan="2">
                            <b>Today's Completed Task:</b>
                        </td>
                    </tr>
                    @foreach($completed as $p) 
                        <tr>
                            <td></td>
                            <td></td>
                            <td>
                               <span class="task-color">{{$p->name}}</span> 
                               ( Completed: {{date("d-m-Y H:i", strtotime($p->closing_time))}})
                            </td>
                        </tr>
                    @endforeach
                @endif
            @endforeach
        </table>
        </div>
    </div>
</section>
<!-- row end -->
@endsection


