Skip to content

Commit

Permalink
Merge branch 'develop' into fix-rewriting-TestManagementConfigMenu-page
Browse files Browse the repository at this point in the history
  • Loading branch information
adityadeshlahre authored Jan 23, 2025
2 parents 87eed7f + 2e269e6 commit 960938f
Show file tree
Hide file tree
Showing 17 changed files with 185 additions and 47 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/publish-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ env:

jobs:
build-and-push-test-image-backend:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -63,6 +64,7 @@ jobs:
build-args: SKIP_SPOTLESS=true

build-and-push-test-image-frontend:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -105,6 +107,7 @@ jobs:
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max

build-and-push-test-image-proxy:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -146,6 +149,7 @@ jobs:
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-proxy:buildcache,mode=max

build-and-push-test-image-fhir:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -303,6 +307,7 @@ jobs:
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-frontend:buildcache,mode=max

build-and-push-image-proxy:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down Expand Up @@ -344,6 +349,7 @@ jobs:
cache-to: type=registry,ref=${{ env.DOCKER_TEST_NAME }}-proxy:buildcache,mode=max

build-and-push-image-fhir:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-dev-backend-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:

jobs:
build-and-push-image-backend-dev:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -83,6 +84,7 @@ jobs:
retention-days: 1

merge-backend-dev-platform-images:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
needs:
- build-and-push-image-backend-dev
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/publish-dev-frontend-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ env:

jobs:
build-and-push-image-frontend-dev:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down Expand Up @@ -85,6 +86,7 @@ jobs:
retention-days: 1

merge-frontend-dev-platform-images:
if: ${{ github.repository == 'I-TECH-UW/OpenELIS-Global-2' }}
runs-on: ubuntu-latest
needs:
- build-and-push-image-frontend-dev
Expand Down
1 change: 1 addition & 0 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ module.exports = defineConfig({
defaultCommandTimeout: 8000,
viewportWidth: 1200,
viewportHeight: 700,
video: false,
watchForFileChanges: false,
e2e: {
setupNodeEvents(on, config) {
Expand Down
10 changes: 5 additions & 5 deletions frontend/cypress/pages/AdminPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ class AdminPage {
goToLabNumberManagementPage() {
// Click on the element using the provided selector
cy.get("a.cds--side-nav__link[href='#labNumber']")
.should("be.visible")
.click();
.should("be.visible")
.click();

cy.url().should("include", "#labNumber");
cy.contains("Lab Number Management").should("be.visible");
cy.url().should("include", "#labNumber");
cy.contains("Lab Number Management").should("be.visible");

return new LabNumberManagementPage();
return new LabNumberManagementPage();
}

//global menu configuration
Expand Down
6 changes: 2 additions & 4 deletions frontend/cypress/pages/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,13 @@ class HomePage {

goToPathologyDashboard() {
this.openNavigationMenu();
cy.get("#menu_pathology_dropdown").click();
cy.get("#menu_pathologydashboard_nav").click();
cy.get("#menu_pathology").click(); // Changed from menu_pathology_dropdown
return new DashBoardPage();
}

goToImmunoChemistryDashboard() {
this.openNavigationMenu();
cy.get("#menu_immunochem_dropdown").click();
cy.get("#menu_immunochemdashboard_nav").click();
cy.get("#menu_immunochem").click(); // Changed from menu_immunochem_dropdown
return new DashBoardPage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,6 @@ function ConfigMenuDisplay(props) {
{rows.map((row) => (
<TableRow
key={row.id}
onClick={() => {
setSelectedRowId(row.id);
}}
>
{row.cells.map((cell) =>
renderCell(cell, row),
Expand Down
21 changes: 21 additions & 0 deletions frontend/src/components/common/CustomDatePicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@ const CustomDatePicker = (props) => {
props.onChange(currentDate);
}

function handleInputChange(e) {
const inputValue = e.target.value;

const isFrenchLocale =
configurationProperties.DEFAULT_DATE_LOCALE === "fr-FR";
const partialDateRegex = isFrenchLocale
? /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/
: /^(\d{0,2})(\/(\d{0,2})(\/(\d{0,4})?)?)?$/;

const fullDateRegex = isFrenchLocale
? /^(0[1-9]|[12][0-9]|3[01])\/(0[1-9]|1[0-2])\/\d{4}$/
: /^(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/\d{4}$/;

if (partialDateRegex.test(inputValue)) {
e.target.value = inputValue;
} else {
e.target.value = ""; // Clear invalid input
}
}

useEffect(() => {
props.onChange(currentDate);
}, [currentDate]);
Expand Down Expand Up @@ -76,6 +96,7 @@ const CustomDatePicker = (props) => {
invalid={props.invalid}
invalidText={props.invalidText}
disabled={props.disabled}
onChange={handleInputChange}
/>
</DatePicker>
</>
Expand Down
99 changes: 67 additions & 32 deletions frontend/src/components/resultPage/SearchResultForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,40 @@ export function SearchResults(props) {
};
}, []);

useEffect(() => {
if (props.results.testResult) {
let newValidationState = { ...validationState };
props.results.testResult.forEach((row) => {
if (row.resultType === "N") {
let value = row.resultValue;
if (!value) {
return;
}
let validation = (newValidationState[row.id] = validateNumericResults(
value,
row,
));

row.resultValue = validation.newValue;
validation.style = {
...validation?.style,
borderColor: validation.isCritical
? "orange"
: validation.isInvalid
? "red"
: "",
background: validation.outsideValid
? "#ffa0a0"
: validation.outsideNormal
? "#ffffa0"
: "var(--cds-field)",
};
}
});
setValidationState(newValidationState);
}
}, [props.results]);

const loadReferalOrganizations = (values) => {
if (componentMounted.current) {
setReferalOrganizations(values);
Expand Down Expand Up @@ -1117,45 +1151,46 @@ export function SearchResults(props) {
type="number"
value={row.resultValue}
style={validationState[row.id]?.style}
onMouseOut={(e) => {
let value = e.target.value;
if (value == null || value == "") {
return;
}
let newValidationState = { ...validationState };
let validation = (newValidationState[row.id] =
validateNumericResults(value, row));
//e.target.value = validation.newValue;
row.resultValue = validation.newValue;
validation.style = {
...validation?.style,
borderColor: validation.isCritical
? "orange"
: validation.isInvalid
? "red"
: "",
background: validation.outsideValid
? "#ffa0a0"
: validation.outsideNormal
? "#ffffa0"
: "var(--cds-field)",
};

setValidationState(newValidationState);

onBlur={(e) => {
if (
validation.isInvalid &&
validationState[row.id].isInvalid &&
configurationProperties.ALERT_FOR_INVALID_RESULTS
) {
alert(
intl.formatMessage({
id: "result.outOfValidRange.msg",
}),
);
addNotification({
title: intl.formatMessage({ id: "notification.title" }),
message:
intl.formatMessage({
id: "result.outOfValidRange.msg",
}) +
" " +
row.testName +
" : " +
row.resultValue,
kind: NotificationKinds.error,
});
setNotificationVisible(true);
}
}}
onChange={(e) => {
handleChange(e, row.id);
if (
validationState[row.id].isInvalid &&
configurationProperties.ALERT_FOR_INVALID_RESULTS
) {
addNotification({
title: intl.formatMessage({ id: "notification.title" }),
message:
intl.formatMessage({
id: "result.outOfValidRange.msg",
}) +
" " +
row.testName +
" : " +
row.resultValue,
kind: NotificationKinds.error,
});
setNotificationVisible(true);
}
}}
/>
);
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<minor.version>1</minor.version>
<state.version>0</state.version>
<!-- 0 = alpha, 1 = beta, 2 = rc, 3 = deployable -->
<fix.version>2</fix.version>
<fix.version>3</fix.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<liquibase.propertyFile>${project.basedir}/liquibase/liquibase.properties</liquibase.propertyFile>
<castor.version>1.4.1</castor.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
package org.openelisglobal.common.provider.query;

import java.math.BigDecimal;
import org.openelisglobal.common.util.ConfigurationProperties;
import org.openelisglobal.common.util.ConfigurationProperties.Property;
import org.openelisglobal.common.util.DateUtil;

public class PatientSearchResults {

Expand Down Expand Up @@ -76,7 +79,7 @@ public String getGender() {
}

public String getDOB() {
return birthdate;
return getFormatedBirthDate();
}

public String getNationalId() {
Expand All @@ -88,7 +91,7 @@ public String getSTNumber() {
}

public String getBirthdate() {
return birthdate;
return getFormatedBirthDate();
}

public void setBirthdate(String birthdate) {
Expand Down Expand Up @@ -198,4 +201,14 @@ public String getContactPhone() {
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}

public String getFormatedBirthDate() {
String format1 = "dd/MM/yyyy";
String format2 = "MM/dd/yyyy";
birthdate = ConfigurationProperties.getInstance().getPropertyValue(Property.DEFAULT_DATE_LOCALE).equals("fr-FR")
? DateUtil.formatStringDate(birthdate, format1)
: DateUtil.formatStringDate(birthdate, format2);

return birthdate;
}
}
3 changes: 3 additions & 0 deletions src/main/java/org/openelisglobal/common/util/DateUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,9 @@ public static java.sql.Date convertDateTimeToSqlDate(Date date) throws LIMSRunti
}

public static String formatStringDate(String dateStr, String outputFormat) {
if (dateStr == null) {
return "";
}
// Define the input date formats
DateTimeFormatter formatter1 = DateTimeFormatter.ofPattern("MM/dd/yyyy");
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("dd/MM/yyyy");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public interface SearchResultsDAO {
String ID_PARAM = "id";
String GUID = "guid";
String DATE_OF_BIRTH = "dateOfBirth";
String DATE_OF_BIRTH_FORMATED = "dateOfBirthFormatted";
String GENDER = "gender";

String ID_TYPE_FOR_ST = "stNumberId";
Expand Down
Loading

0 comments on commit 960938f

Please sign in to comment.