Skip to content

Commit 20d1ccc

Browse files
Bug fixin dec 2025 (#414)
* wip * wip
1 parent db22fe9 commit 20d1ccc

File tree

8 files changed

+120
-19
lines changed

8 files changed

+120
-19
lines changed

app/Http/Controllers/DonationController.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66

77
use App\Http\Requests\Donations\EuPlatescRequest;
88
use App\Models\Donation;
9+
use App\Notifications\UserDonationReceived;
910
use App\Services\EuPlatescService;
11+
use Illuminate\Support\Facades\Notification;
1012
use Inertia\Inertia;
1113

1214
class DonationController extends Controller
@@ -30,6 +32,12 @@ public function makeDonation(Donation $donation)
3032

3133
public function thankYou(string $uuid)
3234
{
35+
$donation = Donation::where('uuid', $uuid)->firstOrFail();
36+
\Log::info('Donation ' . $donation->id . 'was updated in DB');
37+
38+
Notification::route('mail', $donation->email)
39+
->notify(new UserDonationReceived($donation));
40+
3341
return Inertia::render('Public/Donor/ThankYou');
3442
}
3543

app/Http/Filters/ProjectDatesFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __invoke(Builder $query, $dates, string $property): void
1515
$start = Carbon::createFromFormat('Y-m-d', $dates[0])->toDateString();
1616
$end = Carbon::createFromFormat('Y-m-d', $dates[1])->toDateString();
1717

18-
$query->whereBetween('start', [$start, $end])
19-
->orWhereBetween('end', [$start, $end]);
18+
$query->whereDate('start', '<=', $end)
19+
->whereDate('end', '>=', $start);
2020
}
2121
}

app/Http/Requests/Project/EditRequest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ public function rules(): array
4848
'external_links.*.url' => ['required', 'url'],
4949
'is_national' => ['boolean', 'nullable'],
5050
'gallery' => ['array', 'nullable'],
51-
// TODO to check how we can validate this. Problema e ca validate nu stie sa ia mix intre File si array
52-
// 'gallery.*.file' => ['nullable', 'image', 'max:5120'],
51+
52+
// 'gallery.*.file' => ['nullable', 'image', 'max:5120', 'min:400'],
5353
// 'gallery.*.id' => ['nullable', 'exists:media,id'],
54-
// 'gallery.*.url' => ['nullable', 'string'],
54+
// 'gallery.*.url' => ['nullable', 'url'],
5555
'image' => ['nullable', 'image', 'max:5120'],
5656
];
5757
}

app/Http/Requests/Project/StoreRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public function rules(): array
4747

4848
'is_national' => ['boolean', 'nullable'],
4949
'gallery' => ['array', 'nullable'],
50-
'gallery.*.file' => ['nullable', 'image', 'max:5120'],
51-
'preview' => ['nullable', 'image', 'max:5120'],
50+
'gallery.*.file' => ['nullable', 'image', 'max:5120', 'min:500'],
51+
'preview' => ['nullable', 'image', 'max:5120', 'min:500'],
5252
];
5353
}
5454

app/Jobs/CaptureAuthorizedDonationJob.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Illuminate\Foundation\Bus\Dispatchable;
1717
use Illuminate\Queue\InteractsWithQueue;
1818
use Illuminate\Queue\SerializesModels;
19+
use Illuminate\Support\Facades\Notification;
1920

2021
class CaptureAuthorizedDonationJob implements ShouldQueue, ShouldBeUnique
2122
{
@@ -57,12 +58,8 @@ public function handle(): void
5758
'status' => EuPlatescStatus::CHARGED,
5859
'status_updated_at' => now(),
5960
]);
60-
\Log::info('Donation ' . $this->donation->id . 'was updated in DB');
61-
$userInstanceOfDonner = new User([
62-
'email' => $this->donation->email,
63-
'name' => $this->donation->first_name . ' ' . $this->donation->last_name,
64-
]);
65-
\Notification::send($userInstanceOfDonner, new UserDonationReceived($this->donation));
61+
Notification::route('mail', $this->donation->email)
62+
->notify(new UserDonationReceived($this->donation));
6663
\Log::info('Notification was sent to ' . $this->donation->email);
6764
$organizationsUsers = $this->donation->load('organization')
6865
->organization->load('users')->users->filter(function ($user) {

app/Notifications/Ngo/DonationReceived.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function toMail(object $notifiable): MailMessage
3939
return (new MailMessage)
4040
->greeting('Salut,')
4141
->subject('Ai primit o donație pentru proiectul tău listat pe Bursa Binelui')
42-
->line('Proiectul organizației tale listat pe Bursa Binelui a primit o donație. Poți să vizualizezi detaliile tranzacțiilor intrând în contul tău pe platforma Bursa Binelui!')
42+
->line('Proiectul organizației tale listat pe Bursa Binelui a fost inițializată o donație. Poți să vizualizezi detaliile tranzacțiilor intrând în contul tău pe platforma Bursa Binelui!')
4343
->line('Îţi mulțumim,')
4444
->salutation('Echipa Bursa Binelui');
4545
}

resources/js/Components/Gallery.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :id="galleryID" class="grid gap-2 mt-10 sm:grid-cols-2 lg:grid-cols-4 my-gallery">
2+
<div :id="galleryID" class="grid gap-2 mt-10 sm:grid-cols-1 lg:grid-cols-4 my-gallery">
33
<a
44
v-for="(image, key) in images"
55
:key="key"
@@ -9,7 +9,7 @@
99
target="_blank"
1010
rel="noreferrer"
1111
>
12-
<img :src="image.thumbnail" alt="" />
12+
<img :src="image.thumbnail" alt="" class="w-full h-auto" />
1313
</a>
1414
</div>
1515
</template>

resources/js/Layouts/DashboardLayout.vue

Lines changed: 99 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
<OrganizationStatus />
88

99
<div class="flex items-start flex-1 gap-y-10">
10-
<div class="p-4 mt-1 overflow-y-auto bg-white border-r border-gray-200 lg:w-72 shrink-0">
10+
<!-- Desktop sidebar -->
11+
<div class="hidden md:block p-4 mt-1 overflow-y-auto bg-white border-r border-gray-200 lg:w-72 shrink-0">
1112
<nav>
1213
<ul class="space-y-1">
1314
<li v-for="item in navigation" :key="item.name">
@@ -57,15 +58,84 @@
5758
</nav>
5859
</div>
5960

60-
<div class="grid items-start flex-1 p-9" :class="gridClass">
61+
<!-- Main content -->
62+
<div class="grid items-start flex-1 p-9 pb-24 md:pb-9" :class="gridClass">
6163
<slot />
6264
</div>
6365
</div>
6466

67+
<!-- Mobile bottom nav -->
68+
<div class="md:hidden fixed inset-x-0 bottom-0 z-50">
69+
<!-- Dropdown / sheet pentru submenu -->
70+
<transition
71+
enter-active-class="transition duration-150 ease-out"
72+
enter-from-class="opacity-0 translate-y-2"
73+
enter-to-class="opacity-100 translate-y-0"
74+
leave-active-class="transition duration-150 ease-in"
75+
leave-from-class="opacity-100 translate-y-0"
76+
leave-to-class="opacity-0 translate-y-2"
77+
>
78+
<div v-if="openSubMenuItem" class="px-3 pb-2">
79+
<div class="bg-white border border-gray-200 rounded-2xl shadow-lg overflow-hidden">
80+
<div class="flex items-center justify-between px-4 py-3 border-b border-gray-100">
81+
<div class="text-sm font-semibold text-gray-800">
82+
{{ openSubMenuItem.name }}
83+
</div>
84+
<button type="button" class="text-sm font-medium text-gray-500" @click="closeSubMenu">
85+
Închide
86+
</button>
87+
</div>
88+
89+
<div class="p-2">
90+
<Link
91+
v-for="sub in openSubMenuItem.subMenu"
92+
:key="sub.name"
93+
:href="sub.route"
94+
class="flex items-center gap-3 px-3 py-2 rounded-xl text-sm font-medium"
95+
:class="isActive(sub) ? 'bg-primary-50 text-primary-600' : 'text-gray-700'"
96+
@click="closeSubMenu"
97+
>
98+
<component
99+
:is="sub.icon"
100+
class="h-5 w-5"
101+
:class="isActive(sub) ? 'text-primary-600' : 'text-gray-500'"
102+
aria-hidden="true"
103+
/>
104+
{{ $t(sub.name) }}
105+
</Link>
106+
</div>
107+
</div>
108+
</div>
109+
</transition>
110+
111+
<!-- Bara de jos -->
112+
<div class="bg-white border-t border-gray-200 pb-[env(safe-area-inset-bottom)]">
113+
<nav class="grid grid-cols-5">
114+
<button
115+
v-for="item in mobileNavigation"
116+
:key="item.name"
117+
type="button"
118+
class="flex flex-col items-center justify-center gap-1 py-2"
119+
:class="isActive(item) ? 'text-primary-600' : 'text-gray-600'"
120+
@click="onMobileNavClick(item)"
121+
>
122+
<component
123+
:is="item.icon"
124+
class="h-6 w-6"
125+
:class="isActive(item) ? 'text-primary-600' : 'text-gray-500'"
126+
aria-hidden="true"
127+
/>
128+
<span class="text-[11px] leading-none font-medium truncate max-w-[72px]">
129+
{{ item.name }}
130+
</span>
131+
</button>
132+
</nav>
133+
</div>
134+
</div>
135+
65136
<Footer class="mt-16" />
66137
</div>
67138
</template>
68-
69139
<script setup>
70140
import Navbar from '@/Components/Navbar.vue';
71141
import Footer from '@/Components/Footer.vue';
@@ -88,13 +158,15 @@ import {
88158
} from '@heroicons/vue/outline';
89159
import OrganizationStatus from '@/Components/OrganizationStatus.vue';
90160
import { trans } from 'laravel-vue-i18n';
161+
import { computed, ref } from 'vue';
91162
92163
const props = defineProps({
93164
gridClass: {
94165
type: String,
95166
default: 'gap-8',
96167
},
97168
});
169+
const openSubMenuName = ref(null);
98170
99171
const navigation = [
100172
{
@@ -165,6 +237,30 @@ const navigation = [
165237
},
166238
];
167239
240+
const openSubMenuItem = computed(() => {
241+
if (!openSubMenuName.value) return null;
242+
return navigation.find((x) => x.name === openSubMenuName.value && x.subMenu?.length);
243+
});
244+
245+
const closeSubMenu = () => {
246+
openSubMenuName.value = null;
247+
};
248+
249+
const mobileNavigation = computed(() => {
250+
const wanted = ['Panou de control', 'Toate proiectele', 'Voluntari', 'Donații ONG', 'Tickets'];
251+
return navigation.filter((x) => wanted.includes(x.name));
252+
});
253+
254+
const onMobileNavClick = (item) => {
255+
if (item.subMenu?.length) {
256+
openSubMenuName.value = openSubMenuName.value === item.name ? null : item.name;
257+
return;
258+
}
259+
260+
closeSubMenu();
261+
window.location.href = item.route;
262+
};
263+
168264
const isActive = (item) => {
169265
if (typeof window === 'undefined') {
170266
return false;

0 commit comments

Comments
 (0)