-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5f21727
commit 7c69f32
Showing
8 changed files
with
132 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
graphql, | ||
formatQuery, | ||
} from '@openimis/fe-core'; | ||
import { ACTION_TYPE } from './reducer'; | ||
|
||
const DEDUPLICATION_SUMMARY_FULL_PROJECTION = () => [ | ||
'rows {count, columnValues}', | ||
]; | ||
|
||
// eslint-disable-next-line import/prefer-default-export | ||
export function fetchDeduplicationSummary(params) { | ||
const payload = formatQuery('beneficiaryDeduplicationSummary', params, DEDUPLICATION_SUMMARY_FULL_PROJECTION()); | ||
return graphql(payload, ACTION_TYPE.GET_DEDUPLICATION_SUMMARY); | ||
} |
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
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
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,56 @@ | ||
// Disabled due to consistency with other modules | ||
/* eslint-disable default-param-last */ | ||
|
||
import { | ||
parseData, | ||
formatServerError, | ||
} from '@openimis/fe-core'; | ||
import { | ||
ERROR, REQUEST, SUCCESS, | ||
} from './util/action-type'; | ||
|
||
export const ACTION_TYPE = { | ||
GET_DEDUPLICATION_SUMMARY: 'DEDUPLICATION_GET_DEDUPLICATION_SUMMARY', | ||
}; | ||
|
||
function reducer( | ||
state = { | ||
submittingMutation: false, | ||
mutation: {}, | ||
fetchingSummary: false, | ||
errorSummary: null, | ||
fetchedSummary: false, | ||
summary: [], | ||
}, | ||
action, | ||
) { | ||
switch (action.type) { | ||
case REQUEST(ACTION_TYPE.GET_DEDUPLICATION_SUMMARY): | ||
return { | ||
...state, | ||
fetchingSummary: true, | ||
fetchedSummary: false, | ||
summary: null, | ||
}; | ||
case SUCCESS(ACTION_TYPE.GET_DEDUPLICATION_SUMMARY): | ||
return { | ||
...state, | ||
fetchingSummary: false, | ||
fetchedSummary: true, | ||
summary: action.payload.data.beneficiaryDeduplicationSummary.rows?.map((row) => ({ | ||
...row, | ||
})), | ||
errorSummary: null, | ||
}; | ||
case ERROR(ACTION_TYPE.GET_DEDUPLICATION_SUMMARY): | ||
return { | ||
...state, | ||
fetchingSummary: false, | ||
errorSummary: formatServerError(action.payload), | ||
}; | ||
default: | ||
return state; | ||
} | ||
} | ||
|
||
export default reducer; |
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,5 @@ | ||
export const REQUEST = (actionTypeName) => `${actionTypeName}_REQ`; | ||
export const SUCCESS = (actionTypeName) => `${actionTypeName}_RESP`; | ||
export const ERROR = (actionTypeName) => `${actionTypeName}_ERR`; | ||
export const CLEAR = (actionTypeName) => `${actionTypeName}_CLEAR`; | ||
export const VALID = (actionTypeName) => `${actionTypeName}_VALID`; |
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,24 @@ | ||
export const defaultPageStyles = (theme) => ({ | ||
page: theme.page, | ||
}); | ||
|
||
export const defaultFilterStyles = (theme) => ({ | ||
form: { | ||
padding: 0, | ||
}, | ||
item: { | ||
padding: theme.spacing(1), | ||
}, | ||
}); | ||
|
||
export const defaultHeadPanelStyles = (theme) => ({ | ||
tableTitle: theme.table.title, | ||
item: theme.paper.item, | ||
fullHeight: { | ||
height: '100%', | ||
}, | ||
}); | ||
|
||
export const defaultDialogStyles = (theme) => ({ | ||
item: theme.paper.item, | ||
}); |