{{-- DOCUMENTATION ------------------------------------------------------------------------------------------------- 1. Include Scripts into form: If you want to include scripts into form, Enter below script into your form array element. You may pass either script file location. 'include_scripts' => '', Or, your custom script. 'include_scripts' => '', 2. Custom Buttons: If you want to show custom buttons instead of this form's inbuild button, Enter below script into your form array element. 'custom_buttons' => [ [ 'type' => 'submit', 'text' => 'save Save Changes', 'attributes' => [ 'class' => 'btn bg-indigo btn-lg waves-effect', 'id' => 'submit-button-id' ] ], [ 'type' => 'button', 'text' => 'arrow_back Back', 'attributes' => [ 'class' => 'btn bg-info btn-lg waves-effect', 'id' => 'back-button-id', 'onclick' => 'your custom script' ] ] ], --}} @extends('admin.layouts.layout', ['title' => $module]) @section('main')
@if($id) {!! Form::model($data, [ 'method' => 'PATCH', 'route' => [$form['route'], $id], 'class' => 'form-horizontal', 'role' => 'form', 'id' => isset($form['id'])?$form['id']:'admin-common-form', 'autoComplete' => 'off', 'enctype'=>'multipart/form-data' ]) !!} @else {!! Form::open(array('route' => $form['route'],'method'=>'POST','id' => isset($form['id'])?$form['id']:'admin-common-form','role' => 'form','autoComplete' => 'off', 'enctype'=>'multipart/form-data')) !!} @endif @if(!empty($form['fields'])) @php ($editorScript = 0) @php ($multiSelectScript = 0) @foreach($form['fields'] as $key => $value) @php ($attributes = (isset($value['attributes']) ? $value['attributes'] : [])) @php ($attributes['id'] = (isset($attributes['id']) ? $attributes['id'] : $key)) @php ($attributes['class'] = (isset($attributes['class']) ? $attributes['class'] : 'form-control')) @php ($inputValue = (isset($value['value']) ? $value['value'] : null)) @php ($floatOff = ['select', 'multiselect', 'file', 'radio', 'checkbox', 'editor', 'date']) @if(!in_array($value['type'], ['html', 'include', 'hidden'])) @php ($attributes['class'] .= ($errors->has($key) ? ' is-invalid' : ''))
@if(isset($value['label']) && $value['label']) @endif @if($value['type'] == 'text') {!! Form::text($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'label') @php ($attributes['readonly'] = 'true') @php ($attributes['disabled'] = 'true') {!! Form::text($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'email') {!! Form::email($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'number') {!! Form::number($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'date') {!! Form::date($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'password') {!! Form::password($key, $attributes) !!} @elseif($value['type'] == 'textarea') @php($attributes['rows'] = '3') {!! Form::textarea($key, $inputValue, $attributes) !!} @elseif($value['type'] == 'editor') @php ($attributes['class'] .= ' ckeditor') {!! Form::textarea($key, $inputValue, $attributes) !!} @if($editorScript == 0) @push('page_script') @endpush @php ($editorScript = 1) @endif @elseif($value['type'] == 'select') {!! Form::select($key, $value['options'], $value['value'], $attributes) !!} @elseif($value['type'] == 'multiselect') @php ($attributes['multiple'] = 'true') {!! Form::select($key, $value['options'], $value['value'], $attributes) !!} @elseif($value['type'] == 'radio')
@foreach($value['options'] as $k => $option)
@endforeach
@elseif($value['type'] == 'checkbox')
@foreach($value['options'] as $k => $option)
@endforeach
{{-- @elseif($value['type'] == 'file') {!! Form::file($key) !!} @if($value['value']) @if(isset($value['attributes'])) @if(in_array($value['attributes']['file_mime'], \App\File::$fileValidations['image']['file_mimes'])) @endif @else View File @endif @endif @endif --}} @elseif($value['type'] == 'file') @if(isset($value['attributes']['multiple']) && array_key_exists('multiple',$value['attributes']) && $value['attributes']['multiple'])


@else {!! Form::file($key) !!} @endif
@if(isset($value['thumb'])) @elseif($value['value'] && array_key_exists('multiple',$value['attributes']) && $value['attributes']['multiple']) @foreach($value['value'] as $img_key=>$img_val) @if(isset($img_val->file_mime) && isset($img_val->location)) @if(in_array($img_val->file_mime, \App\File::$fileValidations['image']['file_mimes']))
delete
@else View File @endif @elseif(isset($img_val['value']['original'])) @if(in_array($img_val['value']['file_mime'], \App\File::$fileValidations['image']['file_mimes'])) @else View File @endif @endif @endforeach @elseif($value['value']) @if(isset($value['value']->file_mime) && isset($value['value']->location)) @if(in_array($value['value']->file_mime, \App\File::$fileValidations['image']['file_mimes'])) @else View File @endif @elseif(isset($value['value']['original'])) @if(in_array($value['value']['file_mime'], \App\File::$fileValidations['image']['file_mimes'])) @else View File @endif @endif @endif
@endif
@if(isset($value['help'])) {{ $value['help'] }} @endif @if ($errors->has($key)) {{ $errors->first($key) }} @endif
@elseif($value['type'] == 'hidden') {!! Form::hidden($key, $inputValue) !!} @elseif($value['type'] == 'html')
{!! $value['value'] !!}
@elseif($value['type'] == 'include') @include($value['value']) @endif @endforeach @endif
@if(isset($include_page)) @include($include_page) @endif
@if(!isset($form['custom_buttons'])) @if(isset($form['back_route'])) arrow_back Back @endif @else @foreach($form['custom_buttons'] as $button) @endforeach @endif {!! Form::close() !!}
@endsection @if(isset($form['include_scripts'])) @push('page_script') {!! $form['include_scripts'] !!} @endpush @endif