Skip to content

Commit

Permalink
#1189 - default page size to 10 to make full use of screen. do not sh…
Browse files Browse the repository at this point in the history
…ow sync fields in subject type show.
  • Loading branch information
petmongrels committed Apr 12, 2024
1 parent 98fb984 commit 8b12afe
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 122 deletions.
12 changes: 3 additions & 9 deletions src/adminApp/ApplicationMenu/ApplicationMenuList.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ const columns = [
defaultSort: "asc",
sorting: false,
field: "displayKey",
render: rowData => (
<a href={`#/appDesigner/applicationMenu/${rowData.id}/show`}>{rowData.displayKey}</a>
)
render: rowData => <a href={`#/appDesigner/applicationMenu/${rowData.id}/show`}>{rowData.displayKey}</a>
},
{
title: "Type",
Expand Down Expand Up @@ -74,6 +72,7 @@ const ApplicationMenuList = ({ history, userInfo }) => {
columns={columns}
fetchData={fetchData}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: false,
debounceInterval: 500,
Expand All @@ -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"}
Expand Down
43 changes: 9 additions & 34 deletions src/adminApp/EncounterType/EncounterTypeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -45,9 +42,7 @@ const EncounterTypeList = ({ history, userInfo }) => {
title: "Name",
defaultSort: "asc",
sorting: false,
render: rowData => (
<a href={`#/appDesigner/encounterType/${rowData.id}/show`}>{rowData.name}</a>
)
render: rowData => <a href={`#/appDesigner/encounterType/${rowData.id}/show`}>{rowData.name}</a>
},
{
title: "Subject Type",
Expand All @@ -65,26 +60,14 @@ const EncounterTypeList = ({ history, userInfo }) => {
{
title: "Programs",
sorting: false,
render: rowData => (
<ShowPrograms
rowDetails={rowData}
program={program}
formMapping={formMappings}
setMapping={setFormMappings}
/>
)
render: rowData => <ShowPrograms rowDetails={rowData} program={program} formMapping={formMappings} setMapping={setFormMappings} />
},
{
title: "Encounter Form",
field: "formName",
sorting: false,
render: rowData => (
<a
href={`#/appdesigner/forms/${get(
findProgramEncounterForm(formMappings, rowData),
"formUUID"
)}`}
>
<a href={`#/appdesigner/forms/${get(findProgramEncounterForm(formMappings, rowData), "formUUID")}`}>
{get(findProgramEncounterForm(formMappings, rowData), "formName")}
</a>
)
Expand All @@ -94,12 +77,7 @@ const EncounterTypeList = ({ history, userInfo }) => {
field: "formName",
sorting: false,
render: rowData => (
<a
href={`#/appdesigner/forms/${get(
findProgramEncounterCancellationForm(formMappings, rowData),
"formUUID"
)}`}
>
<a href={`#/appdesigner/forms/${get(findProgramEncounterCancellationForm(formMappings, rowData), "formUUID")}`}>
{get(findProgramEncounterCancellationForm(formMappings, rowData), "formName")}
</a>
)
Expand All @@ -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)
Expand Down Expand Up @@ -140,8 +117,7 @@ const EncounterTypeList = ({ history, userInfo }) => {
icon: () => <Delete />,
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) {
Expand All @@ -160,16 +136,15 @@ const EncounterTypeList = ({ history, userInfo }) => {
<div className="container">
<div>
<div style={{ float: "right", right: "50px", marginTop: "15px" }}>
{hasEditPrivilege(userInfo) && (
<CreateComponent onSubmit={addNewConcept} name="New Encounter type" />
)}
{hasEditPrivilege(userInfo) && <CreateComponent onSubmit={addNewConcept} name="New Encounter type" />}
</div>
<AvniMaterialTable
title=""
ref={tableRef}
columns={columns}
fetchData={fetchData}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: true,
debounceInterval: 500,
Expand Down
30 changes: 6 additions & 24 deletions src/adminApp/Program/ProgramList.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,7 @@ const ProgramList = ({ history, userInfo }) => {
field: "formName",
sorting: false,
render: rowData => (
<a
href={`#/appdesigner/forms/${get(
findProgramEnrolmentForm(formMappings, rowData),
"formUUID"
)}`}
>
<a href={`#/appdesigner/forms/${get(findProgramEnrolmentForm(formMappings, rowData), "formUUID")}`}>
{get(findProgramEnrolmentForm(formMappings, rowData), "formName")}
</a>
)
Expand All @@ -71,12 +66,7 @@ const ProgramList = ({ history, userInfo }) => {
field: "formName",
sorting: false,
render: rowData => (
<a
href={`#/appdesigner/forms/${get(
findProgramExitForm(formMappings, rowData),
"formUUID"
)}`}
>
<a href={`#/appdesigner/forms/${get(findProgramExitForm(formMappings, rowData), "formUUID")}`}>
{get(findProgramExitForm(formMappings, rowData), "formName")}
</a>
)
Expand All @@ -86,13 +76,7 @@ const ProgramList = ({ history, userInfo }) => {
field: "colour",
type: "string",
sorting: false,
render: rowData => (
<div
style={{ width: "20px", height: "20px", border: "1px solid", background: rowData.colour }}
>
&nbsp;
</div>
)
render: rowData => <div style={{ width: "20px", height: "20px", border: "1px solid", background: rowData.colour }}>&nbsp;</div>
}
];

Expand All @@ -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)
Expand Down Expand Up @@ -154,9 +137,7 @@ const ProgramList = ({ history, userInfo }) => {
<div className="container">
<div>
<div style={{ float: "right", right: "50px", marginTop: "15px" }}>
{hasEditPrivilege(userInfo) && (
<CreateComponent onSubmit={addNewConcept} name="New Program" />
)}
{hasEditPrivilege(userInfo) && <CreateComponent onSubmit={addNewConcept} name="New Program" />}
</div>

<AvniMaterialTable
Expand All @@ -165,6 +146,7 @@ const ProgramList = ({ history, userInfo }) => {
columns={columns}
fetchData={fetchData}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: true,
debounceInterval: 500,
Expand Down
51 changes: 15 additions & 36 deletions src/adminApp/SubjectType/AdvancedSettingShow.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,18 @@ 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("");
const [concept2Name, setConcept2Name] = useState("");

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]);

Expand All @@ -38,52 +35,34 @@ export const AdvancedSettingShow = ({ locationTypes, subjectType }) => {
</div>
)}

{subjectType.validFirstNameFormat && (
<TextFormatFieldInShow label="Valid First Name" format={subjectType.validFirstNameFormat} />
)}
{subjectType.validFirstNameFormat && <TextFormatFieldInShow label="Valid First Name" format={subjectType.validFirstNameFormat} />}

<BooleanStatusInShow status={subjectType.allowMiddleName} label={"Allow Middle Name"} />

{subjectType.allowMiddleName && subjectType.validMiddleNameFormat && (
<TextFormatFieldInShow
label="Valid Middle Name"
format={subjectType.validMiddleNameFormat}
/>
<TextFormatFieldInShow label="Valid Middle Name" format={subjectType.validMiddleNameFormat} />
)}

<BooleanStatusInShow status={subjectType.lastNameOptional} label={"Last Name Optional"} />

{subjectType.validLastNameFormat && (
<TextFormatFieldInShow label="Valid Last Name" format={subjectType.validLastNameFormat} />
)}
{subjectType.validLastNameFormat && <TextFormatFieldInShow label="Valid Last Name" format={subjectType.validLastNameFormat} />}

<BooleanStatusInShow status={subjectType.allowEmptyLocation} label={"Allow Empty Location"} />
<BooleanStatusInShow status={subjectType.uniqueName} label={"Unique Name"} />
{subjectType.nameHelpText && (
<ShowLabelValue label={"Name help text"} value={subjectType.nameHelpText} />
{subjectType.nameHelpText && <ShowLabelValue label={"Name help text"} value={subjectType.nameHelpText} />}
{subjectType.type !== SubjectTypeType.User && (
<>
<BooleanStatusInShow status={subjectType.shouldSyncByLocation} label={"Sync By Location"} />
<BooleanStatusInShow status={subjectType.directlyAssignable} label={"Sync By Direct Assignment"} />
</>
)}
<BooleanStatusInShow status={subjectType.shouldSyncByLocation} label={"Sync By Location"} />
<BooleanStatusInShow
status={subjectType.directlyAssignable}
label={"Sync By Direct Assignment"}
/>
{!isEmpty(subjectType.settings) && (
<div>
<BooleanStatusInShow
status={subjectType.settings.displayRegistrationDetails}
label={"Display Registration Details"}
/>
<BooleanStatusInShow
status={subjectType.settings.displayPlannedEncounters}
label={"Display Planned Encounters"}
/>
<BooleanStatusInShow status={subjectType.settings.displayRegistrationDetails} label={"Display Registration Details"} />
<BooleanStatusInShow status={subjectType.settings.displayPlannedEncounters} label={"Display Planned Encounters"} />
</div>
)}
<ConceptSyncAttributesShow
subjectType={subjectType}
concept1Name={concept1Name}
concept2Name={concept2Name}
/>
<ConceptSyncAttributesShow subjectType={subjectType} concept1Name={concept1Name} concept2Name={concept2Name} />
</div>
);
};
14 changes: 3 additions & 11 deletions src/adminApp/SubjectType/SubjectTypesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,7 @@ const SubjectTypesList = ({ history, userInfo }) => {
render: rowData => {
const formName = get(findRegistrationForm(formMappings, rowData), "formName");
return hasEditPrivilege(userInfo) ? (
<a
href={`#/appdesigner/forms/${get(
findRegistrationForm(formMappings, rowData),
"formUUID"
)}`}
>
{formName}
</a>
<a href={`#/appdesigner/forms/${get(findRegistrationForm(formMappings, rowData), "formUUID")}`}>{formName}</a>
) : (
formName
);
Expand Down Expand Up @@ -114,9 +107,7 @@ const SubjectTypesList = ({ history, userInfo }) => {
<div className="container">
<div>
<div style={{ float: "right", right: "50px", marginTop: "15px" }}>
{hasEditPrivilege(userInfo) && (
<CreateComponent onSubmit={addNewConcept} name="New Subject type" />
)}
{hasEditPrivilege(userInfo) && <CreateComponent onSubmit={addNewConcept} name="New Subject type" />}
</div>

<AvniMaterialTable
Expand All @@ -125,6 +116,7 @@ const SubjectTypesList = ({ history, userInfo }) => {
columns={columns}
fetchData={fetchData}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: true,
debounceInterval: 500,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ const RelationshipTypeList = ({ userInfo }) => {
<div className="container">
{isIndividualSubjectTypeAvailable === "false" && (
<div style={{ color: "red", size: "10" }}>
Please click <a href={`#/appDesigner/subjectType/create`}>here</a> and create an
Person subject type to enable this screen.
Please click <a href={`#/appDesigner/subjectType/create`}>here</a> and create an Person subject type to enable this screen.
</div>
)}
{isIndividualSubjectTypeAvailable === "true" && (
Expand All @@ -99,6 +98,7 @@ const RelationshipTypeList = ({ userInfo }) => {
columns={columns}
fetchData={result}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: true,
debounceInterval: 500,
Expand Down
9 changes: 3 additions & 6 deletions src/formDesigner/components/Relationships/Relationships.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ const Relationships = ({ history, userInfo }) => {
const columns = [
{
title: "Name",
render: rowData =>
!rowData.voided && (
<a href={`#/appDesigner/relationship/${rowData.id}/show`}>{rowData.name}</a>
)
render: rowData => !rowData.voided && <a href={`#/appDesigner/relationship/${rowData.id}/show`}>{rowData.name}</a>
},
{
title: "Genders",
Expand Down Expand Up @@ -95,8 +92,7 @@ const Relationships = ({ history, userInfo }) => {
<div className="container">
{isIndividualSubjectTypeAvailable === "false" && (
<div style={{ color: "red", size: "10" }}>
Please click <a href={`#/appDesigner/subjectType/create`}>here</a> and create an
Person subject type to enable this screen.
Please click <a href={`#/appDesigner/subjectType/create`}>here</a> and create an Person subject type to enable this screen.
</div>
)}
{isIndividualSubjectTypeAvailable === "true" && (
Expand All @@ -113,6 +109,7 @@ const Relationships = ({ history, userInfo }) => {
columns={columns}
fetchData={result}
options={{
pageSize: 10,
addRowPosition: "first",
sorting: true,
debounceInterval: 500,
Expand Down

0 comments on commit 8b12afe

Please sign in to comment.