Merge pull request #2109 from cuneytsenturk/master

Report page per widget clear own cache
This commit is contained in:
Cüneyt Şentürk
2021-06-15 12:56:41 +03:00
committed by GitHub
7 changed files with 125 additions and 14 deletions

View File

@ -30,9 +30,14 @@ const app = new Vue({
form: new Form('report'),
bulk_action: new BulkAction('reports'),
report_fields: '',
reports_total: [],
}
},
created() {
this.reports_total = reports_total;
},
methods: {
onChangeClass(class_name) {
axios.get(url + '/common/reports/fields', {
@ -76,6 +81,15 @@ const app = new Vue({
onChangeReportFields(event) {
this.form = event;
}
},
onRefreshTotal(report_id) {
axios.get(url + '/common/reports/' + report_id + '/clear')
.then(response => {
this.reports_total[report_id] = response.data.data;
})
.catch(error => {
});
},
}
});

View File

@ -6,7 +6,6 @@
@can('create-common-reports')
<a href="{{ route('reports.create') }}" class="btn btn-success btn-sm">{{ trans('general.add_new') }}</a>
@endcan
<a href="{{ route('reports.clear') }}" class="btn btn-warning btn-sm">{{ trans('general.clear_cache') }}</a>
@endsection
@section('content')
@ -25,14 +24,17 @@
<a class="btn btn-sm items-align-center py-2 mr-0 shadow-none--hover" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-ellipsis-v text-primary"></i>
</a>
<div class="dropdown-menu dropdown-menu-right dropdown-menu-arrow">
@can('update-common-reports')
<a class="dropdown-item" href="{{ route('reports.edit', $report->id) }}">{{ trans('general.edit') }}</a>
@endcan
@can('create-common-reports')
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="{{ route('reports.duplicate', $report->id) }}">{{ trans('general.duplicate') }}</a>
@endcan
@can('delete-common-reports')
<div class="dropdown-divider"></div>
{!! Form::deleteLink($report, 'reports.destroy') !!}
@ -47,9 +49,20 @@
<div class="col">
<a href="{{ route('reports.show', $report->id) }}">
<h5 class="card-title text-uppercase text-muted mb-0">{{ $report->name }}</h5>
<h2 class="font-weight-bold mb-0">{{ $totals[$report->id] }}</h2>
</a>
<div class="d-flex align-items-center">
<a href="{{ route('reports.show', $report->id) }}">
<h2 class="font-weight-bold mb-0" v-if="reports_total[{{ $report->id }}]" v-html="reports_total[{{ $report->id }}]"></h2>
<h2 class="font-weight-bold mb-0" v-else>{{ $totals[$report->id] }}</h2>
</a>
<button type="button" @click="onRefreshTotal('{{ $report->id }}')" class="btn btn-otline-primary btn-sm ml-2">
<i class="fas fa-redo"></i>
</button>
</div>
</div>
<div class="col-auto">
<a href="{{ route('reports.show', $report->id) }}">
<div class="icon icon-shape bg-orange text-white rounded-circle shadow">
@ -58,6 +71,7 @@
</a>
</div>
</div>
<p class="mt-3 mb-0 text-sm">
<a class="text-default" href="{{ route('reports.show', $report->id) }}">
<span class="pre">{{ $report->description }}</span>
@ -73,6 +87,9 @@
@endsection
@push('scripts_start')
<script type="text/javascript">
var reports_total = {!! json_encode($totals) !!};
</script>
<script src="{{ asset('public/js/common/reports.js?v=' . version('short')) }}"></script>
@endpush