<!-- Name Field -->
<div class="form-group col-sm-12">
    {!! Form::label('name', 'Name:') !!}
    {!! Form::text('name', null, ['class' => 'form-control', 'maxlength' => 255, 'maxlength' => 255, 'maxlength' => 255]) !!}
</div>

<!-- Code Field -->
<div class="form-group col-sm-12">
    {!! Form::label('code', 'Code:') !!}
    @isset($coupons)
    {!! Form::text('code', null, ['class' => 'form-control', 'disabled'=>'disabled']) !!}
    @else
    {!! Form::text('code', mt_rand(1000000000000000,9999999999999999), ['class' => 'form-control bg-light', 'readonly' => 'readonly']) !!}
    @endisset
</div>
{!! Form::hidden('discount_type',1) !!}

{{-- <div class="form-group col-sm-12">
    {!! Form::label('discount_type', 'Discount Type:') !!}
    {!! Form::select('discount_type', Common::DiscountType(),null ,['class' => 'select2 form-select ','id'=>'discount_type']) !!}
</div> --}}

<!-- Discount Value Field -->
<div class="form-group col-sm-12">
    {!! Form::label('discount_value', 'Discount Amount:') !!}
    {!! Form::number('discount_value', null, ['class' => 'form-control','step'=>'any']) !!}
</div>

<!-- Start Date Field -->
<div class="form-group col-sm-12">
    @php
    if(isset($coupons->start_date)){
        $start_date = date('Y-m-d',strtotime($coupons->start_date));
    } else{
        $start_date = null;
    }
@endphp    {!! Form::label('start_date', 'Start Date:') !!}
    {!! Form::date('start_date',$start_date, ['class' => 'form-control','id'=>'start_date']) !!}
</div>

<!-- End Date Field -->
<div class="form-group col-sm-12">
    @php
        if(isset($coupons->end_date)){
            $end_date = date('Y-m-d',strtotime($coupons->end_date));
        } else{
            $end_date = null;
        }
    @endphp
    {!! Form::label('end_date', 'End Date:') !!}
    {!! Form::date('end_date', $end_date, ['class' => 'form-control','id'=>'end_date']) !!}
</div>

{!! Form::hidden('usage_limit',1) !!}


<!-- Usage Limit Field -->
{{-- <div class="form-group col-sm-12">
    {!! Form::label('usage_limit', 'Usage Limit:') !!}
    {!! Form::number('usage_limit', null, ['class' => 'form-control']) !!}
</div>

<!-- Min Amount Field -->
<div class="form-group col-sm-12">
    {!! Form::label('min_amount', 'Min Amount:') !!}
    {!! Form::number('min_amount', null, ['class' => 'form-control']) !!}
</div> --}}

<!-- Branch Field -->
@isset(auth()->user()->branch_id)
<div class="form-group col-sm-12">
    {!! Form::hidden('branch_id', auth()->user()->branch_id) !!}
</div>
@else
<div class="form-group col-sm-12">
    {!! Form::label('branch_id', 'Branch:') !!}
    {!! Form::select('branch_id', Common::getBranches(),null ,['class' => 'select2 form-select ','id'=>'branch_id']) !!}
</div>
@endisset

<!-- Status Field -->
<div class="form-group col-sm-12 mt-3">
    <div class="form-check">
       <input type="checkbox" name="status" id="status" class="form-check-input" value="1" @isset($coupons->status) checked @endisset />
       <label for="status" class="pt-0">Is Active</label>

    </div>
</div>
