@extends('layouts.app') @section('title', __('product.add_new_product')) @section('content')

@lang('product.add_new_product')

@include('layouts.sub_menu.product')
@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, 'store']), 'method' => 'post', 'id' => 'product_add_form','class' => 'product_form ' . $form_class, 'files' => true ]) !!} @component('components.widget', ['class' => 'box-primary'])
@lang('lang_v1.basic_information')
{!! Form::label('name', __('product.product_name') . ':*') !!} {!! Form::text('name', !empty($duplicate_product->name) ? $duplicate_product->name : null, ['class' => 'form-control', 'required', 'placeholder' => __('product.product_name')]); !!}
{!! Form::label('sku', __('product.sku') . ':') !!} @show_tooltip(__('tooltip.sku')) {!! Form::text('sku', null, ['class' => 'form-control', 'id' => 'product_sku_input', 'placeholder' => __('product.sku'), 'autocomplete' => 'off']); !!}
@php $custom_labels = json_decode(session('business.custom_labels'), true); $product_custom_fields = !empty($custom_labels['product']) ? $custom_labels['product'] : []; $product_cf_details = !empty($custom_labels['product_cf_details']) ? $custom_labels['product_cf_details'] : []; $cf3 = isset($product_custom_fields['custom_field_3']) ? $product_custom_fields['custom_field_3'] : ''; if(empty($cf3) && is_array($product_custom_fields)) { $i = 1; foreach($product_custom_fields as $cf) { if($i == 3) { $cf3 = $cf; break; } $i++; } } @endphp @if(!empty($cf3)) @php $db_field_name = 'product_custom_field3'; $cf_type = !empty($product_cf_details[3]['type']) ? $product_cf_details[3]['type'] : 'text'; $dropdown = !empty($product_cf_details[3]['dropdown_options']) ? explode(PHP_EOL, $product_cf_details[3]['dropdown_options']) : []; @endphp
{!! Form::label($db_field_name, $cf3 . ':') !!} @if(in_array($cf_type, ['text', 'date'])) @elseif($cf_type == 'dropdown') {!! Form::select($db_field_name, $dropdown, !empty($duplicate_product->$db_field_name) ? $duplicate_product->$db_field_name : null, ['placeholder' => $cf3, 'class' => 'form-control select2']); !!} @endif
@else
{!! Form::label('product_custom_field3', 'Custom Field 3:') !!} {!! Form::text('product_custom_field3', !empty($duplicate_product->product_custom_field3) ? $duplicate_product->product_custom_field3 : null, ['class' => 'form-control', 'placeholder' => 'Custom Field 3']); !!}
@endif
{!! Form::label('discount', __('lang_v1.discount') . ':*') !!} {!! Form::select('discount_id', $discounts, !empty($duplicate_product->discount_id) ? $duplicate_product->discount_id : '', ['class' => 'form-control select2']); !!}
@lang('lang_v1.product_classification')
{!! Form::label('brand_id', __('product.brand') . ':') !!}
{!! Form::select('brand_id', $brands, !empty($duplicate_product->brand_id) ? $duplicate_product->brand_id : null, ['placeholder' => __('messages.please_select'), 'class' => 'form-control select2']); !!}
{!! Form::label('category_id', __('product.category') . ':') !!}
{!! Form::select('category_id', $categories, !empty($duplicate_product->category_id) ? $duplicate_product->category_id : null, ['placeholder' => __('messages.please_select'), 'class' => 'form-control select2']); !!}
{!! Form::label('sub_category_id', __('product.sub_category') . ':') !!}
{!! Form::select('sub_category_id', $sub_categories, !empty($duplicate_product->sub_category_id) ? $duplicate_product->sub_category_id : null, ['placeholder' => __('messages.please_select'), 'class' => 'form-control select2']); !!}
@lang('lang_v1.unit_serial_settings')
{!! Form::label('unit_id', __('product.unit') . ':*') !!}
{!! Form::select('unit_id', $units, !empty($duplicate_product->unit_id) ? $duplicate_product->unit_id : session('business.default_unit'), ['class' => 'form-control select2', 'required']); !!}
@if(!empty($common_settings['enable_product_multi_unit']))
@show_tooltip(__('tooltip.use_multi_unit'))

@lang('product.use_multi_unit_help')

{!! Form::label('first_conversion_unit_id', __('product.first_conversion_unit') . ':*') !!}
{!! Form::select('first_conversion_unit_id', [], null, ['disabled'=> true, 'style' => 'width:100%;', 'class' => 'form-control select2', 'id'=>'first_conversion_unit_id']); !!}
{!! Form::label('first_conversion_unit_rate', __('product.first_conversion_unit_rate') . ':*') !!} {!! Form::text('first_conversion_unit_rate', null, ['disabled'=> true,'class' => 'form-control', 'id'=>'first_conversion_unit_rate', 'placeholder' => __('Conversion rate')]); !!}
{!! Form::label('second_conversion_unit_id', __('product.second_conversion_unit') . ':') !!}
{!! Form::select('second_conversion_unit_id', [], null, ['disabled'=> true, 'style' => 'width:100%;', 'class' => 'form-control select2', 'id'=>'second_conversion_unit_id']); !!}
{!! Form::label('second_conversion_unit_rate', __('product.second_conversion_unit_rate') . ':*') !!} {!! Form::text('second_conversion_unit_rate', null, ['disabled'=> true,'class' => 'form-control', 'id'=>'second_conversion_unit_rate', 'placeholder' => __('Conversion rate')]); !!}
@endif
{!! Form::label('sub_unit_ids', __('lang_v1.related_sub_units') . ':') !!} @show_tooltip(__('lang_v1.sub_units_tooltip')) {!! Form::select('sub_unit_ids[]', [], !empty($duplicate_product->sub_unit_ids) ? $duplicate_product->sub_unit_ids : null, ['class' => 'form-control select2', 'multiple', 'id' => 'sub_unit_ids']); !!}
@if(!empty($common_settings['enable_secondary_unit']))
{!! Form::label('secondary_unit_id', __('lang_v1.secondary_unit') . ':') !!} @show_tooltip(__('lang_v1.secondary_unit_help')) {!! Form::select('secondary_unit_id', $units, !empty($duplicate_product->secondary_unit_id) ? $duplicate_product->secondary_unit_id : null, ['class' => 'form-control select2']); !!}
@endif
@lang('lang_v1.stock_management')
@show_tooltip(__('tooltip.enable_stock'))

@lang('product.enable_stock_help')

{!! Form::label('alert_quantity', __('product.alert_quantity') . ':') !!} @show_tooltip(__('tooltip.alert_quantity')) {!! Form::text('alert_quantity', !empty($duplicate_product->alert_quantity) ? @format_quantity($duplicate_product->alert_quantity) : null , ['class' => 'form-control input-number', 'placeholder' => __('product.alert_quantity'), 'min' => '0']); !!}
@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
{!! Form::label('barcode_type', __('product.barcode_type') . ':*') !!} {!! Form::select('barcode_type', $barcode_types, !empty($duplicate_product->barcode_type) ? $duplicate_product->barcode_type : $barcode_default, ['class' => 'form-control select2', 'required']); !!}
@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') . ':') !!} @show_tooltip(__('lang_v1.product_location_help')) {!! Form::select('product_locations[]', $business_locations, $default_location, ['class' => 'form-control select2', 'multiple', 'id' => 'product_locations']); !!}
@lang('lang_v1.warranty_serial_settings')
@if(!empty($common_settings['enable_product_warranty']))
{!! Form::label('warranty_id', __('lang_v1.warranty') . ':') !!} {!! Form::select('warranty_id', $warranties, null, ['class' => 'form-control select2', 'placeholder' => __('messages.please_select')]); !!}
@endif
@show_tooltip(__('lang_v1.tooltip_enable_serial_number'))
@show_tooltip(__('lang_v1.tooltip_sr_no'))
@lang('lang_v1.product_attributes')
@show_tooltip(__('lang_v1.tooltip_not_for_selling'))
@php $custom_labels = json_decode(session('business.custom_labels'), true); $product_custom_fields = !empty($custom_labels['product']) ? $custom_labels['product'] : []; $product_cf_details = !empty($custom_labels['product_cf_details']) ? $custom_labels['product_cf_details'] : []; @endphp @foreach($product_custom_fields as $index => $cf) @if(!empty($cf) && $loop->iteration != 3) @php $db_field_name = 'product_custom_field' . $loop->iteration; $cf_type = !empty($product_cf_details[$loop->iteration]['type']) ? $product_cf_details[$loop->iteration]['type'] : 'text'; $dropdown = !empty($product_cf_details[$loop->iteration]['dropdown_options']) ? explode(PHP_EOL, $product_cf_details[$loop->iteration]['dropdown_options']) : []; @endphp
{!! Form::label($db_field_name, $cf . ':') !!} @if(in_array($cf_type, ['text', 'date'])) @elseif($cf_type == 'dropdown') {!! Form::select($db_field_name, $dropdown, !empty($duplicate_product->$db_field_name) ? $duplicate_product->$db_field_name : null, ['placeholder' => $cf, 'class' => 'form-control select2']); !!} @endif
@endif @endforeach
@endcomponent @component('components.widget', ['class' => 'box-primary'])
@lang('lang_v1.tax_pricing_configuration')
{!! Form::label('tax', __('product.applicable_tax') . ':') !!} {!! Form::select('tax', $taxes, !empty($duplicate_product->tax) ? $duplicate_product->tax : null, ['placeholder' => __('messages.please_select'), 'class' => 'form-control select2'], $tax_attributes); !!}
{!! Form::label('tax_type', __('product.selling_price_tax_type') . ':*') !!} {!! Form::select('tax_type', ['inclusive' => __('product.inclusive'), 'exclusive' => __('product.exclusive')], !empty($duplicate_product->tax_type) ? $duplicate_product->tax_type : 'exclusive', ['class' => 'form-control select2', 'required']); !!}
{!! Form::label('type', __('product.product_type') . ':*') !!} @show_tooltip(__('tooltip.product_type')) {!! Form::select('type', $product_types, !empty($duplicate_product->type) ? $duplicate_product->type : null, ['class' => 'form-control select2', 'required', 'data-action' => !empty($duplicate_product) ? 'duplicate' : 'add', 'data-product_id' => !empty($duplicate_product) ? $duplicate_product->id : '0']); !!}
@include('product.partials.single_product_form_part', ['profit_percent' => $default_profit_percent])
@endcomponent @component('components.widget', ['class' => 'box-primary hide', 'id' => 'pre_made_div'])
Configure Pre-made Product
{!! Form::text('search_pre_made_product', null, ['class' => 'form-control mousetrap', 'id' => 'search_pre_made_product', 'placeholder' => __('lang_v1.search_product_placeholder')]); !!}
@lang( 'product.product_name' ) @lang( 'lang_v1.quantity' ) @lang( 'product.default_purchase_price')({{ __('product.exc_of_tax') }}) @lang( 'lang_v1.profit_margin' ) @lang( 'product.default_selling_price')(@lang('product.inc_of_tax')) @lang( 'product.total_amount')(@lang('product.inc_of_tax'))

@lang( 'lang_v1.total_items' ):
@lang( 'purchase.net_total_amount' ):
@endcomponent
@can('product.opening_stock') @endcan
{!! Form::close() !!}
@endsection @section('javascript') @endsection