WIP: Simply post the form to a different controller

This commit is contained in:
Marcus Moore 2023-10-30 16:30:53 -07:00
parent 7a5faa9619
commit 06186c9b12
3 changed files with 30 additions and 28 deletions

View file

@ -407,6 +407,7 @@ class ReportsController extends Controller
*/
public function postCustom(Request $request)
{
dd('postCustom', $request->all());
ini_set('max_execution_time', env('REPORT_TIME_LIMIT', 12000)); //12000 seconds = 200 minutes
$this->authorize('reports.view');

View file

@ -6,13 +6,8 @@ use Illuminate\Http\Request;
class SavedReportsController extends Controller
{
//a method to the madness
public function store(Request $request)
{
dd($request->all());
dd('saved reports', $request->all());
}
}

View file

@ -16,7 +16,12 @@
<div class="row">
<div class="col-md-8 col-md-offset-1">
{{ Form::open(['method' => 'post', 'class' => 'form-horizontal', 'id' => 'custom-report-form']) }}
{{ Form::open([
'method' => 'post',
'class' => 'form-horizontal',
'id' => 'custom-report-form',
'url' => '/reports/custom',
]) }}
{{csrf_field()}}
<!-- Horizontal Form -->
@ -449,27 +454,28 @@
$("#savetemplateform").submit(function(e) {
e.preventDefault(e);
let elements = Array.from(document.getElementById("custom-report-form").elements).map(item=>item.name);
console.log(elements);
$("#savetemplateoptions").val(elements)
let formElement = document.getElementById('custom-report-form')
let inputsAsArray = Array.from(formElement.elements)
inputsAsArray.map(function(item){
// not a real method
if (item.isACheckbox()){
return {name: item.name, type: checkbox, checked: item.checked};
}
if (item.isASelect){
return {name:item.name, type: select, selected: [item.elements]}
}
})
// set hidden input to variable
e.currentTarget.submit();
$('#custom-report-form').attr('action', '/reports/savedtemplate').submit()
// let elements = Array.from(document.getElementById("custom-report-form").elements).map(item=>item.name);
// console.log(elements);
//
// $("#savetemplateoptions").val(elements)
//
// let formElement = document.getElementById('custom-report-form')
//
// let inputsAsArray = Array.from(formElement.elements)
//
// inputsAsArray.map(function(item){
// // not a real method
// if (item.isACheckbox()){
// return {name: item.name, type: checkbox, checked: item.checked};
// }
//
// if (item.isASelect){
// return {name:item.name, type: select, selected: [item.elements]}
// }
// })
// // set hidden input to variable
// e.currentTarget.submit();
});
</script>