@extends('layouts.app') @section('title','Import Products') @section('page_title','Import Products') @section('content')

Import Products

Download CSV TemplateBack to Products
@if(session('status'))
{{ session('status') }}
@endif @if($errors->any())
{{ $errors->first() }}
@endif

Import Rules

Maximum500 products per CSV
Whole-number TZSNo decimal prices
New CategoriesCreated automatically
Existing ProductsSkip or update details; stock stays unchanged
Selling ModeUse single, wholesale or wholesale_and_single
Opening UnitUse single or wholesale
@if(empty($previewRows))
@csrf
Use the provided template for correct headers.
@else
Total Rows{{ count($previewRows) }}
Valid Rows{{ $summary['valid'] ?? 0 }}
Invalid Rows{{ $summary['invalid'] ?? 0 }}
Existing Products{{ $summary['existing'] ?? 0 }}
@foreach($previewRows as $row) @endforeach
LineStatusProductCategoryModeOpening StockWholesale UnitWholesale PriceSingle UnitSingle PriceNotes
{{ $row['line'] }}{{ $row['valid'] ? ($row['existing'] ? 'Existing' : 'Valid') : 'Invalid' }}{{ $row['name'] ?: '—' }}{{ $row['category'] ?: '—' }}{{ $row['selling_mode'] ?: '—' }}{{ number_format($row['opening_stock_quantity']) }} {{ $row['opening_stock_unit'] }}{{ $row['wholesale_unit'] ?: '—' }}TZS {{ tzs_amount($row['default_selling_price_per_wholesale']) }}{{ $row['single_unit'] ?: '—' }}TZS {{ tzs_amount($row['default_selling_price_per_single']) }}@if(!$row['valid']){{ implode(' ', $row['errors']) }}@elseif($row['existing'] && $importMode==='update_existing')Details will update; stock unchanged.@elseif($row['existing'])Will be skipped.@elseReady to create.@endif
@foreach($previewRows as $row)
{{ $row['line'] }}

{{ $row['name'] ?: 'Unnamed product' }}

{{ $row['category'] ?: 'General Products' }} · {{ $row['selling_mode'] ?: 'No mode' }}
{{ $row['valid'] ? ($row['existing'] ? 'Existing' : 'Valid') : 'Invalid' }}
Opening stock{{ number_format($row['opening_stock_quantity']) }} {{ $row['opening_stock_unit'] }}
@if(!$row['valid']){{ implode(' ', $row['errors']) }}@elseif($row['existing'] && $importMode==='update_existing')Details update; stock unchanged@elseif($row['existing'])Will be skipped@elseReady to create@endif
•••
Wholesale: {{ $row['wholesale_unit'] ?: '—' }} · TZS {{ tzs_amount($row['default_selling_price_per_wholesale']) }}Single: {{ $row['single_unit'] ?: '—' }} · TZS {{ tzs_amount($row['default_selling_price_per_single']) }}
@endforeach
@csrf @method('DELETE')
@if(($summary['invalid'] ?? 0) === 0)
@csrf
@endif
@endif @endsection