@openmrs/esm-patient-task-list-app 12.1.1-pre.10907

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 (75) hide show
  1. package/.turbo/turbo-build.log +7 -0
  2. package/README.md +28 -0
  3. package/dist/105.js +1 -0
  4. package/dist/105.js.map +1 -0
  5. package/dist/117.js +1 -0
  6. package/dist/117.js.map +1 -0
  7. package/dist/149.js +1 -0
  8. package/dist/149.js.map +1 -0
  9. package/dist/229.js +43 -0
  10. package/dist/229.js.map +1 -0
  11. package/dist/304.js +1 -0
  12. package/dist/304.js.map +1 -0
  13. package/dist/339.js +1 -0
  14. package/dist/339.js.map +1 -0
  15. package/dist/378.js +1 -0
  16. package/dist/378.js.map +1 -0
  17. package/dist/396.js +1 -0
  18. package/dist/396.js.map +1 -0
  19. package/dist/409.js +6 -0
  20. package/dist/409.js.map +1 -0
  21. package/dist/466.js +1 -0
  22. package/dist/466.js.map +1 -0
  23. package/dist/61.js +1 -0
  24. package/dist/61.js.map +1 -0
  25. package/dist/66.js +1 -0
  26. package/dist/66.js.map +1 -0
  27. package/dist/697.js +1 -0
  28. package/dist/697.js.map +1 -0
  29. package/dist/712.js +1 -0
  30. package/dist/712.js.map +1 -0
  31. package/dist/720.js +1 -0
  32. package/dist/720.js.map +1 -0
  33. package/dist/752.js +1 -0
  34. package/dist/752.js.map +1 -0
  35. package/dist/771.js +1 -0
  36. package/dist/771.js.map +1 -0
  37. package/dist/789.js +1 -0
  38. package/dist/789.js.map +1 -0
  39. package/dist/989.js +1 -0
  40. package/dist/989.js.map +1 -0
  41. package/dist/main.js +6 -0
  42. package/dist/main.js.map +1 -0
  43. package/dist/openmrs-esm-patient-task-list-app.js +6 -0
  44. package/dist/openmrs-esm-patient-task-list-app.js.buildmanifest.json +651 -0
  45. package/dist/openmrs-esm-patient-task-list-app.js.map +1 -0
  46. package/dist/routes.json +1 -0
  47. package/jest.config.js +3 -0
  48. package/package.json +61 -0
  49. package/rspack.config.js +1 -0
  50. package/src/config-schema.ts +13 -0
  51. package/src/declarations.d.ts +3 -0
  52. package/src/index.ts +25 -0
  53. package/src/launch-button/task-list-launch-button.extension.tsx +20 -0
  54. package/src/loader/loader.component.tsx +10 -0
  55. package/src/loader/loader.scss +9 -0
  56. package/src/routes.json +28 -0
  57. package/src/types.d.ts +9 -0
  58. package/src/workspace/add-task-form.component.tsx +609 -0
  59. package/src/workspace/add-task-form.scss +49 -0
  60. package/src/workspace/add-task-form.test.tsx +615 -0
  61. package/src/workspace/delete-task.modal.test.tsx +99 -0
  62. package/src/workspace/delete-task.modal.tsx +71 -0
  63. package/src/workspace/delete-task.scss +7 -0
  64. package/src/workspace/task-details-view.component.tsx +212 -0
  65. package/src/workspace/task-details-view.scss +61 -0
  66. package/src/workspace/task-details-view.test.tsx +408 -0
  67. package/src/workspace/task-list-view.component.tsx +154 -0
  68. package/src/workspace/task-list-view.scss +111 -0
  69. package/src/workspace/task-list-view.test.tsx +246 -0
  70. package/src/workspace/task-list.resource.ts +543 -0
  71. package/src/workspace/task-list.scss +37 -0
  72. package/src/workspace/task-list.workspace.test.tsx +135 -0
  73. package/src/workspace/task-list.workspace.tsx +99 -0
  74. package/translations/en.json +66 -0
  75. package/tsconfig.json +4 -0
@@ -0,0 +1,99 @@
1
+ import React, { useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { Button } from '@carbon/react';
4
+ import { Add, ArrowLeft } from '@carbon/react/icons';
5
+ import { Workspace2, type Visit } from '@openmrs/esm-framework';
6
+ import { type PatientWorkspace2DefinitionProps } from '@openmrs/esm-patient-common-lib';
7
+ import { type Task } from './task-list.resource';
8
+ import AddTaskForm from './add-task-form.component';
9
+ import TaskListView from './task-list-view.component';
10
+ import TaskDetailsView from './task-details-view.component';
11
+ import styles from './task-list.scss';
12
+
13
+ type View = 'list' | 'form' | 'details' | 'edit';
14
+
15
+ const TaskListWorkspace: React.FC<PatientWorkspace2DefinitionProps<{}, {}>> = ({ groupProps }) => {
16
+ const { patientUuid, visitContext } = groupProps ?? { patientUuid: '', visitContext: undefined as unknown as Visit };
17
+ const { t } = useTranslation();
18
+ const [view, setView] = useState<View>('list');
19
+ const [selectedTaskUuid, setSelectedTaskUuid] = useState<string | null>(null);
20
+
21
+ const handleTaskClick = (task: Task) => {
22
+ setSelectedTaskUuid(task.uuid);
23
+ setView('details');
24
+ };
25
+
26
+ const handleEdit = (task: Task) => {
27
+ setSelectedTaskUuid(task.uuid);
28
+ setView('edit');
29
+ };
30
+
31
+ const handleEditComplete = () => {
32
+ setView('details');
33
+ };
34
+
35
+ const handleBackClick = () => {
36
+ if (view === 'edit') {
37
+ setView('details');
38
+ return;
39
+ }
40
+ setView('list');
41
+ setSelectedTaskUuid(null);
42
+ };
43
+
44
+ const backText =
45
+ view === 'edit' ? t('backToTaskDetails', 'Back to task details') : t('backToTaskList', 'Back to task list');
46
+
47
+ return (
48
+ <Workspace2 title={t('taskListWorkspaceTitle', 'Task List')}>
49
+ <div className={styles.workspaceContainer}>
50
+ {['form', 'details', 'edit'].includes(view) && (
51
+ <div className={styles.backButton}>
52
+ <Button
53
+ kind="ghost"
54
+ renderIcon={(props) => <ArrowLeft size={16} {...props} />}
55
+ iconDescription={backText}
56
+ onClick={handleBackClick}
57
+ >
58
+ <span>{backText}</span>
59
+ </Button>
60
+ </div>
61
+ )}
62
+ {view === 'form' && (
63
+ <AddTaskForm patientUuid={patientUuid} activeVisit={visitContext} onClose={() => setView('list')} />
64
+ )}
65
+ {view === 'list' && <TaskListView patientUuid={patientUuid} onTaskClick={handleTaskClick} />}
66
+ {view === 'list' && (
67
+ <div className={styles.addTaskButtonContainer}>
68
+ <Button
69
+ kind="ghost"
70
+ renderIcon={(props) => <Add size={16} {...props} />}
71
+ iconDescription={t('addTask', 'Add Task')}
72
+ onClick={() => setView('form')}
73
+ >
74
+ {t('addTask', 'Add Task')}
75
+ </Button>
76
+ </div>
77
+ )}
78
+ {view === 'details' && selectedTaskUuid && (
79
+ <TaskDetailsView
80
+ patientUuid={patientUuid}
81
+ taskUuid={selectedTaskUuid}
82
+ onBack={handleBackClick}
83
+ onEdit={handleEdit}
84
+ />
85
+ )}
86
+ {view === 'edit' && selectedTaskUuid && (
87
+ <AddTaskForm
88
+ patientUuid={patientUuid}
89
+ activeVisit={visitContext}
90
+ onClose={handleEditComplete}
91
+ editTaskUuid={selectedTaskUuid}
92
+ />
93
+ )}
94
+ </div>
95
+ </Workspace2>
96
+ );
97
+ };
98
+
99
+ export default TaskListWorkspace;
@@ -0,0 +1,66 @@
1
+ {
2
+ "addTask": "Add Task",
3
+ "addTaskButton": "Add Task",
4
+ "assignedTo": "Assigned to",
5
+ "assignProviderLabel": "Assign to provider",
6
+ "assignProviderPlaceholder": "Search providers",
7
+ "assignProviderRoleLabel": "Assign to provider role",
8
+ "assignProviderRolePlaceholder": "Search provider roles",
9
+ "backToTaskDetails": "Back to task details",
10
+ "backToTaskList": "Back to task list",
11
+ "createdBy": "Created by",
12
+ "customTaskName": "Custom task",
13
+ "date": "Date",
14
+ "deleteTask": "Delete task",
15
+ "deleteTaskConfirmationText": "Are you sure you want to delete this task?",
16
+ "deleting": "Deleting",
17
+ "discard": "Discard",
18
+ "dueDate": "Due date",
19
+ "dueDateLabel": "Due date",
20
+ "dueDateRequired": "Due date is required when Date is selected",
21
+ "dueLabel": "Due",
22
+ "errorDeletingTask": "Error deleting task",
23
+ "markComplete": "Mark complete",
24
+ "markIncomplete": "Mark incomplete",
25
+ "name": "Name",
26
+ "nextVisit": "Next visit",
27
+ "noAssignment": "No assignment",
28
+ "none": "None",
29
+ "noTasksMessage": "No tasks yet",
30
+ "overdue": "Overdue",
31
+ "priorityHigh": "High",
32
+ "priorityLabel": "Priority",
33
+ "priorityLow": "Low",
34
+ "priorityMedium": "Medium",
35
+ "priorityPlaceholder": "Select priority (optional)",
36
+ "providerSearchHint": "Start typing to search for providers",
37
+ "rationale": "Rationale",
38
+ "rationaleLabel": "Explain briefly why this task is necessary (optional)",
39
+ "rationalePlaceholder": "Add a note here",
40
+ "saveTask": "Save task",
41
+ "scheduledInfo": "Scheduled",
42
+ "scheduledOnNextVisit": "On {{date}} for the following visit",
43
+ "scheduledOnThisVisit": "On {{date}} for the same visit",
44
+ "scheduledTodayForNextVisit": "Today for next visit",
45
+ "scheduledTodayForThisVisit": "Today for this visit",
46
+ "selectSingleAssignee": "Select either a provider or a provider role, not both",
47
+ "systemTaskEditSubtitle": "Task name cannot be changed.",
48
+ "systemTaskEditTitle": "You're editing a system task",
49
+ "task": "Task",
50
+ "taskAdded": "Task added",
51
+ "taskAddFailed": "Task add failed",
52
+ "taskCompleted": "Task marked as complete",
53
+ "taskDeleted": "Task deleted",
54
+ "taskIncomplete": "Task marked as incomplete",
55
+ "taskList": "Task list",
56
+ "taskListLoadError": "There was a problem loading the task list.",
57
+ "taskListWorkspaceTitle": "Task List",
58
+ "taskLoadError": "There was a problem loading the task.",
59
+ "taskNameComboBoxPlaceholder": "Enter or select task name",
60
+ "taskNameLabel": "Task name",
61
+ "taskNamePlaceholder": "Enter task name",
62
+ "taskNameRequired": "Task name is required",
63
+ "taskUpdated": "Task updated",
64
+ "taskUpdateFailed": "Unable to update task",
65
+ "thisVisit": "This visit"
66
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "include": ["src/**/*", "../../tools/setup-tests.ts"]
4
+ }