Error and success messages from form builder
This commit is contained in:
parent
8d79345095
commit
f52b249834
|
@ -11,7 +11,12 @@ class FormController extends Controller
|
|||
|
||||
public function index()
|
||||
{
|
||||
return view('dashboard.administration.forms');
|
||||
|
||||
}
|
||||
|
||||
public function showFormBuilder()
|
||||
{
|
||||
return view('dashboard.administration.formbuilder');
|
||||
}
|
||||
|
||||
public function saveForm(Request $request)
|
||||
|
@ -54,11 +59,11 @@ class FormController extends Controller
|
|||
]
|
||||
);
|
||||
|
||||
$request->session()->flash('sucesss', 'Form created! You can now link this form to a vacancy.');
|
||||
$request->session()->flash('success', 'Form created! You can now link this form to a vacancy.');
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
$request->session()->flash('errors', $validation->errors());
|
||||
$request->session()->flash('errors', $validation->errors()->getMessages());
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
|
|
|
@ -274,9 +274,20 @@ return [
|
|||
'url' => '/admin/positions'
|
||||
],
|
||||
[
|
||||
'text' => 'Manage Forms',
|
||||
'text' => 'Forms',
|
||||
'icon' => 'fab fa-wpforms',
|
||||
'url' => '/admin/forms'
|
||||
'submenu' => [
|
||||
[
|
||||
'text' => 'All forms',
|
||||
'icon' => 'far fa-list-alt',
|
||||
'url' => '/admin/forms'
|
||||
],
|
||||
[
|
||||
'text' => 'Form Builder',
|
||||
'icon' => 'fas fa-fw fa-hammer',
|
||||
'url' => '/admin/forms/builder'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
|
@ -336,7 +347,7 @@ return [
|
|||
'plugins' => [
|
||||
[
|
||||
'name' => 'Datatables',
|
||||
'active' => true,
|
||||
'active' => false,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
|
@ -420,5 +431,21 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'name' => 'Toastr',
|
||||
'active' => true,
|
||||
'files' => [
|
||||
[
|
||||
'type' => 'js',
|
||||
'asset' => false,
|
||||
'location' => 'https://cdn.jsdelivr.net/npm/toastr@2.1.4/toastr.min.js'
|
||||
],
|
||||
[
|
||||
'type' => 'css',
|
||||
'asset' => false,
|
||||
'location' => 'https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
];
|
||||
|
|
|
@ -8,6 +8,28 @@
|
|||
|
||||
@stop
|
||||
|
||||
@section('js')
|
||||
|
||||
@if (session()->has('success'))
|
||||
|
||||
<script>
|
||||
toastr.success("{{session('success')}}")
|
||||
</script>
|
||||
|
||||
@elseif(session()->has('error'))
|
||||
|
||||
@foreach(session('error') as $error)
|
||||
|
||||
<script>
|
||||
toastr.error("{{$error}}")
|
||||
</script>
|
||||
|
||||
@endforeach
|
||||
|
||||
@endif
|
||||
|
||||
@stop
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row">
|
||||
|
@ -41,6 +63,7 @@
|
|||
<div class="card-footer text-center">
|
||||
|
||||
<button onclick="save()" type="button" class="btn btn-success">Save Form</button>
|
||||
<button type="button" class="btn btn-info">Form List</button>
|
||||
|
||||
</div>
|
||||
|
|
@ -67,12 +67,15 @@ Route::group(['middleware' => 'auth'], function(){
|
|||
|
||||
Route::resource('positions', 'VacancyController');
|
||||
|
||||
Route::get('forms', 'FormController@index')
|
||||
Route::get('forms/builder', 'FormController@showFormBuilder')
|
||||
->name('showFormBuilder');
|
||||
|
||||
Route::post('forms/save', 'FormController@saveForm')
|
||||
->name('saveForm');
|
||||
|
||||
Route::get('forms', 'FormController@index')
|
||||
->name('showForms');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue