-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #822 from palladiumkenya/feat/new-reporting-layer
new prod updates
- Loading branch information
Showing
56 changed files
with
4,860 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityArtHtsMnchAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityArtHtsMnch.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityTxcurr()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityTxcurr = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_ART_HTS_MNCH_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
}; | ||
const response = await getAll('common/facilityArtHtsMnch', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_ART_HTS_MNCH_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityByInfrastructureActions = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityByInfrastructure.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityByInfrastructure()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityByInfrastructure = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityByInfrastructure', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
34 changes: 34 additions & 0 deletions
34
src/actions/RR/hisFacilityByInfrastructureCountyActions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityByInfrastructureCountyActions = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityByInfrastructureCounty.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityByInfrastructure()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityByInfrastructure = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_COUNTY_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityByInfrastructureCounty', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_BY_INFRASTRUCTURE_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityLevelByCountyAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityStatusByCounty.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityLevelByCounty()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityLevelByCounty = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_COUNTY_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityLevelByOwnershipCounty', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityLevelByPartnerAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityStatusByPartner.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityLevelByPartner()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityLevelByPartner = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_PARTNER_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityLevelByOwnershipPartner', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_LEVEL_BY_PARTNER_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityLinelistAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityLinelist.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityLinelist()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityLinelist = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_LINELIST_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityLinelist', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_LINELIST_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityStatusAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityStatus.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityStatus()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityStatus = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityStatus', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityStatusByCountyAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityStatusByPartner.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityStatusByPartner()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityStatusByPartner = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_COUNTY_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
}; | ||
const response = await getAll('common/facilityStatusByCounty', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_COUNTY_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityStatusByPartnerAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityStatusByPartner.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityStatusByPartner()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityStatusByPartner = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_PARTNER_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
year: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("YYYY") : '', | ||
month: getState().filters.fromDate ? moment(getState().filters.fromDate, "MMM YYYY").format("MM") : '', | ||
}; | ||
const response = await getAll('common/facilityStatusByPartner', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_STATUS_BY_PARTNER_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../constants'; | ||
import * as actionTypes from '../types'; | ||
import { getAll } from '../../views/Shared/Api'; | ||
|
||
export const loadHisFacilityTxcurrAction = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().hisFacilityTxcurr.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.currentPage !== PAGES.rr) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchHisFacilityTxcurr()); | ||
} | ||
} | ||
|
||
export const fetchHisFacilityTxcurr = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.HIS_FACILITY_TXCURR_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
}; | ||
const response = await getAll('common/facilityTxcurr', params); | ||
dispatch({ type: actionTypes.HIS_FACILITY_TXCURR_FETCH, payload: { filtered: getState().filters.filtered, list: response }}); | ||
}; |
Oops, something went wrong.