Skip to content
Snippets Groups Projects
Commit 4bff3361 authored by Dima Rifai's avatar Dima Rifai Committed by mcfarhat
Browse files

Issue #486 - Handle Select Financial

parent bcd829d9
No related branches found
No related tags found
1 merge request!591Delrifai/#486 add financial operation types
Pipeline #118024 failed
......@@ -17,7 +17,7 @@ import Chip from "./Chip";
import { categorizedOperationTypes } from "@/utils/CategorizedOperationTypes";
import Explorer from "@/types/Explorer";
import { ChevronDown, Search } from "lucide-react";
import { FinancialOperationTypes } from "@/utils/FinancialOperationTypes";
type OperationTypesDialogProps = {
operationTypes?: Explorer.ExtendedOperationTypePattern[];
triggerTitle: string;
......@@ -187,6 +187,30 @@ const OperationTypesDialog: React.FC<OperationTypesDialogProps> = ({
setExpandedSections(allMatchingCategories);
};
const selectFinancial = () => {
const financialOperationTypePatterns = operationTypes?.filter(operationType =>
FinancialOperationTypes.includes(operationType.operation_name)
);
if (!financialOperationTypePatterns) {
return;
}
const financialIds = financialOperationTypePatterns
.filter(filterOperations)
.map((operationType) => operationType.op_type_id);
let finaList = [...financialIds, ...selectedOperationsIds];
finaList = finaList.filter((id, index) => finaList.indexOf(id) === index);
setSelectedOperationsIds([...finaList]);
const allMatchingCategories = getCategoriesToExpand(
finaList,
operationTypes,
categorizedOperationTypes
);
setExpandedSections(allMatchingCategories);
};
const selectVirtual = () => {
const virtualIds = virtualOperations
.filter(filterOperations)
......@@ -448,6 +472,13 @@ const OperationTypesDialog: React.FC<OperationTypesDialogProps> = ({
>
Virtual
</Button>
<Button
type="button"
className="operations-button text-xs"
onClick={selectFinancial}
>
Financial
</Button>
<Button
type="button"
className="operations-button text-xs"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment