Skip to content

Commit

Permalink
Modified download report feature and minor CSS changes 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Shivani-Parihar committed Apr 24, 2017
1 parent b6c1fbf commit 52a8822
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 15 deletions.
49 changes: 41 additions & 8 deletions app/Http/Controllers/ReportDemoController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Http\Controllers;

use App\Emergency;
use App\Patient;
use Illuminate\Http\Request;

use App\Http\Requests;
Expand All @@ -15,21 +16,53 @@

use App\Report;

use App\Hospital;

class ReportDemoController extends Controller
{
public function importExport()
{
return view('importExport');
}
public function downloadExcel($type)
public function downloadExcel(Request $request, $type)
{
$data = Report::get()->toArray();
return Excel::create('ReportOnEmergencyAndBedCount', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
$report_type = $request['report_type'];
if($report_type == 'Hospital') {
$data = Hospital::get()->toArray();
return Excel::create('Report on Hospitals', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
elseif ($report_type == 'Emergency') {
$data = Emergency::get()->toArray();
return Excel::create('Report on Emergency', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
elseif ($report_type == 'Bed Status') {
$data = Report::get()->toArray();
return Excel::create('Report on Bed Status', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
elseif ($report_type == 'Patients') {
$data = Patient::get()->toArray();
return Excel::create('Report on Patients', function($excel) use ($data) {
$excel->sheet('mySheet', function($sheet) use ($data)
{
$sheet->fromArray($data);
});
})->download($type);
}
}
public function importExcel()
{
Expand Down
2 changes: 2 additions & 0 deletions app/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

Route::get('downloadExcel/{type}', 'ReportDemoController@downloadExcel');

Route::post('downloadExcel/{type}', 'ReportDemoController@downloadExcel');

Route::post('importExcel', 'ReportDemoController@importExcel');

Route::get('/generateBarChart', 'ReportDemoController@generateBar');
Expand Down
12 changes: 10 additions & 2 deletions resources/views/about.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading"><h3 style="text-align: center">About Us</h3></div>
<div class="panel-heading">
<div class="pull-left">
<a href="{{ url('/') }}" class="btn btn-info"><i class="fa fa-btn fa-backward"></i>Back</a>
</div>
<h3 style="text-align: center">About Us</h3>
</div>
<div class="panel-body">
<p>The County Health Online Bed Tracking System is a project which was proposed by the Division Chief of Health Data and Planning for the County Health department. Where the County Health Department is responsible for coordination of the hospital resources in that county. The main purpose of this centralized system is to provide a platform to coordinate between the hospitals and all the types of users (First responder, Admin, Nurse, Coordinator).</p>
<p1 style="font-size: medium">The County Health Department is responsible for coordination of the hospital resources in the county. This centralized system is to provide a platform to coordinate between the hospitals and all the types of users (First responder, Admin, Nurse, Coordinator).</p1>
</br>
</br>
<p2 style="font-weight: bold; font-size: large; color: blue"><i class="fa fa-phone" aria-hidden="true"></i>Contact US : 402-999-9999</p2>
</div>
</div>
</div>
Expand Down
17 changes: 13 additions & 4 deletions resources/views/importExport.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,22 @@

</form>
<br/>
<h3>Download File :</h3>
<div class="form-group">
 {!! Form::open(['url' => 'downloadExcel/xls','method'=>'POST']) !!}
<div class="col-lg-2">{{ Form::select('report_type', array('Hospital' => 'Hospital', 'Emergency' => 'Emergency', 'Patients' => 'Patients', 'Bed Status' => 'Bed Status'), null, ['placeholder' => 'Select Report Type', 'class' => 'col-md-4 form-control cds-select']) }}</div>
</div>
<br/>



<h3>Download File :</h3>
<div style="border: 4px solid #a1a1a1;margin-top: 15px;padding: 20px;">
<a href="{{ url('downloadExcel/xls') }}"><button class="btn btn-success btn-lg" style="background-color: #2ca02c;">Download Excel xls</button></a>
<a href="{{ url('downloadExcel/xlsx') }}"><button class="btn btn-success btn-lg" style="background-color: #2ca02c;">Download Excel xlsx</button></a>
<a href="{{ url('downloadExcel/csv') }}"><button class="btn btn-success btn-lg" style="background-color: #2ca02c;">Download CSV</button></a>


<button type="submit" class="btn btn-success" style="background-color: #2ca02c;">Download Report</button>
{!! Form::close() !!}


</div>

</div>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@extends(Auth::user() ? 'layouts.userlayout' : 'layouts.guestpage')
@extends('layouts.app')

<head>
<style>
Expand Down

0 comments on commit 52a8822

Please sign in to comment.