{!! Form::open(['method' => 'POST', 'id' => 'offer_form', 'url' => '/admin/offers/' .$offer->offer_id , 'enctype' => 'multipart/form-data' ]) !!}
@csrf
@method("PUT")
{!! Form::label('Name') !!}
{!! Form::text('offer_name', $offer->offer_name, ['class' => 'form-control', 'placeholder' => 'Name','id' => 'offer_name']) !!}
@if ($errors->has('offer_name'))
{!! $errors->first('offer_name') !!}@endif
{!! Form::label('Slug') !!}
{!! Form::text('offer_name_slug', $offer->offer_name_slug, ['class' => 'form-control', 'placeholder' => 'Name','id' => 'offer_slug']) !!}
@if ($errors->has('offer_name_slug'))
{!! $errors->first('offer_name_slug') !!}@endif
{!! Form::label('Title') !!}
{!! Form::text('offer_title', $offer->offer_title, ['class' => 'form-control', 'placeholder' => 'Name']) !!}
@if ($errors->has('offer_name'))
{!! $errors->first('offer_title') !!}@endif
{!! Form::label('Offer Position') !!}
{!! Form::select('offer_position', $offerPosition, $offer->offer_position, ['class' => 'form-control', 'placeholder' => 'Select offer position', 'id' => 'offer_position']) !!}
@if ($errors->has('offer_position'))
{!! $errors->first('offer_position') !!}@endif
{!! Form::label('Offer Sorting') !!}
{{-- {!! Form::select('is_store', ['0' => 'Offer', '1' => 'Store', '2' => 'New Arrival'], 0, ['class' => 'form-control', 'placeholder' => 'Select offer type', 'id' => 'is_store']) !!} --}}
{!! Form::select('offer_sorting', ['D' => 'Customized', 'LH' => 'Low to High (Price)', 'HL' => 'High to Low (Price)', 'HLD' => 'High to Low (Discount)'], $offer->offer_sorting, ['class' => 'form-control', 'placeholder' => 'Select offer sorting', 'id' => 'offer_sorting', 'required' => 'required']) !!}
@if ($errors->has('offer_sorting'))
{!! $errors->first('offer_sorting') !!}@endif
{!! Form::label('Offer Type') !!}
{{-- {!! Form::select('is_store', ['0' => 'Offer', '1' => 'Store', '2' => 'New Arrival'], $offer->is_store, ['class' => 'form-control', 'placeholder' => 'Select offer position', 'id' => 'is_store']) !!} --}}
{!! Form::select('is_store', ['0' => 'Offer', '1' => 'Store', '2' => 'Campaign'], $offer->is_store, ['class' => 'form-control', 'placeholder' => 'Select offer type', 'id' => 'is_store', 'required' => 'required']) !!}
@if ($errors->has('is_store'))
{!! $errors->first('is_store') !!}@endif
@php
// $selectType = $offer->offer_select_type == "single" ? "1" : "2";
if($offer->offer_select_type == "single"){
$selectType = "1";
} elseif($offer->offer_select_type == "bulk"){
$selectType = "2";
} else {
$selectType = "3";
}
@endphp
{!! Form::label('Product Select Type') !!}
{!! Form::select('select_type', ['1' => 'Single', '2' => 'Bulk', '3' => 'All Products'], $selectType, ['class' => 'form-control', 'placeholder' => 'Select Select Type', 'id' => 'select_type', 'required' => 'required']) !!}
@if ($errors->has('select_type'))
{!! $errors->first('select_type') !!}@endif
@if($offer->offer_select_type == "single")
{!! Form::label('Product Type') !!}
{!! Form::select('is_type', ['0' => 'Item Type Wise', '1' => 'Category Wise'], $offer->is_type, ['class' => 'form-control', 'placeholder' => 'Select Product Type', 'id' => 'is_type']) !!}
@if ($errors->has('is_type'))
{!! $errors->first('is_type') !!}@endif
is_type == "0" ? "style=display:block" : "style=display:none"}}>
{!! Form::label('Item Type') !!}
{!! Form::select('item_type', $item_type, $selectedItemTypes->itemType ?? NULL, ['class' => 'form-control','id' => 'item_type', 'placeholder' => 'Select Item Type']) !!}
@if ($errors->has('item_type'))
{!! $errors->first('item_type') !!}@endif
{!! Form::label('Brand') !!}
{{-- {!! Form::select('brand', $brand, null, ['class' => 'form-control','id' => 'brand', 'placeholder' => 'Select Brand']) !!} --}}
@if ($errors->has('brand'))
{!! $errors->first('brand') !!}@endif
is_type == "1" ? "style=display:block" : "style=display:none"}}>
{!! Form::label('Category') !!}
{{-- {!! Form::select('category_id[]', $category, null, ['class' => 'form-control item_type_select2', 'multiple' => 'multiple', 'id' => 'category']) !!} --}}
@if ($errors->has('category'))
{!! $errors->first('category') !!}@endif
{{-- {{dd($offer->offeredProduct())}} --}}
@endif
@if($offer->offer_select_type == "bulk" || $offer->offer_select_type == "all")
@foreach($offerProducts as $product)
@foreach($product->offeredProduct as $offProduct)
{{$offProduct->product_code_inv ?? ''}}
@endforeach
@endforeach
@endif
{!! Form::textarea('offer_short_desc', $offer->offer_short_desc, ['class' => 'form-control', 'rows' => '8','placeholder' => 'Short Description', 'id' => 'offer_short_desc']) !!}
@if ($errors->has('offer_description'))
{!! $errors->first('offer_short_desc') !!}@endif
{!! Form::textarea('offer_description', $offer->offer_description, ['class' => 'form-control', 'rows' => '8','placeholder' => 'Description', 'id' => 'offer_description']) !!}
@if ($errors->has('offer_description'))
{!! $errors->first('offer_description') !!}@endif
{!! Form::textarea('offer_note', $offer->offer_note, ['class' => 'form-control', 'rows' => '3','placeholder' => 'Note', 'id' => 'offer_note']) !!}
@if ($errors->has('offer_note'))
{!! $errors->first('offer_note') !!}@endif
{!! Form::date('from', $offer->offer_start_date , ['id' => 'from', 'class' => 'form-control']) !!}
{!! Form::date('to', $offer->offer_end_date, ['id' => 'to', 'class' => 'form-control']) !!}
{!! Form::select('offer_is_hidden', [0 => 'No',1 => 'Yes', ], isset($offer->offer_is_hidden) ? $offer->offer_is_hidden : null, ['id' => 'offer_is_hidden' ,'class' => 'form-control']) !!}
{!! Form::select('offer_is_exist', [1 => 'Active', 0 => 'Inactive'], isset($offer->offer_is_exist) ? $offer->offer_is_exist : null, ['id' => 'offer_is_exist', 'class' => 'form-control']) !!}
{!! Form::label('View Style') !!}
{!! Form::select('is_offer_style', ['new' => 'Category', 'old' => 'Product'], isset($offer->is_offer_style) ? $offer->is_offer_style : null, ['class' => 'form-control']) !!}