Files
autocrm/resources/views/partials/lang-switcher.blade.php
T
Vasyka 57bdc1b594 feat: language switcher on portal + apply_margin re-added to Plată & total
Two fixes:

== 1. Language switcher (RO/RU/EN) in portal headers ==

New partial resources/views/partials/lang-switcher.blade.php with two
visual styles:
- style='chip' (default) — white-tinted glass for colored headers
  (shop nav bar, tracking page hero)
- style='light' — outlined buttons for pale backgrounds (invitation
  accept card)

Each button is a POST form to the existing /locale/{lang} route which:
- puts locale in session
- persists to user.locale if authenticated
- redirects back to the same page

Included in:
- resources/views/shop/layout.blade.php (right side of top nav,
  after login/register)
- resources/views/tracking/show.blade.php (top-right of hero header,
  absolutely positioned)
- resources/views/invitations/accept.blade.php (top-right of card,
  above welcome heading, light style)

Current locale button is highlighted (opaque white on colored bg /
blue on pale bg). Others are muted until hovered.

Two new translation keys:
- portal.common.language (RO: Limbă / RU: Язык)

== 2. apply_margin toggle back in "Plată & total" ==

Previous session's edit didn't persist to the file. Now confirmed in
place: WorkOrderResource form's "Plată & total" section shows a
"Aplică marjă internă" toggle between discount_pct and
override_margin_pct. Gated by FINANCE_VIEW_INTERNAL_MARGIN so only
owner / admin / manager / accountant see it. Default = true.

When toggled off on a Fișă, WorkOrderWork::saving hook writes
salary_base = total for every line on that WO (no reduction).
Backend logic already in place — this commit fixes the missing UI
control.

Suite: 303 passed (840 assertions). Unchanged — refactor + view only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-13 19:42:00 +00:00

46 lines
2.2 KiB
PHP

@php
$locales = [
'ro' => ['label' => 'RO', 'full' => 'Română', 'flag' => '🇷🇴'],
'ru' => ['label' => 'RU', 'full' => 'Русский', 'flag' => '🇷🇺'],
'en' => ['label' => 'EN', 'full' => 'English', 'flag' => '🇬🇧'],
];
$current = app()->getLocale();
// Default: dark-glass style suits colored header (shop, tracking). Override via $style param.
$style = $style ?? 'chip';
@endphp
@if ($style === 'chip')
<div style="display:inline-flex;align-items:center;gap:2px;background:rgba(255,255,255,.15);border-radius:8px;padding:2px;font-size:12px;">
@foreach ($locales as $code => $meta)
<form method="POST" action="{{ url('/locale/' . $code) }}" style="margin:0;">
@csrf
<input type="hidden" name="_redirect_back" value="1">
<button type="submit" title="{{ $meta['full'] }}"
style="background:{{ $code === $current ? 'rgba(255,255,255,.95)' : 'transparent' }};
color:{{ $code === $current ? '#1f2937' : '#fff' }};
border:0;padding:5px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;
font-family:inherit;">
{{ $meta['label'] }}
</button>
</form>
@endforeach
</div>
@else
{{-- light style for pale backgrounds (invitations, auth pages) --}}
<div style="display:inline-flex;gap:4px;font-size:12px;">
@foreach ($locales as $code => $meta)
<form method="POST" action="{{ url('/locale/' . $code) }}" style="margin:0;">
@csrf
<button type="submit" title="{{ $meta['full'] }}"
style="background:{{ $code === $current ? '#3b82f6' : 'transparent' }};
color:{{ $code === $current ? '#fff' : '#4b5563' }};
border:1px solid {{ $code === $current ? '#3b82f6' : '#d1d5db' }};
padding:4px 10px;border-radius:6px;cursor:pointer;font-size:12px;font-weight:600;
font-family:inherit;">
{{ $meta['label'] }}
</button>
</form>
@endforeach
</div>
@endif