- Progress commit

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-02-15 21:01:43 -05:00
parent 767c219af8
commit 9cc0d6175e
2 changed files with 35 additions and 6 deletions

View File

@@ -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 (
<Form.Item style={{margin: 0, padding: 0}} dependencies={["key"]}>
{() => {
@@ -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}) {
]}
>
<Select
options={[
{value: "desc", label: "Descending"},
{value: "asc", label: "Ascending"},
]}
options={getOperatorsByType()}
/>
</Form.Item>
</Col>

View File

@@ -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,