1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-16 16:13:20 +01:00
invoiceninja/resources/views/projects/show.blade.php

204 lines
6.6 KiB
PHP
Raw Normal View History

2017-12-24 18:47:49 +01:00
@extends('header')
@section('head')
@parent
<script src="{{ asset('js/select2.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('css/select2.css') }}" rel="stylesheet" type="text/css"/>
2017-12-24 22:54:19 +01:00
<script src="{!! asset('js/Chart.min.js') !!}" type="text/javascript"></script>
2017-12-24 18:47:49 +01:00
@stop
@section('content')
<div class="row">
<div class="col-md-7">
<ol class="breadcrumb">
<li>{{ link_to('/projects', trans('texts.projects')) }}</li>
<li class='active'>{{ $project->name }}</li> {!! $project->present()->statusLabel !!}
</ol>
</div>
<div class="col-md-5">
<div class="pull-right">
2018-03-14 12:03:30 +01:00
{!! Former::open('projects/bulk')->autocomplete('off')->addClass('mainForm') !!}
2017-12-24 18:47:49 +01:00
<div style="display:none">
{!! Former::text('action') !!}
{!! Former::text('public_id')->value($project->public_id) !!}
</div>
@if ( ! $project->is_deleted)
@can('edit', $project)
{!! DropdownButton::normal(trans('texts.edit_project'))
->withAttributes(['class'=>'normalDropDown'])
->withContents([
($project->trashed() ? false : ['label' => trans('texts.archive_project'), 'url' => "javascript:onArchiveClick()"]),
['label' => trans('texts.delete_project'), 'url' => "javascript:onDeleteClick()"],
]
)->split() !!}
@endcan
@endif
@if ($project->trashed())
@can('edit', $project)
{!! Button::primary(trans('texts.restore_project'))
->appendIcon(Icon::create('cloud-download'))
->withAttributes(['onclick' => 'onRestoreClick()']) !!}
@endcan
@endif
{!! Former::close() !!}
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-3">
<h3>{{ trans('texts.details') }}</h3>
2017-12-26 14:59:37 +01:00
<h4>
{!! $project->client->present()->link !!}<br/>
</h4>
2017-12-24 20:01:17 +01:00
@if ($project->due_date)
{{ trans('texts.due_date') . ': ' . Utils::fromSqlDate($project->due_date) }}<br/>
@endif
@if ($project->budgeted_hours)
{{ trans('texts.budgeted_hours') . ': ' . $project->budgeted_hours }}<br/>
@endif
2017-12-25 11:24:39 +01:00
@if ($project->present()->defaultTaskRate)
{{ trans('texts.task_rate') . ': ' . $project->present()->defaultTaskRate }}<br/>
2017-12-24 20:01:17 +01:00
@endif
2017-12-24 18:47:49 +01:00
</div>
2017-12-24 20:01:17 +01:00
2017-12-24 18:47:49 +01:00
<div class="col-md-3">
<h3>{{ trans('texts.notes') }}</h3>
2017-12-24 20:01:17 +01:00
{{ $project->private_notes }}
2017-12-24 18:47:49 +01:00
</div>
2017-12-24 20:01:17 +01:00
2017-12-25 11:59:46 +01:00
<div class="col-md-4">
2017-12-25 11:13:01 +01:00
<h3>{{ trans('texts.summary') }}
<table class="table" style="width:100%">
<tr>
<td><small>{{ trans('texts.tasks') }}</small></td>
2017-12-25 11:39:00 +01:00
<td style="text-align: right">{{ $chartData->count }}</td>
2017-12-25 11:13:01 +01:00
</tr>
<tr>
<td><small>{{ trans('texts.duration') }}</small></td>
2017-12-25 11:59:46 +01:00
<td style="text-align: right">
{{ Utils::formatTime($chartData->duration) }}
@if (floatval($project->budgeted_hours))
2017-12-25 11:59:46 +01:00
[{{ round($chartData->duration / ($project->budgeted_hours * 60 * 60) * 100) }}%]
@endif
</td>
2017-12-25 11:13:01 +01:00
</tr>
</table>
</h3>
2017-12-24 18:47:49 +01:00
</div>
2017-12-24 22:54:19 +01:00
2017-12-24 18:47:49 +01:00
</div>
</div>
</div>
2017-12-25 20:18:24 +01:00
@if ($chartData->duration)
2017-12-25 11:13:01 +01:00
<canvas id="chart-canvas" height="50px" style="background-color:white;padding:20px;display:none"></canvas><br/>
@endif
2017-12-24 22:54:19 +01:00
2017-12-24 20:01:17 +01:00
<ul class="nav nav-tabs nav-justified">
{!! Form::tab_link('#tasks', trans('texts.tasks')) !!}
</ul><br/>
<div class="tab-content">
<div class="tab-pane" id="tasks">
@include('list', [
'entityType' => ENTITY_TASK,
'datatable' => new \App\Ninja\Datatables\ProjectTaskDatatable(true, true),
'projectId' => $project->public_id,
'clientId' => $project->client->public_id,
])
</div>
</div>
<script type="text/javascript">
var loadedTabs = {};
$(function() {
$('.normalDropDown:not(.dropdown-toggle)').click(function(event) {
openUrlOnClick('{{ URL::to('projects/' . $project->public_id . '/edit') }}', event)
});
$('.primaryDropDown:not(.dropdown-toggle)').click(function(event) {
openUrlOnClick('{{ URL::to('tasks/create/' . $project->client->public_id . '/' . $project->public_id ) }}', event);
});
$('.nav-tabs a[href="#tasks"]').tab('show');
2017-12-24 22:54:19 +01:00
2017-12-25 11:13:01 +01:00
var chartData = {!! json_encode($chartData) !!};
2017-12-24 22:54:19 +01:00
loadChart(chartData);
2017-12-24 20:01:17 +01:00
});
function onArchiveClick() {
$('#action').val('archive');
$('.mainForm').submit();
}
function onRestoreClick() {
$('#action').val('restore');
$('.mainForm').submit();
}
function onDeleteClick() {
if (confirm("{!! trans('texts.are_you_sure') !!}")) {
$('#action').val('delete');
$('.mainForm').submit();
}
}
2017-12-24 22:54:19 +01:00
function loadChart(data) {
2018-01-24 16:21:45 +01:00
if (! data.duration) {
return;
}
2017-12-24 22:54:19 +01:00
var ctx = document.getElementById('chart-canvas').getContext('2d');
2017-12-25 11:13:01 +01:00
$('#chart-canvas').fadeIn();
window.myChart = new Chart(ctx, {
type: 'line',
data: data,
options: {
legend: {
display: false,
},
scales: {
xAxes: [{
type: 'time',
time: {
unit: 'day',
round: 'day',
},
gridLines: {
display: false,
},
}],
yAxes: [{
ticks: {
@if ($project->budgeted_hours)
2017-12-25 11:59:46 +01:00
max: {{ max($project->budgeted_hours, $chartData->duration / 60 / 60) }},
2017-12-25 11:13:01 +01:00
@endif
beginAtZero: true,
callback: function(label, index, labels) {
return roundToTwo(label) + " {{ trans('texts.hours') }}";
2017-12-24 22:54:19 +01:00
}
2017-12-25 11:13:01 +01:00
},
}]
2017-12-24 22:54:19 +01:00
}
2017-12-25 11:13:01 +01:00
}
});
2017-12-24 22:54:19 +01:00
}
2017-12-24 20:01:17 +01:00
</script>
2017-12-24 18:47:49 +01:00
@stop