{{ !empty($package) ? 'Edit Package' : 'Add Package' }}
Back
{{ Form::text('title', old('title'), ['class' => 'form-control','placeholder' => 'Title']) }}
@if($errors->has('title'))
{{ $errors->first('title') }}
@endif
{{ Form::select('status', [1 => 'Active', 0 => 'Inactive'], old("status"), ['class' => 'form-control']) }}
@php $features=config::get('constant.package_features');
@$i=1;
if(!empty($package)){
$existingfeatures = $package->package_features->pluck('value','title')->toArray();
}
@endphp
@foreach($features as $key=>$feature)
@php
$value='';
if( !empty($package) && $existingfeatures && array_key_exists($key,$existingfeatures)){
$value=$existingfeatures[$key];
}
else{
$value=old("subscription_plan_features[$i][value]");
}
@endphp
@php $i++; @endphp
@endforeach
{{ Form::hidden("package_features[$i][title]", $key, ['class' => 'form-control']) }}
{!! Form::select("package_features[$i][value]", [1=>"Yes",0=>'No'], $value, ['class' => 'form-control']) !!}
@if($errors->has('package_features.'.$i.'.value'))
{{ $errors->first('package_features.'.$i.'.value') }}
@endif
@php
$priceRanges=$ranges;
@$i=1;
if(!empty($package)){
$existingprices = $package->package_prices->pluck('price','price_range_id')->toArray();
}
@endphp
@foreach($priceRanges as $range)
@php
$value='';
if( !empty($package) && $existingprices && array_key_exists($range->id,$existingprices)){
$value=$existingprices[$range->id];
}
else{
$value=old("package_prices[$i][price]");
}
@endphp
@php $i++; @endphp
@endforeach
{{ Form::hidden("package_prices[$i][price_range_id]", $range->id, ['class' => 'form-control']) }}
{{ Form::number("package_prices[$i][price]", $value, ['class' => 'form-control','placeholder' => 'Amount'/*,'min'=>$range->min,'max'=>$range->max*/,'min'=>0,'step' => '0.01','readonly' => !empty($package) ? false : false]) }}
@if($errors->has('package_prices.'.$i.'.value'))
{{ $errors->first('package_prices.'.$i.'.price') }}
@endif