@extends('layouts.app') @section('content') Back @if ($message = Session::get('success')) {{ $message }} @endif @if ($message = Session::get('error')) {{ $message }} @endif @if ($errors->any()) @foreach ($errors->all() as $error) {{ $error }} @endforeach @endif @csrf @method('PUT') Serial Number: Tag Number: Holder: Status: Status Select Status status == 'In Use/Active' ? 'selected' : '' }}>In Use/Active status == 'Damaged' ? 'selected' : '' }}>Damaged status == 'Lost/Not Found' ? 'selected' : '' }}>Lost/Not Found Location: Select Location @foreach ($locations as $location) location_id == $location->id ? 'selected' : '' }}> {{ $location->name }} @endforeach 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)) @else @if ($index > $existingImagesCount && $remainingSlots > 0) Select Image @php $remainingSlots--; @endphp @endif @endif @endforeach @endif Save Changes Image Preview × @endsection