Skip to content

Commit

Permalink
[Feature #139317] Added facility type fiilter
Browse files Browse the repository at this point in the history
  • Loading branch information
razvanMiu committed Sep 23, 2021
1 parent 3591096 commit 5149e3b
Show file tree
Hide file tree
Showing 4 changed files with 349 additions and 0 deletions.
156 changes: 156 additions & 0 deletions src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,157 @@ let Map,
olExtent;
let OL_LOADED = false;

// const PopupDetails = ({ data }) => {
// const countFactypeEprtr = data.count_factype_EPRTR;
// const countFactypeNonEprtr = data.count_factype_NONEPRTR;
// const countInstypeIed = data.count_instype_IED;
// const countInstypeNonIed = data.count_instype_NONIED;
// const countPlantypeLcp = data.count_plantType_LCP;
// const countPlantypeCoWi = data.count_plantType_coWI;
// const countPlantypeWi = data.count_plantType_WI;

// return (
// <div className="grid-layout">
// {/* SITE CONTENTS */}
// {data.nFacilities || data.nInstallations || data.nLCP ? (
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Site contents</Header>
// </div>
// {countFactypeEprtr ? (
// <div className="column column-12">
// <p>
// {`${countFactypeEprtr} ${
// countFactypeEprtr === 1
// ? 'EPRTR Facility'
// : 'EPRTR Facilities'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}
// {countFactypeNonEprtr ? (
// <div className="column column-12">
// <p>
// {`${countFactypeNonEprtr} ${
// countFactypeNonEprtr === 1
// ? 'NON-EPRTR Facility'
// : 'NON-EPRTR Facilities'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countInstypeIed ? (
// <div className="column column-12">
// <p>
// {`${countInstypeIed} ${
// countInstypeIed === 1
// ? 'IED Installation'
// : 'IED Installations'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countInstypeNonIed ? (
// <div className="column column-12">
// <p>
// {`${countInstypeNonIed} ${
// countInstypeNonIed === 1
// ? 'NON-IED Installation'
// : 'NON-IED Installations'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeLcp ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeLcp} ${
// countPlantypeLcp === 1
// ? 'Large combustion plant'
// : 'Large combustion plants'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeCoWi ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeCoWi} ${
// countPlantypeCoWi === 1
// ? 'Co-waste incinerator'
// : 'Large combustion plants'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeWi ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeWi} ${
// countPlantypeWi === 1
// ? 'Co-waste incinerator'
// : 'Co-waste incinerator'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}
// </div>
// ) : (
// ''
// )}

// {/* SITE POLLUTANT EMISSIONS */}
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Pollutant emissions</Header>
// </div>
// <div className="column column-12 description">
// {data.pollutants ? (
// <p>{data.pollutants}</p>
// ) : (
// <p>There are no data regarding the pollutants</p>
// )}
// </div>
// </div>
// {/* REGULATORY INFORMATION */}
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Regulatory information</Header>
// </div>
// <div className="column column-12">
// {data.Site_reporting_year ? (
// <p>
// Inspections in {data.Site_reporting_year}:{' '}
// {data.numInspections || 0}
// </p>
// ) : (
// ''
// )}
// </div>
// </div>
// </div>
// );
// };

const OpenlayersMapView = (props) => {
const stateRef = useRef({
map: {
Expand Down Expand Up @@ -368,6 +519,11 @@ const OpenlayersMapView = (props) => {
sql: `(Site_reporting_year = :options)`,
type: 'multiple',
},
// Facility type
facilityTypes: {
sql: `(facilityTypes LIKE ':options')`,
type: 'multiple',
},
// Plant type
plantTypes: {
sql: `(plantTypes LIKE '%:options%')`,
Expand Down
37 changes: 37 additions & 0 deletions src/components/manage/Blocks/FiltersBlock/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const View = ({ content, ...props }) => {
'pollutant_groups',
'pollutants',
'reporting_years',
'facility_types',
'plant_types',
'bat_conclusions',
'permit_types',
Expand Down Expand Up @@ -451,6 +452,42 @@ const View = ({ content, ...props }) => {
delete filtersMeta[key];
}
});
filtersMeta['facility_types'] = {
filteringInputs: [
{
id: _uniqueId('select_'),
type: 'select',
position: 0,
},
],
placeholder: 'Select facility type',
queryToSet: 'facilityTypes',
title: 'Facility type',
static: true,
options: [
{ key: null, value: null, text: 'No value' },
{
key: 'EPRTR',
value: 'EPRTR',
text: 'EPRTR',
},
{
key: 'NONEPRTR',
value: 'NONEPRTR',
text: 'NONEPRTR',
},
{
key: 'EPRTR, NONEPRTR',
value: 'EPRTR, NONEPRTR',
text: 'EPRTR, NONEPRTR',
},
{
key: 'NONEPRTR, EPRTR',
value: 'NONEPRTR, EPRTR',
text: 'NONEPRTR, EPRTR',
},
],
};
response.forEach((res, index) => {
const results = JSON.parse(res.request.response).results;
let filteringInputs = [];
Expand Down
151 changes: 151 additions & 0 deletions src/components/manage/Blocks/IndustryMap/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,157 @@ import './style.css';
let _REQS = 0;
const zoomSwitch = 6;

// const PopupDetails = ({ data }) => {
// const countFactypeEprtr = data.count_factype_EPRTR;
// const countFactypeNonEprtr = data.count_factype_NONEPRTR;
// const countInstypeIed = data.count_instype_IED;
// const countInstypeNonIed = data.count_instype_NONIED;
// const countPlantypeLcp = data.count_plantType_LCP;
// const countPlantypeCoWi = data.count_plantType_coWI;
// const countPlantypeWi = data.count_plantType_WI;

// return (
// <div className="grid-layout">
// {/* SITE CONTENTS */}
// {data.nFacilities || data.nInstallations || data.nLCP ? (
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Site contents</Header>
// </div>
// {countFactypeEprtr ? (
// <div className="column column-12">
// <p>
// {`${countFactypeEprtr} ${
// countFactypeEprtr === 1
// ? 'EPRTR Facility'
// : 'EPRTR Facilities'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}
// {countFactypeNonEprtr ? (
// <div className="column column-12">
// <p>
// {`${countFactypeNonEprtr} ${
// countFactypeNonEprtr === 1
// ? 'NON-EPRTR Facility'
// : 'NON-EPRTR Facilities'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countInstypeIed ? (
// <div className="column column-12">
// <p>
// {`${countInstypeIed} ${
// countInstypeIed === 1
// ? 'IED Installation'
// : 'IED Installations'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countInstypeNonIed ? (
// <div className="column column-12">
// <p>
// {`${countInstypeNonIed} ${
// countInstypeNonIed === 1
// ? 'NON-IED Installation'
// : 'NON-IED Installations'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeLcp ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeLcp} ${
// countPlantypeLcp === 1
// ? 'Large combustion plant'
// : 'Large combustion plants'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeCoWi ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeCoWi} ${
// countPlantypeCoWi === 1
// ? 'Co-waste incinerator'
// : 'Large combustion plants'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}

// {countPlantypeWi ? (
// <div className="column column-12">
// <p>
// {`${countPlantypeWi} ${
// countPlantypeWi === 1
// ? 'Co-waste incinerator'
// : 'Co-waste incinerator'
// }`}
// </p>
// </div>
// ) : (
// ''
// )}
// </div>
// ) : (
// ''
// )}

// {/* SITE POLLUTANT EMISSIONS */}
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Pollutant emissions</Header>
// </div>
// <div className="column column-12 description">
// {data.pollutants ? (
// <p>{data.pollutants}</p>
// ) : (
// <p>There are no data regarding the pollutants</p>
// )}
// </div>
// </div>
// {/* REGULATORY INFORMATION */}
// <div className="row mb-1-super mt-0-super">
// <div className="column column-12">
// <Header as="h3">Regulatory information</Header>
// </div>
// <div className="column column-12">
// {data.Site_reporting_year ? (
// <p>
// Inspections in {data.Site_reporting_year}:{' '}
// {data.numInspections || 0}
// </p>
// ) : (
// ''
// )}
// </div>
// </div>
// </div>
// );
// };

const View = (props) => {
const map = useRef();
const popup = useRef();
Expand Down
Loading

0 comments on commit 5149e3b

Please sign in to comment.