@push('scripts') @endpush
@if(isset($id)) {{ html()->modelForm($data, 'PATCH', route('product.update', $id) )->attribute('enctype', 'multipart/form-data')->open() }} @else {{ html()->form('POST', route('product.store'))->attribute('enctype', 'multipart/form-data')->open() }} @endif

{{ $pageTitle }}

{{ html()->label(__('message.title') . ' *', 'title')->class('form-control-label') }} {{ html()->text('title')->placeholder(__('message.title'))->class('form-control')->attribute('required','required') }}
{{ html()->label(__('message.affiliate_link').' *')->class('form-control-label') }} {{ html()->input('url','affiliate_link', old('affiliate_link'))->placeholder(__('message.affiliate_link'))->class('form-control')->attribute('required') }}
{{ html()->label(__('message.price').' *')->class('form-control-label') }} {{ html()->number('price', old('price'))->placeholder(__('message.price'))->class('form-control')->attribute('min', 0)->attribute('step', 'any')->attribute('required', 'required') }}
{{ html()->label(__('message.productcategory').' *')->class('form-control-label') }} {{ html()->select('productcategory_id', isset($id) ? [ optional($data->productcategory)->id => optional($data->productcategory)->title ] : [], old('productcategory_id')) ->class('select2js form-group productcategory') ->attribute('data-placeholder', __('message.select_name', ['select' => __('message.productcategory')])) ->attribute('data-ajax--url', route('ajax-list', ['type' => 'productcategory'])) ->attribute('required', 'required') }}
{{ html()->label(__('message.featured'))->class('form-control-label') }}
{{ html()->radio('featured', old('featured', $data->featured ?? 'yes') == 'yes', 'yes')->class('form-check-input')->id('featured-yes') }}
{{ html()->radio('featured', old('featured', $data->featured ?? 'yes') == 'no', 'no')->class('form-check-input')->id('featured-no') }}
{{ html()->radio('featured', old('featured', $data->featured ?? 'yes') == 'test', 'test')->class('form-check-input')->id('featured-test') }}
{{ html()->label(__('message.status') . ' *', 'status')->class('form-control-label') }} {{ html()->select('status',[ 'active' => __('message.active'), 'inactive' => __('message.inactive') ], old('status'))->class('form-control select2js')->attribute('required', 'required') }}
{{ html()->label(__('message.description'))->class('form-control-label') }} {{ html()->textarea('description', null)->class('form-control tinymce-description') ->placeholder(__('message.description')) }}
@if( isset($id) && getMediaFileExit($data, 'product_image')) @endif

{{ html()->submit( __('message.save') )->class('btn btn-md btn-primary float-end') }}
@if(isset($id)) {{ html()->closeModelForm() }} @else {{ html()->form()->close() }} @endif