From 4168a40cbbb16143e0d706e4e7e41a1c113c6289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=BCneyt=20=C5=9Eent=C3=BCrk?= Date: Thu, 26 Dec 2019 15:15:24 +0300 Subject: [PATCH] Dashboard date filter development start.. --- resources/assets/js/views/common/dashboard.js | 38 +++++++++++++++++-- .../views/common/dashboard/index.blade.php | 15 ++++++++ 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/views/common/dashboard.js b/resources/assets/js/views/common/dashboard.js index 04e8c8fec..63c1a1f12 100644 --- a/resources/assets/js/views/common/dashboard.js +++ b/resources/assets/js/views/common/dashboard.js @@ -13,13 +13,15 @@ import Global from './../../mixins/global'; import AkauntingDashboard from './../../components/AkauntingDashboard'; import AkauntingWidget from './../../components/AkauntingWidget'; -import Form from './../../plugins/form'; -import BulkAction from './../../plugins/bulk-action'; +import {DatePicker} from 'element-ui'; -const app = new Vue({ +Vue.use(DatePicker); + +const dashboard = new Vue({ el: '#main-body', components: { + [DatePicker.name]: DatePicker, AkauntingDashboard, AkauntingWidget }, @@ -46,7 +48,35 @@ const app = new Vue({ action: 'create', sort: 0, widget_id: 0 - } + }, + pickerOptions: { + shortcuts: [{ + text: 'Last week', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 7); + picker.$emit('pick', [start, end]); + } + }, { + text: 'Last month', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit('pick', [start, end]); + } + }, { + text: 'Last 3 months', + onClick(picker) { + const end = new Date(); + const start = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 90); + picker.$emit('pick', [start, end]); + } + }] + }, + value2: '' }; }, diff --git a/resources/views/common/dashboard/index.blade.php b/resources/views/common/dashboard/index.blade.php index fec567153..224fe854d 100644 --- a/resources/views/common/dashboard/index.blade.php +++ b/resources/views/common/dashboard/index.blade.php @@ -92,6 +92,21 @@ @section('new_button') +
+ + +
@endsection @section('content')