@extends('layouts.app') @section('title', __('shop_rma.process_case')) @section('content')

@lang('shop_rma.process_case') {{ $shop_rma->shop_rma_no }}

The page shows only the next action needed for this case.

@if($errors->any())
Please review the information below.
@endif @include('shop_rma.partials.progress')
@lang('shop_rma.supplier')
{{ optional($shop_rma->supplier)->supplier_business_name ?: optional($shop_rma->supplier)->name }}
@lang('shop_rma.shop_location')
{{ optional($shop_rma->location)->name }}
@lang('shop_rma.items')
{{ $shop_rma->items->count() }} item(s) ยท {{ @format_quantity($shop_rma->items->sum('quantity')) }} total qty
@if($shop_rma->status === 'open') @component('components.widget', ['class' => 'box-primary', 'title' => 'Next Step: Send to Supplier'])
@lang('shop_rma.sent_notice')
{!! Form::open(['route' => ['shop-rmas.send', $shop_rma->id], 'method' => 'post', 'class' => 'shop-rma-confirm-form', 'data-confirm' => __('shop_rma.confirm_send')]) !!}
{!! Form::label('sent_at', __('shop_rma.sent_at').':*') !!}{!! Form::input('datetime-local', 'sent_at', old('sent_at', now()->format('Y-m-d\TH:i')), ['class' => 'form-control', 'required']) !!}
{!! Form::label('supplier_reference', __('shop_rma.supplier_reference').':') !!}{!! Form::text('supplier_reference', old('supplier_reference', $shop_rma->supplier_reference), ['class' => 'form-control', 'placeholder' => 'Supplier-issued RMA number']) !!}
{!! Form::label('courier', __('shop_rma.courier').':') !!}{!! Form::text('courier', old('courier'), ['class' => 'form-control']) !!}
{!! Form::label('tracking_no', __('shop_rma.tracking_no').':') !!}{!! Form::text('tracking_no', old('tracking_no'), ['class' => 'form-control']) !!}
{!! Form::label('internal_note', __('shop_rma.internal_note').':') !!}{!! Form::textarea('internal_note', old('internal_note'), ['class' => 'form-control', 'rows' => 2, 'placeholder' => 'Optional handoff or packing note']) !!}
{!! Form::close() !!} @endcomponent @can('shop_rma.cancel') @component('components.widget', ['class' => 'box-danger', 'title' => 'Cancel This Case'])

Cancellation is available only before items are sent. All quarantined stock will return to {{ optional($shop_rma->location)->name }}.

{!! Form::open(['route' => ['shop-rmas.cancel', $shop_rma->id], 'method' => 'post', 'class' => 'shop-rma-confirm-form', 'data-confirm' => __('shop_rma.confirm_cancel')]) !!}
{!! Form::label('final_note', 'Cancellation reason:*') !!}{!! Form::textarea('final_note', null, ['class' => 'form-control', 'rows' => 2, 'required']) !!}
{!! Form::close() !!} @endcomponent @endcan @elseif($shop_rma->status === 'sent') @component('components.widget', ['class' => 'box-primary', 'title' => 'Next Step: Record Supplier Resolution'])
@lang('shop_rma.resolution_notice')
{!! Form::open(['route' => ['shop-rmas.resolve', $shop_rma->id], 'method' => 'post', 'id' => 'shop_rma_resolution_form']) !!} @foreach($shop_rma->items as $item)
{{ optional($item->product)->name }}
{{ @format_quantity($item->quantity) }} {{ optional(optional($item->product)->unit)->short_name }}
@if(!empty($item->serial_numbers))
Original serials
@foreach($item->serial_numbers as $serial){{ $serial }} @endforeach
@endif
{!! Form::label("items[$item->id][supplier_outcome]", __('shop_rma.supplier_outcome').':*') !!} {!! Form::select("items[$item->id][supplier_outcome]", $outcomes, old("items.$item->id.supplier_outcome"), ['class' => 'form-control select2 shop-rma-outcome', 'style' => 'width:100%', 'placeholder' => __('messages.please_select'), 'required', 'data-serial-required' => $item->serial_tracking_required ? '1' : '0']) !!}
{!! Form::label("items[$item->id][resolution_reference]", __('shop_rma.resolution_reference').':') !!} {!! Form::text("items[$item->id][resolution_reference]", old("items.$item->id.resolution_reference"), ['class' => 'form-control', 'placeholder' => 'Credit memo, replacement, or repair reference']) !!}
@if($item->serial_tracking_required) @endif
@endforeach
{!! Form::label('resolution_note', __('shop_rma.resolution_note').':') !!}{!! Form::textarea('resolution_note', old('resolution_note'), ['class' => 'form-control', 'rows' => 3, 'placeholder' => 'Summarize the supplier decision or anything your team should know']) !!}
{!! Form::label('internal_note', __('shop_rma.internal_note').':') !!}{!! Form::textarea('internal_note', old('internal_note'), ['class' => 'form-control', 'rows' => 2]) !!}
{!! Form::close() !!} @endcomponent @elseif($shop_rma->status === 'resolved') @component('components.widget', ['class' => 'box-primary', 'title' => 'Final Step: Complete Case'])

The supplier outcome and all inventory movements have been recorded. Add an optional closing note, then complete the case.

{!! Form::open(['route' => ['shop-rmas.complete', $shop_rma->id], 'method' => 'post', 'class' => 'shop-rma-confirm-form', 'data-confirm' => __('shop_rma.confirm_complete')]) !!}
{!! Form::label('final_note', __('shop_rma.final_note').':') !!}{!! Form::textarea('final_note', old('final_note'), ['class' => 'form-control', 'rows' => 3, 'placeholder' => 'Optional closing note']) !!}
{!! Form::close() !!} @endcomponent @else
This case has no remaining actions.
@endif @component('components.widget', ['class' => 'box-default', 'title' => __('shop_rma.items')]) @include('shop_rma.partials.items') @endcomponent
@endsection @section('javascript') @endsection