@php $tabMeta = [ 'export' => ['label' => __('New export'), 'icon' => 'arrow-down-tray'], 'saved' => ['label' => __('Saved exports'), 'icon' => 'book-open'], ]; if ($canSeeLog) { $tabMeta['log'] = ['label' => __('Export log'), 'icon' => 'shield-check']; } $selectClass = 'mt-1 block w-full rounded-xl border-slate-300 text-sm shadow-sm focus:border-indigo-500 focus:ring-indigo-500'; $tz = config('app.display_timezone'); @endphp
{{ __('Imports and Exports') }}
@foreach ($tabMeta as $key => $meta) @endforeach
@if ($tab === 'export')
{{-- What --}}

{{ __('What to export') }}

@foreach ($datasets as $key => $label) @endforeach
@foreach ($filterMeta as $key => [$label, $kind])
@if ($kind === 'date') @else @endif
@endforeach
@if (array_filter($filters) !== []) @endif
{{-- Columns --}}

{{ __('Columns') }}

@foreach ($available as $key => $column) @php $locked = $column['contact'] && ! $mayContacts; @endphp @endforeach
@if (! $mayContacts && collect($available)->contains('contact', true))

{{ __('Columns with a lock carry contact details. Exporting those in bulk is for directors only.') }}

@endif @if (in_array($dataset, ['organisations', 'contacts'], true))

{{ __('Column names match the client profile import template, so an exported list can be corrected and imported again.') }}

@endif
{{-- Summary and download --}}

{{ __('Rows to export') }}

{{ number_format($count) }}

{{ $describe($dataset, $filters) }}

@if ($withContacts)

{{ __('Contact details are included, so anyone who withdrew marketing consent is left out.') }}

@endif
{{ __('Export') }} {{ __('Preparing...') }}

{{ __('An Excel file has an "About this export" sheet with the filters, who ran it and when, and the currency basis.') }}

{{ __('Save this selection') }}

{{ __('Save selection') }}
@elseif ($tab === 'saved')
@forelse ($saved as $view) @empty @endforelse
{{ __('Name') }} {{ __('List') }} {{ __('Filters') }} {{ __('Saved by') }} {{ __('Actions') }}
{{ $view->name }} @if ($view->is_shared) {{ __('Shared') }} @endif {{ __(\App\Models\Crm\ExportLog::DATASETS[$view->context] ?? $view->context) }} {{ $describe($view->context, (array) $view->filters) }} {{ $view->user?->name }}
@can('update', $view) @endcan
@elseif ($tab === 'log' && $log)

{{ __('Export log') }}

{{ __('Every export of CRM data and every downloaded report. Nobody can change or remove a line.') }}

@forelse ($log as $entry) @empty @endforelse
{{ __('When') }} {{ __('Who') }} {{ __('What') }} {{ __('Filters') }} {{ __('Rows') }} {{ __('Format') }}
{{ $entry->created_at?->setTimezone($tz)->format('j M Y H:i') }} {{ $entry->user?->name ?? __('Scheduled delivery') }} {{ __(\App\Models\Crm\ExportLog::DATASETS[$entry->dataset] ?? $entry->dataset) }} @if ($entry->includes_contact_details) {{ __('Contact details') }} @endif @if ($entry->dataset === 'report') {{ app(\App\Services\Crm\Reports\ReportRegistry::class)->find($entry->filters['report'] ?? '')?->title ?? ($entry->filters['report'] ?? '') }} @else {{ in_array($entry->dataset, \App\Services\Crm\Reports\ExportCentre::DATASETS, true) ? $describe($entry->dataset, (array) $entry->filters) : '' }} @endif {{ number_format($entry->row_count) }} {{ __(\App\Models\Crm\ExportLog::FORMATS[$entry->format] ?? $entry->format) }}
{{ $log->links() }}
@endif