File: D:/HostingSpaces/SBogers10/hours.komma.pro/resources/views/projects/index.blade.php
@extends('app')
@section('pageTitle')
Projecten | Urensysteem
@endsection
@section('content')
<div class="container">
<div class="row">
<div class="col-md-4">
<h1>Projecten</h1>
</div>
<div class="col-lg-4">
<form action="/projecten" id="search" method="get">
<div class="col-lg-10">
<input type="text" id="searchBar" class="form-control" placeholder="Zoeken" value="{{\Request::has('search') ? \Request::get('search') : ''}}"
style="margin-top: 26px;">
</div>
<div class="col-xs-2">
<input type="submit" class="btn btn-primary" form="search" value="Zoeken"
style="margin-top: 26px;">
</div>
<input type="hidden" name="action" id="actionValue" value="">
<input type="hidden" name="search" id="searchValue" value="">
</form>
</div>
<div class="col-lg-4">
<button type="button" name="createProject" data-toggle=modal data-backdrop="static"
data-target="#createProjectModal"
onclick="loadPopup('/projecten/create','#createProjectModal');"
class="btn btn-primary pull-right" style="margin-top: 26px;">+ Maak een nieuw project
</button>
</div>
{{-- @can('download_excel')--}}
{{-- <div class="col-lg-12">--}}
{{-- <hr>--}}
{{-- <div class="col-md-3">--}}
{{-- <label>Begin datum</label>--}}
{{-- <input type="text" id="datepicker" name="begin" value="{{ !empty($begin) ? $begin : ""}}"--}}
{{-- class="form-control beginDate">--}}
{{-- </div>--}}
{{-- <div class="col-md-3">--}}
{{-- <label>Eind datum</label>--}}
{{-- <input type="text" id="datepicker2" name="end" value="{{ !empty($end) ? $end : ""}}"--}}
{{-- class="form-control endDate">--}}
{{-- </div>--}}
{{-- <div class="col-md-3" style="margin-top: 27px;">--}}
{{-- <select name="projectWorker" id="projectWorker" class="form-control selectpicker"--}}
{{-- data-live-search="true" title="Kies een werknemer">--}}
{{-- @if(!empty($user))--}}
{{-- <option value="{{$user}}" selected>{{$user}}</option>--}}
{{-- @foreach($users as $projectUser)--}}
{{-- @if($user != $projectUser->name)--}}
{{-- <option value="{{$projectUser->name}}">{{$projectUser->name}}</option>--}}
{{-- @endif--}}
{{-- @endforeach--}}
{{-- @else--}}
{{-- <option selected disabled></option>--}}
{{-- @foreach($users as $projectUser)--}}
{{-- <option value="{{$projectUser->name}}">{{$projectUser->name}}</option>--}}
{{-- @endforeach--}}
{{-- @endif--}}
{{-- </select>--}}
{{-- </div>--}}
{{-- <div class="col-md-1">--}}
{{-- <a href="/projecten" class="btn btn-primary"--}}
{{-- style="margin-top: 27px;">Reset alles</a>--}}
{{-- </div>--}}
{{-- <div class="col-md-2">--}}
{{-- <a href="{{route('excel', ['begin' => request('begin'), 'end' => request('end'), 'user' => request('user')])}}"--}}
{{-- class="pull-right excelExport" style="margin-top: 32px;"><img--}}
{{-- src="/images/excel.png"> Download Excel</a>--}}
{{-- </div>--}}
{{-- </div>--}}
{{-- @endcan--}}
<div class="col-lg-12">
<hr>
@if (\Session::has('message'))
@if(!empty(Session::get('message')['url']))
<div class="alert alert-info">
{{ Session::get('message')['message'] }}
<a class="pull-right btn btn-default" href="{{ Session::get('message')['url'] }}"
style="margin-top: -7px">Herstel</a>
</div>
@else
<div class="alert alert-info">{{ Session::get('message') }}</div>
@endif
@endif
</div>
<div class="col-lg-12">
<ul class="nav nav-tabs">
<li role="presentation" @if($action === "active") class="active" @endif><a
href="/projecten?action=active{{\Request::has('search') ? '&search='.\Request::get('search') : ''}}">Actief <span
class="badge">{{$badgeCounter->countActive}}</span></a></li>
<li role="presentation" @if($action === "toBeProcessed") class="active" @endif><a
href="/projecten?action=toBeProcessed{{\Request::has('search') ? '&search='.\Request::get('search') : ''}}">Te verwerken <span
class="badge">{{$badgeCounter->countToBeProcessed}}</span></a></li>
<li role="presentation" @if($action === "processed") class="active" @endif><a
href="/projecten?action=processed{{\Request::has('search') ? '&search='.\Request::get('search') : ''}}">Voltooid <span
class="badge">{{$badgeCounter->countProcessed}}</span></a></li>
<li role="presentation" @if($action === "all") class="active" @endif><a
href="/projecten?action=all{{\Request::has('search') ? '&search='.\Request::get('search') : ''}}">Alle projecten <span
class="badge">{{$badgeCounter->countAll}}</span></a></li>
<li role="presentation" @if($action === "deleted") class="active" @endif><a
href="/projecten?action=deleted{{\Request::has('search') ? '&search='.\Request::get('search') : ''}}">Verwijderd <span
class="badge">{{$badgeCounter->countDeleted}}</span></a></li>
</ul>
</div>
@if ($projects->isEmpty())
<div class="panel panel-default col-lg-12">
<div class="col-md-12">
<h2>Geen projecten.</h2>
</div>
</div>
@else
@foreach($projects as $index => $project)
<div dusk="project{{$project->id}}" pid="{{$project->id}}"
class="project @if($project->deleted_at === null)@if($project->archived == '1') inactive @else active @endif @else deleted @endif">
<div class="col-md-12">
<div class="row title-holder">
<div class="col-md-9">
<h2 class="title">
@if($project->deleted_at === null)
<a href="{{url('/projecten/'.$project->id) . '?' . http_build_query(['begin' => request('begin'), 'end' => request('end'), 'user' => request('user')])}}">{{$project->name}}</a>
@else
{{$project->name}}
@endif
</h2>
</div>
<div class="col-md-3 pull-right">
@if(!empty($project->create_every_x_months))
<label style="position: absolute; top: 5px; right: 30px;">Sluit
op: {{\Carbon\Carbon::now()->month($project->created_at->month + $project->create_every_x_months - 1)->endOfMonth()->format('d-m-Y G:i:s')}} </label>
@endif
@if($project->deleted_at != null)
<a href="/projecten/{{ $project->id }}/restore" class="btn btn-default"
style="margin: 70px 0 0 -40px;">Herstellen</a>
@else
@if($project->archived != 0 and $project->calculated != 0)
<span class="glyphicon glyphicon-ok check pull-right" data-toggle="tooltip"
title="herberekend" aria-hidden="true"></span>
@endif
@endif
</div>
</div>
<div class="row">
<div class="col-lg-2">
<h4><b>Klant</b></h4>
<h4><b>Projectleider</b></h4>
</div>
<div class="col-lg-4">
<h4><a href="/klanten/{{$project->Company->id}}">{{$project->Company->name}}</a></h4>
<h4>@foreach($project->ProjectWorkers as $projectWorker){{$projectWorker->User->name}}@endforeach</h4>
</div>
<div class="col-md-6">
@if($budgets[$index]->projectHours['budget'] > 0)
<div class="col-md-6">
<h4><b>Process:</b> {{$budgets[$index]->projectHours['totalHoursInBudget']}}
/ {{$budgets[$index]->projectHours['budget']}}</h4>
</div>
<div class="col-md-6" style="text-align: right;">
<h4><b>Resterend budget:</b> <span
style="margin-top: 4px; color: {{ $budgets[$index]->projectHours['hoursLeftInBudget'] > 0 ? '#2ab27b' : 'red' }}; ">{{ $budgets[$index]->projectHours['hoursLeftInBudget'] }}</span>
</h4>
</div>
@else
<div class="col-md-6">
<h4> </h4>
</div>
@endif
<div class="col-md-12">
@include('partials.generalElements.progressBar',[
'totalHoursInBudget' => $budgets[$index]->projectHours['totalHoursInBudget'],
'hoursNoBudget' => $budgets[$index]->projectHours['totalBillWithoutBudget']+$budgets[$index]->projectHours['totalNotBillWithoutBudget'],
'budget' => $budgets[$index]->projectHours['budget'],
'hoursLeftInBudget' => $budgets[$index]->projectHours['hoursLeftInBudget'],
'barWidth' => $budgets[$index]->projectHours['budget'] > 0 ? ((100 / $budgets[$index]->projectHours['budget']) * $budgets[$index]->projectHours['totalHoursInBudget']) : 100,
'isProject' => true
])
</div>
</div>
</div>
</div>
</div>
@endforeach
<div class="text-center">
{!! $projects->appends(Request::except('page'))->render() !!}
</div>
@endif
</div>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="createProjectModal"
id="createProjectModal"></div>
</div>
@stop
@section('script')
<script type="text/javascript">
$(document).off("submit", "#search").on("submit", "#search", function (event) {
var value = $("#searchBar").val();
var param = "";
if (window.location.search.indexOf('action=') > -1) {
param = $.urlParam('action');
}
$("#searchValue").attr("value", value);
$("#actionValue").attr("value", param);
$.pjax.submit(event, pJaxContainer);
});
</script>
<script src="{{ asset('js/createFilterParams.js') }}"></script>
@stop