diff --git a/app/Http/Controllers/FormController.php b/app/Http/Controllers/FormController.php
index bc95730..deeeee0 100644
--- a/app/Http/Controllers/FormController.php
+++ b/app/Http/Controllers/FormController.php
@@ -87,7 +87,7 @@ class FormController extends Controller
{
$deletable = false;
}
-
+
if ($deletable)
{
$form->delete();
@@ -103,4 +103,11 @@ class FormController extends Controller
}
+ public function preview(Request $request, Form $form)
+ {
+ return view('dashboard.administration.formpreview')
+ ->with('form', json_decode($form->formStructure, true))
+ ->with('title', $form->formName);
+ }
+
}
diff --git a/app/View/Components/Form.php b/app/View/Components/Form.php
new file mode 100644
index 0000000..06e868d
--- /dev/null
+++ b/app/View/Components/Form.php
@@ -0,0 +1,33 @@
+disableFields = $disableFields;
+ }
+
+ /**
+ * Get the view / contents that represent the component.
+ *
+ * @return \Illuminate\View\View|string
+ */
+ public function render()
+ {
+ return view('components.form');
+ }
+}
diff --git a/public/img/preview.svg b/public/img/preview.svg
new file mode 100644
index 0000000..008b3f5
--- /dev/null
+++ b/public/img/preview.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/views/components/form.blade.php b/resources/views/components/form.blade.php
new file mode 100644
index 0000000..41e10b8
--- /dev/null
+++ b/resources/views/components/form.blade.php
@@ -0,0 +1,32 @@
+@foreach($form['fields'] as $fieldName => $field)
+
+ @switch ($field['type'])
+
+ @case('textarea')
+
+
+
+
+
+
+
+
+ @break
+
+ @case('textbox')
+
+
+
+
+
+
+
+
+
+ @break
+
+ @endswitch
+
+@endforeach
diff --git a/resources/views/dashboard/administration/formpreview.blade.php b/resources/views/dashboard/administration/formpreview.blade.php
new file mode 100644
index 0000000..3c00ddd
--- /dev/null
+++ b/resources/views/dashboard/administration/formpreview.blade.php
@@ -0,0 +1,79 @@
+@extends('adminlte::page')
+
+@section('title', 'Raspberry Network | Application Form Preview')
+
+@section('content_header')
+
+ Administration / Form Builder / Preview
+
+@stop
+
+
+@section('js')
+
+
+
+@stop
+
+
+@section('content')
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
This is how your form looks like to applicants
+
+
+ You may edit it and add more fields later.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ @component('components.form', ['form' => $form, 'disableFields' => true])
+
+ @endcomponent
+
+
+
+
+
+
+
+
+
+
+
+@stop
diff --git a/resources/views/dashboard/administration/forms.blade.php b/resources/views/dashboard/administration/forms.blade.php
index 8505dcc..2ddf00b 100644
--- a/resources/views/dashboard/administration/forms.blade.php
+++ b/resources/views/dashboard/administration/forms.blade.php
@@ -59,7 +59,7 @@
-
+
diff --git a/resources/views/dashboard/application-rendering/apply.blade.php b/resources/views/dashboard/application-rendering/apply.blade.php
index 236b520..5d57f2b 100644
--- a/resources/views/dashboard/application-rendering/apply.blade.php
+++ b/resources/views/dashboard/application-rendering/apply.blade.php
@@ -93,38 +93,10 @@
diff --git a/routes/web.php b/routes/web.php
index d3e88cc..05681b8 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -194,6 +194,9 @@ Route::group(['middleware' => ['auth', 'forcelogout']], function(){
Route::get('forms', 'FormController@index')
->name('showForms');
+ Route::get('forms/preview/{form}', 'FormController@preview')
+ ->name('previewForm');
+
Route::get('devtools', 'DevToolsController@index')
->name('devTools');