@extends('layouts.dashboard') @section('content') @php $summary = $preview['summary'] ?? ['create' => 0, 'update' => 0, 'unchanged' => 0, 'error' => 0]; $rows = collect($preview['rows'] ?? []); $headers = collect($rows->first()['values'] ?? [])->keys(); $actionTone = fn (string $action) => match ($action) { 'create' => 'positive', 'update' => 'primary', 'error' => 'negative', default => 'neutral', }; $formatValue = function ($value): string { if ($value instanceof \DateTimeInterface) { return $value->format('Y-m-d'); } if (is_array($value)) { return json_encode($value, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) ?: ''; } if ($value === null || $value === '') { return '-'; } return (string) $value; }; @endphp

Excel flexImport

@csrf @error('workbook')
{{ $message }}
@enderror
@if ($preview)

Preview

{{ $workbook['name'] ?? 'Workbook' }} / {{ $preview['table'] ?? 'Unknown table' }} / {{ count($preview['keys'] ?? []) }} key field(s)

@csrf
@csrf
Create {{ $summary['create'] ?? 0 }}
Update {{ $summary['update'] ?? 0 }}
Unchanged {{ $summary['unchanged'] ?? 0 }}
Error {{ $summary['error'] ?? 0 }}
@if (! ($preview['can_apply'] ?? false))
Fix rows in error, then upload the workbook again before applying.
@endif
@foreach ($headers as $header) @endforeach @forelse ($rows as $row) $row['action'] === 'error'])> @foreach ($headers as $header) @endforeach @empty @endforelse
Row Action{{ $header }}Changes / errors
{{ $row['row'] }} {{ ucfirst($row['action']) }} {{ $formatValue($row['values'][$header] ?? null) }} @if (! empty($row['errors']))
    @foreach ($row['errors'] as $error)
  • {{ $error }}
  • @endforeach
@elseif (! empty($row['changes']))
    @foreach ($row['changes'] as $field => $change)
  • {{ $field }}: {{ $formatValue($change['old'] ?? null) }} ? {{ $formatValue($change['new'] ?? null) }}
  • @endforeach
@else No change @endif
No rows found in the workbook.
@else

No preview yet

Upload an `.xlsx` workbook with named ranges to inspect creates, updates and errors before writing to kView INVESTOR.

@endif
@endsection