From 8b12afe5a1f48b71233f249e39411e9ab016dfcf Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Fri, 12 Apr 2024 14:52:45 +0530 Subject: [PATCH] #1189 - default page size to 10 to make full use of screen. do not show sync fields in subject type show. --- .../ApplicationMenu/ApplicationMenuList.js | 12 ++--- .../EncounterType/EncounterTypeList.js | 43 ++++------------ src/adminApp/Program/ProgramList.js | 30 +++-------- .../SubjectType/AdvancedSettingShow.js | 51 ++++++------------- src/adminApp/SubjectType/SubjectTypesList.js | 14 ++--- .../RelationshipTypes/RelationshipTypeList.js | 4 +- .../components/Relationships/Relationships.js | 9 ++-- 7 files changed, 41 insertions(+), 122 deletions(-) diff --git a/src/adminApp/ApplicationMenu/ApplicationMenuList.js b/src/adminApp/ApplicationMenu/ApplicationMenuList.js index e3a862e68..af9db954b 100644 --- a/src/adminApp/ApplicationMenu/ApplicationMenuList.js +++ b/src/adminApp/ApplicationMenu/ApplicationMenuList.js @@ -18,9 +18,7 @@ const columns = [ defaultSort: "asc", sorting: false, field: "displayKey", - render: rowData => ( - {rowData.displayKey} - ) + render: rowData => {rowData.displayKey} }, { title: "Type", @@ -74,6 +72,7 @@ const ApplicationMenuList = ({ history, userInfo }) => { columns={columns} fetchData={fetchData} options={{ + pageSize: 10, addRowPosition: "first", sorting: false, debounceInterval: 500, @@ -85,12 +84,7 @@ const ApplicationMenuList = ({ history, userInfo }) => { actions={ hasEditPrivilege(userInfo) && [ EntityListUtil.createEditAction(history, "applicationMenu", "application menu"), - EntityListUtil.createVoidAction( - tableRef, - "menuItem", - "application menu", - "displayKey" - ) + EntityListUtil.createVoidAction(tableRef, "menuItem", "application menu", "displayKey") ] } route={"/appdesigner/applicationMenu"} diff --git a/src/adminApp/EncounterType/EncounterTypeList.js b/src/adminApp/EncounterType/EncounterTypeList.js index 0e45af147..699da5c2f 100644 --- a/src/adminApp/EncounterType/EncounterTypeList.js +++ b/src/adminApp/EncounterType/EncounterTypeList.js @@ -5,10 +5,7 @@ import { Redirect, withRouter } from "react-router-dom"; import Box from "@material-ui/core/Box"; import { Title } from "react-admin"; import { ShowPrograms, ShowSubjectType } from "../WorkFlow/ShowSubjectType"; -import { - findProgramEncounterCancellationForm, - findProgramEncounterForm -} from "../domain/formMapping"; +import { findProgramEncounterCancellationForm, findProgramEncounterForm } from "../domain/formMapping"; import { CreateComponent } from "../../common/components/CreateComponent"; import AvniMaterialTable from "adminApp/components/AvniMaterialTable"; import { connect } from "react-redux"; @@ -45,9 +42,7 @@ const EncounterTypeList = ({ history, userInfo }) => { title: "Name", defaultSort: "asc", sorting: false, - render: rowData => ( - {rowData.name} - ) + render: rowData => {rowData.name} }, { title: "Subject Type", @@ -65,26 +60,14 @@ const EncounterTypeList = ({ history, userInfo }) => { { title: "Programs", sorting: false, - render: rowData => ( - - ) + render: rowData => }, { title: "Encounter Form", field: "formName", sorting: false, render: rowData => ( - + {get(findProgramEncounterForm(formMappings, rowData), "formName")} ) @@ -94,12 +77,7 @@ const EncounterTypeList = ({ history, userInfo }) => { field: "formName", sorting: false, render: rowData => ( - + {get(findProgramEncounterCancellationForm(formMappings, rowData), "formName")} ) @@ -111,8 +89,7 @@ const EncounterTypeList = ({ history, userInfo }) => { let apiUrl = "/web/encounterType?"; apiUrl += "size=" + query.pageSize; apiUrl += "&page=" + query.page; - if (!_.isEmpty(query.orderBy.field)) - apiUrl += `&sort=${query.orderBy.field},${query.orderDirection}`; + if (!_.isEmpty(query.orderBy.field)) apiUrl += `&sort=${query.orderBy.field},${query.orderDirection}`; http .get(apiUrl) .then(response => response.data) @@ -140,8 +117,7 @@ const EncounterTypeList = ({ history, userInfo }) => { icon: () => , tooltip: "Delete encounter type", onClick: (event, rowData) => { - const voidedMessage = - "Do you really want to delete the encounter type " + rowData.name + " ?"; + const voidedMessage = "Do you really want to delete the encounter type " + rowData.name + " ?"; if (window.confirm(voidedMessage)) { http.delete("/web/encounterType/" + rowData.id).then(response => { if (response.status === 200) { @@ -160,9 +136,7 @@ const EncounterTypeList = ({ history, userInfo }) => {
- {hasEditPrivilege(userInfo) && ( - - )} + {hasEditPrivilege(userInfo) && }
{ columns={columns} fetchData={fetchData} options={{ + pageSize: 10, addRowPosition: "first", sorting: true, debounceInterval: 500, diff --git a/src/adminApp/Program/ProgramList.js b/src/adminApp/Program/ProgramList.js index d0d605e1e..474156d17 100644 --- a/src/adminApp/Program/ProgramList.js +++ b/src/adminApp/Program/ProgramList.js @@ -56,12 +56,7 @@ const ProgramList = ({ history, userInfo }) => { field: "formName", sorting: false, render: rowData => ( - + {get(findProgramEnrolmentForm(formMappings, rowData), "formName")} ) @@ -71,12 +66,7 @@ const ProgramList = ({ history, userInfo }) => { field: "formName", sorting: false, render: rowData => ( - + {get(findProgramExitForm(formMappings, rowData), "formName")} ) @@ -86,13 +76,7 @@ const ProgramList = ({ history, userInfo }) => { field: "colour", type: "string", sorting: false, - render: rowData => ( -
-   -
- ) + render: rowData =>
 
} ]; @@ -106,8 +90,7 @@ const ProgramList = ({ history, userInfo }) => { let apiUrl = "/web/program?"; apiUrl += "size=" + query.pageSize; apiUrl += "&page=" + query.page; - if (!_.isEmpty(query.orderBy.field)) - apiUrl += `&sort=${query.orderBy.field},${query.orderDirection}`; + if (!_.isEmpty(query.orderBy.field)) apiUrl += `&sort=${query.orderBy.field},${query.orderDirection}`; http .get(apiUrl) .then(response => response.data) @@ -154,9 +137,7 @@ const ProgramList = ({ history, userInfo }) => {
- {hasEditPrivilege(userInfo) && ( - - )} + {hasEditPrivilege(userInfo) && }
{ columns={columns} fetchData={fetchData} options={{ + pageSize: 10, addRowPosition: "first", sorting: true, debounceInterval: 500, diff --git a/src/adminApp/SubjectType/AdvancedSettingShow.js b/src/adminApp/SubjectType/AdvancedSettingShow.js index b5425be85..253de8792 100644 --- a/src/adminApp/SubjectType/AdvancedSettingShow.js +++ b/src/adminApp/SubjectType/AdvancedSettingShow.js @@ -6,6 +6,7 @@ import http from "../../common/utils/httpClient"; import { ConceptSyncAttributesShow } from "./ConceptSyncAttributeShow"; import { ShowLabelValue } from "../../formDesigner/common/ShowLabelValue"; import { TextFormatFieldInShow } from "../../common/components/TextFormatFieldInShow"; +import { SubjectTypeType } from "./Types"; export const AdvancedSettingShow = ({ locationTypes, subjectType }) => { const [concept1Name, setConcept1Name] = useState(""); @@ -13,14 +14,10 @@ export const AdvancedSettingShow = ({ locationTypes, subjectType }) => { useEffect(() => { if (subjectType.syncRegistrationConcept1) { - http - .get(`/web/concept/${subjectType.syncRegistrationConcept1}`) - .then(res => setConcept1Name(_.get(res, "data.name"))); + http.get(`/web/concept/${subjectType.syncRegistrationConcept1}`).then(res => setConcept1Name(_.get(res, "data.name"))); } if (subjectType.syncRegistrationConcept2) { - http - .get(`/web/concept/${subjectType.syncRegistrationConcept2}`) - .then(res => setConcept2Name(_.get(res, "data.name"))); + http.get(`/web/concept/${subjectType.syncRegistrationConcept2}`).then(res => setConcept2Name(_.get(res, "data.name"))); } }, [subjectType.syncRegistrationConcept2, subjectType.syncRegistrationConcept1]); @@ -38,52 +35,34 @@ export const AdvancedSettingShow = ({ locationTypes, subjectType }) => {
)} - {subjectType.validFirstNameFormat && ( - - )} + {subjectType.validFirstNameFormat && } {subjectType.allowMiddleName && subjectType.validMiddleNameFormat && ( - + )} - {subjectType.validLastNameFormat && ( - - )} + {subjectType.validLastNameFormat && } - {subjectType.nameHelpText && ( - + {subjectType.nameHelpText && } + {subjectType.type !== SubjectTypeType.User && ( + <> + + + )} - - {!isEmpty(subjectType.settings) && (
- - + +
)} - +
); }; diff --git a/src/adminApp/SubjectType/SubjectTypesList.js b/src/adminApp/SubjectType/SubjectTypesList.js index 79b1bc1a2..50ec24b97 100644 --- a/src/adminApp/SubjectType/SubjectTypesList.js +++ b/src/adminApp/SubjectType/SubjectTypesList.js @@ -37,14 +37,7 @@ const SubjectTypesList = ({ history, userInfo }) => { render: rowData => { const formName = get(findRegistrationForm(formMappings, rowData), "formName"); return hasEditPrivilege(userInfo) ? ( - - {formName} - + {formName} ) : ( formName ); @@ -114,9 +107,7 @@ const SubjectTypesList = ({ history, userInfo }) => {
- {hasEditPrivilege(userInfo) && ( - - )} + {hasEditPrivilege(userInfo) && }
{ columns={columns} fetchData={fetchData} options={{ + pageSize: 10, addRowPosition: "first", sorting: true, debounceInterval: 500, diff --git a/src/formDesigner/components/RelationshipTypes/RelationshipTypeList.js b/src/formDesigner/components/RelationshipTypes/RelationshipTypeList.js index d5b65aa2e..cec8203af 100644 --- a/src/formDesigner/components/RelationshipTypes/RelationshipTypeList.js +++ b/src/formDesigner/components/RelationshipTypes/RelationshipTypeList.js @@ -81,8 +81,7 @@ const RelationshipTypeList = ({ userInfo }) => {
{isIndividualSubjectTypeAvailable === "false" && (
- Please click here and create an - Person subject type to enable this screen. + Please click here and create an Person subject type to enable this screen.
)} {isIndividualSubjectTypeAvailable === "true" && ( @@ -99,6 +98,7 @@ const RelationshipTypeList = ({ userInfo }) => { columns={columns} fetchData={result} options={{ + pageSize: 10, addRowPosition: "first", sorting: true, debounceInterval: 500, diff --git a/src/formDesigner/components/Relationships/Relationships.js b/src/formDesigner/components/Relationships/Relationships.js index 6e469f699..76fa095fa 100644 --- a/src/formDesigner/components/Relationships/Relationships.js +++ b/src/formDesigner/components/Relationships/Relationships.js @@ -22,10 +22,7 @@ const Relationships = ({ history, userInfo }) => { const columns = [ { title: "Name", - render: rowData => - !rowData.voided && ( - {rowData.name} - ) + render: rowData => !rowData.voided && {rowData.name} }, { title: "Genders", @@ -95,8 +92,7 @@ const Relationships = ({ history, userInfo }) => {
{isIndividualSubjectTypeAvailable === "false" && (
- Please click here and create an - Person subject type to enable this screen. + Please click here and create an Person subject type to enable this screen.
)} {isIndividualSubjectTypeAvailable === "true" && ( @@ -113,6 +109,7 @@ const Relationships = ({ history, userInfo }) => { columns={columns} fetchData={result} options={{ + pageSize: 10, addRowPosition: "first", sorting: true, debounceInterval: 500,