@extends('layouts.app') @section('title', __('lang_v1.edit_offer')) @section('content')

@lang( 'lang_v1.edit_offer' )

@lang('lang_v1.offer_on_qty')

@can('offer.create') @endcan
@can('offer.create') {!! Form::open(['url' => action([\App\Http\Controllers\OfferController::class, 'update'], [$offerData->id]), 'method' => 'put', 'id' => 'offer_form' ]) !!}
{!! Form::label('offer_type', __( 'lang_v1.select_offer_type' ) . ':*') !!} {!! Form::select('offer_type', [''=> 'Select Offer Type', '1'=> 'Individual Item', '2'=> 'Bill Amount', '3' => 'Based On Qty' ], isset($offer_type) ? $offer_type : '', ['onchange' => 'javascript:onChange(this.value)', 'class' => 'form-control select2', 'id' => 'unit_id']); !!}
{!! Form::label('calculation_type', 'Calculation Method:*') !!} {!! Form::select('calculation_type', ['1'=> 'General', '2'=> 'Advance'], $offerData->cal_type, ['class' => 'form-control select2', 'id' => 'calculation_type']); !!}

For General Example : 100x11/100 = 11.00, For Advance Example : 100/1.11 = 90.09

{!! Form::label('offer_for', 'Offer For:*') !!} {!! Form::select('offer_for', ['' => 'Select offer for','1'=> 'All Stores', '2'=> 'Specific Store'], $offerData->offer_for, ['onchange' => "javascript:($(this).val() == 2) ? $('#divStore').show() : $('#divStore').hide();", 'class' => 'form-control select2', 'id' => 'offer_for']); !!}
offer_for == 2) style="display:block" @endif>
{!! Form::label('location_id', 'Store Name:*') !!} {!! Form::select('location_id', $locations, $offerData->business_for, ['placeholder' => __('messages.please_select'), 'class' => 'form-control select2']); !!}
{!! Form::label('name', 'Offer Name:*') !!} {!! Form::text('name', $offerData->name, ['class' => 'form-control', 'required', 'placeholder' => 'Name' ]); !!}
{!! Form::label('category_id', __('product.category') . ':') !!} {!! Form::select('category_id', $categories, 0, ['id' => "category_id", 'class' => 'form-control select2']); !!}
{!! Form::label('sub_category_id', __('product.sub_category') . ':') !!} {!! Form::select('sub_category_id', ['0' => 'All'], 0, ['id' => "sub_category_id", 'class' => 'form-control select2']); !!}
{!! Form::label('brand_id', __('product.brand') . ':') !!} {!! Form::select('brand_id', $brands, null, ['id' => "brand_id", 'class' => 'form-control select2']); !!}
{!! Form::label('variation_ids', __('report.products') . ':') !!} Leave it blank for all products. In case of particular products, select individual products {!! Form::select('variation_ids', [], 0, ['multiple' => 'multiple','id' => "variation_ids", 'class' => 'form-control']); !!}
{!! Form::label('min_qty', 'Min Qty:*') !!} {!! Form::text('min_qty[]', null, ['id' =>'min_qty', 'placeholder' => 'Min Qty','class' => 'form-control input_number']); !!}
{!! Form::label('max_qty', 'Max Qty:*') !!} {!! Form::text('max_qty[]', null, ['id' =>'max_qty','placeholder' => 'Max Qty','class' => 'form-control input_number ']); !!}
{!! Form::label('discount', 'Discount:*') !!} {!! Form::text('discount[]', null, ['id' =>'discount','class' => 'form-control input_number', 'placeholder' => 'Discount' ]); !!}
@php($offerQty = \App\OfferQty::where(['offer_id' => $offerData->id])->get()) @if (!empty($offerQty)) @foreach ($offerQty as $billQty) @endforeach @endif
Min Qty Max Qty Discount Category Sub Category Brand Item Delete
@php($catName = \App\Category::select('id','name')->where(['id' => $billQty->cat_id])->first()) @php($subCatName = \App\Category::select('id','name')->where(['id' => $billQty->sub_cat_id])->first()) @php($brandName = \App\Brands::select('id','name')->where(['id' => $billQty->brand_id])->first()) @if (isset($billQty->item_id) && $billQty->item_id != 0) @foreach (explode(',', $billQty->item_id) as $product) @php($prodName = \App\Product::select('id','name')->where(['id' => $product])->first()) @php($prdNames[] = $prodName->name) @endforeach @else @endif
{!! Form::label('offer_start_date', 'Offers Start Date:*') !!} {!! Form::text('offer_start_date', $start_date, ['class' => 'form-control', 'required', 'placeholder' => __( 'lang_v1.starts_at' ), 'readonly', 'required' => 'required' ]); !!}
{!! Form::label('offer_end_date', 'Offers End Date:*') !!} {!! Form::text('offer_end_date', $end_date, ['class' => 'form-control', 'required', 'placeholder' => __( 'lang_v1.ends_at' ), 'readonly', 'required' => 'required']); !!}
{!! Form::label('status', 'Status') !!}
{!! Form::checkbox('status', 1, $offerData->status == 1 ? true : '', ['class' => 'input-icheck']); !!} @lang('lang_v1.is_active')
{!! Form::close() !!} @endcan
@stop @section('javascript') @endsection