{!! Form::open(['url' => url('/offerandpromotion/promotions/' . $promotion->id), 'method' => 'put', 'id' => 'promotion_form']) !!}
{!! Form::hidden('id', $promotion->id) !!}
{{-- Promotion Type --}}
{{-- Product / Variation --}}
{!! Form::label('product_id', __('offerandpromotion::lang.product') . ':*') !!}
{!! Form::select('product_id', $products, $promotion->product_id, ['class' => 'form-control select2', 'required', 'style' => 'width:100%', 'id' => 'product_id']); !!}
{!! Form::label('variation_id', __('offerandpromotion::lang.variation') . ':') !!}
{!! Form::select('variation_id', $variations, $promotion->variation_id, ['class' => 'form-control select2', 'style' => 'width:100%', 'id' => 'variation_id', 'placeholder' => __('offerandpromotion::lang.all_variations')]); !!}
{{ __('offerandpromotion::lang.leave_empty_for_all_variations') }}
{{-- Name / Location --}}
{!! Form::label('name', __('offerandpromotion::lang.name') . ':') !!}
{!! Form::text('name', $promotion->name, ['class' => 'form-control', 'placeholder' => __('offerandpromotion::lang.optional')]); !!}
{!! Form::label('location_id', __('offerandpromotion::lang.location') . ':') !!}
{!! Form::select('location_id', $locations, $promotion->location_id, ['class' => 'form-control select2', 'style' => 'width:100%', 'placeholder' => __('offerandpromotion::lang.all_locations')]); !!}
{{ __('offerandpromotion::lang.leave_empty_for_all_locations') }}
{{-- ---- DISCOUNT FIELDS ---- --}}
@php $currentType = $promotion->promotion_type ?? 'discount'; @endphp
{!! Form::label('is_active', __('offerandpromotion::lang.status') . ':') !!}
{!! Form::select('is_active', ['1' => __('offerandpromotion::lang.active'), '0' => __('offerandpromotion::lang.inactive')], $promotion->is_active, ['class' => 'form-control']); !!}
{{-- ---- FREE PRODUCT FIELDS ---- --}}
@php
$existingFreeIds = $promotion->freeProductIds();
@endphp
🎁 {{ __('offerandpromotion::lang.free_product_promotion') }}
{!! Form::label('free_product_ids[]', __('offerandpromotion::lang.free_products') . ':') !!}
{!! Form::select('free_product_ids[]', $products, $existingFreeIds, [
'class' => 'form-control select2',
'multiple' => 'multiple',
'id' => 'free_product_ids',
'style' => 'width:100%',
'placeholder' => __('offerandpromotion::lang.select_free_product'),
]); !!}
{{ __('offerandpromotion::lang.free_products_help') }}
{!! Form::label('free_product_qty', __('offerandpromotion::lang.free_product_qty') . ':') !!}
{!! Form::number('free_product_qty', $promotion->free_product_qty ?? 1, ['class' => 'form-control', 'min' => 1, 'placeholder' => '1']); !!}
{{ __('offerandpromotion::lang.free_product_qty_help') }}
{!! Form::label('free_min_purchase_qty', __('offerandpromotion::lang.free_min_purchase_qty') . ':') !!}
{!! Form::number('free_min_purchase_qty', $promotion->free_min_purchase_qty ?? 1, ['class' => 'form-control', 'min' => 1, 'placeholder' => '1']); !!}
{{ __('offerandpromotion::lang.free_min_purchase_qty_help') }}
{!! Form::label('is_active_fp', __('offerandpromotion::lang.status') . ':') !!}
{!! Form::select('is_active', ['1' => __('offerandpromotion::lang.active'), '0' => __('offerandpromotion::lang.inactive')], $promotion->is_active, ['class' => 'form-control', 'id' => 'is_active_fp']); !!}
{{-- Daily Limits --}}
{!! Form::label('daily_quantity_limit', __('offerandpromotion::lang.daily_quantity_limit') . ':') !!}
{!! Form::text('daily_quantity_limit', $promotion->daily_quantity_limit, ['class' => 'form-control input_number', 'placeholder' => __('offerandpromotion::lang.unlimited')]); !!}
@lang('offerandpromotion::lang.daily_quantity_limit_help')
{!! Form::label('daily_invoice_limit', __('offerandpromotion::lang.daily_invoice_limit') . ':') !!}
{!! Form::text('daily_invoice_limit', $promotion->daily_invoice_limit, ['class' => 'form-control input_number', 'placeholder' => __('offerandpromotion::lang.unlimited')]); !!}
@lang('offerandpromotion::lang.daily_invoice_limit_help')
{{-- Date Range --}}
{{-- Description --}}
{!! Form::label('description', __('offerandpromotion::lang.description') . ':') !!}
{!! Form::textarea('description', $promotion->description, ['class' => 'form-control', 'rows' => 3, 'placeholder' => __('offerandpromotion::lang.optional')]); !!}
{!! Form::close() !!}