@extends('crm.master') @section('title', 'Edit Product') @section('content')

Edit Product

{{ $product->name }} — {{ $product->sku }}

Back to Products
@include('crm.components.alerts')
@csrf @method('PUT') @php $activeTab = old('active_tab', request('tab', 'details')); @endphp
Basic Information
@error('name') {{ $message }} @enderror
@error('sku') {{ $message }} @enderror
@error('category_id') {{ $message }} @enderror
@php $selectedTags = old('tags', $product->tags->pluck('id')->toArray()); @endphp @foreach($tags as $tag)
id, $selectedTags) ? 'checked' : '' }}>
@endforeach @if($tags->isEmpty()) No tags available. @endif
@if($product->photos->count() > 0)
Current Photos
@foreach($product->photos as $idx => $photo)
@if($idx === 0) Main @endif
@endforeach
{{ $product->photos->count() }}/5 photos uploaded. Add new photos below.
@endif @if($product->photos->count() < 5)
{{ $product->photos->count() > 0 ? 'Add More Photos' : 'Product Photos' }}

Add up to {{ 5 - $product->photos->count() }} more photo(s). {{ $product->photos->count() === 0 ? 'The first image will be the main image.' : '' }}

Click or drag images here to upload

Max 2MB each. JPG, PNG, GIF, WebP
@endif
Description
@error('description') {{ $message }} @enderror
Status
@error('status') {{ $message }} @enderror
Additional Info
@error('video_link') {{ $message }} @enderror
@error('sort_order') {{ $message }} @enderror
Cancel
Inventory
@error('inventory_type') {{ $message }} @enderror
@error('inventory_amount') {{ $message }} @enderror
@php $avail = $product->availability->first(); @endphp
Availability Schedule
@error('availability.event_name') {{ $message }} @enderror
@error('availability.start_date') {{ $message }} @enderror
@error('availability.end_date') {{ $message }} @enderror
@php $daysOfWeek = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']; $dayValues = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday']; $savedDays = $avail ? ($avail->days_of_week ?? $dayValues) : $dayValues; $oldDays = old('availability.days_of_week', $savedDays); @endphp @foreach($daysOfWeek as $i => $day)
@endforeach
@php $toMinutes = function ($value, $unit) { if ($value === null || $value === '') { return 0; } return match ($unit) { 'days' => (int) $value * 24 * 60, 'hours' => (int) $value * 60, default => (int) $value, }; }; $minDurationMinutes = old('availability.min_duration_hours') !== null || old('availability.min_duration_minutes') !== null ? null : $toMinutes($avail?->min_duration_value, $avail?->min_duration_unit); $maxDurationMinutes = old('availability.max_duration_hours') !== null || old('availability.max_duration_minutes') !== null ? null : $toMinutes($avail?->max_duration_value, $avail?->max_duration_unit); $bookingWindowMinutes = old('availability.booking_window_hours') !== null || old('availability.booking_window_minutes') !== null ? null : $toMinutes($avail?->booking_window_value, $avail?->booking_window_unit); $cutoffWindowMinutes = old('availability.cutoff_window_hours') !== null || old('availability.cutoff_window_minutes') !== null ? null : $toMinutes($avail?->cutoff_window_value, $avail?->cutoff_window_unit); $bookingRulesEnabled = old('availability.booking_rules_enabled', $avail?->booking_rules_enabled ? '1' : ''); @endphp
Pricing
Additional pricing rules can be configured after saving the product.
USD $
Per Booking

deposit_required ? '1' : '') ? 'checked' : '' }}>
@php $savedDepositType = old('deposit_type', $product->deposit_type ?? 'system_default'); @endphp
{{-- Percent input --}}
%
Percentage of total charged at booking
{{-- Dollar input (fixed / per day / per qty) --}}
USD $
Amount charged at booking

Select taxes and fees to apply to this product.

@if($taxFees->isEmpty()) No active taxes or fees. Create one first. @else @php $selectedTaxFees = old('tax_fees', $product->taxFees->pluck('id')->toArray()); @endphp
@foreach($taxFees as $fee)
id, $selectedTaxFees) ? 'checked' : '' }}>
@endforeach
@endif

Only custom rates assigned to this product are shown here.
Add Rate
@foreach($product->customRates as $rate) @endforeach @if($customRates->isEmpty()) No custom rates assigned to this product yet. @else
@foreach($customRates as $rate)
{{ $rate->name }} {{ ucfirst(str_replace('_', ' ', $rate->rate_type)) }} @if($rate->start_date) • {{ $rate->start_date->format('Y/m/d') }} @endif @if($rate->end_date) - {{ $rate->end_date->format('Y/m/d') }} @else - Open Ended @endif • {{ $rate->products_count }} linked product{{ $rate->products_count === 1 ? '' : 's' }} Assigned
@endforeach
@endif
@forelse($product->customRates as $rate) @php $rateTypeLabel = match($rate->rate_type) { 'per_booking' => 'Per Booking', 'per_24_hours' => 'Per 24 Hours', default => 'Per Day', }; @endphp @foreach($rate->tiers as $tier) @php $unit = match($rate->rate_type) { 'per_24_hours' => 'Day', 'per_day' => 'Day', default => 'Booking', }; $lower = $tier->lower_threshold; $upper = $tier->upper_threshold; if ($upper === null) { $tierLabel = $lower . ' – ∞ ' . $unit . 's'; } elseif ((int)$lower === (int)$upper) { $tierLabel = $lower . ' ' . $unit . ($lower > 1 ? 's' : ''); } else { $tierLabel = $lower . ' - ' . $upper . ' ' . $unit . 's'; } $base = (float)($product->base_price ?? 0); $adj = (float)$tier->adjustment_amount; $price = $base + $adj; @endphp @endforeach @empty @endforelse
{{ $product->name }}
Base Rate ${{ number_format($product->base_price ?? 0, 2) }}
{{ Str::limit($rate->name, 25) }} {{ $rateTypeLabel }}
{{ $rate->start_date->format('Y/m/d') }} – {{ $rate->end_date ? $rate->end_date->format('Y/m/d') : '∞' }}
{{ $tierLabel }} ${{ number_format($price, 2) }} (+${{ number_format($adj, 2) }})
No custom rates added yet.
Cancel
{{-- Photo delete forms (placed outside main form to avoid nesting) --}} @foreach($product->photos as $photo) @endforeach
@endsection @section('page-script') @endsection