@csrf @method('PUT')

{{ __('lang.edit') }}

{{ __('advancedpromotions::lang.promotions') }} :-

{!! Form::text('name', $data->name??null, ['class' => 'form-control', 'required']); !!}
{!! Form::label('location_id', __('lang.location') . ':' ) !!}
{!! Form::select('location_id', getLocations(null, false), $data->location_id??auth()->user()->location_id , ['class' => 'form-control select2', 'id' => 'location_id', 'required', 'style' => 'width: 100%;']); !!}
@php $startDate = (!empty($data->start_date) && $data->start_date != '0000-00-00' && $data->start_date != '0000-00-00 00:00:00') ? \Carbon\Carbon::parse($data->start_date)->format('m/d/Y') : null; @endphp {!! Form::text('start_date', $startDate, ['class' => 'form-control datepicker', 'autocomplete' => 'off', 'readonly']); !!}
@php $endDate = (!empty($data->end_date) && $data->end_date != '0000-00-00' && $data->end_date != '0000-00-00 00:00:00') ? \Carbon\Carbon::parse($data->end_date)->format('m/d/Y') : null; @endphp {!! Form::text('end_date', $endDate, ['class' => 'form-control datepicker', 'readonly', 'required']); !!}
{!! Form::label('selling_price_groups', __('lang.selling_price_group') . ':') !!} {!! Form::select('selling_price_groups[]', $selling_price_groups, $data->selling_price_groups->pluck('id')??[], [ 'class' => 'form-control select2', 'multiple' => true, 'style' => 'width: 100%;', ]) !!}
{!! Form::label('users', __('lang.sales_person') . ':') !!} {!! Form::select('users[]', $users, $data->users->pluck('id')??[], [ 'class' => 'form-control select2', 'multiple' => true, 'style' => 'width: 100%;', ]) !!}

{{ __('advancedpromotions::lang.conditional_rules') }} :-

{!! Form::number('min_quantity', $data->min_quantity??1, ['class' => 'form-control']); !!}
{!! Form::number('min_price', $data->min_price??0, ['class' => 'form-control']); !!}
{!! Form::label('products', __('lang.products') . ':') !!} {!! Form::select('products[]', $products, $data->products->pluck('id')??[], ['class' => 'form-control select2', 'multiple' => true, 'style' => 'width: 100%;']) !!}
{!! Form::label('categories', __('lang.categories') . ':') !!} {!! Form::select('categories[]', $categories, $data->categories->pluck('id')??[], ['class' => 'form-control select2', 'multiple' => true,'style' => 'width: 100%;']) !!}
{!! Form::label('tags', __('lang.tags') . ':*') !!} {!! Form::select('tags[]', $tags, $data->tags->pluck('id')??[], ['class' => 'form-control select2', 'multiple' => true, 'style' => 'width: 100%;']) !!}

{{ __('advancedpromotions::lang.rewards') }} :-

@if(!empty($data->rewards) && count($data->rewards) > 0) @foreach($data->rewards as $k => $r)
type=='free_product') hidden @endif>
method!='percentage') hidden @endif>
type=='discount') hidden @endif>
@endforeach @endif