Skip to content

Commit

Permalink
add dashboard for ngo admin
Browse files Browse the repository at this point in the history
  • Loading branch information
gheorghelupu17 committed Jan 16, 2024
1 parent a1617f0 commit bf48612
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 7 deletions.
17 changes: 11 additions & 6 deletions app/Http/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class DashboardController extends Controller
public function __invoke(): Response|RedirectResponse
{
if (auth()->user()->belongsToOrganization()) {
return $this->ongDashboard();
return $this->ongDashboard();
}
if (auth()->user()->isDonor()) {
return $this->donorDashboard();
Expand Down Expand Up @@ -47,9 +47,9 @@ private function donorDashboard()
private function ongDashboard()
{
$organization = auth()->user()->organization;
$data = Cache::remember('organization_id_stats', 60, function () use ($organization) {
$data = Cache::remember('organization_id_stats', 60, function () use ($organization) {
return [
'organization' =>[
'organization' => [
'status' => $organization->status,
'name' => $organization->name,
'has_statute' => $organization->has_statute,
Expand All @@ -65,12 +65,17 @@ private function ongDashboard()
'closed' => $organization->projects()->whereIsClosed()->count(),
'starts_soon' => $organization->projects()->whereStartsSoon()->count(),
],
'tickets' => [
'total' => $organization->tickets->count(),
'open' => $organization->tickets()->whereOpen()->count(),
'closed' => $organization->tickets()->whereClosed()->count(),
],
];
});

dd($data);
return Inertia::render('Ong/Dashboard', [
'data'=> $data,

return Inertia::render('AdminOng/Dashboard', [
'data' => $data,
]);
}
}
34 changes: 33 additions & 1 deletion lang/ro.json
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,13 @@
"tickets.close.title": "Închide ticket",
"tickets.close.content": "Ești sigur că vrei să închizi acest tichet?",

"tickets.stats.open": "Tichete deschis",
"tickets.stats.closed": "Tichete inchise",
"tickets.stats.total": "Total tichete",




"tickets.reopen.title": "Redeschide ticket",
"tickets.reopen.content": "Ești sigur că vrei să redeschizi acest tichet?",

Expand All @@ -456,6 +463,30 @@
"projects.status.close": "Închis",
"projects.status.starting_soon": "Incepe in curand",
"projects.status.ending_soon": "Se incheie in curand",
"projects.status.rejected": "Respinse",
"projects.status.draft": "Draft",
"projects.status.pending": "In asteptare",
"projects.status.approved": "Aprobate",
"projects.status.closed": "Inchise",
"projects.status.published": "Publicate",
"projects.status.starts_soon": "Incepe in curand",
"projects.status.total": "Total proiecte",

"projects.stats.open": "Deschis",
"projects.stats.close": "Închis",
"projects.stats.starting_soon": "Incepe in curand",
"projects.stats.ending_soon": "Se incheie in curand",
"projects.stats.rejected": "Respinse",
"projects.stats.draft": "Draft",
"projects.stats.pending": "In asteptare",
"projects.stats.approved": "Aprobate",
"projects.stats.closed": "Inchise",
"projects.stats.published": "Publicate",
"projects.stats.starts_soon": "Incepe in curand",
"projects.stats.total": "Total proiecte",




"project.labels.preview_image": "Imagine de prezentare",
"project.labels.videos": "Videoclipuri externe ale proiectului",
Expand All @@ -466,5 +497,6 @@
"project.labels.change_gallery_label": "Schimbă galeria de imagini",

"organization_status_disabled": "Organizația este dezactivată, vezi detalii în secțiunea de tichete",
"organization_status_pending": "Organizația este în așteptare"
"organization_status_pending": "Organizația este în așteptare",
"organization_status_approved": "Organizația este aprobată"
}
57 changes: 57 additions & 0 deletions resources/js/Pages/AdminOng/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<DashboardLayout>
<Title :title="$t('dashbord')" :icon="ChartBarIcon" />

<div class="border-b border-b-gray-900/10 lg:border-t lg:border-t-gray-900/5">
<dl class="mx-auto grid max-w-7xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 lg:px-2 xl:px-0">
<div class="flex items-baseline flex-wrap justify-between gap-y-2 gap-x-4 border-t border-gray-900/5 px-4 py-10 sm:px-6 lg:border-t-0 xl:px-8">
<dt class="text-sm font-medium leading-6 text-gray-500">{{ $t('organization') }}</dt>
<dd class="w-full flex-none text-3xl font-medium leading-10 tracking-tight text-gray-900">{{ data.organization.name }}</dd>
</div>

<div class="flex items-baseline flex-wrap justify-between gap-y-2 gap-x-4 border-t border-gray-900/5 px-4 py-10 sm:px-6 lg:border-t-0 xl:px-8">
<dt class="text-sm font-medium leading-6 text-gray-500">{{ $t('status') }}</dt>
<dd class="w-full flex-none text-3xl font-medium leading-10 tracking-tight text-gray-900">{{ $t('organization_status_'+data.organization.status) }}</dd>
</div>

<div class="flex items-baseline flex-wrap justify-between gap-y-2 gap-x-4 border-t border-gray-900/5 px-4 py-10 sm:px-6 lg:border-t-0 xl:px-8">
<dt class="text-sm font-medium leading-6 text-gray-500">{{ $t('status_document_label') }}</dt>
<dd class="w-full flex-none text-3xl font-medium leading-10 tracking-tight text-gray-900">{{ data.organization.has_statute ? $t('yes') : $('no') }}</dd>
</div>
</dl>
</div>

<div class="border-b border-b-gray-900/10 lg:border-t lg:border-t-gray-900/5">
<dl class="mx-auto grid max-w-7xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 lg:px-2 xl:px-0">
<div v-for="(stat, statIdx) in data.projects" :key="statIdx" class="flex items-baseline flex-wrap justify-between gap-y-2 gap-x-4 border-t border-gray-900/5 px-4 py-10 sm:px-6 lg:border-t-0 xl:px-8">
<dt class="text-sm font-medium leading-6 text-gray-500">{{ $t('projects.stats.'+ statIdx) }}</dt>
<dd class="w-full flex-none text-3xl font-medium leading-10 tracking-tight text-gray-900">{{ stat }}</dd>
</div>
</dl>
</div>

<div class="border-b border-b-gray-900/10 lg:border-t lg:border-t-gray-900/5">
<dl class="mx-auto grid max-w-7xl grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 lg:px-2 xl:px-0">
<div v-for="(stat, statIdx) in data.tickets" :key="statIdx" class="flex items-baseline flex-wrap justify-between gap-y-2 gap-x-4 border-t border-gray-900/5 px-4 py-10 sm:px-6 lg:border-t-0 xl:px-8">
<dt class="text-sm font-medium leading-6 text-gray-500">{{ $t('tickets.stats.'+ statIdx) }}</dt>
<dd class="w-full flex-none text-3xl font-medium leading-10 tracking-tight text-gray-900">{{ stat }}</dd>
</div>
</dl>
</div>
</DashboardLayout>
</template>

<script setup>
/** Import components. */
import DashboardLayout from '@/Layouts/DashboardLayout.vue';
import Title from '@/Components/Title.vue';
import {ChartBarIcon} from '@heroicons/vue/outline';
import {organization} from "../../../../public/build/assets/ro-adfdc2c4.js";
const props = defineProps({
data: {
type: Object,
},
});
</script>

0 comments on commit bf48612

Please sign in to comment.