@php
$form_class = empty($duplicate_product) ? 'create' : '';
$is_image_required = !empty($common_settings['is_product_image_required']);
@endphp
{!! Form::open(['url' => action([\App\Http\Controllers\ProductController::class, 'update'] , [$product->id] ), 'method' => 'PUT', 'id' => 'product_add_form', 'class' => 'product_form', 'files' => true ,'novalidate']) !!}
@component('components.widget', ['title' => __('product.product_info'),'class' => '','icon'=>'
',])
{!! Form::label('sku', __('product.sku') . ':', ['class' => 'form-label']) !!}
@show_tooltip(__('tooltip.sku'))
{!! Form::text('sku', $product->sku, ['class' => 'form-control',
'placeholder' => __('product.sku')]); !!}
{!! Form::label('category_id', __('product.category') . ':', ['class' => 'form-label']) !!}
{!! Form::select('category_id', $categories, !empty($duplicate_product->category_id) ? $duplicate_product->category_id : $product->category_id, ['placeholder' => __('messages.please_select'), 'class' => 'form-select select2']); !!}
{!! Form::label('sub_category_id', __('product.sub_category') . ':', ['class' => 'form-label']) !!}
{!! Form::select('sub_category_id', $sub_categories, !empty($duplicate_product->sub_category_id) ? $duplicate_product->sub_category_id : $product->sub_category_id, ['placeholder' => __('messages.please_select'), 'class' => 'form-select select2']); !!}
{!! Form::label('sub_unit_ids', __('product.related_sub_units') . ':', ['class' => 'form-label']) !!}
@show_tooltip(__('product.sub_units_tooltip'))
{!! Form::select('sub_unit_ids[]', $updated_sub_units, $product->sub_unit_ids, ['class' => 'form-select select2', 'multiple', 'id' => 'sub_unit_ids']); !!}
@if(!empty($common_settings['enable_secondary_unit']))
{!! Form::label('secondary_unit_id', __('app.secondary_unit') . ':', ['class' => 'form-label']) !!}
@show_tooltip(__('product.secondary_unit_help'))
{!! Form::select('secondary_unit_id', $units, !empty($duplicate_product->secondary_unit_id) ? $duplicate_product->secondary_unit_id : $product->secondary_unit_id, ['class' => 'form-select select2']); !!}
@endif
@php
$default_location = null;
if(count($business_locations) == 1){
$default_location = array_key_first($business_locations->toArray());
}
@endphp
{!! Form::label('product_locations', __('business.business_locations') . ':', ['class' => 'form-label']) !!}
@show_tooltip(__('product.product_location_help'))
{!! Form::select('product_locations[]', $business_locations, $product->product_locations->pluck('id'), ['class' => 'form-select select2', 'multiple', 'id' => 'product_locations']); !!}
{!! Form::checkbox('enable_stock', 1, !empty($duplicate_product) ? $duplicate_product->enable_stock : $product->enable_stock, ['class' => 'input-icheck', 'id' => 'enable_stock']); !!}
{!! Form::label('alert_quantity', __('product.alert_quantity') . ':', ['class' => 'form-label']) !!}
@show_tooltip(__('product.alert_quantity'))
{!! Form::text('alert_quantity', !empty($duplicate_product->alert_quantity) ? @format_quantity($duplicate_product->alert_quantity) : $product->alert_quantity , ['class' => 'form-control input_number',
'placeholder' => __('product.alert_quantity'), 'min' => '0']); !!}
{!! Form::label('product_description', __('product.product_description') . ':', ['class' => 'form-label']) !!}
{!! Form::textarea('product_description', !empty($duplicate_product->product_description) ? $duplicate_product->product_description : null, ['class' => 'form-control']); !!}
@component('components.widget', ['title' => __('product.product_image')])
@if(!empty($product->image))
@endif
@endcomponent
@if(!empty($common_settings['enable_product_warranty']))
{!! Form::label('warranty_id', __('app.warranty') . ':', ['class' => 'form-label']) !!}
{!! Form::select('warranty_id', $warranties, null, ['class' => 'form-select select2', 'placeholder' => __('messages.please_select')]); !!}
@endif
@if(!empty($pos_module_data))
@foreach($pos_module_data as $key => $value)
@if(!empty($value['view_path']))
@includeIf($value['view_path'], ['view_data' => $value['view_data']])
@endif
@endforeach
@endif
@if( $product->type=='single')
@include('product.partials.single_product_form_part', ['profit_percent' => $default_profit_percent])
@endif
@endcomponent