Skip to content

Commit

Permalink
Merge branch 'develop' into 5177-Allow-user-to-create-PROGRAM-manual-…
Browse files Browse the repository at this point in the history
…requisitions
  • Loading branch information
roxy-dao committed Oct 29, 2024
2 parents a848abd + 8e94318 commit 7f2cbc4
Show file tree
Hide file tree
Showing 192 changed files with 5,112 additions and 722 deletions.
1 change: 1 addition & 0 deletions client/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ module.exports = {
transformIgnorePatterns: [
'/node_modules/(?!uuid|@mui/x-date-pickers|@babel)',
],
roots: ['../server', '../client'],
};
15 changes: 13 additions & 2 deletions client/packages/coldchain/src/Equipment/DetailView/DetailView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ import { Summary } from './Tabs';
import { useAssets } from '../api';
import { StatusLogs } from './Tabs/StatusLogs';
import { Documents } from './Tabs/Documents';
import { ActivityLogList, useLocation } from '@openmsupply-client/system';
import {
ActivityLogList,
LocationRowFragment,
useLocation,
} from '@openmsupply-client/system';
import { DraftAsset } from '../types';
import { Details } from './Tabs/Details';

Expand Down Expand Up @@ -98,7 +102,7 @@ export const EquipmentDetailView = () => {

const locations =
locationData?.nodes.map(location => ({
label: location.code,
label: formatLocationLabel(location),
value: location.id,
})) || [];

Expand Down Expand Up @@ -163,3 +167,10 @@ export const EquipmentDetailView = () => {
</React.Suspense>
);
};

// Displays location with storage name if present, e.g. "ABC (Cold store)".
// If not present, just displays the code alone
export const formatLocationLabel = (location: LocationRowFragment) => {
const { code, coldStorageType } = location;
return `${code}${coldStorageType ? ` (${coldStorageType.name})` : ''}`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
StoreSearchInput,
} from '@openmsupply-client/system';
import { DraftAsset } from '../../types';
import { formatLocationLabel } from '../DetailView';
interface SummaryProps {
draft?: DraftAsset;
onChange: (patch: Partial<DraftAsset>) => void;
Expand Down Expand Up @@ -112,7 +113,7 @@ export const Summary = ({ draft, onChange, locations }: SummaryProps) => {
if (!draft) return null;

const defaultLocations = draft.locations.nodes.map(location => ({
label: location.code,
label: formatLocationLabel(location),
value: location.id,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import gql from 'graphql-tag';
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
export type AssetRowFragment = { __typename: 'AssetNode', assetNumber?: string | null, id: string, notes?: string | null, serialNumber?: string | null, modifiedDatetime: any, installationDate?: string | null, createdDatetime: any, replacementDate?: string | null, storeId?: string | null, properties: string, catalogProperties?: string | null, statusLog?: { __typename: 'AssetLogNode', logDatetime: any, status?: Types.StatusType | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null } | null, store?: { __typename: 'StoreNode', id: string, code: string, storeName: string } | null, catalogueItem?: { __typename: 'AssetCatalogueItemNode', manufacturer?: string | null, model: string, code: string } | null, assetType?: { __typename: 'AssetTypeNode', name: string } | null };

export type AssetFragment = { __typename: 'AssetNode', catalogueItemId?: string | null, assetNumber?: string | null, createdDatetime: any, id: string, installationDate?: string | null, properties: string, catalogProperties?: string | null, modifiedDatetime: any, notes?: string | null, replacementDate?: string | null, serialNumber?: string | null, storeId?: string | null, donorNameId?: string | null, warrantyStart?: string | null, warrantyEnd?: string | null, needsReplacement?: boolean | null, documents: { __typename: 'SyncFileReferenceConnector', nodes: Array<{ __typename: 'SyncFileReferenceNode', fileName: string, id: string, mimeType?: string | null }> }, locations: { __typename: 'LocationConnector', totalCount: number, nodes: Array<{ __typename: 'LocationNode', id: string, code: string, name: string, onHold: boolean }> }, statusLog?: { __typename: 'AssetLogNode', logDatetime: any, status?: Types.StatusType | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null } | null, store?: { __typename: 'StoreNode', id: string, code: string, storeName: string } | null, catalogueItem?: { __typename: 'AssetCatalogueItemNode', manufacturer?: string | null, model: string } | null, assetType?: { __typename: 'AssetTypeNode', id: string, name: string } | null, assetClass?: { __typename: 'AssetClassNode', id: string, name: string } | null, assetCategory?: { __typename: 'AssetCategoryNode', id: string, name: string } | null, donor?: { __typename: 'NameNode', id: string, name: string } | null };
export type AssetFragment = { __typename: 'AssetNode', catalogueItemId?: string | null, assetNumber?: string | null, createdDatetime: any, id: string, installationDate?: string | null, properties: string, catalogProperties?: string | null, modifiedDatetime: any, notes?: string | null, replacementDate?: string | null, serialNumber?: string | null, storeId?: string | null, donorNameId?: string | null, warrantyStart?: string | null, warrantyEnd?: string | null, needsReplacement?: boolean | null, documents: { __typename: 'SyncFileReferenceConnector', nodes: Array<{ __typename: 'SyncFileReferenceNode', fileName: string, id: string, mimeType?: string | null }> }, locations: { __typename: 'LocationConnector', totalCount: number, nodes: Array<{ __typename: 'LocationNode', id: string, code: string, name: string, onHold: boolean, coldStorageType?: { __typename: 'ColdStorageTypeNode', id: string, name: string, maxTemperature: number, minTemperature: number } | null }> }, statusLog?: { __typename: 'AssetLogNode', logDatetime: any, status?: Types.StatusType | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null } | null, store?: { __typename: 'StoreNode', id: string, code: string, storeName: string } | null, catalogueItem?: { __typename: 'AssetCatalogueItemNode', manufacturer?: string | null, model: string } | null, assetType?: { __typename: 'AssetTypeNode', id: string, name: string } | null, assetClass?: { __typename: 'AssetClassNode', id: string, name: string } | null, assetCategory?: { __typename: 'AssetCategoryNode', id: string, name: string } | null, donor?: { __typename: 'NameNode', id: string, name: string } | null };

export type ColdchainAssetLogFragment = { __typename: 'AssetLogNode', comment?: string | null, id: string, logDatetime: any, status?: Types.StatusType | null, type?: string | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null, user?: { __typename: 'UserNode', firstName?: string | null, lastName?: string | null, username: string, jobTitle?: string | null } | null, documents: { __typename: 'SyncFileReferenceConnector', nodes: Array<{ __typename: 'SyncFileReferenceNode', fileName: string, id: string, mimeType?: string | null }> } };

Expand All @@ -27,7 +27,7 @@ export type AssetByIdQueryVariables = Types.Exact<{
}>;


export type AssetByIdQuery = { __typename: 'Queries', assets: { __typename: 'AssetConnector', totalCount: number, nodes: Array<{ __typename: 'AssetNode', catalogueItemId?: string | null, assetNumber?: string | null, createdDatetime: any, id: string, installationDate?: string | null, properties: string, catalogProperties?: string | null, modifiedDatetime: any, notes?: string | null, replacementDate?: string | null, serialNumber?: string | null, storeId?: string | null, donorNameId?: string | null, warrantyStart?: string | null, warrantyEnd?: string | null, needsReplacement?: boolean | null, documents: { __typename: 'SyncFileReferenceConnector', nodes: Array<{ __typename: 'SyncFileReferenceNode', fileName: string, id: string, mimeType?: string | null }> }, locations: { __typename: 'LocationConnector', totalCount: number, nodes: Array<{ __typename: 'LocationNode', id: string, code: string, name: string, onHold: boolean }> }, statusLog?: { __typename: 'AssetLogNode', logDatetime: any, status?: Types.StatusType | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null } | null, store?: { __typename: 'StoreNode', id: string, code: string, storeName: string } | null, catalogueItem?: { __typename: 'AssetCatalogueItemNode', manufacturer?: string | null, model: string } | null, assetType?: { __typename: 'AssetTypeNode', id: string, name: string } | null, assetClass?: { __typename: 'AssetClassNode', id: string, name: string } | null, assetCategory?: { __typename: 'AssetCategoryNode', id: string, name: string } | null, donor?: { __typename: 'NameNode', id: string, name: string } | null }> } };
export type AssetByIdQuery = { __typename: 'Queries', assets: { __typename: 'AssetConnector', totalCount: number, nodes: Array<{ __typename: 'AssetNode', catalogueItemId?: string | null, assetNumber?: string | null, createdDatetime: any, id: string, installationDate?: string | null, properties: string, catalogProperties?: string | null, modifiedDatetime: any, notes?: string | null, replacementDate?: string | null, serialNumber?: string | null, storeId?: string | null, donorNameId?: string | null, warrantyStart?: string | null, warrantyEnd?: string | null, needsReplacement?: boolean | null, documents: { __typename: 'SyncFileReferenceConnector', nodes: Array<{ __typename: 'SyncFileReferenceNode', fileName: string, id: string, mimeType?: string | null }> }, locations: { __typename: 'LocationConnector', totalCount: number, nodes: Array<{ __typename: 'LocationNode', id: string, code: string, name: string, onHold: boolean, coldStorageType?: { __typename: 'ColdStorageTypeNode', id: string, name: string, maxTemperature: number, minTemperature: number } | null }> }, statusLog?: { __typename: 'AssetLogNode', logDatetime: any, status?: Types.StatusType | null, reason?: { __typename: 'AssetLogReasonNode', reason: string } | null } | null, store?: { __typename: 'StoreNode', id: string, code: string, storeName: string } | null, catalogueItem?: { __typename: 'AssetCatalogueItemNode', manufacturer?: string | null, model: string } | null, assetType?: { __typename: 'AssetTypeNode', id: string, name: string } | null, assetClass?: { __typename: 'AssetClassNode', id: string, name: string } | null, assetCategory?: { __typename: 'AssetCategoryNode', id: string, name: string } | null, donor?: { __typename: 'NameNode', id: string, name: string } | null }> } };

export type AssetLogsQueryVariables = Types.Exact<{
filter: Types.AssetLogFilterInput;
Expand Down Expand Up @@ -132,6 +132,12 @@ export const AssetFragmentDoc = gql`
code
name
onHold
coldStorageType {
id
name
maxTemperature
minTemperature
}
}
totalCount
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ fragment Asset on AssetNode {
code
name
onHold
coldStorageType {
id
name
maxTemperature
minTemperature
}
}
totalCount
}
Expand Down
10 changes: 5 additions & 5 deletions client/packages/coldchain/src/Sensor/api/operations.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as Types from '@openmsupply-client/common';
import { GraphQLClient, RequestOptions } from 'graphql-request';
import gql from 'graphql-tag';
type GraphQLClientRequestHeaders = RequestOptions['requestHeaders'];
export type LocationRowFragment = { __typename: 'LocationNode', id: string, name: string, onHold: boolean, code: string };
export type SensorLocationRowFragment = { __typename: 'LocationNode', id: string, name: string, onHold: boolean, code: string };

export type SensorFragment = { __typename: 'SensorNode', id: string, isActive: boolean, name: string, serial: string, batteryLevel?: number | null, breach?: Types.TemperatureBreachNodeType | null, type: Types.SensorNodeType, location?: { __typename: 'LocationNode', id: string, name: string, onHold: boolean, code: string } | null, latestTemperatureLog?: { __typename: 'TemperatureLogConnector', totalCount: number, nodes: Array<{ __typename: 'TemperatureLogNode', temperature: number, datetime: string }> } | null, assets: { __typename: 'AssetConnector', totalCount: number, nodes: Array<{ __typename: 'AssetNode', id: string, assetNumber?: string | null }> } };

Expand All @@ -25,8 +25,8 @@ export type UpdateSensorMutationVariables = Types.Exact<{

export type UpdateSensorMutation = { __typename: 'Mutations', updateSensor: { __typename: 'SensorNode', id: string, isActive: boolean, name: string, serial: string, batteryLevel?: number | null, breach?: Types.TemperatureBreachNodeType | null, type: Types.SensorNodeType, location?: { __typename: 'LocationNode', id: string, name: string, onHold: boolean, code: string } | null, latestTemperatureLog?: { __typename: 'TemperatureLogConnector', totalCount: number, nodes: Array<{ __typename: 'TemperatureLogNode', temperature: number, datetime: string }> } | null, assets: { __typename: 'AssetConnector', totalCount: number, nodes: Array<{ __typename: 'AssetNode', id: string, assetNumber?: string | null }> } } | { __typename: 'UpdateSensorError' } };

export const LocationRowFragmentDoc = gql`
fragment LocationRow on LocationNode {
export const SensorLocationRowFragmentDoc = gql`
fragment SensorLocationRow on LocationNode {
__typename
id
name
Expand All @@ -45,7 +45,7 @@ export const SensorFragmentDoc = gql`
breach
type
location {
...LocationRow
...SensorLocationRow
}
latestTemperatureLog {
totalCount
Expand All @@ -62,7 +62,7 @@ export const SensorFragmentDoc = gql`
}
}
}
${LocationRowFragmentDoc}`;
${SensorLocationRowFragmentDoc}`;
export const SensorsDocument = gql`
query sensors($page: PaginationInput, $sort: [SensorSortInput!], $filter: SensorFilterInput, $storeId: String!) {
sensors(page: $page, sort: $sort, filter: $filter, storeId: $storeId) {
Expand Down
4 changes: 2 additions & 2 deletions client/packages/coldchain/src/Sensor/api/operations.graphql
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fragment LocationRow on LocationNode {
fragment SensorLocationRow on LocationNode {
__typename
id
name
Expand All @@ -17,7 +17,7 @@ fragment Sensor on SensorNode {
type

location {
...LocationRow
...SensorLocationRow
}

latestTemperatureLog {
Expand Down
12 changes: 10 additions & 2 deletions client/packages/common/src/intl/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@
"error.failed-to-generate-report": "Failed to generate report",
"error.failed-to-save-service-charges": "Failed to save service charges",
"error.failed-to-save-vaccination": "Failed to save vaccination!",
"error.failed-to-save-item-variant": "Failed to save item variant",
"error.failed-to-save-vaccine-course": "Failed to save vaccine course",
"error.fetch-notifications": "Unable to display cold chain notifications",
"error.field-must-be-specified": "{{field}} must be specified",
Expand Down Expand Up @@ -569,6 +570,7 @@
"label.cold-consecutive": "Cold Consecutive",
"label.cold-cumulative": "Cold Cumulative",
"label.cold-storage-location": "Cold storage location",
"label.storage-type": "Storage type",
"label.collapse": "Collapse",
"label.collapse-all": "Collapse all",
"label.color": "Colour",
Expand Down Expand Up @@ -644,6 +646,7 @@
"label.edit-location": "Edit Location",
"label.edit-pack-variant": "Edit Pack Variant",
"label.edit-store-properties": "Edit store properties",
"label.edit-variant": "Edit Variant",
"label.edited-by": "Edited by",
"label.encounter": "Encounter",
"label.encounter-end": "End",
Expand Down Expand Up @@ -859,6 +862,7 @@
"label.placeholder": "Placeholder",
"label.previous-encounters": "Previous Encounters",
"label.pricing": "Pricing",
"label.primary": "Primary",
"label.program": "Program",
"label.program-enrolment": "Program Enrolment",
"label.program-enrolments": "Program Enrolments",
Expand Down Expand Up @@ -906,6 +910,7 @@
"label.save-log": "Save log to file",
"label.schedule": "Schedule",
"label.search-results": "Search results",
"label.secondary": "Secondary",
"label.select": "Select",
"label.select-all": "Select all",
"label.select-batch": "Select batch",
Expand Down Expand Up @@ -965,6 +970,7 @@
"label.target-stock": "Target Stock",
"label.tax": "Tax",
"label.temperature": "Temperature",
"label.tertiary": "Tertiary",
"label.this-week": "This week",
"label.threshold-for-overstock": "Threshold for overstock",
"label.threshold-for-understock": "Threshold for understock",
Expand Down Expand Up @@ -1028,7 +1034,7 @@
"label.visit-start": "Start",
"label.volume-per-outer-pack": "Volume per outer pack",
"label.volume-per-pack": "Volume per pack",
"label.volume-per-unit": "Volume per unit",
"label.volume-per-unit": "Volume per unit (L)",
"label.warning-message": "Warning",
"label.warranty-end-date": "Warranty end",
"label.warranty-start-date": "Warranty start",
Expand Down Expand Up @@ -1151,7 +1157,7 @@
"messages.confirm-changing-from-new": "Note: changing from 'New' will remove any lines with zero quantity.",
"messages.confirm-delete-assets_one": "This will permanently remove this asset.",
"messages.confirm-delete-assets_other": "This will permanently remove the {{count}} selected assets.",
"messages.confirm-delete-customer-return": "This will permanently Customer Return #{{number}}",
"messages.confirm-delete-customer-return": "This will permanently delete Customer Return #{{number}}",
"messages.confirm-delete-document": "This will remove this document.",
"messages.confirm-delete-generic": "This will permanently remove data",
"messages.confirm-delete-immunisation-programs_one": "This will permanently remove this Immunization Program.",
Expand Down Expand Up @@ -1325,6 +1331,7 @@
"messages.internal-order-created-on": "Internal order created on {{date}}",
"messages.invalid-file": "Invalid file",
"messages.inventory-adjustment-saved": "Inventory adjustment saved 🥳",
"messages.item-variant-saved": "Item variant saved successfully",
"messages.last-temperature": "Last temperature reading: {{temperature}} °C",
"messages.loading-report": "Loading report...",
"messages.location": "Location:",
Expand All @@ -1344,6 +1351,7 @@
"messages.no-data-available": "No data available",
"messages.no-data-found": "No data found",
"messages.no-documents-uploaded": "No documents have been uploaded",
"messages.no-item-variants": "No item variants configured",
"messages.no-items-with-stock": "No items with stock available",
"messages.no-ledger": "This stock line has no stock movements to display",
"messages.no-lines": "Cannot change the status because there are no lines or because there are only placeholder lines",
Expand Down
Loading

0 comments on commit 7f2cbc4

Please sign in to comment.