From 5325f64e4f8662e9b385865dbdab5cf9c3a91877 Mon Sep 17 00:00:00 2001 From: Benjamin Newman Date: Wed, 10 Jan 2024 10:32:05 -0800 Subject: [PATCH] feat(select): only return all providers if opt in --- packages/select/src/AvProviderSelect.js | 27 ++++++++++++++++++++ packages/select/src/SelectField.js | 1 + packages/select/src/resources.d.ts | 24 +++++++++++------ packages/select/src/resources.js | 11 ++------ packages/select/tests/ResourceSelect.test.js | 1 + packages/select/tests/Select.test.js | 1 + packages/select/tests/SelectField.test.js | 1 + 7 files changed, 49 insertions(+), 17 deletions(-) create mode 100644 packages/select/src/AvProviderSelect.js diff --git a/packages/select/src/AvProviderSelect.js b/packages/select/src/AvProviderSelect.js new file mode 100644 index 0000000000..bd4b7464ba --- /dev/null +++ b/packages/select/src/AvProviderSelect.js @@ -0,0 +1,27 @@ +import React from 'react'; +import PropTypes from 'prop-types'; +import { avProvidersApi } from '@availity/api-axios'; +import ResourceSelect from './ResourceSelect'; + +const ProviderSelect = ResourceSelect.create({ + resource: avProvidersApi, + labelKey: 'uiDisplayName', + valueKey: 'npi', + requiredParams: ['customerId'], + watchParams: ['customerId'], +}); + +const AvProviderSelect = ({ searchAll = false, parameters: originalParams, ...props }) => { + let parameters = originalParams; + if (!searchAll) { + parameters = { ...originalParams, role: 'OFFICE' }; + } + return ; +}; + +AvProviderSelect.propTypes = { + searchAll: PropTypes.bool, + parameters: PropTypes.object(), +}; + +export default AvProviderSelect; diff --git a/packages/select/src/SelectField.js b/packages/select/src/SelectField.js index 4061c578b9..4b8d6f8a85 100644 --- a/packages/select/src/SelectField.js +++ b/packages/select/src/SelectField.js @@ -2,6 +2,7 @@ import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import { FormText } from 'reactstrap'; +// eslint-disable-next-line import/no-unresolved import { FormGroup, Feedback, Label } from '@availity/form'; import Select from './Select'; diff --git a/packages/select/src/resources.d.ts b/packages/select/src/resources.d.ts index 390d1eb854..18b7a97e0f 100644 --- a/packages/select/src/resources.d.ts +++ b/packages/select/src/resources.d.ts @@ -10,7 +10,7 @@ export { AvOrganizationSelect, AvRegionSelect }; type PrebuiltResourceSelectProps< Option, IsMulti extends boolean, - Group extends GroupBase