Skip to content

Commit d2525b8

Browse files
fix/createsponsor ora hanno il totale
1 parent d92d3b3 commit d2525b8

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

resources/views/sponsors/createBronze.blade.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,32 @@
2424
<!-- Sponsorizzazione Attiva/Inattiva -->
2525
@if($apartment->sponsorships->where('name', 'Bronze')->first())
2626
<p class="mt-4 text-sm font-bold text-green-400">Stato: Attivo</p>
27+
@php
28+
$bronzeCount = 0;
29+
foreach ($apartment->sponsorships as $sponsorship) {
30+
if ($sponsorship->name == 'Bronze') {
31+
$bronzeCount++;
32+
}
33+
}
34+
@endphp
35+
<p class="mt-4 text-sm font-bold text-green-400">Attivo: {{ $bronzeCount }} volte</p>
36+
@php
37+
$bronzeDuration = 0;
38+
foreach ($apartment->sponsorships as $sponsorship) {
39+
if ($sponsorship->name == 'Bronze') {
40+
$bronzeDuration += $sponsorship->duration;
41+
}
42+
}
43+
@endphp
44+
<p class="mt-4 text-sm font-bold text-green-400">Durata: {{ $bronzeDuration }} ore</p>
2745
@else
2846
<p class="mt-4 text-sm font-bold text-red-500">Stato: Inattivo</p>
2947
@endif
3048
</div>
3149
</div>
3250
@endforeach
3351
</div>
34-
52+
3553
<div class="md:flex md:justify-between md:items-center mt-8 sm:grid sm:grid-cols-1 sm:grid-rows-2">
3654
<p class="text-2xl text-center mb-10 font-bold text-white">Prezzo Totale: <span id="totalPrice">0,00 €</span></p>
3755
<div class="flex flex-col items-end gap-2">

resources/views/sponsors/createSilver.blade.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,24 @@
2020

2121
@if($apartment->sponsorships->where('name', 'Silver')->first())
2222
<p class="mt-4 text-sm font-bold text-green-400">Stato: Attivo</p>
23+
@php
24+
$silverCount = 0;
25+
foreach ($apartment->sponsorships as $sponsorship) {
26+
if ($sponsorship->name == 'Silver') {
27+
$silverCount++;
28+
}
29+
}
30+
@endphp
31+
<p class="mt-4 text-sm font-bold text-green-400">Attivo: {{ $silverCount }} volte</p>
32+
@php
33+
$silverDuration = 0;
34+
foreach ($apartment->sponsorships as $sponsorship) {
35+
if ($sponsorship->name == 'Silver') {
36+
$silverDuration += $sponsorship->duration;
37+
}
38+
}
39+
@endphp
40+
<p class="mt-4 text-sm font-bold text-green-400">Durata: {{ $silverDuration }} ore</p>
2341
@else
2442
<p class="mt-4 text-sm font-bold text-red-500">Stato: Inattivo</p>
2543
@endif

0 commit comments

Comments
 (0)