-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
150 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
app/Actions/SysAdmin/UI/ShowSysAdminAnalyticsDashboard.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
/* | ||
* Author: Raul Perusquia <raul@inikoo.com> | ||
* Created: Sun, 05 Jan 2025 14:59:28 Malaysia Time, Kuala Lumpur, Malaysia | ||
* Copyright (c) 2025, Raul A Perusquia Flores | ||
*/ | ||
|
||
namespace App\Actions\SysAdmin\UI; | ||
|
||
use App\Actions\OrgAction; | ||
use App\Actions\UI\Dashboards\ShowGroupDashboard; | ||
use App\Enums\UI\SysAdmin\SysAdminAnalyticsDashboardTabsEnum; | ||
use App\Models\SysAdmin\Group; | ||
use Inertia\Inertia; | ||
use Inertia\Response; | ||
use Lorisleiva\Actions\ActionRequest; | ||
|
||
class ShowSysAdminAnalyticsDashboard extends OrgAction | ||
{ | ||
public function authorize(ActionRequest $request): bool | ||
{ | ||
return $request->user()->hasPermissionTo("sysadmin.view"); | ||
} | ||
|
||
|
||
public function handle(Group $group): Group | ||
{ | ||
return $group; | ||
} | ||
|
||
public function asController(ActionRequest $request): Group | ||
{ | ||
$group = group(); | ||
$this->initialisationFromGroup($group, $request)->withTab(SysAdminAnalyticsDashboardTabsEnum::values()); | ||
|
||
return $this->handle($group); | ||
} | ||
|
||
|
||
public function htmlResponse(Group $group): Response | ||
{ | ||
return Inertia::render( | ||
'SysAdmin/SysAdminAnalyticsDashboard', | ||
[ | ||
'breadcrumbs' => $this->getBreadcrumbs(), | ||
'title' => __('System analytics'), | ||
'pageHead' => [ | ||
'icon' => [ | ||
'icon' => ['fal', 'fa-analytics'], | ||
'title' => __('System analytics') | ||
], | ||
'title' => __('System analytics'), | ||
], | ||
'tabs' => [ | ||
'current' => $this->tab, | ||
'navigation' => SysAdminAnalyticsDashboardTabsEnum::navigation() | ||
], | ||
] | ||
); | ||
} | ||
|
||
public function getBreadcrumbs(): array | ||
{ | ||
return | ||
array_merge( | ||
ShowGroupDashboard::make()->getBreadcrumbs(), | ||
[ | ||
[ | ||
'type' => 'simple', | ||
'simple' => [ | ||
'route' => [ | ||
'name' => 'grp.sysadmin.analytics.dashboard' | ||
], | ||
'label' => __('analytics'), | ||
] | ||
] | ||
] | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
resources/js/Pages/Grp/SysAdmin/SysAdminAnalyticsDashboard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!-- | ||
- Author: Raul Perusquia <raul@inikoo.com> | ||
- Created: Sun, 05 Jan 2025 14:59:28 Malaysia Time, Kuala Lumpur, Malaysia | ||
- Copyright (c) 2025, Raul A Perusquia Flores | ||
--> | ||
|
||
<script setup lang="ts"> | ||
import { Head } from '@inertiajs/vue3' | ||
import PageHeading from '@/Components/Headings/PageHeading.vue' | ||
import Tabs from "@/Components/Navigation/Tabs.vue" | ||
|
||
import { useTabChange } from "@/Composables/tab-change" | ||
import { capitalize } from "@/Composables/capitalize" | ||
import { computed, defineAsyncComponent, ref } from 'vue' | ||
import type { Component } from 'vue' | ||
|
||
import { PageHeading as TSPageHeading } from '@/types/PageHeading' | ||
import { Tabs as TSTabs } from '@/types/Tabs' | ||
|
||
const props = defineProps<{ | ||
title: string, | ||
pageHead: TSPageHeading | ||
tabs: TSTabs | ||
dashboard_stats: { | ||
label: string | ||
count: number | ||
icon: string | ||
}[] | ||
|
||
|
||
}>() | ||
const currentTab = ref(props.tabs.current) | ||
const handleTabUpdate = (tabSlug: string) => useTabChange(tabSlug, currentTab) | ||
|
||
const component = computed(() => { | ||
|
||
const components: Component = { | ||
dashboard: {} | ||
} | ||
|
||
return components[currentTab.value] | ||
|
||
}) | ||
|
||
|
||
</script> | ||
|
||
<template> | ||
<Head :title="capitalize(title)" /> | ||
<PageHeading :data="pageHead"></PageHeading> | ||
<Tabs :current="currentTab" :navigation="tabs.navigation" @update:tab="handleTabUpdate" /> | ||
<component :is="component" :data="props[currentTab as keyof typeof props]" :tab="currentTab" /> | ||
|
||
|
||
</template> | ||
|