@extends('layouts.app') @section('title', __('lang_v1.serial_backfill')) @section('content')

@lang('lang_v1.serial_backfill') @lang('lang_v1.serial_backfill_help')

@if(!$serial_tracking_enabled)
@lang('lang_v1.serial_tracking_not_enabled')
@else
{!! Form::open(['method' => 'get', 'class' => 'row']) !!}
{!! Form::text('search', $search ?? null, [ 'class' => 'form-control', 'placeholder' => 'Search product or SKU', ]) !!}
{!! Form::close() !!}
@endif @if($serial_tracking_enabled && $rows->isEmpty())

{{ !empty($search) ? 'No matching products found.' : __('lang_v1.serial_backfill_all_done') }}

@elseif($serial_tracking_enabled)
@foreach($rows as $row) @php $variation_label = $row->product_type == 'variable' ? trim(($row->product_variation_name ? $row->product_variation_name . ' - ' : '') . $row->variation_name) : null; $missing_count = (int) $row->missing_serials; @endphp @endforeach
@lang('sale.product') @lang('product.sku') @lang('business.business_location') @lang('report.current_stock') @lang('lang_v1.available_serials') @lang('lang_v1.missing_serials') @lang('lang_v1.serial_numbers')
{{ $row->product_name }} @if(!empty($variation_label))
{{ $variation_label }} @endif
{{ $row->sub_sku }} {{ $row->location_name }} {{ $row->qty_available }} {{ $row->available_serials }} {{ $missing_count }} {!! Form::open(['route' => 'products.serial_backfill.store', 'method' => 'post']) !!} {!! Form::hidden('product_id', $row->product_id) !!} {!! Form::hidden('variation_id', $row->variation_id) !!} {!! Form::hidden('location_id', $row->location_id) !!}
{!! Form::label('received_at', __('lang_v1.date'), ['class' => 'small text-muted']) !!} {!! Form::text('received_at', @format_date('now'), [ 'class' => 'form-control input-sm datepicker', 'readonly', 'required', ]) !!}
{!! Form::textarea('serial_numbers', null, [ 'class' => 'form-control input-sm', 'rows' => 2, 'placeholder' => __('lang_v1.serial_backfill_placeholder', ['count' => $missing_count]), 'data-serial-quantity' => $missing_count, 'data-serial-count-mode' => 'max', 'required', ]) !!}
@lang('lang_v1.serial_backfill_row_help', ['count' => $missing_count]) {!! Form::close() !!}
@endif
@endsection