-
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 #823 from palladiumkenya/prod
prod to master
- Loading branch information
Showing
91 changed files
with
5,517 additions
and
635 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,36 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../../constants'; | ||
import * as actionTypes from '../../types'; | ||
import { getAll } from '../../../views/Shared/Api'; | ||
|
||
export const loadAlhivOnArtByAgeSex = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().otzAlhivOnArtByAgeSex.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.ctTab !== 'otz' && | ||
getState().ui.currentPage !== PAGES.ct) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchAlhivOnArtByAgeSex()); | ||
} | ||
} | ||
|
||
export const fetchAlhivOnArtByAgeSex = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.CT_OTZ_ALHIV_ON_ART_BY_AGE_SEX_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
project: getState().filters.projects, | ||
gender: getState().filters.genders, | ||
datimAgeGroup: getState().filters.datimAgeGroups, | ||
}; | ||
const response = await getAll('care-treatment/getAlhivOnArtByAgeSex', params); | ||
dispatch({ type: actionTypes.CT_OTZ_ALHIV_ON_ART_BY_AGE_SEX_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,36 @@ | ||
import moment from 'moment'; | ||
import { CACHING, PAGES } from '../../../constants'; | ||
import * as actionTypes from '../../types'; | ||
import { getAll } from '../../../views/Shared/Api'; | ||
|
||
export const loadOtzTotalWithDurableVLResults = () => async (dispatch, getState) => { | ||
const diffInMinutes = moment().diff( | ||
moment(getState().otzTotalWithDurableVlResults.lastFetch), | ||
'minutes' | ||
); | ||
if (getState().ui.ctTab !== 'otz' && | ||
getState().ui.currentPage !== PAGES.ct) { | ||
return; | ||
} | ||
else if ((diffInMinutes < CACHING.LONG) && getState().filters.filtered === false) { | ||
return; | ||
} else { | ||
await dispatch(fetchOtzTotalWithDurableVLResults()); | ||
} | ||
} | ||
|
||
export const fetchOtzTotalWithDurableVLResults = () => async (dispatch, getState) => { | ||
dispatch({ type: actionTypes.CT_OTZ_TOTAL_WITH_DURABLE_VL_RESULTS_REQUEST }); | ||
const params = { | ||
county: getState().filters.counties, | ||
subCounty: getState().filters.subCounties, | ||
facility: getState().filters.facilities, | ||
partner: getState().filters.partners, | ||
agency: getState().filters.agencies, | ||
project: getState().filters.projects, | ||
gender: getState().filters.genders, | ||
datimAgeGroup: getState().filters.datimAgeGroups | ||
}; | ||
const response = await getAll('care-treatment/getOtzTotalWithDurableVl', params); | ||
dispatch({ type: actionTypes.CT_OTZ_TOTAL_WITH_DURABLE_VL_RESULTS_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 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 }}); | ||
}; |
Oops, something went wrong.