@extends('layouts.app') @section('title', isset($product) && isset($readonly) && $readonly ? __('labels.view_case_study') : (isset($product) ? __('labels.edit_case_study') : __('labels.create_case_study'))) @push('pageTitle') {{ __('labels.products') }} @endpush @section('css') @endsection @section('js') @endsection @section('content') @include('components.common.page-header',[ 'pageTitle' => isset($product) && isset($readonly) && $readonly ? __('labels.view_product') : (isset($product) ? __('labels.edit_product') : __('labels.create_product')), 'actionButton' => [ 'url' => route('products.index'), 'text' => __('labels.back_to_product') ] ]) @include('components.common.flush-message') @include('components.common.validation-errors') @php // Define variables at the top for cleaner code // Priority: old() values > database values > defaults $hasImage = isset($product) && !empty($product->feature_image_url); $oldImage = old('feature_image', $hasImage ? $product->feature_image_url : ''); $imageUrl = !empty($oldImage) ? $oldImage : ($hasImage ? $product->feature_image_url : ''); $title = old('title', isset($product) ? $product->title : ''); $introduction = old('introduction', isset($product) ? $product->introduction : ''); $description = old('description', isset($product) ? $product->description : ''); $sortOrder = old('sort_order', isset($product) ? $product->sort_order : 0); $isActive = old('is_active', isset($product) ? $product->is_active : true); $isFeatured = old('is_featured', isset($product) ? $product->is_featured : false); $productId = isset($product) ? $product->id : ''; // Determine if we should show image preview $showImage = !empty($imageUrl); @endphp
@csrf @if(isset($product)) @method('PUT') @endif

{{ __('labels.basic_information') }}

{{ __('labels.upload_image') }}

Image Preview
@if(!(isset($readonly) && $readonly))
@if($showImage) @endif
{{ __('labels.image_recommended_size') }}: 1200x800px, Max: 1MB @endif
@error('title')
{{ $message }}
@enderror
{{--
{{ __('labels.tags_description') }} @error('tags')
{{ $message }}
@enderror
--}}
{{-- {{ __('labels.introduction') }} --}} @error('introduction')
{{ $message }}
@enderror
@error('description')
{{ $message }}
@enderror
{{ __('labels.lower_number_first') }} @error('sort_order')
{{ $message }}
@enderror
@if(!isset($readonly) || (isset($readonly) && !$readonly))
{{ __('labels.cancel') }}
@else
{{ __('labels.edit') }} {{ __('labels.back') }}
@endif
@endsection