mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-12 22:37:28 -08:00
WIP: Simply post the form to a different controller
This commit is contained in:
parent
7a5faa9619
commit
06186c9b12
|
@ -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');
|
||||
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue