diff --git a/app/Http/Controllers/Api/TimeTrackerController.php b/app/Http/Controllers/Api/TimeTrackerController.php index cc41134..2c3e7ef 100644 --- a/app/Http/Controllers/Api/TimeTrackerController.php +++ b/app/Http/Controllers/Api/TimeTrackerController.php @@ -80,8 +80,8 @@ public function getTimeTrackerOfDateByUser(string $date, int $user_id) public function report(Request $request) { $today = Carbon::now()->format('Y-m-d'); - $fromDate = Carbon::now()->subDays(5)->format('Y-m-d'); - $toDate = $today; + $fromDate = $request->input('dateFrom') ?: Carbon::now()->subDays(1)->format('Y-m-d'); + $toDate = $request->input('dateTo') ?: $today; $usersGroupByDate = TimeTracker::select('user_id','date') ->whereBetween('date', [$fromDate, $toDate]) diff --git a/package-lock.json b/package-lock.json index a874451..e8a789a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5,6 +5,7 @@ "packages": { "": { "dependencies": { + "@vuepic/vue-datepicker": "^3.5.3", "ag-grid-community": "^28.2.1", "ag-grid-vue3": "^28.2.1" }, @@ -326,6 +327,20 @@ "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==", "dev": true }, + "node_modules/@vuepic/vue-datepicker": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-3.5.3.tgz", + "integrity": "sha512-tyqnRDuqj02decCwzwGP7ht0erc33Ktcm8zyEx90C7Vt5Y4roq2CV21ovzmdRluUW8p/1abLcL7ZSqedWtAzKw==", + "dependencies": { + "date-fns": "^2.29.3" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "vue": ">=3.2.0" + } + }, "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -611,6 +626,18 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" }, + "node_modules/date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==", + "engines": { + "node": ">=0.11" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/date-fns" + } + }, "node_modules/deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -2229,6 +2256,14 @@ "integrity": "sha512-oJ4F3TnvpXaQwZJNF3ZK+kLPHKarDmJjJ6jyzVNDKH9md1dptjC7lWR//jrGuLdek/U6iltWxqAnYOu8gCiOvA==", "dev": true }, + "@vuepic/vue-datepicker": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/@vuepic/vue-datepicker/-/vue-datepicker-3.5.3.tgz", + "integrity": "sha512-tyqnRDuqj02decCwzwGP7ht0erc33Ktcm8zyEx90C7Vt5Y4roq2CV21ovzmdRluUW8p/1abLcL7ZSqedWtAzKw==", + "requires": { + "date-fns": "^2.29.3" + } + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -2424,6 +2459,11 @@ "resolved": "https://registry.npmjs.org/csstype/-/csstype-2.6.21.tgz", "integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w==" }, + "date-fns": { + "version": "2.29.3", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", + "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" + }, "deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", diff --git a/package.json b/package.json index 5c0fef3..9ffe70e 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "vue": "^3.2.41" }, "dependencies": { + "@vuepic/vue-datepicker": "^3.5.3", "ag-grid-community": "^28.2.1", "ag-grid-vue3": "^28.2.1" } diff --git a/resources/js/Components/Report/ReportTimeTracker.vue b/resources/js/Components/Report/ReportTimeTracker.vue index d4bb65c..b2e549d 100644 --- a/resources/js/Components/Report/ReportTimeTracker.vue +++ b/resources/js/Components/Report/ReportTimeTracker.vue @@ -1,18 +1,33 @@ + \ No newline at end of file