Skip to content

Commit

Permalink
ISNE-106 Modification in filter for national n dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmoy-eGov committed May 13, 2024
1 parent fe1e85d commit 5f8a63a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const getRequest = (type, code, requestDate, filters, moduleLevel = "", addlFilt
acc[curr] = newFilter[curr];
return acc;
}, {});

requestDate.interval = JSON.parse(sessionStorage.getItem("customDateFilter")).filterType;
return {
aggregationRequestDto: {
visualizationType: type.toUpperCase(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SelectCustomDateRange = ({ values, onFilterChange, t }) => {
"interval": "",
"title": ""
});
const [rangeType, setRangeType] = useState("week");
const [rangeType, setRangeType] = useState("year");
const [currentYear, setCurrentYear] = useState(new Date().getFullYear());
const [startYearRange,setStartYearRange] = useState(new Date().getFullYear());
const [monthCurrentYear, setMonthCurrentYear] = useState(new Date().getFullYear());
Expand Down Expand Up @@ -56,6 +56,10 @@ const SelectCustomDateRange = ({ values, onFilterChange, t }) => {
selection.startDate = new Date(tempStartYear,months[tempStartMonth], 1);
selection.endDate = new Date(tempEndYear,months[tempEndMonth]+1, 0);
}
let customDateFilter = {
filterType : rangeType
}
sessionStorage.setItem("customDateFilter",JSON.stringify(customDateFilter))
setTimeout(() => {
setIsModalOpen(false);
setSelectionRange(selection);
Expand Down Expand Up @@ -114,6 +118,10 @@ const SelectCustomDateRange = ({ values, onFilterChange, t }) => {
setCalenderDataStartDate(selection.startDate);
}else if (calenderDataStartDate && !calenderDataEndDate){
setCalenderDataStartDate(selection.endDate);
let customDateFilter = {
filterType : rangeType
}
sessionStorage.setItem("customDateFilter",JSON.stringify(customDateFilter))
setTimeout(() => {
setIsModalOpen(false);
setSelectionRange(selection);
Expand Down Expand Up @@ -263,13 +271,13 @@ const SelectCustomDateRange = ({ values, onFilterChange, t }) => {
<div className="options-card" style={{ overflow: "visible", width: "unset", maxWidth: "unset" }}>
<div className="rdrDateRangePickerWrapper pickerShadow">
<div className="rdrDefinedRangesWrapper" style={{width:"110px"}}>
<button type="button" className="rdrStaticRange" onClick={() => { selectRangeType("week") }}>
<button type="button" className="rdrStaticRange" style={{fontWeight:rangeType==="week"?"bold":"normal"}} onClick={() => { selectRangeType("week") }}>
<span tabindex="-1" className="rdrStaticRangeLabel">By Weeks</span>
</button>
<button type="button" className="rdrStaticRange" onClick={() => { selectRangeType("month") }}>
<button type="button" className="rdrStaticRange" style={{fontWeight:rangeType==="month"?"bold":"normal"}} onClick={() => { selectRangeType("month") }}>
<span tabindex="-1" className="rdrStaticRangeLabel">By Months</span>
</button>
<button type="button" className="rdrStaticRange" onClick={() => { selectRangeType("year") }}>
<button type="button" className="rdrStaticRange" style={{fontWeight:rangeType==="year"?"bold":"normal"}} onClick={() => { selectRangeType("year") }}>
<span tabindex="-1" className="rdrStaticRangeLabel">By Years</span>
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@egovernments/digit-ui-module-common": "1.7.3",
"@egovernments/digit-ui-module-core": "1.7.2",
"@upyog/digit-ui-module-engagement": "1.7.2",
"@egovernments/digit-ui-module-dss": "1.7.4",
"@egovernments/digit-ui-module-dss": "1.7.5",
"@egovernments/digit-ui-module-fsm": "1.7.4",
"@upyog/digit-ui-module-hrms": "1.7.3",
"@upyog/digit-ui-module-mcollect": "1.7.3",
Expand Down

0 comments on commit 5f8a63a

Please sign in to comment.