Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-prins committed Oct 16, 2023
2 parents 7725ab2 + 3e7a293 commit 29c017b
Show file tree
Hide file tree
Showing 390 changed files with 8,733 additions and 1,967 deletions.
6 changes: 5 additions & 1 deletion client/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
extends: [
'plugin:jest-dom/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'plugin:@typescript-eslint/recommended',
'google',
'prettier',
Expand All @@ -27,7 +28,7 @@ module.exports = {
},

settings: { react: { version: 'detect' } },
plugins: ['react', , '@typescript-eslint'],
plugins: ['react', '@typescript-eslint'],
rules: {
camelcase: ['error', { allow: ['_ONLY_FOR_TESTING'] }],
'require-jsdoc': 'off',
Expand All @@ -48,5 +49,8 @@ module.exports = {
'always',
{ markers: ['#', '/'], exceptions: ['-'] },
],
'react-hooks/exhaustive-deps': 'off',
'@typescript-eslint/no-explicit-any': 'warn',
},
ignorePatterns: ['**/operations.generated.ts', '**/types/schema.ts'],
};
4 changes: 3 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"electron:build": "lerna run --scope @openmsupply-client/electron make",
"i18n-unused-display": "i18n-unused display-unused",
"i18n-unused-remove": "i18n-unused remove-unused",
"i18n-missing": "i18n-unused display-missed"
"i18n-missing": "i18n-unused display-missed",
"eslint": "lerna run --scope @openmsupply-client/* --parallel eslint"
},
"workspaces": {
"packages": [
Expand Down Expand Up @@ -81,6 +82,7 @@
"eslint-plugin-jest-dom": "^5.0.1",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-storybook": "^0.6.11",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^8.0.3",
"i18n-unused": "^0.13.0",
"jest": "^29.6.2",
Expand Down
3 changes: 2 additions & 1 deletion client/packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"private": true,
"main": "./src/index.ts",
"scripts": {
"tsc": "tsc"
"tsc": "tsc",
"eslint": "eslint ./src"
},
"peerDependencies": {
"react": "^17.0.2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { LocaleKey } from '@common/intl';
import { create } from 'zustand';

export interface UrlPart {
disabled?: boolean;
path: string;
key: LocaleKey;
value: string;
Expand Down
2 changes: 1 addition & 1 deletion client/packages/common/src/hooks/useDialog/useDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface ButtonProps {

export interface ModalProps {
contentProps?: DialogContentProps;
children: React.ReactElement<any, any>;
children: React.ReactElement;
cancelButton?: JSX.Element;
height?: number;
nextButton?: React.ReactElement<{
Expand Down
2 changes: 1 addition & 1 deletion client/packages/common/src/hooks/useNativeClient/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export enum NativeMode {

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

export const isProtocol = (value: any): value is Protocol =>
export const isProtocol = (value: string): value is Protocol =>
value === 'http' || value === 'https';

// Should match server/server/src/discovery.rs (FrontEndHost)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useEffect } from 'react';
import { useUrlQuery } from './useUrlQuery';
import { Column, useLocalStorage } from '@openmsupply-client/common';
import {
Column,
RecordWithId,
useLocalStorage,
} from '@openmsupply-client/common';
import { FilterBy, FilterController } from '../useQueryParams';

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

const updateSortQuery = (column: Column<any>) => {
const updateSortQuery = <T extends RecordWithId>(column: Column<T>) => {
const currentSort = urlQuery['sort'];
const sort = column.key as string;
if (sort !== currentSort) {
Expand Down Expand Up @@ -96,8 +100,8 @@ export const useUrlQueryParams = ({
offset: urlQuery.page ? (urlQuery.page - 1) * rowsPerPage : 0,
first: rowsPerPage,
sortBy: {
key: urlQuery.sort ?? initialSort?.key ?? '',
direction: urlQuery.dir ?? initialSort?.dir ?? 'asc',
key: urlQuery.sort ?? '',
direction: urlQuery.dir ?? 'asc',
isDesc: urlQuery.dir === 'desc',
},
filterBy: filter.filterBy,
Expand Down
5 changes: 0 additions & 5 deletions client/packages/common/src/intl/currency/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,3 @@ export const useFormatCurrency = (dp?: number) => {
const { c } = useCurrency(dp);
return (value: currency.Any) => c(value).format();
};

export const useCurrencyFormat = (value: currency.Any) => {
const { c } = useCurrency();
return c(value).format();
};
1 change: 1 addition & 0 deletions client/packages/common/src/intl/locales/en/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
"patients": "Patients",
"dispensary": "Dispensary",
"programs": "Programs",
"contact-trace": "Contact Tracing",
"prescription": "Prescriptions",
"suppliers": "Suppliers",
"sync": "Sync",
Expand Down
15 changes: 13 additions & 2 deletions client/packages/common/src/intl/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@
"label.encounter-status-cancelled": "Cancelled",
"label.encounter-status-missed": "Missed",
"label.encounter-status-scheduled": "Scheduled",
"label.contact-tracing-type": "Type of contact",
"label.trace-status-pending": "Pending",
"label.trace-status-done": "Done",
"label.program-enrolment-status-active": "Active",
"label.program-enrolment-status-opt": "Opted out",
"label.program-enrolment-status-transferred": "Transferred out",
Expand Down Expand Up @@ -236,6 +239,7 @@
"label.pack-quantity-issued": "Pack Qty Issued",
"label.pack-size": "Pack Size",
"label.patient": "Patient",
"label.contact-patient": "Contact Patient",
"label.period": "Period",
"label.phone": "Phone",
"label.picked": "Picked",
Expand Down Expand Up @@ -298,6 +302,8 @@
"label.add-another": "Add another",
"label.remove": "Remove",
"link.copy-to-clipboard": "Copy to Clipboard",
"log.changed-to": "to",
"log.changed-from": "From",
"log.invoice-created": "Shipment created",
"log.user-logged-in": "User logged in",
"log.invoice-deleted": "Shipment deleted",
Expand Down Expand Up @@ -333,13 +339,17 @@
"messages.confirm-status-as": "Confirm status as $t({{status}})?",
"messages.confirm-remove-item": "Are you sure?",
"messages.confirm-save-generic": "Are you ready to save changes?",
"messages.confirm-zero-quantity": "There is no allocated quantity for this item! Click OK again to confirm.",
"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.",
"messages.delete-this-line": "Delete this line",
"messages.confirm-delete-shipment": "This will permanently remove Shipment #{{number}}",
"messages.deleted-generic_one": "Deleted {{count}} record",
"messages.deleted-generic_other": "Deleted {{count}} records",
"messages.deleted-lines_one": "Deleted {{count}} line",
"messages.deleted-lines_other": "Deleted {{count}} lines",
"messages.detect-scanner": "To identify your scanner, try scanning the barcode above",
"messages.over-allocated": "Due to the pack sizes available a total quantity of {{quantity}} has been allocated rather than {{issueQuantity}}",
"messages.over-allocated": "Due to the pack sizes available a total quantity of {{allocatedQuantity}} has been allocated rather than {{requestedQuantity}}",
"messages.placeholder-allocated": "Not enough stock is available to allocate the requested quantity. A placeholder has been added for {{placeholderQuantity}} units.",
"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.",
"messages.native-mode-client": "This mode allows you to select which server to connect to.",
"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.",
Expand Down Expand Up @@ -370,5 +380,6 @@
"sync-status.push": "Push",
"sync-status.integrate": "Integrate",
"table.show-columns": "Show / hide columns",
"warning.caps-lock": "Warning: Caps lock is on"
"warning.caps-lock": "Warning: Caps lock is on",
"multiple": "[multiple]"
}
26 changes: 23 additions & 3 deletions client/packages/common/src/intl/locales/en/dispensary.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@
"button.new-patient": "New Patient",
"button.add-encounter": "Add Encounter",
"button.add-program": "Add Program",
"button.add-contact-trace": "Add Contact",
"button.new-prescription": "New Prescription",
"button-save-as-visited": "Save as Visited",
"button.link-contact-to-patient": "Link to Patient",
"button.edit-linked-patient": "Edit Linked Patient",
"button.unlink-patient": "Unlink Patient",
"error.encounter-not-found": "Encounter not found.",
"error.encounter-not-created": "Unable to create encounter",
"error.contact-trace-not-created": "Unable to create contact trace",
"error.failed-to-create-prescription": "Failed to create prescription!",
"error.no-prescriptions": "There are no Prescriptions to display.",
"error.prescription-not-found": "Prescription not found.",
Expand All @@ -17,6 +23,7 @@
"label.edit-encounter": "Edit Encounter",
"label.gender": "Gender",
"label.new-encounter": "New Encounter",
"label.new-contact-trace": "Add Contact",
"label.patient-details": "Patient Details",
"label.patient": "Patient",
"label.patients": "Patients",
Expand All @@ -26,6 +33,8 @@
"label.visit-end": "End",
"label.clinician": "Clinician",
"label.encounter-status": "Status",
"label.contact-trace-status": "Status",
"label.directions": "Directions",
"label.note": "Note",
"label.additional-info": "Additional Info",
"label.entered-by": "Entered by",
Expand All @@ -34,6 +43,9 @@
"label.previous-encounters": "Previous Encounters",
"label.more": "More...",
"label.customer-name": "Customer Name",
"label.contact": "Contact",
"label.linked-patient": "Linked Patient",
"label.recorded-contact-differs": "Recorded Contact: {{recordedName}}",
"title.patient-retrieval-modal": "Patient Data Retrieval",
"messages.confirm-patient-retrieval": "Are you sure you want to retrieve patient data for {{name}}?",
"messages.fetching-patient-data": "Fetching patient data...",
Expand All @@ -42,16 +54,21 @@
"messages.confirm-delete-lines_one": "This will permanently remove 1 line from this prescription",
"messages.confirm-delete-lines_other": "This will permanently remove {{count}} lines from this prescription",
"messages.click-to-return-to-encounters": "Unable to find an encounter with that ID. Click OK to return to the encounter list",
"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",
"messages.click-to-view": "Click to view the patient record for {{firstName}} {{lastName}}",
"messages.click-to-fetch": "Click to fetch patient record from central server",
"messages.no-matching-patients": "No matching patients! 😁",
"messages.no-programs": "This patient is not enrolled in any programs",
"messages.no-contact-traces": "This patient has no contact traces",
"messages.no-matching-patients-for-contact-trace": "No matching patients",
"messages.patient-data-required-for-search": "Please enter patient information",
"messages.no-patient-record": "Can't access detailed information for this patient.",
"messages.patients-found_one": "1 patient found matching the supplied details",
"messages.patients-found_other": "{{count}} patients found matching the supplied details",
"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.",
"messages.regenerate-id-confirm": "This will create a new ID and cannot be undone.",
"messages.inactive": "Program inactive",
"messages.confirm-delete-prescription": "This will permanently remove Prescription #{{number}}",
"messages.confirm-delete-prescriptions_one": "This will permanently remove 1 prescription",
"messages.confirm-delete-prescriptions_other": "This will permanently remove {{count}} prescriptions",
"messages.deleted-prescriptions_one": "Deleted {{count}} prescription",
Expand All @@ -61,11 +78,14 @@
"messages.error-saving-prescription": "Error saving prescription 🥺",
"messages.recorded-on": "Recorded on {{datetime}}",
"messages.results-found": "{{totalCount}} results found",
"messages.results-over-limit": "Showing the first 100 results only - please refine your search",
"messages.results-over-limit": "Showing the first 100 results only - please refine your search",
"messages.save-encounter-as-visited": "Save encounter as Visited?",
"messages.no-stock-available": "There is no stock available",
"messages.stock-on-hold": "Some stock lines are hold and cannot be allocated.",
"messages.stock-expired": "Some stock lines are expired and cannot be allocated.",
"placeholder.search-by-first-name": "Search by first name",
"placeholder.search-by-last-name": "Search by last name",
"placeholder.search-by-identifier": "Search by id",
"warning.cannot-create-placeholder-packs": "There is a total of {{quantity}} packs available. Unable to allocate the full amount requested.",
"warning.cannot-create-placeholder-units": "There is a total of {{quantity}} units available. Unable to allocate the full amount requested."
"warning.cannot-create-placeholder-packs": "There is a total of {{allocatedQuantity}} packs available. Unable to allocate all {{requestedQuantity}} packs.",
"warning.cannot-create-placeholder-units": "There is a total of {{allocatedQuantity}} units available. Unable to allocate all {{requestedQuantity}} units."
}
3 changes: 3 additions & 0 deletions client/packages/common/src/intl/locales/en/distribution.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
"messages.saved": "Saved",
"messages.select-rows-to-delete-them": "Select rows to delete them",
"messages.shipment-saved": "Shipment saved 🥳",
"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?",
"messages.stock-on-hold": "Some stock lines are hold and cannot be allocated.",
"messages.stock-expired": "Some stock lines are expired and cannot be allocated.",
"stocktake.description-template": "Created by {{username}} on {{date}}",
"warning.nothing-to-supply": "Nothing left to supply!",
"info.no-shipment": "Finalising this requisition will prevent you from creating a shipment for it."
Expand Down
1 change: 1 addition & 0 deletions client/packages/common/src/intl/locales/en/inventory.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"messages.unlocked-description": "This will re-enable changes to the stocktake.",
"messages.select-rows-to-delete": "Select rows to delete",
"messages.click-to-return": "Unable to find a stocktake with that ID. Click OK to return to the stocktake list",
"messages.confirm-delete-stocktake": "This will permanently remove Stocktake #{{number}}",
"messages.confirm-delete-stocktakes_one": "This will permanently remove 1 stocktake",
"messages.confirm-delete-stocktakes_other": "This will permanently remove {{count}} stocktakes",
"messages.confirm-delete-stocktake_lines_one": "This will permanently remove 1 stocktake line",
Expand Down
4 changes: 2 additions & 2 deletions client/packages/common/src/intl/locales/en/programs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"control.note.author-label": "Author",
"control.search.searching-label": "Searching...",
"control.search.no-results-label": "No results",
"control.search.search-placeholder": "Search...",
"control.search.search-patient-placeholder": "Search by patient code...",
"control.search.reset-button": "Unlink matched patient",
"control.search.matching-patients": "We've found some existing patients that match the above entered data. Please select from this list if applicable",
"control.search.error.no-document": "Unable to access requested document",
"control.search.error.no-data": "Unable to extract path \"{{docPath}}\" from document",
"control.search.error.no-patient-contact": "No matching patient contact found",
Expand Down
13 changes: 8 additions & 5 deletions client/packages/common/src/intl/locales/en/replenishment.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"label.hide-stock-over-minimum": "Hide stock over minimum",
"label.location": "Location",
"label.max": "Max",
"label.max-months-of-stock": "Maximum MOS",
"label.max-months-of-stock": "Target MOS",
"label.min": "Min",
"label.min-months-of-stock": "Minimum MOS",
"label.min-months-of-stock": "Reorder threshold MOS",
"label.moving-average": "Mov. Avg. (3mo)",
"label.new": "New",
"label.number-months_one": "{{count}} Month",
Expand Down Expand Up @@ -75,8 +75,9 @@
"messages.off-hold-confirmation": "This will re-enable status changes",
"messages.on-hold-confirmation": "This will prevent any further status changes until the hold is removed",
"messages.cant-delete-requisitions": "Can only delete requisitions with a status of 'Draft'",
"messages.changing-max-mos": "This will change the maximum months of stock target.",
"messages.changing-min-mos": "This will change the minimum months of stock threshold.",
"messages.changing-max-mos": "This will change the target months of stock.",
"messages.changing-min-mos": "This will change the reorder threshold months of stock.",
"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.",
"messages.click-to-return-to-requisitions": "Unable to find a requisition with that ID. Click OK to return to the requisition list",
"messages.click-to-return-to-shipments": "Unable to find a shipment with that ID. Click OK to return to the shipment list",
"messages.confirm-inbound-status-as": "Confirm status as $t({{status}})?\nNote: changing from 'New' will remove any lines with zero quantity.",
Expand All @@ -90,6 +91,7 @@
"messages.confirm-delete-requisition-lines_other": "This will permanently remove {{count}} lines from this order",
"messages.confirm-delete-shipments_one": "This will permanently remove 1 shipment",
"messages.confirm-delete-shipments_other": "This will permanently remove {{count}} shipments",
"messages.confirm-delete-requisition": "This will permently remove Internal Order #{{number}}",
"messages.confirm-delete-requisitions_one": "This will permanently remove 1 internal order",
"messages.confirm-delete-requisitions_other": "This will permanently remove {{count}} internal order",
"messages.confirm-delete-shipment-lines_one": "This will permanently remove 1 shipment line",
Expand All @@ -101,5 +103,6 @@
"messages.select-rows-to-delete-them": "Select rows to delete them",
"messages.shipment-saved": "Shipment saved 🥳",
"info.cannot-edit-program-requisition": "Cannot edit supplier, minimum MOS, maximum MOS or add items in a program requisition.",
"template.requisition-sent": "Approved by {{name}}{{job}}. Email: {{email}} and Phone Number: {{phone}}."
"template.requisition-sent": "Approved by {{name}}{{job}}. Email: {{email}} and Phone Number: {{phone}}.",
"label.not-set": "Not set"
}
4 changes: 0 additions & 4 deletions client/packages/common/src/intl/locales/es/replenishment.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@
"label.hide-stock-over-minimum": "Ocultar inventario por encima del mínimo",
"label.pricing": "Precios",
"label.max": "Máximo",
"label.max-months-of-stock": "Máximo MOS (Stock de Seguridad Óptimo)",
"label.min": "Mínimo",
"label.min-months-of-stock": "Mínimo MOS (Stock de Seguridad Mínimo)",
"label.moving-average": "Promedio Móvil (3 meses)",
"label.number-months_one": "{{count}} Mes",
"label.number-months_other": "{{count}} Meses",
Expand All @@ -61,8 +59,6 @@
"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",
"messages.deleted-shipments_one": "Se eliminó {{count}} envío",
"messages.deleted-shipments_other": "Se eliminaron {{count}} envíos",
"messages.changing-max-mos": "Esto cambiará el objetivo máximo de meses de existencias.",
"messages.changing-min-mos": "Esto cambiará el umbral mínimo de meses de existencias.",
"messages.could-not-save": "No se pudo guardar",
"messages.confirm-delete-shipments_other": "Esto eliminará permanentemente {{count}} envíos",
"messages.confirm-delete-invoice-lines_other": "Esto eliminará permanentemente {{count}} líneas de esta factura",
Expand Down
Loading

0 comments on commit 29c017b

Please sign in to comment.