Skip to content
This repository was archived by the owner on May 10, 2022. It is now read-only.

GSoC2018 report generator #1

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7c71034
Adding migrations and models for report generator tables
Trodrige May 26, 2018
3db8a1b
An attempt to add Factories and seeders for the report generator. Add…
Trodrige May 28, 2018
b62f74a
Added the junction table for report format and draggable component re…
Trodrige Jun 4, 2018
ff73094
display draggable components
Trodrige Jun 6, 2018
eae3984
Getting the option IDs of selected components
Jun 11, 2018
2fc50a5
Sending CSRF header and getting response from controller
Jun 12, 2018
84cb384
corrected previous PR. Added command to create two laravel-ehr databases
Trodrige Jun 14, 2018
2e6ac8d
An attempt to get data from selected columns, and send to views
Trodrige Jun 17, 2018
33fc9c7
Attempt to retrieve data
Trodrige Jun 22, 2018
8536b8a
cleaned showReport function, and sending data to view
Trodrige Jun 23, 2018
8d4896c
attempt to display rendered data in the view
Trodrige Jun 23, 2018
eae851d
Displaying rendered data
Trodrige Jun 25, 2018
877388b
Add new system feature
Trodrige Jul 1, 2018
b1cb778
Adding ability to save report format. Adding entries to join table
Trodrige Jul 2, 2018
780e21a
Updating instruction.txt to show Libre EHR Db configurations
Trodrige Jul 2, 2018
8e281b5
Merging install and instruction files in README file
Trodrige Jul 5, 2018
83de3ee
dumping test data for features and report formats
Trodrige Jul 5, 2018
6b70601
updating and deleting system features
Trodrige Jul 16, 2018
c932ea5
Delete report format
Trodrige Jul 16, 2018
4558a47
Edit report format title and description
Trodrige Jul 20, 2018
29bbb2b
View existing report from selected report format
Trodrige Jul 20, 2018
00a4f22
hiding save report format button when showing existing report
Trodrige Jul 23, 2018
bc024c6
Adding pdf_report.php for PDF generation function
Trodrige Jul 27, 2018
7f33e3f
sending for columns for use in pdf generation
Trodrige Jul 28, 2018
ecc9ebc
keeping all draggable components in drop box and draggable pool.
Trodrige Aug 3, 2018
2320022
--amend
Trodrige Aug 3, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,25 @@ public function index()
* Show the generated report.
* @return Response
*/
public function getComponents()
public function getComponents(Request $request)
{
$option_ids = Input::get($option_ids); // returns an array
$option_ids = $request->ids; // returns an array
// use ids to get the draggable components notes
// use notes to get the table columns
// send the data to the view
//return view('reportgenerator::report')->with('ids', $option_ids);
return url('reportgenerator/showReport');
$option_ids = serialize($option_ids);
return response()->json([
'redirecturl' => 'http://localhost:8000/reportgenerator/report/'.$option_ids,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoutcast port? :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this affects, but might need to be configurable/discoverable. For instance, this would not work in my production setup. localhost does one thing. 127.0.0.1 does something completely different.
-I am sure you have this under consideration, or it is actually a non-issue...I am just making sure you know I am here! 😺

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have this @aethelwulffe I'll use the $DB_HOST global.

'success' => 'Received IDs',
'option_ids' => $option_ids
]);
}

public function showReport($option_ids)
{
$option_ids = unserialize($option_ids);
return view('reportgenerator::report')->with('option_ids', $option_ids);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Modules/ReportGenerator/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

Route::get('/generate', 'ReportGeneratorController@getComponents');

Route::get('/showReport', 'ReportGeneratorController@showReport');
Route::get('/report/{option_ids}', 'ReportGeneratorController@showReport');
});
21 changes: 12 additions & 9 deletions Modules/ReportGenerator/Resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@section('title', 'Report Generator')

@section('content')
<nav class="navbar navbar-expand-lg navbar-light bg-warning">
<nav class="navbar navbar-expand-lg navbar-light bg-warning" style="background-color:#fd7e14 !important">
<!-- The button below opens the add system feature modal below. -->
<button type="button" class="btn btn-info" data-toggle="modal" data-target="#add-system-feature">Add system feature</button>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
Expand Down Expand Up @@ -73,19 +73,22 @@
</nav><!-- /.navbar -->
&nbsp;
<div class="container">
<div class="alert alert-success" style="display:none"></div>
<div class="row">
<div class="col-sm-6">
<div id="accordion">
<div class="card">
<div class="card-header" id="headingOne">
<h5 class="mb-0"><b>Drop columns here</b>
<button type="button" name="submit" class="btn btn-info" id="generate-button">Generate report</button></h5>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" id="second">
<p class="note">Why am I still empty?</p>
<form id="dropForm">
<div class="card-header" id="headingOne">
<h5 class="mb-0"><b>Drop columns here</b>
<button type="button" name="submit" class="btn btn-info" id="generate-button">Generate report</button></h5>
</div>
</div>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body" id="second">
<p class="note">Why am I still empty?</p>
</div>
</div>
</form>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta name="_token" content="{{ csrf_token() }}" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Tigpezeghe Rodrige K. @ [email protected]">
<metan name="description" content="GSoC2018: Building a report generator for LibreHealthEHR">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taken care of!

<meta name="description" content="GSoC2018: Building a report generator for LibreHealthEHR">
<title>@yield('title') - LibreHealthEHR</title>

<!-- Custom app.css in public/assets/css -->
Expand Down
19 changes: 16 additions & 3 deletions public/assets/js/master.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,32 @@ function generate(IDs) {
return i == IDs.indexOf(item);
});
console.log(option_ids);
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
}
});
$.ajax({
url: 'reportgenerator/generate',
type: 'GET',
type: 'get',
data: { ids: option_ids },
dataType: 'json',
success: function(response){
alert("You've successfully sent the unique ids");
console.log(response);
//alert("You've successfully sent the unique ids");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, debug.

jQuery('.alert').show();
jQuery('.alert').html(response.option_ids);
window.location.href = response.redirecturl; // your action should return an object having [redirecturl] property
},
error: function (httpRequest, textStatus, errorThrown) { // detailed error messsage
alert("Error: " + textStatus + " " + errorThrown + " " + httpRequest);
}
});
}

$(document).ready(function() {
$('#generate-button').click(function() {
$('#generate-button').click(function(e) {
e.preventDefault();
if (jQuery.isEmptyObject(IDs)) { // check if the user has dropped any component before trying to generate a report
alert("Please drag and drop components before you can generate a report!");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Cannot create a blank report. Please drag and drop at least one component into your new report before attempting to generate it."
OR
"Cannot generate a blank report! You must add at least one component."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought of that, and it escaped me. Handling it now!

} else {
Expand Down