-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
OEUI-311: Support Order Reason for Lab Orders
- Loading branch information
1 parent
216ca90
commit 7fbadc2
Showing
14 changed files
with
855 additions
and
336 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
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,9 @@ | ||
import axiosInstance from '../config'; | ||
|
||
const fetchOrderReasons = conceptUUID => ({ | ||
type: 'FETCH_ORDER_REASONS', | ||
payload: axiosInstance.get(`/concept/${conceptUUID}`), | ||
|
||
}); | ||
|
||
export default fetchOrderReasons; |
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,59 @@ | ||
import axiosInstance from '../config'; | ||
import loading from "./loading"; | ||
import networkError from "./networkError"; | ||
import { | ||
FETCH_ORDER_REASONS_GLOBAL_PROPERTY_FAILURE, | ||
FETCH_ORDER_REASONS_GLOBAL_PROPERTY_SUCCESS, | ||
} from "./actionTypes"; | ||
import fetchOrderReasons from "./fetchOrderReasons"; | ||
|
||
|
||
export const fetchOrderReasonsGlobalPropertySuccess = value => ({ | ||
type: FETCH_ORDER_REASONS_GLOBAL_PROPERTY_SUCCESS, | ||
payload: value, | ||
}); | ||
|
||
export const fetchOrderReasonsGlobalPropertyFailure = error => ({ | ||
type: FETCH_ORDER_REASONS_GLOBAL_PROPERTY_FAILURE, | ||
payload: error, | ||
}); | ||
|
||
|
||
export const fetchOrderReasonsGlobalProperty = () => (dispatch) => { | ||
dispatch(loading('FETCH_ORDER_REASONS_GLOBAL_PROPERTY', true)); | ||
return axiosInstance.get(`systemsetting?v=custom:(value)&q=orderentryowa.orderReasonsMap`) | ||
.then((response) => { | ||
const orderReasonsMap = {}; | ||
const reasonSetUuids = []; | ||
|
||
if (response.data.results.length > 0) { | ||
response.data.results[0].value.split('|').forEach((element) => { | ||
const orderables = element.split('=')[0]; | ||
const reasonSetUuid = element.split('=')[1]; | ||
orderables.split(',').forEach((orderable) => { | ||
orderReasonsMap[orderable] = { | ||
setUuid: reasonSetUuid, | ||
members: [], | ||
}; | ||
}); | ||
if (!reasonSetUuids.includes(reasonSetUuid)) { | ||
reasonSetUuids.push(reasonSetUuid); | ||
} | ||
}); | ||
|
||
dispatch(fetchOrderReasonsGlobalPropertySuccess(orderReasonsMap)); | ||
|
||
reasonSetUuids.forEach((uuid) => { | ||
dispatch(fetchOrderReasons(uuid)); | ||
}); | ||
dispatch(loading('FETCH_ORDER_REASON_GLOBAL_PROPERTY', false)); | ||
} | ||
}).catch((error) => { | ||
if (!error.response) dispatch(networkError('Network error occurred')); | ||
else dispatch(fetchOrderReasonsGlobalPropertyFailure(error)); | ||
dispatch(loading('FETCH_ORDER_REASONS_GLOBAL_PROPERTY', false)); | ||
}); | ||
}; | ||
|
||
|
||
export default fetchOrderReasonsGlobalProperty; |
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
Oops, something went wrong.