@extends('layout.main') @section('content')

{{ __('Draft, review, decide') }}

{{ __('Writing assistant') }}

{{ __('Optional AI drafts for staff. You decide what to share and review every result before using it.') }}

@if((int)auth()->user()->role_users_id === 1)

{{ __('AI Settings') }}

@endif @include('shared.errors') @include('shared.flash_message') @isset($preview)

{{ __('Review what will be shared') }}

{{ __('Provider: OpenAI. The text below and your selected model will be sent only when you confirm. Remove personal or confidential information that is not needed.') }}

{{ __(\App\Services\WorkspaceWritingAssistant::TASKS[$preview['task']]) }}

{{ $preview['payload']['request'] }}
@foreach($preview['payload']['sources'] as $source)

{{ $source['label'] }}

{{ $source['text'] }}
@endforeach
@csrf
{{ __('Back') }}
@elseif(isset($result))

{{ __('Your draft — review before using') }}

{{ __('AI can make mistakes. Verify names, dates, figures and policy wording. Nothing has been sent or saved to a business record.') }}

@if($result['sources'])

{{ __('Verified source records') }}

@endif {{ __('Back to writing assistant') }}
@else

{{ __(\App\Services\WorkspaceWritingAssistant::TASKS[$task]) }}

{{ __('Monthly requests used: :used / :limit. Failed attempts also count; token usage is recorded when returned by the provider.', ['used'=>$usage,'limit'=>$settings?->monthly_limit ?? 0]) }}

@if(!$settings?->enabled)

{{ __('The writing assistant is not enabled for this company.') }}

@endif
@csrf @if(in_array($task, ['handbook','expense_summary'], true))
{{ __('Choose up to five policies or one approved expense, depending on the draft type. No attachments are sent.') }}
@endif

{{ __('Your recent requests') }}

    @forelse($recent as $row)
  • {{ $row->created_at }} · {{ __(\App\Services\WorkspaceWritingAssistant::TASKS[$row->task]) }} · @if($row->status === 'completed'){{ __('Review draft') }}@else{{ __('Request did not complete') }}@endif
  • @empty
  • {{ __('No assistant requests yet.') }}
  • @endforelse
@endif
@endsection