@extends('layouts.app') @section('content')
@if ($message = Session::get('success')) @endif @if ($message = Session::get('error')) @endif @if ($errors->any()) @endif
@csrf @method('PUT')
Serial Number:
Tag Number:
Holder:
Status:
Location:
Pictures:
@php // Count the number of existing images $existingImagesCount = 0; foreach (range(1, 7) as $index) { $imageField = 'image' . $index; if (!empty($serial->images->first()->$imageField)) { $existingImagesCount++; } } // Calculate the remaining slots for new images $remainingSlots = 7 - $existingImagesCount; @endphp @if ($existingImagesCount == 0) @else @foreach (range(1, 7) as $index) @php $imageField = 'image' . $index; @endphp
@if (!empty($serial->images->first()->$imageField)) Selected Image @else @if ($index > $existingImagesCount && $remainingSlots > 0) @php $remainingSlots--; @endphp @endif @endif
@endforeach @endif
@endsection