@extends('layouts/contentLayoutMaster') @php $dimensions = \App\Models\Dimension::query() ->where('is_custom', false) ->orWhereHas('products', function ($q) use ($model) { $q->where('dimensionable_id', $model->id)->where('dimensionable_type', get_class($model)); }) ->get(['id', 'name']); $variantsForJs = $model->variants->mapWithKeys(function ($variant) { $media = $variant->media->first(); return [ $variant->key => [ 'id' => $variant->id, 'image' => $media?->id, 'image_url' => $media?->original_url, ] ]; }); $specs = $model->specifications ->filter(fn($spec) => $spec->fixed_key !== 'cutting') ->map(function ($spec) { return [ 'name' => $spec->getTranslation('name', 'en'), 'options' => $spec->options ->map(fn($opt) => $opt->getTranslation('value', 'en')) ->filter() ->values() ->toArray(), ]; }) ->filter(fn($row) => !empty($row['name']) && count($row['options'])) ->values(); $mediaToArray = function ($media) { if (! $media) { return null; } return [ 'id' => $media->id ?? null, 'file_name' => $media->file_name ?? 'Image', 'size' => $media->size ?? 12345, 'url' => method_exists($media, 'getUrl') ? $media->getUrl() : ($media->original_url ?? null), ]; }; $getOptionFrameMedia = function ($option) { $frame = null; if ($option->relationLoaded('frameImage') || method_exists($option, 'frameImage')) { $frame = $option->frameImage; } if (! $frame && ($option->relationLoaded('frame_image') || method_exists($option, 'frame_image'))) { $frame = $option->frame_image; } if (! $frame && method_exists($option, 'getFirstMedia')) { $frame = $option->getFirstMedia('option_frame_image') ?? $option->getFirstMedia('frame_image') ?? $option->getFirstMedia('option_frame'); } return is_object($frame) ? $frame : null; }; @endphp @section('title', 'Edit Categories') @section('main-page', 'Categories') @section('sub-page', 'Edit Category') @section('main-page-url', route("products.index")) @section('sub-page-url', route("products.edit",$model->id)) @section('vendor-style') @endsection @section('content')
@csrf @method("PUT") {{-- checkbox added --}}
show_add_cart_btn ?? false))>
Show “Add to Cart” Button

When the checkbox is selected, the product can be added directly to the cart without customization. If it’s not selected, the product must be customized before being added to cart.

show_customize_design_btn ?? false))>
Show “Customize Design” Button

When the checkbox is selected, the product can be customized before being added to cart.

Drop image here or click to upload
Max size: 1MB | Dimensions: 512x512 px
Drop image here or click to upload
Max size: 1MB | Dimensions: 512x512 px
Uploaded
{{-- Category Colors --}} {{--
--}} {{--
--}} {{-- --}} {{-- @php--}} {{-- $colors = collect($model->colors) ?? collect();--}} {{-- $hasColors = $colors->isNotEmpty();--}} {{-- @endphp--}} {{--
--}} {{--
--}} {{-- @forelse($colors as $color)--}} {{--
--}} {{--
--}} {{-- --}}{{-- Color value --}} {{--
--}} {{-- --}} {{--
--}} {{-- --}}{{-- Color picker --}} {{-- --}} {{-- --}}{{-- Text hex input (submitted) --}} {{-- --}} {{--
--}} {{-- --}} {{-- Pick a color or type hex (e.g. #FFAA00).--}} {{-- --}} {{--
--}} {{-- --}}{{-- Color image --}} {{--
--}} {{-- --}} {{-- @php--}} {{-- $mediaWithColor = $model--}} {{-- ->getMedia('product_extra_images')--}} {{-- ->first(fn ($media) => $media->getCustomProperty('color_hex') ==$color);--}} {{-- @endphp--}} {{-- --}} {{--
--}} {{-- Drop image or click--}} {{--
--}} {{--
--}} {{-- --}} {{--
--}} {{-- --}}{{-- Delete row --}} {{--
--}} {{-- --}} {{--
--}} {{--
--}} {{--
--}} {{-- @empty--}} {{--
--}} {{--
--}} {{--
--}} {{-- --}} {{--
--}} {{-- --}} {{-- --}} {{--
--}} {{-- Pick a color or type--}} {{-- hex (e.g. #FFAA00).--}} {{--
--}} {{--
--}} {{-- --}} {{-- --}} {{--
--}} {{-- Drop image or click--}} {{--
--}} {{--
--}} {{-- --}} {{--
--}} {{--
--}} {{-- --}} {{--
--}} {{--
--}} {{--
--}} {{-- @endforelse--}} {{--
--}} {{--
--}} {{--
--}} {{-- --}} {{--
--}} {{--
--}} {{--
--}} {{--
--}} {{--
--}}

Drag images here or click to upload

Max size: 1MB | Dimensions: 512x512 px
@foreach($dimensions as $dimension)
dimensions->contains($dimension->id)) />
@endforeach
has_custom_prices == 1)>
has_custom_prices == 0)>
@forelse($model->prices as $price)
@empty
@endforelse
@php $editableSpecifications = $model->specifications->filter(fn($specification) => $specification->fixed_key !== 'cutting'); $hasSpecs = $editableSpecifications->isNotEmpty(); $cuttingSpec = $model->specifications() ->where('fixed_key', 'cutting') ->first(); $cuttingSpecId = $cuttingSpec?->id; @endphp
Select one or more specs. They will be added automatically below.
@forelse($editableSpecifications as $specification)
fixed_key) data-spec-key="{{ $specification->fixed_key }}" @endif>
fixed_key)) placeholder="Specification Name (EN)"/>
fixed_key)) placeholder="Specification Name (AR)"/>
@foreach($specification->options as $option)
Max size: 1MB | Dimensions: 200x200 px @php $frameMedia = $getOptionFrameMedia($option); @endphp
@endforeach
@empty
@endforelse
@include("modals.products.add-size")
@endsection @section('vendor-script') @endsection @section('page-script') {{-- --}} {{-- --}} {{-- Tableau frame dropzone repeater fix: only show frame upload under Frame Color spec --}} @endsection