1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 07:02:34 +01:00
invoiceninja/resources/views/reports/chart_builder.blade.php

218 lines
7.5 KiB
PHP
Raw Normal View History

2015-10-14 16:15:39 +02:00
@extends('header')
2015-04-30 19:54:19 +02:00
2016-09-18 16:06:56 +02:00
@section('head')
@parent
<script src="{{ asset('js/daterangepicker.min.js') }}" type="text/javascript"></script>
<link href="{{ asset('css/daterangepicker.css') }}" rel="stylesheet" type="text/css"/>
@stop
2015-04-30 19:54:19 +02:00
@section('content')
@parent
2016-09-11 16:30:23 +02:00
@include('accounts.nav', ['selected' => ACCOUNT_REPORTS, 'advanced' => true])
2015-04-30 19:54:19 +02:00
2016-09-18 16:06:56 +02:00
<script type="text/javascript">
$(function() {
var chartStartDate = moment("{{ $startDate }}");
var chartEndDate = moment("{{ $endDate }}");
// Initialize date range selector
function cb(start, end) {
$('#reportrange span').html(start.format('{{ $account->getMomentDateFormat() }}') + ' - ' + end.format('{{ $account->getMomentDateFormat() }}'));
$('#start_date').val(start.format('YYYY-MM-DD'));
$('#end_date').val(end.format('YYYY-MM-DD'));
}
$('#reportrange').daterangepicker({
locale: {
"format": "{{ $account->getMomentDateFormat() }}",
},
startDate: chartStartDate,
endDate: chartEndDate,
linkedCalendars: false,
ranges: {
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
'This Month': [moment().startOf('month'), moment().endOf('month')],
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')],
'This Year': [moment().startOf('year'), moment().endOf('month')]
2016-09-18 16:06:56 +02:00
}
}, cb);
cb(chartStartDate, chartEndDate);
});
</script>
2015-04-30 19:54:19 +02:00
2016-07-27 12:40:54 +02:00
{!! Former::open()->rules(['start_date' => 'required', 'end_date' => 'required'])->addClass('warn-on-exit') !!}
2015-04-30 19:54:19 +02:00
2015-10-14 16:15:39 +02:00
<div style="display:none">
{!! Former::text('action') !!}
</div>
{!! Former::populateField('start_date', $startDate) !!}
{!! Former::populateField('end_date', $endDate) !!}
2015-04-30 19:54:19 +02:00
<div class="row">
2015-10-14 16:15:39 +02:00
<div class="col-lg-12">
2015-04-30 19:54:19 +02:00
<div class="panel panel-default">
<div class="panel-heading">
2016-02-24 21:58:42 +01:00
<h3 class="panel-title">{!! trans('texts.report_settings') !!}</h3>
2016-07-27 12:40:54 +02:00
</div>
<div class="panel-body">
2015-10-14 16:15:39 +02:00
<div class="row">
<div class="col-md-6">
2016-09-18 16:06:56 +02:00
<div class="form-group">
<label for="reportrange" class="control-label col-lg-4 col-sm-4">
{{ trans('texts.date_range') }}
</label>
<div class="col-lg-8 col-sm-8">
<div id="reportrange" style="background: #f9f9f9; cursor: pointer; padding: 9px 14px; border: 1px solid #dfe0e1; margin-top: 0px; margin-left:18px">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>&nbsp;
<span></span> <b class="caret"></b>
</div>
2015-10-14 16:15:39 +02:00
2016-09-18 16:06:56 +02:00
<div style="display:none">
{!! Former::text('start_date') !!}
{!! Former::text('end_date') !!}
</div>
</div>
</div>
<p>&nbsp;</p>
2015-10-14 16:15:39 +02:00
<p>&nbsp;</p>
2016-07-27 12:40:54 +02:00
{!! Former::actions(
2015-10-14 16:15:39 +02:00
Button::primary(trans('texts.export'))->withAttributes(array('onclick' => 'onExportClick()'))->appendIcon(Icon::create('export')),
Button::success(trans('texts.run'))->withAttributes(array('id' => 'submitButton'))->submit()->appendIcon(Icon::create('play'))
) !!}
@if (!Auth::user()->hasFeature(FEATURE_REPORTS))
2015-10-14 16:15:39 +02:00
<script>
2016-07-27 12:40:54 +02:00
$(function() {
2016-02-27 22:00:27 +01:00
$('form.warn-on-exit').find('input, button').prop('disabled', true);
2015-10-14 16:15:39 +02:00
});
2016-07-27 12:40:54 +02:00
</script>
2015-10-14 16:15:39 +02:00
@endif
2016-02-23 22:32:39 +01:00
</div>
2015-10-14 16:15:39 +02:00
<div class="col-md-6">
2016-02-23 22:32:39 +01:00
{!! Former::select('report_type')->options($reportTypes, $reportType)->label(trans('texts.type')) !!}
2016-02-24 21:58:42 +01:00
<div id="dateField" style="display:{{ $reportType == ENTITY_TAX_RATE ? 'block' : 'none' }}">
{!! Former::select('date_field')->label(trans('texts.filter'))
->addOption(trans('texts.invoice_date'), FILTER_INVOICE_DATE)
->addOption(trans('texts.payment_date'), FILTER_PAYMENT_DATE) !!}
</div>
2016-07-27 12:40:54 +02:00
2015-10-14 16:15:39 +02:00
{!! Former::close() !!}
2015-04-30 19:54:19 +02:00
</div>
</div>
2015-10-14 16:15:39 +02:00
</div>
</div>
<div class="panel panel-default">
<div class="panel-body">
<table class="table table-striped invoice-table">
2016-07-27 12:40:54 +02:00
<thead>
2015-10-14 16:15:39 +02:00
<tr>
2016-07-27 12:40:54 +02:00
@foreach ($columns as $column)
2016-02-23 22:32:39 +01:00
<th>{{ trans("texts.{$column}") }}</th>
2015-04-30 19:54:19 +02:00
@endforeach
2016-02-23 22:32:39 +01:00
</tr>
2015-10-14 16:15:39 +02:00
</thead>
<tbody>
2016-02-25 09:32:31 +01:00
@if (count($displayData))
@foreach ($displayData as $record)
<tr>
@foreach ($record as $field)
<td>{!! $field !!}</td>
@endforeach
</tr>
@endforeach
@else
2015-04-30 19:54:19 +02:00
<tr>
2016-02-25 09:32:31 +01:00
<td colspan="10" style="text-align: center">{{ trans('texts.empty_table') }}</td>
2015-10-14 16:15:39 +02:00
</tr>
2016-02-25 09:32:31 +01:00
@endif
2015-10-14 16:15:39 +02:00
</tbody>
2016-02-23 22:32:39 +01:00
</table>
<p>&nbsp;</p>
@if (count(array_values($reportTotals)))
<table class="table table-striped invoice-table">
<thead>
2015-10-14 16:15:39 +02:00
<tr>
2016-02-23 22:32:39 +01:00
<th>{{ trans("texts.totals") }}</th>
@foreach (array_values($reportTotals)[0] as $key => $val)
<th>{{ trans("texts.{$key}") }}</th>
@endforeach
2015-11-10 23:07:05 +01:00
</tr>
2016-02-23 22:32:39 +01:00
</thead>
<tbody>
@foreach ($reportTotals as $currencyId => $val)
<tr>
<td>{!! Utils::getFromCache($currencyId, 'currencies')->name !!}</td>
@foreach ($val as $id => $field)
<td>{!! Utils::formatMoney($field, $currencyId) !!}</td>
@endforeach
</tr>
@endforeach
</tbody>
2015-10-14 16:15:39 +02:00
</table>
2016-02-23 22:32:39 +01:00
@endif
2015-04-30 19:54:19 +02:00
2015-10-14 16:15:39 +02:00
</div>
2016-02-23 22:32:39 +01:00
</div>
2015-04-30 19:54:19 +02:00
</div>
<script type="text/javascript">
function onExportClick() {
$('#action').val('export');
$('#submitButton').click();
2016-07-27 12:40:54 +02:00
$('#action').val('');
2015-04-30 19:54:19 +02:00
}
2015-09-07 11:07:55 +02:00
$(function() {
$('.start_date .input-group-addon').click(function() {
toggleDatePicker('start_date');
});
$('.end_date .input-group-addon').click(function() {
toggleDatePicker('end_date');
});
2016-02-24 21:58:42 +01:00
$('#report_type').change(function() {
var val = $('#report_type').val();
if (val == '{{ ENTITY_TAX_RATE }}') {
$('#dateField').fadeIn();
} else {
$('#dateField').fadeOut();
}
});
2015-09-07 11:07:55 +02:00
})
2015-04-30 19:54:19 +02:00
</script>
@stop
@section('onReady')
$('#start_date, #end_date').datepicker({
autoclose: true,
todayHighlight: true,
keyboardNavigation: false
});
2016-07-27 12:40:54 +02:00
@stop