Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix) O3-2671: Lab orders added directly to the basket should be marked incomplete #1552

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,14 @@ const TestTypeSearchResultItem: React.FC<TestTypeSearchResultItemProps> = ({ tes

const addToBasket = useCallback(() => {
const labOrder = createLabOrder(testType);
labOrder.isOrderIncomplete = true;
setOrders([...orders, labOrder]);
closeWorkspace('add-lab-order', true);
launchPatientWorkspace('order-basket');
}, [orders, setOrders, createLabOrder, testType]);

const removeFromBasket = useCallback(() => {
setOrders(orders.filter((order) => order.testType.conceptUuid != testType.conceptUuid));
setOrders(orders.filter((order) => order.testType.conceptUuid !== testType.conceptUuid));
}, [orders, setOrders, testType.conceptUuid]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export function LabOrderBasketItemTile({ orderBasketItem, onItemClick, onRemoveC
// Hence, we manually prevent the handleClick callback from being invoked as soon as the button is pressed once.
const shouldOnClickBeCalled = useRef(true);

const labelClassName = classNames(styles.orderActionNewLabel, {
[styles.orderActionIncompleteLabel]: orderBasketItem.isOrderIncomplete,
});

return (
<ClickableTile
role="listitem"
Expand All @@ -36,7 +40,9 @@ export function LabOrderBasketItemTile({ orderBasketItem, onItemClick, onRemoveC
>
<div className={styles.orderBasketItemTile}>
<div className={styles.clipTextWithEllipsis}>
<span className={styles.orderActionNewLabel}>{t('orderActionNew', 'New')}</span>
<span className={labelClassName}>
{orderBasketItem.isOrderIncomplete ? t('incomplete', 'Incomplete') : t('orderActionNew', 'New')}
</span>
<br />
<>
<span className={styles.name}>{orderBasketItem.testType?.label}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
padding: 0 0.25rem;
}

.orderActionIncompleteLabel {
@extend .label;
color: white;
background-color: $danger;
padding: 0 0.25rem;
}

.orderErrorText {
color: $danger;
display: flex;
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/am.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "Error occured when loading test types",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "Lab reference number",
"loading": "Loading",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "حدث خطأ أثناء تحميل أنواع الاختبارات",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "رقم المرجع المخبري",
"loading": "جار التحميل",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "Error occured when loading test types",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "Lab reference number",
"loading": "Loading",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "Error al cargar los tipos de pruebas",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "Número de referencia del laboratorio",
"loading": "Cargando",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "Une erreur s'est produite lors du chargement des types de tests",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "Numéro de référence du laboratoire",
"loading": "Chargement",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "אירעה שגיאה בעת טעינת סוגי הבדיקות",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "מספר התייחסות של המעבדה",
"loading": "טוען",
Expand Down
1 change: 1 addition & 0 deletions packages/esm-patient-labs-app/translations/km.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"errorLoadingTestTypes": "មានបញ្ហាក្នុងការផ្ទុកប្រភេទតេស្ត",
"female": "Female",
"full": "Full",
"incomplete": "Incomplete",
"labOrders": "Lab orders",
"labReferenceNumber": "លេខយោងប្រតិបត្តិការប្រតិបត្តិការ",
"loading": "កំពុងផ្ទុក",
Expand Down
Loading