diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..da93b2d --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,23 @@ +name: Sonar CI pipeline +on: + push: + branches: + - main + - 'release/**' + - develop + - 'feature/**' + pull_request: + types: [opened, synchronize, reopened] +jobs: + sonarcloud: + name: SonarCloud + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: SonarCloud Scan + uses: SonarSource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..fb4fb7d --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=openimis_openimis-fe-contract_js +sonar.organization=openimis-1 +sonar.projectName=openimis-fe-contract_js + +sonar.sources=src +sonar.sourceEncoding=UTF-8 diff --git a/src/components/ContractContributionDetailsFilter.js b/src/components/ContractContributionDetailsFilter.js index 7d4a4c6..1ae4326 100644 --- a/src/components/ContractContributionDetailsFilter.js +++ b/src/components/ContractContributionDetailsFilter.js @@ -18,7 +18,12 @@ const styles = theme => ({ class ContractContributionDetailsFilter extends Component { _filterValue = k => { const { filters } = this.props; - return !!filters[k] ? filters[k].value : null + return !!filters[k] ? filters[k].value : null; + } + + _filterTextFieldValue = (key) => { + const { filters } = this.props; + return !!filters[key] ? filters[key].value : ""; } render() { @@ -29,7 +34,7 @@ class ContractContributionDetailsFilter extends Component { onChangeFilters([{ id: 'contractDetails_Insuree_ChfId', value: v, @@ -69,6 +74,7 @@ class ContractContributionDetailsFilter extends Component { pubRef="product.ProductPicker" withNull={true} label={formatMessage(intl, "contract", "benefitPlan")} + value={this._filterValue('contributionPlan_BenefitPlan_Id')} onChange={v => onChangeFilters([{ id: 'contributionPlan_BenefitPlan_Id', value: v, diff --git a/src/components/ContractDetailsFilter.js b/src/components/ContractDetailsFilter.js index 67d07e8..ad66231 100644 --- a/src/components/ContractDetailsFilter.js +++ b/src/components/ContractDetailsFilter.js @@ -18,7 +18,12 @@ const styles = theme => ({ class ContractDetailsFilter extends Component { _filterValue = k => { const { filters } = this.props; - return !!filters[k] ? filters[k].value : null + return !!filters[k] ? filters[k].value : null; + } + + _filterTextFieldValue = (key) => { + const { filters } = this.props; + return !!filters[key] ? filters[key].value : ""; } render() { @@ -29,7 +34,7 @@ class ContractDetailsFilter extends Component { onChangeFilters([{ id: 'insuree_ChfId', value: v, diff --git a/src/components/ContractFilter.js b/src/components/ContractFilter.js index 821bc1a..a02d034 100644 --- a/src/components/ContractFilter.js +++ b/src/components/ContractFilter.js @@ -27,7 +27,12 @@ class ContractFilter extends Component { _filterValue = k => { const { filters } = this.props; - return !!filters[k] ? filters[k].value : null + return !!filters[k] ? filters[k].value : null; + } + + _filterTextFieldValue = (key) => { + const { filters } = this.props; + return !!filters[key] ? filters[key].value : ""; } _onChangeFilter = (k, v) => { @@ -68,7 +73,7 @@ class ContractFilter extends Component { this._onChangeStringFilter('code', v, CONTAINS_LOOKUP)} /> @@ -139,7 +144,7 @@ class ContractFilter extends Component { this._onChangeStringFilter('paymentReference', v, CONTAINS_LOOKUP)} /> diff --git a/src/components/ContractForm.js b/src/components/ContractForm.js index 560a6fb..c38da14 100644 --- a/src/components/ContractForm.js +++ b/src/components/ContractForm.js @@ -94,7 +94,12 @@ class ContractForm extends Component { this.setState((state, props) => ({ contract: { ...state.contract, - policyHolder: props.policyHolders.find((v) => decodeId(v.id) === props.predefinedPolicyHolderId) + policyHolder: props.predefinedPolicyHolderId + ? props.policyHolders.find((v) => decodeId(v.id) === props.predefinedPolicyHolderId) + : ( props.contract.policyHolder + ? props.policyHolders.find((v) => decodeId(v.id) === decodeId(props.contract.policyHolder.id)) + : null + ) } })); }