Skip to content

Commit

Permalink
Bug fixing (#74)
Browse files Browse the repository at this point in the history
* Added donor pages, started evolution page

* evolution charts

* fix #27, fix #26, fix
fix #45,  fix #49,  fix #54,  fix #56,  fix #57, fix #58, fix #59, fix #67

* fix #50, fix #42, fix #38

* fix #31, fix #48, fix #43
  • Loading branch information
FlorinZarafu authored Jul 4, 2023
1 parent e98c20d commit e602ff3
Show file tree
Hide file tree
Showing 35 changed files with 1,126 additions and 404 deletions.
94 changes: 93 additions & 1 deletion app/Http/Controllers/EvolutionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
namespace App\Http\Controllers;

use Inertia\Inertia;
use App\Models\County;
use App\Models\ActivityDomain;

class EvolutionController extends Controller
{
public function index()
{
$donations = 102030;
$amount = 122345;
$projects = 1000;

$donations_number = [
[
Expand Down Expand Up @@ -67,12 +70,101 @@ public function index()
]
];

$projects_number = [
[
'month' => 'Ian',
'number' => 123,
],
[
'month' => 'Feb',
'number' => 280,
],
[
'month' => 'Mar',
'number' => 150,
],
[
'month' => 'Apr',
'number' => 1100,
],
[
'month' => 'Mai',
'number' => 2150,
],
[
'month' => 'Iun',
'number' => 330,
]
];

$table_data = [
'current_page' => 1,
'data' => [
[
'id' => 1,
'month' => 'Ian',
'number' => 23,
'amount' => 400,
'domain' => 'Social'
],
[
'id' => 2,
'month' => 'Ian',
'number' => 23,
'amount' => 400,
'domain' => 'Social'
],
[
'id' => 3,
'month' => 'Ian',
'number' => 23,
'amount' => 400,
'domain' => 'Social'
],
[
'id' => 4,
'month' => 'Ian',
'number' => 23,
'amount' => 400,
'domain' => 'Social'
],
],
'first_page_url' => 'http://bursabinelui.test/articole?page=1',
'from' => 1,
'last_page' => 2,
'last_page_url'=> 'http://bursabinelui.test/articole?page=2',
'links' => [
[
'url' => 'http://bursabinelui.test/articole?page=1',
'label' => '1',
'active' => true,
],
[
'url'=> 'http://bursabinelui.test/articole?page=2',
'label'=> '2',
'active'=> false,
],
],
'next_page_url'=> 'http://bursabinelui.test/articole?page=1',
'path'=> 'http://bursabinelui.test/articole',
'per_page' =>15,
'prev_page_url' => null,
'to' => 15,
'total' => 20,

];

$counties = County::get(['name', 'id']);
return Inertia::render('Public/Evolution/Evolution', [
'donations' => $donations,
'amount' => $amount,
'donations_number' => $donations_number,
'donations_amount' => $donations_amount
'donations_amount' => $donations_amount,
'projects' => $projects,
'projects_number' => $projects_number,
'counties' => $counties,
'domains' => ActivityDomain::all(),
'table_data' => $table_data
]);
}
}
6 changes: 4 additions & 2 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ public function index()
],
];

$projects = Project::publish()->paginate(9)->withQueryString();
$bcr_projects = Project::publish()->paginate(9)->withQueryString();
$donate_projects = Project::publish()->paginate(9)->withQueryString();

return Inertia::render('Public/Home', [
'query' => $projects,
'bcr_projects' => $bcr_projects,
'donate_projects' => $donate_projects,
'articles' => $articles,
]);
}
Expand Down
51 changes: 51 additions & 0 deletions public/images/svg/small_dotted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion resources/js/Components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
{
name: 'Evolutia faptelor bune',
description: 'Vezi evoluția faptelor bune pe Bursa Binelui în timp, cu ajutorul unor grafice.',
href: 'about'
href: 'evolution'
},
{
name: 'Întrebări frecvente',
Expand Down
15 changes: 9 additions & 6 deletions resources/js/Components/cards/OngCard.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
<template>
<li class="col-span-1 flex flex-col rounded-lg bg-white shadow-md">
<div class="flex flex-1 flex-col p-6">
<img class="mx-auto h-32 w-32 flex-shrink-0 rounded-full" :src="data.cover_image ? data.cover_image: '/images/ong.png'" alt="" />
<li class="flex flex-col col-span-1 bg-white rounded-lg shadow-md">
<div class="flex flex-col flex-1 p-6">
<img class="flex-shrink-0 w-32 h-32 mx-auto rounded-full" :src="data.cover_image ? data.cover_image: '/images/ong.png'" alt="" />

<h3 class="mt-4 text-2xl font-bold text-gray-700 line-clamp-2">{{ data.name }}</h3>

<div class="mt-1 flex items-center flex-wrap gap-5 text-base text-gray-800 font-medium mb-6">
<div v-if="data.activity_domains" class="flex gap-1 items-center">
<div class="flex flex-wrap items-center gap-5 mt-1 mb-6 text-base font-medium text-gray-800">
<div v-if="0 < data.activity_domains?.length" class="flex items-center gap-1">
<SvgLoader class="shrink-0" name="activity" />
<p class="line-clamp-1">{{ data.activity_domains?.map(item=>item.name).join(', ') }}</p>
<!-- <p class="line-clamp-1">{{ data.activity_domains?.map(item=>item.name).join(', ') }}</p> -->
<div class="flex gap-1.5 flex-wrap">
<p v-for="(domain, index) in data.activity_domains">{{ domain.name }}</p>
</div>
</div>
</div>
Expand Down
89 changes: 17 additions & 72 deletions resources/js/Components/charts/AppChart.vue
Original file line number Diff line number Diff line change
@@ -1,72 +1,26 @@
<template>
<!-- Time evolution -->
<div class="space-y-6">
<h1 class="text-4xl font-extrabold text-center text-gray-900">
<span>{{ donations ? donations : 0 }} {{ $t('donations') }},&nbsp;</span>
<span>{{ amount ? amount : 0 }} {{ $t('currency') }}</span>
</h1>
<div class="flex items-center justify-center gap-6">
<PrimaryButton
:background="['time_evolution' === time_evolution_1 ? 'red-500' : 'gray-100']"
:hover="['time_evolution' === time_evolution_1 ? 'red-400' : 'gray-200']"
:color="['time_evolution' === time_evolution_1 ? 'white' : 'gray-700']"
class="px-6 py-1.5"
@click="time_evolution_1='time_evolution'"
>
{{ $t('time_evolution') }}
</PrimaryButton>
<h1 class="text-4xl font-extrabold text-center text-gray-900">{{ $t('good_deeds') }}</h1>

<PrimaryButton
:background="['donations_per_domain' === time_evolution_1 ? 'red-500' : 'gray-100']"
:hover="['donations_per_domain' === time_evolution_1 ? 'red-400' : 'gray-200']"
:color="['donations_per_domain' === time_evolution_1 ? 'white' : 'gray-700']"
class="px-6 py-1.5"
@click="time_evolution_1='donations_per_domain'"
>
{{ $t('Donații per domenii') }}
</PrimaryButton>
</div>

<div v-if="'time_evolution' === time_evolution_1" class="border border-gray-200 rounded">
<div class="border border-gray-200 rounded">
<div class="flex items-center justify-between p-4 border-b border-gray-200">
<h3 class="text-lg font-bold text-gray-900">{{ $t('time_evolution') }}</h3>

<div class="flex items-center justify-center gap-6">
<PrimaryButton
:background="['nr_donations' === time_evolution_2 ? 'primary-500' : 'gray-100']"
:hover="['nr_donations' === time_evolution_2 ? 'primary-400' : 'gray-200']"
:color="['nr_donations' === time_evolution_2 ? 'white' : 'gray-700']"
class="px-6 py-1.5"
@click="time_evolution_2='nr_donations'"
>
{{ $t('donation_number') }}
</PrimaryButton>

<PrimaryButton
:background="['amount_donations' === time_evolution_2 ? 'primary-500' : 'gray-100']"
:hover="['amount_donations' === time_evolution_2 ? 'primary-400' : 'gray-200']"
:color="['amount_donations' === time_evolution_2 ? 'white' : 'gray-700']"
class="px-6 py-1.5"
@click="time_evolution_2='amount_donations'"
>
{{ $t('donation_amount') }}
</PrimaryButton>
<h3 class="text-lg font-bold text-gray-900">{{ $t('good_deeds_evolution') }}</h3>

<div class="flex items-center justify-center w-3/12 gap-6">
<Input
class="w-full"
:label="$t('project_date_start_label')"
color="gray-700"
type="date"
/>
</div>
</div>

<LineChart
v-if="'nr_donations' === time_evolution_2"
:data="donations_number"
:data="projects_number"
:xAxe="xAxe"
:yAxeId="donationsNumberY"
class="p-4"
/>

<LineChart
v-if="'amount_donations' === time_evolution_2"
:data="donations_amount"
:xAxe="xAxe"
:yAxeId="donationsAmountY"
:yAxeId="projectsNumberY"
class="p-4"
/>
</div>
Expand All @@ -75,22 +29,13 @@

<script setup>
import { ref } from 'vue';
import PrimaryButton from '@/Components/buttons/PrimaryButton.vue';
import LineChart from '@/Components/charts/LineChart.vue';
import Input from '@/Components/form/Input.vue';
const props = defineProps({
donations: Number,
amount: Number,
donations_number: Array,
donations_amount: Array
projects: Number,
projects_number: Array
});
const time_evolution_1 = ref('time_evolution');
const time_evolution_2 = ref('nr_donations');
const xAxe = ['Ian', 'Feb', 'Mar', 'Apr', 'Mai', 'Iun', 'Iul', 'Aug', 'Sep', 'Oct', 'Noi', 'Dec'];
const donationsNumberY = "number"
const donationsAmountY = "amount"
const projectsNumberY = "number"
</script>
Loading

0 comments on commit e602ff3

Please sign in to comment.