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

Cherry pick more updates #10

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion src/core/api/types/stockOperation/StockOperationType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export enum OperationType {
}

export function operationFromString(str: string): OperationType | undefined {
str = str.toLowerCase();
str = str?.toLowerCase();
if (str === OperationType.TRANSFER_OUT_OPERATION_TYPE)
return OperationType.TRANSFER_OUT_OPERATION_TYPE;
if (str === OperationType.DISPOSED_OPERATION_TYPE)
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/table/table.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

type FilterProps = {
rowIds: Array<string>;
headers: any;

Check warning on line 32 in src/core/components/table/table.component.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
cellsById: any;

Check warning on line 33 in src/core/components/table/table.component.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
inputValue: string;
getCellId: (row, key) => string;
};
Expand Down Expand Up @@ -85,13 +85,13 @@
headers.some(({ key }) => {
const cellId = getCellId(rowId, key);
const filterableValue = cellsById[cellId].value;
const filterTerm = inputValue.toLowerCase();
const filterTerm = inputValue?.toLowerCase();

if (typeof filterableValue === "boolean") {
return false;
}

return ("" + filterableValue).toLowerCase().includes(filterTerm);
return ("" + filterableValue)?.toLowerCase().includes(filterTerm);
})
);
};
Expand Down
2 changes: 1 addition & 1 deletion src/core/utils/datetimeUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const ParseDate = (value: string | null | undefined) => {
let date = null;
try {
if (!value) return date;
value = value.toLowerCase();
value = value?.toLowerCase();
if (value.includes("jan")) value = value.replace("jan", "01");
else if (value.includes("feb")) value = value.replace("feb", "02");
else if (value.includes("mar")) value = value.replace("mar", "03");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ const ConceptsSelector = <T,>(props: ConceptsSelectorProps<T>) => {
? concepts
: concepts.filter((concept) =>
concept.display
.toLowerCase()
.includes(inputValue.trim().toLowerCase())
?.toLowerCase()
.includes(inputValue.trim()?.toLowerCase())
);
}, [inputValue, concepts]);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { useTranslation } from "react-i18next";
import { StockOperationDTO } from "../../core/api/types/stockOperation/StockOperationDTO";
import { SaveStockOperation } from "../../stock-items/types";
Expand Down Expand Up @@ -83,6 +83,12 @@ const BaseOperationDetails: React.FC<BaseOperationDetailsProps> = ({

const [isOtherUser, setIsOtherUser] = useState<boolean | null>();
const [isSaving, setIsSaving] = useState(false);
useEffect(() => {
if (defaultLoggedUserUuid) {
setValue("responsiblePersonUuid", defaultLoggedUserUuid);
}
}, [defaultLoggedUserUuid, setValue]);

if (isLoading) {
return (
<InlineLoading
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const AddStockUserRoleScope: React.FC<AddStockUserRoleScopeProps> = ({
.filter((item: any) => item.uuid !== loggedInUserUuid)
.filter((item: any) => {
const displayName = item?.person?.display ?? item?.display ?? "";
return displayName.toLowerCase().includes(query.toLowerCase());
return displayName?.toLowerCase().includes(query?.toLowerCase());
});
setFilteredItems(filtered);
}
Expand Down
Loading