166 lines
6.4 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
@extends('layouts.admin')
2019-11-16 10:21:14 +03:00
@section('title', $dashboard->name)
@section('dashboard_action')
2020-01-07 17:15:00 +03:00
@permission(['create-common-widgets', 'read-common-dashboards'])
2019-11-16 10:21:14 +03:00
<span class="dashboard-action">
<div class="dropdown">
<a class="btn btn-sm items-align-center py-2 mt--1" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v"></i>
</a>
<div class="dropdown-menu dropdown-menu-left dropdown-menu-arrow">
2020-01-07 17:15:00 +03:00
@permission('create-common-widgets')
{!! Form::button(trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]), [
2019-11-16 10:21:14 +03:00
'type' => 'button',
'class' => 'dropdown-item',
'title' => trans('general.title.add', ['type' => trans_choice('general.widgets', 1)]),
2020-01-07 17:15:00 +03:00
'@click' => 'onCreateWidget()',
]) !!}
@endpermission
@permission('read-common-dashboards')
2019-11-16 10:21:14 +03:00
<div class="dropdown-divider"></div>
2020-01-07 17:15:00 +03:00
@permission('create-common-dashboards')
<a class="dropdown-item" href="{{ route('dashboards.create') }}">{{ trans('general.title.create', ['type' => trans_choice('general.dashboards', 1)]) }}</a>
@endpermission
<a class="dropdown-item" href="{{ route('dashboards.index') }}">{{ trans('general.title.manage', ['type' => trans_choice('general.dashboards', 2)]) }}</a>
@endpermission
2017-09-14 22:21:00 +03:00
</div>
</div>
2019-11-16 10:21:14 +03:00
</span>
2020-01-07 17:15:00 +03:00
@endpermission
2019-11-16 10:21:14 +03:00
@php
$text = json_encode([
'name' => trans('general.name'),
2020-01-07 17:15:00 +03:00
'type' => trans_choice('general.types', 1),
'width' => trans('general.width'),
'sort' => trans('general.sort'),
2019-11-16 10:21:14 +03:00
'enabled' => trans('general.enabled'),
'yes' => trans('general.yes'),
'no' => trans('general.no'),
'save' => trans('general.save'),
'cancel' => trans('general.cancel')
]);
$placeholder = json_encode([
'name' => trans('general.form.enter', ['field' => trans('general.name')]),
2020-01-07 17:15:00 +03:00
'type' => trans('general.form.enter', ['field' => trans_choice('general.types', 1)]),
'width' => trans('general.form.enter', ['field' => trans('general.width')]),
'sort' => trans('general.form.enter', ['field' => trans('general.sprt')])
2019-11-16 10:21:14 +03:00
]);
2019-12-26 16:07:51 +03:00
@endphp
2019-11-16 10:21:14 +03:00
<akaunting-widget
v-if="widget_modal"
:title="'{{ trans_choice('general.widgets', 1) }}'"
:show="widget_modal"
2019-12-31 14:48:32 +03:00
:widget_id="widget.id"
2019-11-16 10:21:14 +03:00
:name="widget.name"
:width="widget.width"
:action="widget.action"
2019-12-31 14:48:32 +03:00
:type="widget.class"
2019-11-16 10:21:14 +03:00
:types="widgets"
2019-12-31 14:48:32 +03:00
:sort="widget.sort"
2019-11-16 10:21:14 +03:00
:dashboard_id="{{ $dashboard->id }}"
:text="{{ $text }}"
:placeholder="{{ $placeholder }}"
@cancel="onCancel">
</akaunting-widget>
@endsection
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
@section('new_button')
<!--Dashboard General Filter-->
<el-date-picker
v-model="filter_date"
type="daterange"
align="right"
unlink-panels
:format="'yyyy-MM-dd'"
value-format="yyyy-MM-dd"
@change="onChangeFilterDate"
range-separator="{{ trans('general.to')}}"
start-placeholder="{{ trans('general.start_date')}}"
end-placeholder="{{ trans('general.end_date')}}"
:picker-options="{
shortcuts: [
{
text: '{{ trans("reports.this_year") }}',
onClick(picker) {
const end = new Date('{{ $financial_start }}');
const start = new Date('{{ $financial_start }}');
end.setFullYear(start.getFullYear() + 1);
end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
picker.$emit('pick', [start, end]);
}
},
{
text: '{{ trans("reports.previous_year") }}',
onClick(picker) {
const end = new Date('{{ $financial_start }}');
const start = new Date('{{ $financial_start }}');
start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
end.setFullYear(start.getFullYear() + 1);
end.setTime(end.getTime() - 3600 * 1000 * 24 * 1);
picker.$emit('pick', [start, end]);
}
},
{
text: '{{ trans("reports.this_quarter") }}',
onClick(picker) {
const now = new Date();
const quarter = Math.floor((now.getMonth() / 3));
const start = new Date(now.getFullYear(), quarter * 3, 1);
const end = new Date(start.getFullYear(), start.getMonth() + 3, 0);
picker.$emit('pick', [start, end]);
}
},
{
text: '{{ trans("reports.previous_quarter") }}',
onClick(picker) {
const now = new Date();
const quarter = Math.floor((now.getMonth() / 3));
const start = new Date(now.getFullYear(), quarter * 3, 1);
const end = new Date(start.getFullYear(), start.getMonth() + 3, 0);
start.setMonth(start.getMonth() - 3);
end.setMonth(end.getMonth() - 3);
picker.$emit('pick', [start, end]);
}
},
{
text: '{{ trans("reports.last_12_months") }}',
onClick(picker) {
const end = new Date();
const start = new Date();
start.setTime(start.getTime() - 3600 * 1000 * 24 * 365);
picker.$emit('pick', [start, end]);
}
}
]
}">
</el-date-picker>
2019-11-16 10:21:14 +03:00
@endsection
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
@section('content')
2017-09-14 22:21:00 +03:00
<div class="row">
2019-12-31 02:20:10 +03:00
@foreach($widgets as $widget)
@widget($widget)
2019-11-16 10:21:14 +03:00
@endforeach
2017-09-14 22:21:00 +03:00
</div>
@endsection
2019-11-16 10:21:14 +03:00
@push('scripts_start')
2020-01-07 17:15:00 +03:00
<script src="{{ asset('public/js/common/dashboards.js?v=' . version('short')) }}"></script>
2018-12-14 11:23:15 +05:30
@endpush