Add vehicle battery compatibility report. #291
This commit is contained in:
parent
ec5b8951da
commit
16763c5386
5 changed files with 123 additions and 4 deletions
|
|
@ -298,6 +298,8 @@ access_keys:
|
|||
label: RESQ MEH Customer Report
|
||||
- id: report.warranty.class
|
||||
label: Warranty Class Report
|
||||
- id: report.vehicle.battery.compatibility
|
||||
label: Vehicle Battery Compatibility Report
|
||||
|
||||
- id: service
|
||||
label: Other Services
|
||||
|
|
|
|||
|
|
@ -57,3 +57,13 @@ rep_warranty_class_export_csv:
|
|||
path: /report/warranty_class_report
|
||||
controller: App\Controller\ReportController::warrantyClassExportCSV
|
||||
methods: [POST]
|
||||
|
||||
rep_vehicle_battery_compatibility_form:
|
||||
path: /report/vehicle_battery_compatibility_report
|
||||
controller: App\Controller\ReportController::vehicleBatteryCompatibilityForm
|
||||
methods: [GET]
|
||||
|
||||
rep_vehicle_battery_compatibility_export_csv:
|
||||
path: /report/vehicle_battery_compatibility_report
|
||||
controller: App\Controller\ReportController::vehicleBatteryCompatibilityExportCSV
|
||||
methods: [POST]
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ use Symfony\Component\HttpFoundation\File\UploadedFile;
|
|||
use Symfony\Component\Security\Core\Encoder\EncoderFactoryInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
use Catalyst\MenuBundle\Annotation\Menu;
|
||||
|
||||
|
|
@ -614,6 +613,48 @@ class ReportController extends Controller
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function vehicleBatteryCompatibilityForm()
|
||||
{
|
||||
$this->denyAccessUnlessGranted('report.vehicle.battery.compatibility', null, 'No access.');
|
||||
$params['mode'] = 'form';
|
||||
|
||||
return $this->render('report/vehicle-battery-compatibility/form.html.twig', $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Menu(selected="outlet_list")
|
||||
*/
|
||||
public function vehicleBatteryCompatibilityExportCSV(Request $req, EntityManagerInterface $em)
|
||||
{
|
||||
$data = $this->getVehicleBatteryCompatibilityData($em);
|
||||
|
||||
$resp = new StreamedResponse();
|
||||
$resp->setCallback(function() use ($data) {
|
||||
// csv output
|
||||
$csv_handle = fopen('php://output', 'w+');
|
||||
fputcsv($csv_handle, [
|
||||
]);
|
||||
foreach ($data as $row)
|
||||
{
|
||||
fputcsv($csv_handle, $row);
|
||||
}
|
||||
|
||||
fclose($csv_handle);
|
||||
});
|
||||
|
||||
$filename = 'vehicle_battery_compatibility_report' . '.csv';
|
||||
|
||||
$resp->setStatusCode(200);
|
||||
$resp->headers->set('Content-Type', 'text/csv; charset=utf-8');
|
||||
$resp->headers->set('Content-Disposition', 'attachment; filename="' . $filename . '"');
|
||||
|
||||
return $resp;
|
||||
|
||||
}
|
||||
|
||||
protected function processPopappFile(UploadedFile $csv_file, EntityManagerInterface $em)
|
||||
{
|
||||
// attempt to open file
|
||||
|
|
@ -915,4 +956,11 @@ class ReportController extends Controller
|
|||
return $data;
|
||||
|
||||
}
|
||||
|
||||
protected function getVehicleBatteryCompatibilityData(EntityManagerInterface $em)
|
||||
{
|
||||
$results = [];
|
||||
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@
|
|||
</h3>
|
||||
<ul class="m-menu__inner">
|
||||
<li class="m-menu__item " data-redirect="true" aria-haspopup="true">
|
||||
<a href="{{ url('rep_popapp_comp_form') }}" class="m-menu__link">
|
||||
<a href="{{ url('rep_popapp_comp_form') }}" class="m-menu__link">
|
||||
<i class="m-menu__link-bullet m-menu__link-bullet--dot">
|
||||
<span></span>
|
||||
</i>
|
||||
|
|
@ -157,7 +157,7 @@
|
|||
Popapp Comparison Report
|
||||
</span>
|
||||
</a>
|
||||
<a href="{{ url('rep_resq_meh_form') }}" class="m-menu__link">
|
||||
<a href="{{ url('rep_resq_meh_form') }}" class="m-menu__link">
|
||||
<i class="m-menu__link-bullet m-menu__link-bullet--dot">
|
||||
<span></span>
|
||||
</i>
|
||||
|
|
@ -165,7 +165,7 @@
|
|||
RESQ MEH Customer Report
|
||||
</span>
|
||||
</a>
|
||||
<a href="{{ url('rep_warranty_class_form') }}" class="m-menu__link">
|
||||
<a href="{{ url('rep_warranty_class_form') }}" class="m-menu__link">
|
||||
<i class="m-menu__link-bullet m-menu__link-bullet--dot">
|
||||
<span></span>
|
||||
</i>
|
||||
|
|
@ -173,6 +173,15 @@
|
|||
Warranty Class Report
|
||||
</span>
|
||||
</a>
|
||||
<a href="{{ url('rep_vehicle_battery_compatibility_form') }}" class="m-menu__link">
|
||||
<i class="m-menu__link-bullet m-menu__link-bullet--dot">
|
||||
<span></span>
|
||||
</i>
|
||||
<span class="m-menu__link-text">
|
||||
Vehicle Battery Compatibility Report
|
||||
</span>
|
||||
</a>
|
||||
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<!-- BEGIN: Subheader -->
|
||||
<div class="m-subheader">
|
||||
<div class="d-flex align-items-center">
|
||||
<div class="mr-auto">
|
||||
<h3 class="m-subheader__title">
|
||||
Vehicle Battery Compatibility Report
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- END: Subheader -->
|
||||
<div class="m-content">
|
||||
<!--Begin::Section-->
|
||||
<div class="row">
|
||||
<div class="col-xl-6">
|
||||
<div class="m-portlet m-portlet--mobile">
|
||||
<div class="m-portlet__head">
|
||||
<div class="m-portlet__head-caption">
|
||||
<div class="m-portlet__head-title">
|
||||
<span class="m-portlet__head-icon">
|
||||
<i class="fa fa-upload"></i>
|
||||
</span>
|
||||
<h3 class="m-portlet__head-text">
|
||||
Generate Vehicle Battery Compatibility CSV File
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<form id="upload_form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ url('rep_vehicle_battery_compatibility_export_csv') }}" enctype="multipart/form-data">
|
||||
<div class="m-portlet__body">
|
||||
<div class="m-portlet__foot m-portlet__foot--fit">
|
||||
<div class="m-form__actions m-form__actions--solid m-form__actions--right">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button type="submit" class="btn btn-success">Export to CSV</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Loading…
Reference in a new issue