Skip to content

Commit 29c017b

Browse files
committed
Merge branch 'develop'
2 parents 7725ab2 + 3e7a293 commit 29c017b

File tree

390 files changed

+8733
-1967
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

390 files changed

+8733
-1967
lines changed

client/.eslintrc.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
extends: [
77
'plugin:jest-dom/recommended',
88
'plugin:react/recommended',
9+
'plugin:react-hooks/recommended',
910
'plugin:@typescript-eslint/recommended',
1011
'google',
1112
'prettier',
@@ -27,7 +28,7 @@ module.exports = {
2728
},
2829

2930
settings: { react: { version: 'detect' } },
30-
plugins: ['react', , '@typescript-eslint'],
31+
plugins: ['react', '@typescript-eslint'],
3132
rules: {
3233
camelcase: ['error', { allow: ['_ONLY_FOR_TESTING'] }],
3334
'require-jsdoc': 'off',
@@ -48,5 +49,8 @@ module.exports = {
4849
'always',
4950
{ markers: ['#', '/'], exceptions: ['-'] },
5051
],
52+
'react-hooks/exhaustive-deps': 'off',
53+
'@typescript-eslint/no-explicit-any': 'warn',
5154
},
55+
ignorePatterns: ['**/operations.generated.ts', '**/types/schema.ts'],
5256
};

client/package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"electron:build": "lerna run --scope @openmsupply-client/electron make",
3030
"i18n-unused-display": "i18n-unused display-unused",
3131
"i18n-unused-remove": "i18n-unused remove-unused",
32-
"i18n-missing": "i18n-unused display-missed"
32+
"i18n-missing": "i18n-unused display-missed",
33+
"eslint": "lerna run --scope @openmsupply-client/* --parallel eslint"
3334
},
3435
"workspaces": {
3536
"packages": [
@@ -81,6 +82,7 @@
8182
"eslint-plugin-jest-dom": "^5.0.1",
8283
"eslint-plugin-react": "^7.27.1",
8384
"eslint-plugin-storybook": "^0.6.11",
85+
"eslint-plugin-react-hooks": "^4.6.0",
8486
"husky": "^8.0.3",
8587
"i18n-unused": "^0.13.0",
8688
"jest": "^29.6.2",

client/packages/common/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"private": true,
66
"main": "./src/index.ts",
77
"scripts": {
8-
"tsc": "tsc"
8+
"tsc": "tsc",
9+
"eslint": "eslint ./src"
910
},
1011
"peerDependencies": {
1112
"react": "^17.0.2"

client/packages/common/src/hooks/useBreadcrumbs/useBreadcrumbs.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { LocaleKey } from '@common/intl';
44
import { create } from 'zustand';
55

66
export interface UrlPart {
7+
disabled?: boolean;
78
path: string;
89
key: LocaleKey;
910
value: string;

client/packages/common/src/hooks/useDialog/useDialog.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface ButtonProps {
1616

1717
export interface ModalProps {
1818
contentProps?: DialogContentProps;
19-
children: React.ReactElement<any, any>;
19+
children: React.ReactElement;
2020
cancelButton?: JSX.Element;
2121
height?: number;
2222
nextButton?: React.ReactElement<{

client/packages/common/src/hooks/useNativeClient/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export enum NativeMode {
6363

6464
export type Protocol = 'http' | 'https';
6565

66-
export const isProtocol = (value: any): value is Protocol =>
66+
export const isProtocol = (value: string): value is Protocol =>
6767
value === 'http' || value === 'https';
6868

6969
// Should match server/server/src/discovery.rs (FrontEndHost)

client/packages/common/src/hooks/useUrlQuery/useUrlQueryParams.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { useEffect } from 'react';
22
import { useUrlQuery } from './useUrlQuery';
3-
import { Column, useLocalStorage } from '@openmsupply-client/common';
3+
import {
4+
Column,
5+
RecordWithId,
6+
useLocalStorage,
7+
} from '@openmsupply-client/common';
48
import { FilterBy, FilterController } from '../useQueryParams';
59

610
// This hook uses the state of the url query parameters (from useUrlQuery hook)
@@ -50,7 +54,7 @@ export const useUrlQueryParams = ({
5054
updateQuery({ sort, dir: dir === 'desc' ? 'desc' : '' });
5155
}, [initialSort]);
5256

53-
const updateSortQuery = (column: Column<any>) => {
57+
const updateSortQuery = <T extends RecordWithId>(column: Column<T>) => {
5458
const currentSort = urlQuery['sort'];
5559
const sort = column.key as string;
5660
if (sort !== currentSort) {
@@ -96,8 +100,8 @@ export const useUrlQueryParams = ({
96100
offset: urlQuery.page ? (urlQuery.page - 1) * rowsPerPage : 0,
97101
first: rowsPerPage,
98102
sortBy: {
99-
key: urlQuery.sort ?? initialSort?.key ?? '',
100-
direction: urlQuery.dir ?? initialSort?.dir ?? 'asc',
103+
key: urlQuery.sort ?? '',
104+
direction: urlQuery.dir ?? 'asc',
101105
isDesc: urlQuery.dir === 'desc',
102106
},
103107
filterBy: filter.filterBy,

client/packages/common/src/intl/currency/currency.ts

-5
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,3 @@ export const useFormatCurrency = (dp?: number) => {
139139
const { c } = useCurrency(dp);
140140
return (value: currency.Any) => c(value).format();
141141
};
142-
143-
export const useCurrencyFormat = (value: currency.Any) => {
144-
const { c } = useCurrency();
145-
return c(value).format();
146-
};

client/packages/common/src/intl/locales/en/app.json

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@
9292
"patients": "Patients",
9393
"dispensary": "Dispensary",
9494
"programs": "Programs",
95+
"contact-trace": "Contact Tracing",
9596
"prescription": "Prescriptions",
9697
"suppliers": "Suppliers",
9798
"sync": "Sync",

client/packages/common/src/intl/locales/en/common.json

+13-2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@
180180
"label.encounter-status-cancelled": "Cancelled",
181181
"label.encounter-status-missed": "Missed",
182182
"label.encounter-status-scheduled": "Scheduled",
183+
"label.contact-tracing-type": "Type of contact",
184+
"label.trace-status-pending": "Pending",
185+
"label.trace-status-done": "Done",
183186
"label.program-enrolment-status-active": "Active",
184187
"label.program-enrolment-status-opt": "Opted out",
185188
"label.program-enrolment-status-transferred": "Transferred out",
@@ -236,6 +239,7 @@
236239
"label.pack-quantity-issued": "Pack Qty Issued",
237240
"label.pack-size": "Pack Size",
238241
"label.patient": "Patient",
242+
"label.contact-patient": "Contact Patient",
239243
"label.period": "Period",
240244
"label.phone": "Phone",
241245
"label.picked": "Picked",
@@ -298,6 +302,8 @@
298302
"label.add-another": "Add another",
299303
"label.remove": "Remove",
300304
"link.copy-to-clipboard": "Copy to Clipboard",
305+
"log.changed-to": "to",
306+
"log.changed-from": "From",
301307
"log.invoice-created": "Shipment created",
302308
"log.user-logged-in": "User logged in",
303309
"log.invoice-deleted": "Shipment deleted",
@@ -333,13 +339,17 @@
333339
"messages.confirm-status-as": "Confirm status as $t({{status}})?",
334340
"messages.confirm-remove-item": "Are you sure?",
335341
"messages.confirm-save-generic": "Are you ready to save changes?",
342+
"messages.confirm-zero-quantity": "There is no allocated quantity for this item! Click OK again to confirm.",
343+
"messages.confirm-zero-quantity-status": "You have rows with 0 quantity issued. If you proceed, these will be removed. Please \"Cancel\" if you wish to update the items.",
336344
"messages.delete-this-line": "Delete this line",
345+
"messages.confirm-delete-shipment": "This will permanently remove Shipment #{{number}}",
337346
"messages.deleted-generic_one": "Deleted {{count}} record",
338347
"messages.deleted-generic_other": "Deleted {{count}} records",
339348
"messages.deleted-lines_one": "Deleted {{count}} line",
340349
"messages.deleted-lines_other": "Deleted {{count}} lines",
341350
"messages.detect-scanner": "To identify your scanner, try scanning the barcode above",
342-
"messages.over-allocated": "Due to the pack sizes available a total quantity of {{quantity}} has been allocated rather than {{issueQuantity}}",
351+
"messages.over-allocated": "Due to the pack sizes available a total quantity of {{allocatedQuantity}} has been allocated rather than {{requestedQuantity}}",
352+
"messages.placeholder-allocated": "Not enough stock is available to allocate the requested quantity. A placeholder has been added for {{placeholderQuantity}} units.",
343353
"messages.native-mode": "Select the mode which you would like to run. Note that you can change this option later if you have administrator access.",
344354
"messages.native-mode-client": "This mode allows you to select which server to connect to.",
345355
"messages.native-mode-server": "Selecting this option will start the local server and automatically connect to it. Other users on the network will also be able to connect to this server.",
@@ -370,5 +380,6 @@
370380
"sync-status.push": "Push",
371381
"sync-status.integrate": "Integrate",
372382
"table.show-columns": "Show / hide columns",
373-
"warning.caps-lock": "Warning: Caps lock is on"
383+
"warning.caps-lock": "Warning: Caps lock is on",
384+
"multiple": "[multiple]"
374385
}

client/packages/common/src/intl/locales/en/dispensary.json

+23-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
"button.new-patient": "New Patient",
33
"button.add-encounter": "Add Encounter",
44
"button.add-program": "Add Program",
5+
"button.add-contact-trace": "Add Contact",
56
"button.new-prescription": "New Prescription",
7+
"button-save-as-visited": "Save as Visited",
8+
"button.link-contact-to-patient": "Link to Patient",
9+
"button.edit-linked-patient": "Edit Linked Patient",
10+
"button.unlink-patient": "Unlink Patient",
611
"error.encounter-not-found": "Encounter not found.",
712
"error.encounter-not-created": "Unable to create encounter",
13+
"error.contact-trace-not-created": "Unable to create contact trace",
814
"error.failed-to-create-prescription": "Failed to create prescription!",
915
"error.no-prescriptions": "There are no Prescriptions to display.",
1016
"error.prescription-not-found": "Prescription not found.",
@@ -17,6 +23,7 @@
1723
"label.edit-encounter": "Edit Encounter",
1824
"label.gender": "Gender",
1925
"label.new-encounter": "New Encounter",
26+
"label.new-contact-trace": "Add Contact",
2027
"label.patient-details": "Patient Details",
2128
"label.patient": "Patient",
2229
"label.patients": "Patients",
@@ -26,6 +33,8 @@
2633
"label.visit-end": "End",
2734
"label.clinician": "Clinician",
2835
"label.encounter-status": "Status",
36+
"label.contact-trace-status": "Status",
37+
"label.directions": "Directions",
2938
"label.note": "Note",
3039
"label.additional-info": "Additional Info",
3140
"label.entered-by": "Entered by",
@@ -34,6 +43,9 @@
3443
"label.previous-encounters": "Previous Encounters",
3544
"label.more": "More...",
3645
"label.customer-name": "Customer Name",
46+
"label.contact": "Contact",
47+
"label.linked-patient": "Linked Patient",
48+
"label.recorded-contact-differs": "Recorded Contact: {{recordedName}}",
3749
"title.patient-retrieval-modal": "Patient Data Retrieval",
3850
"messages.confirm-patient-retrieval": "Are you sure you want to retrieve patient data for {{name}}?",
3951
"messages.fetching-patient-data": "Fetching patient data...",
@@ -42,16 +54,21 @@
4254
"messages.confirm-delete-lines_one": "This will permanently remove 1 line from this prescription",
4355
"messages.confirm-delete-lines_other": "This will permanently remove {{count}} lines from this prescription",
4456
"messages.click-to-return-to-encounters": "Unable to find an encounter with that ID. Click OK to return to the encounter list",
57+
"messages.click-to-return-to-contact-traces": "Unable to find an contact trace with that ID. Click OK to return to the contact traces list",
4558
"messages.click-to-view": "Click to view the patient record for {{firstName}} {{lastName}}",
4659
"messages.click-to-fetch": "Click to fetch patient record from central server",
4760
"messages.no-matching-patients": "No matching patients! 😁",
4861
"messages.no-programs": "This patient is not enrolled in any programs",
62+
"messages.no-contact-traces": "This patient has no contact traces",
63+
"messages.no-matching-patients-for-contact-trace": "No matching patients",
64+
"messages.patient-data-required-for-search": "Please enter patient information",
4965
"messages.no-patient-record": "Can't access detailed information for this patient.",
5066
"messages.patients-found_one": "1 patient found matching the supplied details",
5167
"messages.patients-found_other": "{{count}} patients found matching the supplied details",
5268
"messages.patients-create": "Click [OK & Next] to add a new patient with the details entered, or click an existing patient below to view their details.",
5369
"messages.regenerate-id-confirm": "This will create a new ID and cannot be undone.",
5470
"messages.inactive": "Program inactive",
71+
"messages.confirm-delete-prescription": "This will permanently remove Prescription #{{number}}",
5572
"messages.confirm-delete-prescriptions_one": "This will permanently remove 1 prescription",
5673
"messages.confirm-delete-prescriptions_other": "This will permanently remove {{count}} prescriptions",
5774
"messages.deleted-prescriptions_one": "Deleted {{count}} prescription",
@@ -61,11 +78,14 @@
6178
"messages.error-saving-prescription": "Error saving prescription 🥺",
6279
"messages.recorded-on": "Recorded on {{datetime}}",
6380
"messages.results-found": "{{totalCount}} results found",
64-
"messages.results-over-limit": "Showing the first 100 results only - please refine your search",
81+
"messages.results-over-limit": "Showing the first 100 results only - please refine your search",
82+
"messages.save-encounter-as-visited": "Save encounter as Visited?",
6583
"messages.no-stock-available": "There is no stock available",
84+
"messages.stock-on-hold": "Some stock lines are hold and cannot be allocated.",
85+
"messages.stock-expired": "Some stock lines are expired and cannot be allocated.",
6686
"placeholder.search-by-first-name": "Search by first name",
6787
"placeholder.search-by-last-name": "Search by last name",
6888
"placeholder.search-by-identifier": "Search by id",
69-
"warning.cannot-create-placeholder-packs": "There is a total of {{quantity}} packs available. Unable to allocate the full amount requested.",
70-
"warning.cannot-create-placeholder-units": "There is a total of {{quantity}} units available. Unable to allocate the full amount requested."
89+
"warning.cannot-create-placeholder-packs": "There is a total of {{allocatedQuantity}} packs available. Unable to allocate all {{requestedQuantity}} packs.",
90+
"warning.cannot-create-placeholder-units": "There is a total of {{allocatedQuantity}} units available. Unable to allocate all {{requestedQuantity}} units."
7191
}

client/packages/common/src/intl/locales/en/distribution.json

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
"messages.saved": "Saved",
103103
"messages.select-rows-to-delete-them": "Select rows to delete them",
104104
"messages.shipment-saved": "Shipment saved 🥳",
105+
"messages.confirm-not-fully-supplied": "Not all items in this requisition have been supplied to the customer. If you finalise you will not be able to supply any more items to the customer from this requisition. Would you still like to continue?",
106+
"messages.stock-on-hold": "Some stock lines are hold and cannot be allocated.",
107+
"messages.stock-expired": "Some stock lines are expired and cannot be allocated.",
105108
"stocktake.description-template": "Created by {{username}} on {{date}}",
106109
"warning.nothing-to-supply": "Nothing left to supply!",
107110
"info.no-shipment": "Finalising this requisition will prevent you from creating a shipment for it."

client/packages/common/src/intl/locales/en/inventory.json

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"messages.unlocked-description": "This will re-enable changes to the stocktake.",
4848
"messages.select-rows-to-delete": "Select rows to delete",
4949
"messages.click-to-return": "Unable to find a stocktake with that ID. Click OK to return to the stocktake list",
50+
"messages.confirm-delete-stocktake": "This will permanently remove Stocktake #{{number}}",
5051
"messages.confirm-delete-stocktakes_one": "This will permanently remove 1 stocktake",
5152
"messages.confirm-delete-stocktakes_other": "This will permanently remove {{count}} stocktakes",
5253
"messages.confirm-delete-stocktake_lines_one": "This will permanently remove 1 stocktake line",

client/packages/common/src/intl/locales/en/programs.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"control.note.author-label": "Author",
55
"control.search.searching-label": "Searching...",
66
"control.search.no-results-label": "No results",
7-
"control.search.search-placeholder": "Search...",
8-
"control.search.search-patient-placeholder": "Search by patient code...",
7+
"control.search.reset-button": "Unlink matched patient",
8+
"control.search.matching-patients": "We've found some existing patients that match the above entered data. Please select from this list if applicable",
99
"control.search.error.no-document": "Unable to access requested document",
1010
"control.search.error.no-data": "Unable to extract path \"{{docPath}}\" from document",
1111
"control.search.error.no-patient-contact": "No matching patient contact found",

client/packages/common/src/intl/locales/en/replenishment.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"label.hide-stock-over-minimum": "Hide stock over minimum",
3636
"label.location": "Location",
3737
"label.max": "Max",
38-
"label.max-months-of-stock": "Maximum MOS",
38+
"label.max-months-of-stock": "Target MOS",
3939
"label.min": "Min",
40-
"label.min-months-of-stock": "Minimum MOS",
40+
"label.min-months-of-stock": "Reorder threshold MOS",
4141
"label.moving-average": "Mov. Avg. (3mo)",
4242
"label.new": "New",
4343
"label.number-months_one": "{{count}} Month",
@@ -75,8 +75,9 @@
7575
"messages.off-hold-confirmation": "This will re-enable status changes",
7676
"messages.on-hold-confirmation": "This will prevent any further status changes until the hold is removed",
7777
"messages.cant-delete-requisitions": "Can only delete requisitions with a status of 'Draft'",
78-
"messages.changing-max-mos": "This will change the maximum months of stock target.",
79-
"messages.changing-min-mos": "This will change the minimum months of stock threshold.",
78+
"messages.changing-max-mos": "This will change the target months of stock.",
79+
"messages.changing-min-mos": "This will change the reorder threshold months of stock.",
80+
"messages.unassign-min-mos": "This will remove the stock reorder threshold. Reorder threshold will now default to be the same as target months of stock.",
8081
"messages.click-to-return-to-requisitions": "Unable to find a requisition with that ID. Click OK to return to the requisition list",
8182
"messages.click-to-return-to-shipments": "Unable to find a shipment with that ID. Click OK to return to the shipment list",
8283
"messages.confirm-inbound-status-as": "Confirm status as $t({{status}})?\nNote: changing from 'New' will remove any lines with zero quantity.",
@@ -90,6 +91,7 @@
9091
"messages.confirm-delete-requisition-lines_other": "This will permanently remove {{count}} lines from this order",
9192
"messages.confirm-delete-shipments_one": "This will permanently remove 1 shipment",
9293
"messages.confirm-delete-shipments_other": "This will permanently remove {{count}} shipments",
94+
"messages.confirm-delete-requisition": "This will permently remove Internal Order #{{number}}",
9395
"messages.confirm-delete-requisitions_one": "This will permanently remove 1 internal order",
9496
"messages.confirm-delete-requisitions_other": "This will permanently remove {{count}} internal order",
9597
"messages.confirm-delete-shipment-lines_one": "This will permanently remove 1 shipment line",
@@ -101,5 +103,6 @@
101103
"messages.select-rows-to-delete-them": "Select rows to delete them",
102104
"messages.shipment-saved": "Shipment saved 🥳",
103105
"info.cannot-edit-program-requisition": "Cannot edit supplier, minimum MOS, maximum MOS or add items in a program requisition.",
104-
"template.requisition-sent": "Approved by {{name}}{{job}}. Email: {{email}} and Phone Number: {{phone}}."
106+
"template.requisition-sent": "Approved by {{name}}{{job}}. Email: {{email}} and Phone Number: {{phone}}.",
107+
"label.not-set": "Not set"
105108
}

client/packages/common/src/intl/locales/es/replenishment.json

-4
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@
3535
"label.hide-stock-over-minimum": "Ocultar inventario por encima del mínimo",
3636
"label.pricing": "Precios",
3737
"label.max": "Máximo",
38-
"label.max-months-of-stock": "Máximo MOS (Stock de Seguridad Óptimo)",
3938
"label.min": "Mínimo",
40-
"label.min-months-of-stock": "Mínimo MOS (Stock de Seguridad Mínimo)",
4139
"label.moving-average": "Promedio Móvil (3 meses)",
4240
"label.number-months_one": "{{count}} Mes",
4341
"label.number-months_other": "{{count}} Meses",
@@ -61,8 +59,6 @@
6159
"messages.click-to-return-to-requisitions": "No se puede encontrar una solicitud con ese ID. Haz clic en Aceptar para volver a la lista de solicitudes",
6260
"messages.deleted-shipments_one": "Se eliminó {{count}} envío",
6361
"messages.deleted-shipments_other": "Se eliminaron {{count}} envíos",
64-
"messages.changing-max-mos": "Esto cambiará el objetivo máximo de meses de existencias.",
65-
"messages.changing-min-mos": "Esto cambiará el umbral mínimo de meses de existencias.",
6662
"messages.could-not-save": "No se pudo guardar",
6763
"messages.confirm-delete-shipments_other": "Esto eliminará permanentemente {{count}} envíos",
6864
"messages.confirm-delete-invoice-lines_other": "Esto eliminará permanentemente {{count}} líneas de esta factura",

0 commit comments

Comments
 (0)