@extends('admin.layouts.layout') @section('main')
{{$module}}
@php($form_id=array_key_exists('id',$form)?$form['id']:'') @if($id) {!! Form::model($data, [ 'method' => 'PATCH', 'route' => [$form['route'], $id], 'class' => 'form-horizontal', 'id'=>$form_id, 'enctype'=>'multipart/form-data' ]) !!} @else {!! Form::open(array('route' => $form['route'],'method'=>'POST', 'enctype'=>'multipart/form-data','id'=>$form_id)) !!} @endif
@if(!empty($form['fields'])) @php ($editorScript = 0) @php ($col = 1) @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 ($attributes['data-live-search']= (isset($attributes['data-live-search']) ? $attributes['data-live-search'] : false)) @php ($attributes['autocomplete'] = (isset($attributes['autocomplete']) ? $attributes['autocomplete'] : 'false')) @php ($inputValue = (isset($value['value']) ? $value['value'] : null)) @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'] == 'number') @php($attributes['step']='0.01') {!! Form::number($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'] == 'password') {!! Form::password($key, $attributes) !!} @elseif($value['type'] == 'textarea') {!! 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'] == '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'], ['image/jpeg', 'image/png', 'image/gif'])) @elseif(in_array($value['attributes']['file_mime'], ['video/mp4'])) @endif @else View File @endif @endif @endif @if(isset($value['help'])) {{ $value['help'] }} @endif @if ($errors->has($key)) {{ $errors->first($key) }} @endif
@if($col == 2)
@php ($col = 0) @endif @php ($col++) @elseif($value['type'] == 'hidden') {!! Form::hidden($key, $inputValue,$attributes) !!} @elseif($value['type'] == 'html')
{!! $value['value'] !!}
@elseif($value['type'] == 'include') @include($value['value']) @endif @endforeach @endif @if(isset($include_page)) @include($include_page) @endif
{!! Form::close() !!}
@endsection @if(isset($form['include_scripts'])) @push('page_script') {!! $form['include_scripts'] !!} @endpush @endif @section('scripts') @endsection