<?php
use App\Classes\jDate;
use App\Classes\jDateTime;
$jDate	= new jDate();
$jDateTime	= new jDateTime();
$domain = explode('/',$_SERVER['REQUEST_URI']);
$DateNew = date('Y-m-d');
$Date = date('Y-m-d', strtotime($DateNew. " $domain[2] month"));




?>
@extends('index')

@section('content')

    <div class="page-content">
        <div class="row">
            <div class="col-12">
                <div class="page-title-box d-flex align-items-center justify-content-between">
                    <h4 class="page-title mb-0 font-size-18">عناصر فرم</h4>

                    <div class="page-title-right">
                        <ol class="breadcrumb m-0">
                            <li class="breadcrumb-item"><a href="">فرم ها</a></li>
                            <li class="breadcrumb-item active">{{date('Y-m-d', strtotime($Date. " 0 days"))}}</li>
                            <li class="breadcrumb-item active">{{$jDate::forge(date('Y-m-d', strtotime($Date. " 0 days")))->format('date')}}</li>
                        </ol>
                    </div>@php($Day = $domain[2])@php($Day2 = $domain[2])
                    <form method="post" id="bottomForm">@csrf
                    </form>
                    <button type="button" class="btn btn-danger w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/adminCalendarByMonth/{{  ++$Day}}'" onmouseup="document.getElementById('bottomForm').submit()">
                        next </button>
                    <button type="button" class="btn btn-danger w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/adminCalendarByMonth/{{ --$Day2}}'" onmouseup="document.getElementById('bottomForm').submit()">
                        back </button>
                </div>
            </div>
        </div>

        @for($i=0 ;$i<=31;$i++)
            <label>{{$jDate::forge(date('Y-m-d', strtotime($Date. "$i  days")))->format('l d F')}}</label>
            <hr>
            <div class="row">
                @foreach($tasks as $task)
                    @if((date('Y-m-d', strtotime($Date. " $i days")) >= $task->d1 ) && (date('Y-m-d', strtotime($Date. " $i days")) <= $task->d3 ))
                        <div class="col-lg-4">
                            <div class="card bg-primary text-white-50 class{{$task->status}}">
                                <div class="card-body">
                                    <h5 class="mt-0 mb-4 text-white"><i class="mdi mdi-bullseye-arrow mr-3"></i>{{$task->title}}<label style="color: red; float: left;">task</label></h5>
                                    <p class="card-text">{!! $task->task !!}</p>

                                    <form action="" method="post" id="bottomForm">@csrf

                                        {{--                                @if($Admin->premises == 0)--}}
                                        {{--                                    <button type="button" class="btn btn-danger w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/project_works/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        اضافه کردن کار ها</button>--}}
                                        {{--                                    <button type="button" class="btn btn-success w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/editProject/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        ویرایش</button>--}}
                                        {{--                                @endif--}}

                                    </form>
                                </div>

                            </div>
                        </div>
                    @endif

                @endforeach
                @foreach($project_infos as $project_info)
                    @if((date('Y-m-d', strtotime($Date. " $i days")) >= $project_info->d1 ) && (date('Y-m-d', strtotime($Date. " $i days")) <= $project_info->d3 ))
                        <div class="col-lg-4" onmousedown="document.getElementById('linksInCalendar').action = 'https://admin.borjeweb.com/project_works/{{$project_info->id}}'" onmouseup="document.getElementById('linksInCalendar').submit()" style="cursor: pointer;">
                            <div class="card bg-primary text-white-50 class{{$project_info->status}}">
                                <div class="card-body">
                                    <h5 class="mt-0 mb-4 text-white"><i class="mdi mdi-bullseye-arrow mr-3"></i>{{$project_info->title}}<label style="color: red;float: left;">project</label></h5>
                                    <p class="card-text">{!! $project_info->body !!}</p>

                                    <form action="" method="post" id="bottomForm">@csrf

                                        {{--                                @if($Admin->premises == 0)--}}
                                        {{--                                    <button type="button" class="btn btn-danger w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/project_works/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        اضافه کردن کار ها</button>--}}
                                        {{--                                    <button type="button" class="btn btn-success w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/editProject/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        ویرایش</button>--}}
                                        {{--                                @endif--}}

                                    </form>
                                </div>

                            </div>
                        </div>
                    @endif
                @endforeach
                @foreach($notes as $note)
                    @if((date('Y-m-d', strtotime($Date. " $i days")) == $note->d1 ))
                        <div class="col-lg-4">
                            <div class="card bg-primary text-white-50 class{{$note->status}}">
                                <div class="card-body">
                                    <h5 class="mt-0 mb-4 text-white"><i class="mdi mdi-bullseye-arrow mr-3"></i>{{$note->title}}<label style="color: red;float: left;">note</label></h5>
                                    <p class="card-text">{!! $note->task !!}</p>

                                    <form action="" method="post" id="bottomForm">@csrf

                                        {{--                                @if($Admin->premises == 0)--}}
                                        {{--                                    <button type="button" class="btn btn-danger w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/project_works/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        اضافه کردن کار ها</button>--}}
                                        {{--                                    <button type="button" class="btn btn-success w-lg waves-effect waves-light" onmousedown="document.getElementById('bottomForm').action = 'https://admin.borjeweb.com/editProject/{{$project_info->id}}'" onmouseup="document.getElementById('bottomForm').submit()">--}}
                                        {{--                                        ویرایش</button>--}}
                                        {{--                                @endif--}}

                                    </form>
                                </div>

                            </div>
                        </div>
                    @endif
                @endforeach




            </div>
            @endfor

            </form>

    </div>
@endsection