feat(work-order-dashboard): PDF download in Docs tab + gate chat by config
- Documente tab: link to a new /app/work-orders/{id}/pdf route that
streams the invoice PDF via WorkOrderPdfService; also lists any
files uploaded to the 'signed_documents' media collection.
- Chat client card: only show the input form when telegram_bot or
whatsapp_business is enabled AND credentialed in the tenant's
Integrations page. Otherwise render an empty state with a shortcut
to /app/integrations.
RU + EN translations added for the new strings (RO source).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -681,7 +681,22 @@
|
||||
|
||||
{{-- ── DOCUMENTS TAB ── --}}
|
||||
<div x-show="tab === 'docs'" x-cloak>
|
||||
<div class="wd-empty">{{ __('Nicio factură emisă încă') }}</div>
|
||||
<div style="display:flex;flex-direction:column;gap:8px;">
|
||||
<a class="wd-btn" href="{{ url('/app/work-orders/' . $wo->id . '/pdf') }}" target="_blank">
|
||||
📄 {{ __('Descarcă factură (PDF)') }}
|
||||
</a>
|
||||
@php $signed = $wo->getMedia('signed_documents'); @endphp
|
||||
@if ($signed->isNotEmpty())
|
||||
<div style="font-size:11px;color:var(--wd-text-3);text-transform:uppercase;margin-top:12px;">{{ __('Documente semnate') }}</div>
|
||||
@foreach ($signed as $doc)
|
||||
<a class="wd-btn" href="{{ $doc->getFullUrl() }}" target="_blank">
|
||||
📎 {{ $doc->name }} <span style="color:var(--wd-text-3);">({{ round($doc->size / 1024) }} KB)</span>
|
||||
</a>
|
||||
@endforeach
|
||||
@else
|
||||
<div class="wd-empty" style="padding:12px 0;font-size:11px;">{{ __('Niciun document semnat încă. Poți încărca documente din formularul de editare al fișei.') }}</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- ── NOTES TAB ── --}}
|
||||
@@ -754,16 +769,34 @@
|
||||
</div>
|
||||
|
||||
{{-- CHAT CLIENT --}}
|
||||
@php
|
||||
$tenantSettings = (array) (app(\App\Tenancy\TenantManager::class)->current()?->settings ?? []);
|
||||
$integrations = (array) ($tenantSettings['integrations'] ?? []);
|
||||
$telegramEnabled = (bool) data_get($integrations, 'telegram_bot.enabled')
|
||||
&& filled(data_get($integrations, 'telegram_bot.fields.bot_token'));
|
||||
$whatsappEnabled = (bool) data_get($integrations, 'whatsapp_business.enabled')
|
||||
&& filled(data_get($integrations, 'whatsapp_business.fields.token'));
|
||||
$messagingConfigured = $telegramEnabled || $whatsappEnabled;
|
||||
@endphp
|
||||
<div class="wd-card">
|
||||
<div class="wd-card-hd">
|
||||
<h3>{{ __('Chat client') }}</h3>
|
||||
@if ($wo->client?->telegram_chat_id)
|
||||
@if ($telegramEnabled && $wo->client?->telegram_chat_id)
|
||||
<span style="font-size:10px;color:var(--wd-blue);">✓ Telegram</span>
|
||||
@elseif ($wo->client?->phone)
|
||||
<span style="font-size:10px;color:var(--wd-text-3);">SMS/WhatsApp</span>
|
||||
@elseif ($whatsappEnabled && $wo->client?->phone)
|
||||
<span style="font-size:10px;color:var(--wd-text-3);">✓ WhatsApp</span>
|
||||
@endif
|
||||
</div>
|
||||
@if ($wo->client)
|
||||
@if (! $messagingConfigured)
|
||||
<div class="wd-empty" style="padding:16px 0;">
|
||||
{{ __('Mesageria nu este configurată.') }}
|
||||
<div class="wd-empty-add" style="margin-top:8px;">
|
||||
<a class="wd-btn" href="{{ url('/app/integrations') }}">⚙️ {{ __('Configurează integrări') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
@elseif (! $wo->client)
|
||||
<div class="wd-empty" style="padding:16px 0;">{{ __('Fișa nu are client asociat.') }}</div>
|
||||
@else
|
||||
<div class="wd-chat">
|
||||
<div class="wd-chat-list">
|
||||
@forelse ($messages as $m)
|
||||
@@ -784,8 +817,6 @@
|
||||
<button type="submit" class="wd-btn wd-btn-primary">➤</button>
|
||||
</form>
|
||||
</div>
|
||||
@else
|
||||
<div class="wd-empty" style="padding:16px 0;">{{ __('Fără client — nu se poate trimite mesaj.') }}</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user