Skip to content

Commit

Permalink
Ngo gale regionale, (#28)
Browse files Browse the repository at this point in the history
added projects in gale regionale

Co-authored-by: Lupu Gheorghe <[email protected]>
  • Loading branch information
FlorinZarafu and gheorghelupu17 authored Jun 26, 2023
1 parent 5da562a commit 191f1d4
Show file tree
Hide file tree
Showing 14 changed files with 920 additions and 176 deletions.
30 changes: 30 additions & 0 deletions app/Http/Controllers/Ngo/ProjectController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,36 @@ public function create()
]);
}

public function createRegional()
{
$countries = County::get(['name', 'id']);

return Inertia::render('AdminOng/Projects/AddRegionalProject', [
'countries' => $countries,
'projectCategories' => ProjectCategory::values(),
]);
}

public function storeRegional(StoreRequest $request)
{
$data = $request->validated();
$data['organization_id'] = auth()->user()->organization_id;
$data['slug'] = \Str::slug($data['name']);
$project = Project::create($data);
if ($request->has('counties')) {
$project->counties()->attach($data['counties']);
}
$project->addAllMediaFromRequest()->each(function ($fileAdder) {
$fileAdder->toMediaCollection('project_files');
});

auth()->user()->notify(new ProjectCreated($project));
$adminUsers = User::whereRole(UserRole::bb_admin)->get();
Notification::send($adminUsers, new ProjectCreatedAdmin($project));

return redirect()->route('admin.ong.project.edit', $project->id)->with('success', 'Project created.');
}

public function store(StoreRequest $request)
{
$data = $request->validated();
Expand Down
107 changes: 106 additions & 1 deletion app/Http/Controllers/RegionalController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,16 @@ public function index()

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

$countries = County::get(['name', 'id']);

return Inertia::render('Public/Regional/Regional', [
'query' => $projects,
'editions' => $editions,
'articles' => $articles,
'parteners' => $parteners,
'registration' => $registration,
'faqs' => $faqs,
'countries' => $countries
]);
}

Expand Down Expand Up @@ -195,10 +198,112 @@ public function edition()

public function project(Project $project)
{
\Log::info(print_r($project, true));
$gallery = [
[
'src' => 'https://youtu.be/f-t2nWVauSE',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => 'https://youtu.be/f-t2nWVauSE',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => 'https://youtu.be/f-t2nWVauSE',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => 'https://youtu.be/f-t2nWVauSE',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => 'https://youtu.be/f-t2nWVauSE',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'video'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
[
'src' => '/images/project_img.png',
'type' => 'image'
],
];

return Inertia::render('Public/Regional/Project', [
'project' => $project,
'gallery' => $gallery
]);
}
}
8 changes: 4 additions & 4 deletions resources/js/Components/cards/RegionalProject.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
>
<div class="flex flex-col flex-1">
<Link
:href="route('regionalproject', data.slug)"
:href="route('regional.project', data.slug)"
class="relative bg-gray-200 group-hover:opacity-75 sm:h-52"
>

Expand All @@ -28,7 +28,7 @@
<div class="pb-4 text-base font-medium text-gray-700">{{ data.organization.name }}</div>

<Link
:href="route('regionalproject', data.slug)"
:href="route('regional.project', data.slug)"
class="mt-4 text-2xl font-bold text-gray-700"
>
{{ data.name }}
Expand All @@ -37,7 +37,7 @@
<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 }}
<!-- {{ data.county.name }} -->
</div>

<div v-if="data.activity_domains" class="flex items-center gap-1">
Expand All @@ -49,7 +49,7 @@

<div class="w-full p-6">
<Link
:href="route('regionalproject', data.slug)"
:href="route('regional.project', 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') }}
Expand Down
10 changes: 5 additions & 5 deletions resources/js/Components/form/FileGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
<label for="cover-photo" class="block text-sm font-medium leading-6 text-gray-900">{{
$t('photo_gallery')
}}</label>
<div class="mt-2 flex justify-center rounded-lg border border-dashed border-gray-900/25 px-6 text-center">
<div class="flex justify-center p-6 px-6 mt-2 border border-dashed rounded-lg border-gray-900/25">
<div class="text-center">
<PhotoIcon class="mx-auto h-12 w-12 text-gray-300" aria-hidden="true"/>
<PhotoIcon class="w-12 h-12 mx-auto text-gray-300" aria-hidden="true"/>

<div class="mt-4 flex text-sm leading-6 text-gray-600">
<div class="flex justify-center mt-4 text-sm leading-6 text-center text-gray-600">
<label for="file-upload"
class="relative cursor-pointer rounded-md bg-white font-semibold text-turqoise-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-turqoise-600 focus-within:ring-offset-2 hover:text-turqoise-500 text-center">
class="relative font-semibold text-center bg-white rounded-md cursor-pointer text-turqoise-600 focus-within:outline-none focus-within:ring-2 focus-within:ring-turqoise-600 focus-within:ring-offset-2 hover:text-turqoise-500">
<span>{{ $t('load_image') }}</span>
<input
id="file-upload"
Expand All @@ -33,7 +33,7 @@
<div class="flex flex-wrap">
<div :style="{backgroundImage:'url('+files[index]+')'}" style="background-size: contain"
v-for="(url,index) in modelValue"
class="w-60 h-60 mx-2 my-2 grid grid-cols-2 gap-4 content-end ">
class="grid content-end grid-cols-2 gap-4 mx-2 my-2 w-60 h-60 ">
<DangerButton
@click="removeImage(index)"
>{{ $t('remove_image') }}
Expand Down
8 changes: 6 additions & 2 deletions resources/js/Components/form/Radio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
name="test"
type="radio"
:value="option.value"
class="w-4 h-4 text-indigo-600 border-gray-300 focus:ring-indigo-600"
class="w-4 h-4 border-gray-300 text-turqoise-500 focus:ring-turqoise-500"
/>
<label :for="option.value" class="block ml-3 text-sm font-medium leading-6 text-gray-900">{{ option.label }}</label>
</div>

<!-- Error -->
<p v-show="error" class="mt-2 text-sm text-red-600">{{ error }}</p>
</div>
</fieldset>
</div>
</template>

<script setup>
const props = defineProps({
options: Array
options: Array,
error: String
});
</script>
9 changes: 8 additions & 1 deletion resources/js/Components/templates/Dashboard.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="flex">
<div class="overflow-y-auto border-r border-gray-200 bg-white lg:w-72 mt-1 p-4">
<div class="p-4 mt-1 overflow-y-auto bg-white border-r border-gray-200 lg:w-72">
<p class="mb-5 text-base font-medium text-gray-500">Administrează</p>
<nav>
<ul role="list" class="space-y-1">
Expand Down Expand Up @@ -119,6 +119,13 @@ const navigation = [
route: route('admin.ong.projects', {'project_status': 'draft'}),
subroutes: [],
icon: FolderMinusIcon
},
{
name: 'regional_projects',
href: 'admin.ong.regional.project.add',
route: route('admin.ong.regional.project.add'),
subroutes: [],
icon: FolderMinusIcon
}
],
icon: FolderIcon
Expand Down
Loading

0 comments on commit 191f1d4

Please sign in to comment.