diff --git a/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx b/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx
index 62efefac0..4e3d0aa5d 100644
--- a/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx
+++ b/client/src/components/report-center-modal/report-center-modal-filters-sorters-component.jsx
@@ -5,8 +5,20 @@ import {DeleteFilled} from "@ant-design/icons";
import {useTranslation} from "react-i18next";
import {getOperatorsByType} from "../../utils/graphQLmodifier";
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
+import {setModalContext} from "../../redux/modals/modals.actions";
+import {connect} from "react-redux";
+import {createStructuredSelector} from "reselect";
+import {selectBodyshop, selectCurrentUser} from "../../redux/user/user.selectors";
-export default function ReportCenterModalFiltersSortersComponent({form}) {
+const mapDispatchToProps = (dispatch) => ({});
+const mapStateToProps = createStructuredSelector({
+ bodyshop: selectBodyshop,
+ currentUser: selectCurrentUser
+});
+
+export function ReportCenterModalFiltersSortersComponent({form, bodyshop, currentUser}) {
+ console.dir(bodyshop, {depth: null})
+ console.dir(currentUser, {depth: null})
return (
{() => {
@@ -17,6 +29,9 @@ export default function ReportCenterModalFiltersSortersComponent({form}) {
);
}
+export default connect(mapStateToProps, mapDispatchToProps)(ReportCenterModalFiltersSortersComponent);
+
+
function RenderFilters({templateId, form}) {
const [state, setState] = useState(null);
const [visible, setVisible] = useState(false);
@@ -210,7 +225,7 @@ function RenderFilters({templateId, form}) {
state.sorters
? state.sorters.map((f) => ({
value: f.name,
- label: t(f.translation),
+ label: f?.translation ? (t(f.translation) === f.translation ? f.label : t(f.translation)) : f.label,
}))
: []
}
@@ -230,10 +245,7 @@ function RenderFilters({templateId, form}) {
]}
>
diff --git a/client/src/utils/graphQLmodifier.js b/client/src/utils/graphQLmodifier.js
index 5716753ad..c9a93542e 100644
--- a/client/src/utils/graphQLmodifier.js
+++ b/client/src/utils/graphQLmodifier.js
@@ -16,7 +16,24 @@ const NUMBER_OPERATORS = [
{value: "_gte", label: "greater than or equal"},
{value: "_lte", label: "less than or equal"}
];
+const ORDER_BY_OPERATORS = [
+ {value: "asc", label: "ascending"},
+ {value: "desc", label: "descending"}
+];
+/**
+ * Get the available operators for filtering
+ * @returns {[{label: string, value: string},{label: string, value: string}]}
+ */
+export function getOrderByOperators() {
+ return ORDER_BY_OPERATORS;
+}
+
+/**
+ * Get the available operators for filtering
+ * @param type
+ * @returns {[{label: string, value: string},{label: string, value: string},{label: string, value: string},{label: string, value: string},{label: string, value: string},null]}
+ */
export function getOperatorsByType(type = 'string') {
const operators = {
string: STRING_OPERATORS,