@openmrs/esm-fast-data-entry-app 1.0.0-pre.59 → 1.0.1-pre.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/.husky/pre-push +0 -0
  2. package/.tx/config +9 -0
  3. package/.yarn/plugins/@yarnpkg/plugin-version.cjs +550 -0
  4. package/.yarn/versions/45b499b6.yml +0 -0
  5. package/dist/openmrs-esm-fast-data-entry-app.js +1 -1
  6. package/jest.config.json +20 -18
  7. package/package.json +31 -38
  8. package/src/FormBootstrap.tsx +9 -2
  9. package/src/Root.tsx +12 -5
  10. package/src/add-group-modal/AddGroupModal.tsx +209 -0
  11. package/src/add-group-modal/styles.scss +35 -0
  12. package/src/context/FormWorkflowContext.tsx +1 -1
  13. package/src/context/FormWorkflowReducer.ts +1 -1
  14. package/src/context/GroupFormWorkflowContext.tsx +141 -0
  15. package/src/context/GroupFormWorkflowReducer.ts +272 -0
  16. package/src/empty-state/EmptyState.tsx +12 -8
  17. package/src/form-entry-workflow/FormEntryWorkflow.tsx +23 -13
  18. package/src/{form-review-card → form-entry-workflow/form-review-card}/FormReviewCard.tsx +3 -3
  19. package/src/{form-review-card → form-entry-workflow/form-review-card}/index.ts +0 -0
  20. package/src/form-entry-workflow/form-review-card/styles.scss +39 -0
  21. package/src/{patient-banner → form-entry-workflow/patient-banner}/PatientBanner.test.tsx +0 -0
  22. package/src/{patient-banner → form-entry-workflow/patient-banner}/PatientBanner.tsx +3 -3
  23. package/src/{patient-banner → form-entry-workflow/patient-banner}/index.ts +0 -0
  24. package/src/{patient-banner → form-entry-workflow/patient-banner}/styles.scss +8 -7
  25. package/src/{patient-search-header → form-entry-workflow/patient-search-header}/PatientSearchHeader.tsx +13 -11
  26. package/src/{patient-search-header → form-entry-workflow/patient-search-header}/index.ts +0 -0
  27. package/src/form-entry-workflow/patient-search-header/styles.scss +22 -0
  28. package/src/form-entry-workflow/styles.scss +14 -13
  29. package/src/{workflow-review → form-entry-workflow/workflow-review}/WorkflowReview.tsx +6 -6
  30. package/src/{workflow-review → form-entry-workflow/workflow-review}/index.ts +0 -0
  31. package/src/{workflow-review → form-entry-workflow/workflow-review}/styles.scss +0 -0
  32. package/src/forms-app-menu-link.tsx +2 -2
  33. package/src/forms-page/FormsPage.tsx +55 -21
  34. package/src/{forms-table → forms-page/forms-table}/FormsTable.tsx +14 -6
  35. package/src/{forms-table → forms-page/forms-table}/index.ts +0 -0
  36. package/src/{forms-table → forms-page/forms-table}/styles.scss +0 -0
  37. package/src/forms-page/styles.scss +5 -5
  38. package/src/group-form-entry-workflow/GroupFormEntryWorkflow.tsx +413 -0
  39. package/src/group-form-entry-workflow/group-banner/GroupBanner.test.tsx +9 -0
  40. package/src/group-form-entry-workflow/group-banner/GroupBanner.tsx +45 -0
  41. package/src/group-form-entry-workflow/group-banner/index.ts +3 -0
  42. package/src/group-form-entry-workflow/group-banner/styles.scss +60 -0
  43. package/src/group-form-entry-workflow/group-search/CompactGroupResults.tsx +106 -0
  44. package/src/group-form-entry-workflow/group-search/CompactGroupSearch.tsx +63 -0
  45. package/src/group-form-entry-workflow/group-search/GroupSearch.tsx +93 -0
  46. package/src/group-form-entry-workflow/group-search/compact-group-result.scss +64 -0
  47. package/src/group-form-entry-workflow/group-search/compact-group-search.scss +35 -0
  48. package/src/group-form-entry-workflow/group-search/group-search.scss +94 -0
  49. package/src/group-form-entry-workflow/group-search/mock-group-data.ts +79 -0
  50. package/src/group-form-entry-workflow/group-search/useGroupSearch.ts +14 -0
  51. package/src/group-form-entry-workflow/group-search-header/GroupSearchHeader.tsx +42 -0
  52. package/src/group-form-entry-workflow/group-search-header/index.ts +3 -0
  53. package/src/{patient-search-header → group-form-entry-workflow/group-search-header}/styles.scss +5 -6
  54. package/src/group-form-entry-workflow/index.ts +3 -0
  55. package/src/group-form-entry-workflow/styles.scss +86 -0
  56. package/src/hooks/useKeyPress.ts +31 -0
  57. package/src/hooks/usePostCohort.ts +18 -0
  58. package/src/index.ts +5 -1
  59. package/src/patient-card/PatientCard.tsx +11 -9
  60. package/src/patient-card/styles.scss +9 -8
  61. package/translations/en.json +30 -1
  62. package/.github/pull_request_template.md +0 -18
  63. package/.github/workflows/node.js.yml +0 -121
  64. package/dist/132.js +0 -1
  65. package/dist/187.js +0 -1
  66. package/dist/247.js +0 -1
  67. package/dist/294.js +0 -2
  68. package/dist/294.js.LICENSE.txt +0 -14
  69. package/dist/312.js +0 -1
  70. package/dist/412.js +0 -1
  71. package/dist/536.js +0 -2
  72. package/dist/536.js.LICENSE.txt +0 -8
  73. package/dist/574.js +0 -1
  74. package/dist/592.js +0 -1
  75. package/dist/595.js +0 -2
  76. package/dist/595.js.LICENSE.txt +0 -1
  77. package/dist/776.js +0 -1
  78. package/dist/804.js +0 -1
  79. package/dist/880.js +0 -2
  80. package/dist/880.js.LICENSE.txt +0 -20
  81. package/dist/906.js +0 -1
  82. package/dist/935.js +0 -2
  83. package/dist/935.js.LICENSE.txt +0 -23
  84. package/dist/990.js +0 -1
  85. package/dist/openmrs-esm-fast-data-entry-app.js.buildmanifest.json +0 -433
  86. package/dist/openmrs-esm-fast-data-entry-app.old +0 -1
  87. package/src/form-review-card/styles.scss +0 -38
@@ -1,26 +1,28 @@
1
- import { Add20, Close20 } from "@carbon/icons-react";
1
+ import { Add, Close } from "@carbon/react/icons";
2
2
  import {
3
3
  ExtensionSlot,
4
4
  interpolateUrl,
5
5
  navigate,
6
6
  } from "@openmrs/esm-framework";
7
- import { Button } from "carbon-components-react";
7
+ import { Button } from "@carbon/react";
8
8
  import React, { useContext } from "react";
9
9
  import { Link } from "react-router-dom";
10
- import FormWorkflowContext from "../context/FormWorkflowContext";
10
+ import FormWorkflowContext from "../../context/FormWorkflowContext";
11
11
  import styles from "./styles.scss";
12
+ import { useTranslation } from "react-i18next";
12
13
 
13
14
  const PatientSearchHeader = () => {
14
15
  const { addPatient, workflowState, activeFormUuid } =
15
16
  useContext(FormWorkflowContext);
16
- const handleSelectPatient = (uuid) => {
17
- addPatient(uuid);
17
+ const handleSelectPatient = (patient) => {
18
+ addPatient(patient.uuid);
18
19
  };
20
+ const { t } = useTranslation();
19
21
 
20
22
  if (workflowState !== "NEW_PATIENT") return null;
21
23
 
22
24
  const afterUrl = encodeURIComponent(
23
- `\${openmrsSpaBase}/forms/${activeFormUuid}?patientUuid=\${patientUuid}`
25
+ `\${openmrsSpaBase}/forms/form/${activeFormUuid}?patientUuid=\${patientUuid}`
24
26
  );
25
27
  const patientRegistrationUrl = interpolateUrl(
26
28
  `\${openmrsSpaBase}/patient-registration?afterUrl=${afterUrl}`
@@ -28,7 +30,7 @@ const PatientSearchHeader = () => {
28
30
 
29
31
  return (
30
32
  <div className={styles.searchHeaderContainer}>
31
- <span className={styles.padded}>Next patient:</span>
33
+ <span className={styles.padded}>{t("nextPatient", "Next patient")}:</span>
32
34
  <span className={styles.searchBarWrapper}>
33
35
  <ExtensionSlot
34
36
  extensionSlotName="patient-search-bar-slot"
@@ -40,17 +42,17 @@ const PatientSearchHeader = () => {
40
42
  }}
41
43
  />
42
44
  </span>
43
- <span className={styles.padded}>or</span>
45
+ <span className={styles.padded}>{t("or", "or")}</span>
44
46
  <span>
45
47
  <Button onClick={() => navigate({ to: patientRegistrationUrl })}>
46
- Create new patient <Add20 />
48
+ {t("createNewPatient", "Create new patient")} <Add size={20} />
47
49
  </Button>
48
50
  </span>
49
51
  <span style={{ flexGrow: 1 }} />
50
52
  <span>
51
- <Link to="">
53
+ <Link to="../">
52
54
  <Button kind="ghost">
53
- Cancel <Close20 />
55
+ {t("cancel", "Cancel")} <Close size={20} />
54
56
  </Button>
55
57
  </Link>
56
58
  </span>
@@ -0,0 +1,22 @@
1
+ @use '@carbon/styles/scss/spacing';
2
+ // @use '@carbon/colors';
3
+ // @use '@carbon/styles/scss/type';
4
+ @import '~@openmrs/esm-styleguide/src/vars';
5
+
6
+ .searchHeaderContainer {
7
+ height: spacing.$spacing-11;
8
+ display: flex;
9
+ align-items: center;
10
+ background-color: $ui-02;
11
+ border-top: 0.0125rem solid $ui-03;
12
+ border-bottom: 0.0125rem solid $ui-03;
13
+ padding: 0 spacing.$spacing-05;
14
+ }
15
+
16
+ .searchBarWrapper {
17
+ min-width: 35rem;
18
+ }
19
+
20
+ .padded {
21
+ padding: spacing.$spacing-05;
22
+ }
@@ -1,12 +1,13 @@
1
- @import "~@openmrs/esm-styleguide/src/vars";
2
- @import "~carbon-components/src/globals/scss/vars";
3
- @import "~carbon-components/src/globals/scss/mixins";
1
+ @use '@carbon/styles/scss/spacing';
2
+ @use '@carbon/colors';
3
+ @use '@carbon/styles/scss/type';
4
+ @import '~@openmrs/esm-styleguide/src/vars';
4
5
 
5
6
 
6
7
  .breadcrumbsContainer > div > div > nav {
7
8
  background-color: $ui-02;
8
- padding: $spacing-04 $spacing-05;
9
- height: $spacing-08;
9
+ padding: spacing.$spacing-04 spacing.$spacing-05;
10
+ height: spacing.$spacing-08;
10
11
  }
11
12
 
12
13
  .workspaceWrapper {
@@ -19,16 +20,16 @@
19
20
  }
20
21
 
21
22
  .selectPatientMessage {
22
- @include carbon--type-style('productive-heading-03');
23
- margin: $spacing-07;
23
+ @include type.type-style('productive-heading-03');
24
+ margin: spacing.$spacing-07;
24
25
  text-align: center;
25
26
  }
26
27
 
27
28
  .formMainContent {
28
29
  display: flex;
29
30
  text-align: center;
30
- margin-top: $spacing-05;
31
- column-gap: $spacing-05;
31
+ margin-top: spacing.$spacing-05;
32
+ column-gap: spacing.$spacing-05;
32
33
  }
33
34
 
34
35
  .formContainer {
@@ -37,7 +38,7 @@
37
38
  overflow-y: scroll;
38
39
  }
39
40
 
40
- .formContainer :global(.bx--form-item) :global(.question-area) {
41
+ .formContainer :global(.cds--form-item) :global(.question-area) {
41
42
  max-width: 100%;
42
43
  }
43
44
 
@@ -48,14 +49,14 @@
48
49
  }
49
50
 
50
51
  .patientCardsSection {
51
- margin: $spacing-05 0;
52
- border-bottom: 1px solid $carbon--gray-10;
52
+ margin: spacing.$spacing-05 0;
53
+ border-bottom: 1px solid colors.$gray-10;
53
54
  }
54
55
 
55
56
  .rightPanelActionButtons {
56
57
  display: flex;
57
58
  flex-direction: column;
58
- row-gap: $spacing-03;
59
+ row-gap: spacing.$spacing-03;
59
60
  & button {
60
61
  width: 100%;
61
62
  text-decoration: "none";
@@ -1,23 +1,23 @@
1
- import { Button } from "carbon-components-react";
1
+ import { Button } from "@carbon/react";
2
2
  import React, { useContext } from "react";
3
- import { useHistory } from "react-router-dom";
4
- import FormWorkflowContext from "../context/FormWorkflowContext";
3
+ import { useNavigate } from "react-router-dom";
4
+ import FormWorkflowContext from "../../context/FormWorkflowContext";
5
5
  import FormReviewCard from "../form-review-card";
6
6
  import styles from "./styles.scss";
7
7
 
8
8
  const WorkflowReview = () => {
9
9
  const { patientUuids } = useContext(FormWorkflowContext);
10
- const history = useHistory();
10
+ const navigate = useNavigate();
11
11
  return (
12
12
  <div className={styles.workspaceWrapper}>
13
13
  <div className={styles.workspace}>
14
14
  <div className={styles.leftPanel}>
15
15
  <h4>Review</h4>
16
16
  <div className={styles.navButtons}>
17
- <Button kind="primary" onClick={() => history.push("/")}>
17
+ <Button kind="primary" onClick={() => navigate("/")}>
18
18
  Save & Close
19
19
  </Button>
20
- <Button kind="tertiary" onClick={() => history.push("/")}>
20
+ <Button kind="tertiary" onClick={() => navigate("/")}>
21
21
  Cancel
22
22
  </Button>
23
23
  </div>
@@ -2,12 +2,12 @@ import React from "react";
2
2
  import { useTranslation } from "react-i18next";
3
3
  import { ConfigurableLink } from "@openmrs/esm-framework";
4
4
 
5
- export default function OfflineToolsAppMenuLink() {
5
+ export default function FormsAppMenuLink() {
6
6
  const { t } = useTranslation();
7
7
  return (
8
8
  // eslint-disable-next-line
9
9
  <ConfigurableLink to="${openmrsSpaBase}/forms">
10
- {t("formsAppMenuLink", "Forms")}
10
+ {t("formsAppMenuLink", "Fast Data Entry")}
11
11
  </ConfigurableLink>
12
12
  );
13
13
  }
@@ -1,15 +1,19 @@
1
1
  import { useConfig } from "@openmrs/esm-framework";
2
- import { Tab, Tabs } from "carbon-components-react";
2
+ import { Tab, Tabs, TabList, TabPanels, TabPanel } from "@carbon/react";
3
3
  import React from "react";
4
4
  import { Config } from "../config-schema";
5
5
  import { useGetAllForms } from "../hooks";
6
- import FormsTable from "../forms-table";
6
+ import FormsTable from "./forms-table";
7
7
  import styles from "./styles.scss";
8
8
  import { useTranslation } from "react-i18next";
9
9
  import {
10
10
  fdeWorkflowStorageName,
11
11
  fdeWorkflowStorageVersion,
12
12
  } from "../context/FormWorkflowReducer";
13
+ import {
14
+ fdeGroupWorkflowStorageName,
15
+ fdeGroupWorkflowStorageVersion,
16
+ } from "../context/GroupFormWorkflowReducer";
13
17
 
14
18
  // helper function useful for debugging
15
19
  // given a list of forms, it will organize into permissions
@@ -45,18 +49,33 @@ const FormsPage = () => {
45
49
  const { formCategories, formCategoriesToShow } = config;
46
50
  const { forms, isLoading, error } = useGetAllForms();
47
51
  const cleanRows = prepareRowsForTable(forms);
48
- const savedData = localStorage.getItem(fdeWorkflowStorageName);
52
+ const savedFormsData = localStorage.getItem(fdeWorkflowStorageName);
53
+ const savedGroupFormsData = localStorage.getItem(fdeGroupWorkflowStorageName);
49
54
  const activeForms = [];
55
+ const activeGroupForms = [];
56
+
50
57
  if (
51
- savedData &&
52
- JSON.parse(savedData)?.["_storageVersion"] === fdeWorkflowStorageVersion
58
+ savedFormsData &&
59
+ JSON.parse(savedFormsData)?.["_storageVersion"] ===
60
+ fdeWorkflowStorageVersion
53
61
  ) {
54
- Object.entries(JSON.parse(savedData).forms).forEach(
62
+ Object.entries(JSON.parse(savedFormsData).forms).forEach(
55
63
  ([formUuid, form]: [string, { [key: string]: unknown }]) => {
56
64
  if (form.workflowState) activeForms.push(formUuid);
57
65
  }
58
66
  );
59
67
  }
68
+ if (
69
+ savedGroupFormsData &&
70
+ JSON.parse(savedGroupFormsData)?.["_storageVersion"] ===
71
+ fdeGroupWorkflowStorageVersion
72
+ ) {
73
+ Object.entries(JSON.parse(savedGroupFormsData).forms).forEach(
74
+ ([formUuid, form]: [string, { [key: string]: unknown }]) => {
75
+ if (form.workflowState) activeGroupForms.push(formUuid);
76
+ }
77
+ );
78
+ }
60
79
 
61
80
  const categoryRows = formCategoriesToShow.map((name) => {
62
81
  const category = formCategories.find((category) => category.name === name);
@@ -70,23 +89,38 @@ const FormsPage = () => {
70
89
 
71
90
  return (
72
91
  <div className={styles.mainContent}>
73
- <h3 className={styles.pageTitle}>{t("forms", "Forms")}</h3>
74
- <Tabs type="container">
75
- <Tab
76
- label={`${t("allForms", "All Forms")} (${
77
- cleanRows ? cleanRows?.length : "??"
78
- })`}
79
- >
80
- <FormsTable rows={cleanRows} {...{ error, isLoading, activeForms }} />
81
- </Tab>
82
- {categoryRows?.map((category, index) => (
83
- <Tab label={`${category.name} (${category.rows.length})`} key={index}>
92
+ <h3 className={styles.pageTitle}>
93
+ {t("fastDataEntry", "Fast Data Entry")}
94
+ </h3>
95
+ <Tabs>
96
+ <TabList>
97
+ <Tab label={t("allForms", "All Forms")}>
98
+ {`${t("allForms", "All Forms")} (${
99
+ cleanRows ? cleanRows?.length : "??"
100
+ })`}
101
+ </Tab>
102
+ {categoryRows?.map((category, index) => (
103
+ <Tab label={category.name} key={index}>
104
+ {`${category.name} (${category.rows.length})`}
105
+ </Tab>
106
+ ))}
107
+ </TabList>
108
+ <TabPanels>
109
+ <TabPanel>
84
110
  <FormsTable
85
- rows={category.rows}
86
- {...{ error, isLoading, activeForms }}
111
+ rows={cleanRows}
112
+ {...{ error, isLoading, activeForms, activeGroupForms }}
87
113
  />
88
- </Tab>
89
- ))}
114
+ </TabPanel>
115
+ {categoryRows?.map((category, index) => (
116
+ <TabPanel key={index}>
117
+ <FormsTable
118
+ rows={category.rows}
119
+ {...{ error, isLoading, activeForms, activeGroupForms }}
120
+ />
121
+ </TabPanel>
122
+ ))}
123
+ </TabPanels>
90
124
  </Tabs>
91
125
  </div>
92
126
  );
@@ -12,14 +12,20 @@ import {
12
12
  TableToolbar,
13
13
  TableToolbarContent,
14
14
  TableToolbarSearch,
15
- } from "carbon-components-react";
15
+ } from "@carbon/react";
16
16
  import React from "react";
17
17
  import { useTranslation } from "react-i18next";
18
18
  import { Link } from "react-router-dom";
19
- import EmptyState from "../empty-state/EmptyState";
19
+ import EmptyState from "../../empty-state/EmptyState";
20
20
  import styles from "./styles.scss";
21
21
 
22
- const FormsTable = ({ rows, error, isLoading, activeForms }) => {
22
+ const FormsTable = ({
23
+ rows,
24
+ error,
25
+ isLoading,
26
+ activeForms,
27
+ activeGroupForms,
28
+ }) => {
23
29
  const { t } = useTranslation();
24
30
 
25
31
  const formsHeader = [
@@ -40,15 +46,17 @@ const FormsTable = ({ rows, error, isLoading, activeForms }) => {
40
46
  const augmenteRows = rows?.map((row) => ({
41
47
  ...row,
42
48
  actions: (
43
- <Link to={row.uuid}>
49
+ <Link to={`form/${row.uuid}`}>
44
50
  {activeForms.includes(row.uuid)
45
51
  ? t("resumeSession", "Resume Session")
46
52
  : t("fillForm", "Fill Form")}
47
53
  </Link>
48
54
  ),
49
55
  actions2: (
50
- <Link to="#" className={styles.inactiveLink}>
51
- {t("startGroupSession", "Start Group Session")}
56
+ <Link to={`groupform/${row.uuid}`}>
57
+ {activeGroupForms.includes(row.uuid)
58
+ ? t("resumeGroupSession", "Resume Group Session")
59
+ : t("startGroupSession", "Start Group Session")}
52
60
  </Link>
53
61
  ),
54
62
  }));
@@ -1,11 +1,11 @@
1
- @import "~@openmrs/esm-styleguide/src/vars";
2
- @import "~carbon-components/src/globals/scss/vars";
3
- @import "~carbon-components/src/globals/scss/mixins";
1
+ @use '@carbon/styles/scss/spacing';
2
+ // @use '@carbon/styles/scss/type';
3
+ // @import '~@openmrs/esm-styleguide/src/vars';
4
4
 
5
5
  .mainContent {
6
- padding: $spacing-07;
6
+ padding: spacing.$spacing-07;
7
7
  }
8
8
 
9
9
  .pageTitle {
10
- margin-bottom: $spacing-06;
10
+ margin-bottom: spacing.$spacing-06;
11
11
  }