add filters conditions

master
g 3 years ago
parent 752c7249af
commit d110334506

@ -227,7 +227,7 @@ export default function Regions({ mapOptions, onMapOptionClick }) {
const generatePopup = (info) => { const generatePopup = (info) => {
// console.log(info) console.log(info)
const [currentTech, currentSupport, currentYear, currentParameter] = filterFilters.map(f => f.options.find(o => o.checked)).concat(paintFilters[0].options.find(o => o.checked)) const [currentTech, currentSupport, currentYear, currentParameter] = filterFilters.map(f => f.options.find(o => o.checked)).concat(paintFilters[0].options.find(o => o.checked))
return ( return (
<div> <div>
@ -600,10 +600,20 @@ export default function Regions({ mapOptions, onMapOptionClick }) {
className="peer h-4 w-4 rounded-full border-gray-400 text-indigo-600 focus:ring-indigo-500 disabled:text-gray-400 disabled:border-gray-200" className="peer h-4 w-4 rounded-full border-gray-400 text-indigo-600 focus:ring-indigo-500 disabled:text-gray-400 disabled:border-gray-200"
onChange={handleFilterToggle} onChange={handleFilterToggle}
disabled={ disabled={
paintFilters[0].options.find(o => o.checked).value == "power_fact_mw" && section.id == "year" && option.value > 2022 || (paintFilters[0].options.find(o => o.checked).value == "power_fact_mw" &&
paintFilters[0].options.find(o => o.checked).value == "power_plan_mw" && section.id == "year" && option.value < 2022 ? section.id == "year" && option.value > 2022) ||
true (paintFilters[0].options.find(o => o.checked).value == "power_plan_mw" &&
: false section.id == "year" && option.value <= 2022) ||
(paintFilters[0].options.find(o => o.checked).value == "power_opw_mw" &&
section.id == "year" && option.value >= 2024) ||
(paintFilters[0].options.find(o => o.checked).value == "generation_mwh" &&
section.id == "year" && option.value >= 2023) ||
(paintFilters[0].options.find(o => o.checked).value == "res_share_generation" &&
(section.id == "year" && (option.value <= 2016 || option.value >= 2023) || section.id == "id_tech" && option.value != 5 || section.id == "id_support" && option.value != 4)) ||
(paintFilters[0].options.find(o => o.checked).value == "res_share_power" &&
(section.id == "year" && (option.value <= 2016 || option.value >= 2023) || section.id == "id_tech" && option.value != 5 || section.id == "id_support" && option.value != 4))
? true
: false
} }
/> />
<label <label

Loading…
Cancel
Save