First Commit

This commit is contained in:
marco
2026-09-01 07:49:48 -03:00
commit 28b1044038
399 changed files with 41659 additions and 0 deletions
+75
View File
@@ -0,0 +1,75 @@
@php
$cookieAccepted = false;
if (Auth::check()) {
$user = Auth::user();
$latestConsent = $user->consents()->orderByDesc('accepted_at')->first();
$currentVersions = config('legal', []);
if ($latestConsent &&
$latestConsent->terms_version === ($currentVersions['terms_version'] ?? '1.0.0') &&
$latestConsent->privacy_version === ($currentVersions['privacy_version'] ?? '1.0.0') &&
$latestConsent->cookie_version === ($currentVersions['cookie_version'] ?? '1.0.0')
) {
$cookieAccepted = true;
}
} else {
$cookieAccepted = request()->cookie('cookie_consent_accepted') === '1.0.0';
}
@endphp
@if(!$cookieAccepted)
<div id="cookie-banner" class="fixed bottom-0 left-0 right-0 bg-gray-900 text-white p-4 shadow-lg z-50">
<div class="max-w-7xl mx-auto flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="flex-1">
<p class="text-sm sm:text-base">
<strong>{{ __('legal.cookie_banner_title') }}</strong>
{{ __('legal.cookie_banner_text') }}
<a href="{{ route('legal.terms') }}" class="underline hover:text-indigo-300">{{ __('legal.terms_of_use') }}</a>
&nbsp;|&nbsp;
<a href="{{ route('legal.privacy') }}" class="underline hover:text-indigo-300">{{ __('legal.privacy_policy') }}</a>
&nbsp;|&nbsp;
<a href="{{ route('legal.cookies') }}" class="underline hover:text-indigo-300">{{ __('legal.cookie_policy') }}</a>
</p>
</div>
<div class="flex gap-3">
<button onclick="acceptCookies()" class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition-colors">
{{ __('legal.cookie_banner_accept') }}
</button>
</div>
</div>
</div>
<script>
function acceptCookies() {
@if(Auth::check())
const formData = new URLSearchParams();
formData.append('terms_version', '{{ config('legal.terms_version', '1.0.0') }}');
formData.append('privacy_version', '{{ config('legal.privacy_version', '1.0.0') }}');
formData.append('cookie_version', '{{ config('legal.cookie_version', '1.0.0') }}');
fetch('{{ route('legal.cookie-banner.accept') }}', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
'Accept': 'application/json',
},
body: formData
}).then(() => {
document.getElementById('cookie-banner').style.display = 'none';
});
@else
document.cookie = 'cookie_consent_accepted=1.0.0; path=/; max-age=' + (60 * 60 * 24 * 365) + '; SameSite=Lax';
document.getElementById('cookie-banner').style.display = 'none';
@endif
}
document.addEventListener('keydown', function(event) {
if (event.key === 'Escape') {
const banner = document.getElementById('cookie-banner');
if (banner) {
banner.style.display = 'none';
}
}
});
</script>
@endif
+28
View File
@@ -0,0 +1,28 @@
<div x-data="{ langOpen: false }" class="relative">
<button @click="langOpen = !langOpen" @click.away="langOpen = false" type="button"
class="flex items-center gap-2 px-3 py-2 text-sm transition {{ $variant ?? 'text-gray-700 hover:text-gray-900' }}">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 5h12M9 3v2m1.048 9.5A18.022 18.022 0 016.412 9m6.088 9h7M11 21l5-10 5 10M12.751 5C11.783 10.77 8.07 15.61 3.18 17.34" />
</svg>
<span class="hidden sm:inline">{{ strtoupper(app()->getLocale()) }}</span>
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg>
</button>
<div x-show="langOpen" x-cloak
class="absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg py-1 z-50 border border-gray-200">
<a href="{{ route('language.switch', 'pt_BR') }}"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 {{ app()->getLocale() == 'pt_BR' ? 'bg-indigo-50 text-indigo-600' : '' }}">
🇧🇷 Português (Brasil)
</a>
<a href="{{ route('language.switch', 'en') }}"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 {{ app()->getLocale() == 'en' ? 'bg-indigo-50 text-indigo-600' : '' }}">
🇺🇸 English
</a>
<a href="{{ route('language.switch', 'es') }}"
class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 {{ app()->getLocale() == 'es' ? 'bg-indigo-50 text-indigo-600' : '' }}">
🇪🇸 Español
</a>
</div>
</div>