Files
autocrm/resources/views/partials/cookie-banner.blade.php
T
Vasyka 68f58cbcdc feat: cookie policy & consent banner per Moldova law 195/2024
- Settings page: new "Politica Cookie" section — toggle banner on/off,
  editable RO/RU policy text (defaults to full 14-section template)
- Public route GET /cookie-policy → CookiePolicyController returns
  locale-aware full policy page with tenant branding
- Cookie banner partial (Alpine.js, localStorage) shown on tracking and
  landing pages; Accept/Reject stores consent, banner dismisses
- Translation keys added to lang/ro/portal.php and lang/ru/portal.php
- Alpine.js (CDN) added to tracking and landing pages

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-09-16 17:52:23 +00:00

91 lines
2.9 KiB
PHP

{{-- Cookie consent banner — localStorage-based, shown once per browser --}}
@php
$bannerEnabled = data_get($tenant->settings ?? [], 'cookie.banner_enabled', true);
@endphp
@if ($bannerEnabled)
<div
x-data="{
show: false,
init() {
if (!localStorage.getItem('cookie_consent')) {
this.show = true;
}
},
accept() {
localStorage.setItem('cookie_consent', 'accepted');
this.show = false;
},
reject() {
localStorage.setItem('cookie_consent', 'essential_only');
this.show = false;
}
}"
x-show="show"
x-cloak
x-transition:enter="transition ease-out duration-300"
x-transition:enter-start="opacity-0 translate-y-4"
x-transition:enter-end="opacity-100 translate-y-0"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100 translate-y-0"
x-transition:leave-end="opacity-0 translate-y-4"
style="
position: fixed;
bottom: 0;
left: 0;
right: 0;
z-index: 9999;
background: #1f2937;
color: #f9fafb;
padding: 16px 20px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
box-shadow: 0 -4px 20px rgba(0,0,0,.25);
font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
font-size: 13px;
line-height: 1.5;
"
>
<div style="flex:1;min-width:200px;">
<span style="font-weight:600;margin-right:6px;">🍪 {{ __('portal.cookie.banner_title') }}</span>
{{ __('portal.cookie.banner_body') }}
<a href="{{ route('cookie.policy') }}" style="color:#93c5fd;text-decoration:underline;margin-left:4px;" target="_blank" rel="noopener">
{{ __('portal.cookie.read_policy') }}
</a>
</div>
<div style="display:flex;gap:8px;flex-shrink:0;flex-wrap:wrap;">
<button
@click="reject()"
style="
padding: 8px 16px;
border: 1px solid #6b7280;
border-radius: 6px;
background: transparent;
color: #d1d5db;
cursor: pointer;
font-size: 13px;
font-weight: 500;
white-space: nowrap;
"
>{{ __('portal.cookie.reject') }}</button>
<button
@click="accept()"
style="
padding: 8px 20px;
border: none;
border-radius: 6px;
background: {{ $themeColor ?? '#3B82F6' }};
color: #fff;
cursor: pointer;
font-size: 13px;
font-weight: 600;
white-space: nowrap;
"
>{{ __('portal.cookie.accept') }}</button>
</div>
</div>
@endif