Skip to content

Commit

Permalink
Regional Gala (#20)
Browse files Browse the repository at this point in the history
* added controller for regional gala

* added infinite scroll for projects

* added images

* added texts

* separate success page from user registration

* added regional gala pages

* added routes

* added cards

* change emited event on success

* updated paginated grid

* added infinete scroll in modal

* Update navbar
  • Loading branch information
FlorinZarafu authored Jun 17, 2023
1 parent ff31d53 commit 3e9d6ac
Show file tree
Hide file tree
Showing 19 changed files with 1,702 additions and 166 deletions.
8 changes: 8 additions & 0 deletions app/Http/Controllers/ChampionshipController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use App\Models\County;
use App\Models\Project;
use Inertia\Inertia;
use Illuminate\Http\Request;

class ChampionshipController extends Controller
{
Expand Down Expand Up @@ -92,6 +93,7 @@ public function index()

$projects = Project::publish()->paginate(9)->withQueryString();
$counties = County::whereHas('projects')->get(['name', 'id']);

return Inertia::render('Public/Championship/Championship', [
'query' => $projects,
'counties' => $counties,
Expand Down Expand Up @@ -217,4 +219,10 @@ public function edition()
'statistics' => $statistics
]);
}

public function projects(Request $request)
{
$offset = ($request->page - 1) * 8;
return Project::publish()->offset($offset)->limit(8)->get();
}
}
228 changes: 228 additions & 0 deletions app/Http/Controllers/RegionalController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
<?php

declare(strict_types=1);

namespace App\Http\Controllers;

use App\Models\County;
use App\Models\Project;
use Inertia\Inertia;

class RegionalController extends Controller
{
public function index()
{
$testimonials = [
[
'content' => '11111 Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo expedita voluptas culpa sapiente alias molestiae. Numquam corrupti in laborum sed rerum et corporis.',
'name' => 'Judith Black',
'job' => 'CEO',
'company' => 'Workcation'
],
[
'content' => '222222222 Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo expedita voluptas culpa sapiente alias molestiae. Numquam corrupti in laborum sed rerum et corporis.',
'name' => 'Judith Black',
'job' => 'CEO',
'company' => 'Workcation'
]
];

$links = [
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
],
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
],
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
]
];

$editions = [
[
'href' => '1',
'name' => 'Campionatul de bine 2020'
],
[
'href' => '2',
'name' => 'Campionatul de bine 2019'
],
[
'href' => '3',
'name' => 'Campionatul de bine 2018'
],
];

$articles = [
[
'id' => 1,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
[
'id' => 2,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
[
'id' => 3,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
];

$projects = Project::publish()->paginate(9)->withQueryString();
$counties = County::whereHas('projects')->get(['name', 'id']);
return Inertia::render('Public/Regional/Regional', [
'query' => $projects,
'counties' => $counties,
'testimonials' => $testimonials,
'links' => $links,
'editions' => $editions,
'articles' => $articles
]);
}

public function edition()
{
$testimonials = [
[
'content' => '11111 Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo expedita voluptas culpa sapiente alias molestiae. Numquam corrupti in laborum sed rerum et corporis.',
'name' => 'Judith Black',
'job' => 'CEO',
'company' => 'Workcation'
],
[
'content' => '222222222 Lorem ipsum dolor sit amet consectetur adipisicing elit. Nemo expedita voluptas culpa sapiente alias molestiae. Numquam corrupti in laborum sed rerum et corporis.',
'name' => 'Judith Black',
'job' => 'CEO',
'company' => 'Workcation'
]
];

$links = [
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
],
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
],
[
'href' => "#",
'label' => "Titlu Articol",
'source' => "sursa.ro"
]
];

$editions = [
[
'href' => '1',
'name' => 'Campionatul de bine 2020'
],
[
'href' => '2',
'name' => 'Campionatul de bine 2019'
],
[
'href' => '3',
'name' => 'Campionatul de bine 2018'
],
];

$articles = [
[
'id' => 1,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
[
'id' => 2,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
[
'id' => 3,
'img' => '/images/project_img.png',
'author' => 'Ion Popescu',
'name' => 'Importanța educației remediare în România în timpul pandemiei',
'team' => 'Echipa BCR',
'content' => 'Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto accusantium praesentium eius, ut atque fuga culpa, similique sequi cum eos quis dolorum.',
'date' => '15.02.2022'
],
];

$statistics = [
[
'month' => 'Decembrie 2016',
'donations' => '2210',
'amount' => '188873,00'
],
[
'month' => 'Decembrie 2016',
'donations' => '2210',
'amount' => '188873,00'
],
[
'month' => 'Decembrie 2016',
'donations' => '2210',
'amount' => '188873,00'
],
[
'month' => 'Decembrie 2016',
'donations' => '2210',
'amount' => '188873,00'
]
];

$projects = Project::publish()->paginate(9)->withQueryString();
$counties = County::whereHas('projects')->get(['name', 'id']);
return Inertia::render('Public/Regional/LastEdition', [
'query' => $projects,
'counties' => $counties,
'testimonials' => $testimonials,
'links' => $links,
'editions' => $editions,
'articles' => $articles,
'statistics' => $statistics
]);
}

public function project(Project $project)
{
\Log::info(print_r($project,true));
return Inertia::render('Public/Regional/Project', [
'project' => $project,
]);
}
}
2 changes: 1 addition & 1 deletion public/images/svg/location.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/svg/location_big.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions public/images/svg/location_extra.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions resources/js/Components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@
name: 'Campionatul de Bine',
description: 'O competiție a faptelor bune. Alătură-te!',
href: 'championship'
},
{
name: 'Gale Regionale',
description: 'Proiectele cu cel mai mare impact, pe regiuni. Vezi participanții!',
href: 'regional'
}
];
Expand Down
74 changes: 74 additions & 0 deletions resources/js/Components/cards/ChampionshipProject.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<li
class="flex flex-col col-span-1 bg-white divide-y divide-gray-200 rounded-lg shadow"
>
<div class="flex flex-col flex-1">
<Link
:href="route('regionalproject', data.slug)"
class="relative bg-gray-200 group-hover:opacity-75 sm:h-52"
>

<img
:src="data.cover_image!=='' ?data.cover_image: 'https://images.unsplash.com/photo-1508779544523-dd1b27685be3?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1470&q=80'"
alt="imagine proiect"
class="object-cover object-center w-full h-full rounded-t-lg sm:h-full sm:w-full"
/>

<div class="absolute z-10 flex flex-wrap gap-2 bottom-3 left-3">
<div
class="inline-flex items-center px-3 py-1 text-base font-bold text-white bg-red-500 rounded-full gap-x-2"
>
<SvgLoader class="shrink-0 fill-white" name="location" />
4
</div>
</div>
</Link>

<div class="p-6">
<div class="pb-4 text-base font-medium text-gray-700">{{ data.organization.name }}</div>

<Link
:href="route('regionalproject', data.slug)"
class="mt-4 text-2xl font-bold text-gray-700"
>
{{ data.name }}
</Link>

<div class="flex items-center gap-5 mt-1 text-base font-medium text-gray-700">
<div v-if="data.county" class="flex items-center gap-1">
<SvgLoader class="shrink-0" name="location" />
{{ data.county.name }}
</div>

<div v-if="data.activity_domains" class="flex items-center gap-1">
<SvgLoader class="shrink-0" name="activity" />
<span class="w-20 truncate lg:w-40">{{ data.activity_domains.join(',') }}</span>
</div>
</div>
</div>

<div class="w-full p-6">
<Link
:href="route('regionalproject', data.slug)"
class="block text-center w-full mt-auto bg-turqoise-500 hover:bg-turqoise-400 text-white focus-visible:outline-turqoise-500 rounded-md px-3.5 py-2.5 text-sm font-semibold shadow-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2"
>
{{ $t('see') }}
</Link>
</div>
</div>
</li>
</template>

<script setup>
/** Import from inertia. */
import { Link } from "@inertiajs/vue3";
/** Import components. */
import SvgLoader from "@/Components/SvgLoader.vue";
/** Component props. */
const props = defineProps({
data: Object,
cardType: String,
});
</script>
Loading

0 comments on commit 3e9d6ac

Please sign in to comment.