- Fix the page layout, the footer was in the content section causing it not to remain at the bottom and just reside 'at the bottom' of the content section. Also added a 100% on the outer container height (100vh) so the grey background fills the page
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -1,18 +1,20 @@
|
|||||||
import { SyncOutlined } from "@ant-design/icons";
|
import {SyncOutlined} from "@ant-design/icons";
|
||||||
import { Button, Card, Input, Space, Table, Typography } from "antd";
|
import {Button, Card, Input, Space, Table, Typography} from "antd";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, {useEffect, useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { Link, useNavigate, useLocation } from "react-router-dom";
|
import {Link, useLocation, useNavigate} from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
|
import {pageLimit} from "../../utils/config";
|
||||||
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
import StartChatButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
//currentUser: selectCurrentUser
|
//currentUser: selectCurrentUser
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
@@ -21,14 +23,15 @@ const mapDispatchToProps = (dispatch) => ({
|
|||||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
export function JobsList({bodyshop, refetch, loading, jobs, total}) {
|
||||||
const search = queryString.parse(useLocation().search);
|
const search = queryString.parse(useLocation().search);
|
||||||
const [openSearchResults, setOpenSearchResults] = useState([]);
|
const [openSearchResults, setOpenSearchResults] = useState([]);
|
||||||
const [searchLoading, setSearchLoading] = useState(false);
|
const [searchLoading, setSearchLoading] = useState(false);
|
||||||
const { page, sortcolumn, sortorder } = search;
|
const [filter, setFilter] = useLocalStorage("filter_jobs_all", null);
|
||||||
|
const {page, sortcolumn, sortorder} = search;
|
||||||
const history = useNavigate();
|
const history = useNavigate();
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const columns = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.ro_number"),
|
title: t("jobs.fields.ro_number"),
|
||||||
@@ -53,11 +56,11 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.ownerid ? (
|
return record.ownerid ? (
|
||||||
<Link to={"/manage/owners/" + record.ownerid}>
|
<Link to={"/manage/owners/" + record.ownerid}>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -69,7 +72,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<StartChatButton phone={record.ownr_ph1} jobid={record.id} />
|
<StartChatButton phone={record.ownr_ph1} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -79,7 +82,7 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
|
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<StartChatButton phone={record.ownr_ph2} jobid={record.id} />
|
<StartChatButton phone={record.ownr_ph2} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -93,8 +96,9 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
render: (text, record) => {
|
render: (text, record) => {
|
||||||
return record.status || t("general.labels.na");
|
return record.status || t("general.labels.na");
|
||||||
},
|
},
|
||||||
|
filteredValue: filter?.status || null,
|
||||||
filters: bodyshop.md_ro_statuses.statuses.map((s) => {
|
filters: bodyshop.md_ro_statuses.statuses.map((s) => {
|
||||||
return { text: s, value: [s] };
|
return {text: s, value: [s]};
|
||||||
}),
|
}),
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
},
|
},
|
||||||
@@ -189,7 +193,8 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
} else {
|
} else {
|
||||||
delete search.statusFilters;
|
delete search.statusFilters;
|
||||||
}
|
}
|
||||||
history({ search: queryString.stringify(search) });
|
setFilter(filters);
|
||||||
|
history({search: queryString.stringify(search)});
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -221,13 +226,13 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
{search.search && (
|
{search.search && (
|
||||||
<>
|
<>
|
||||||
<Typography.Title level={4}>
|
<Typography.Title level={4}>
|
||||||
{t("general.labels.searchresults", { search: search.search })}
|
{t("general.labels.searchresults", {search: search.search})}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
delete search.search;
|
delete search.search;
|
||||||
delete search.page;
|
delete search.page;
|
||||||
history({ search: queryString.stringify(search) });
|
history({search: queryString.stringify(search)});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("general.actions.clear")}
|
{t("general.actions.clear")}
|
||||||
@@ -235,13 +240,13 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder={search.search || t("general.labels.search")}
|
placeholder={search.search || t("general.labels.search")}
|
||||||
onSearch={(value) => {
|
onSearch={(value) => {
|
||||||
search.search = value;
|
search.search = value;
|
||||||
history({ search: queryString.stringify(search) });
|
history({search: queryString.stringify(search)});
|
||||||
searchJobs(value);
|
searchJobs(value);
|
||||||
}}
|
}}
|
||||||
loading={loading || searchLoading}
|
loading={loading || searchLoading}
|
||||||
@@ -273,4 +278,5 @@ export function JobsList({ bodyshop, refetch, loading, jobs, total }) {
|
|||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsList);
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsList);
|
||||||
|
|||||||
@@ -1,22 +1,18 @@
|
|||||||
import {
|
import {BranchesOutlined, ExclamationCircleFilled, PauseCircleOutlined, SyncOutlined,} from "@ant-design/icons";
|
||||||
SyncOutlined,
|
import {useQuery} from "@apollo/client";
|
||||||
ExclamationCircleFilled,
|
import {Button, Card, Grid, Input, Space, Table, Tooltip} from "antd";
|
||||||
PauseCircleOutlined,
|
|
||||||
BranchesOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import { useQuery } from "@apollo/client";
|
|
||||||
import { Button, Card, Grid, Input, Space, Table, Tooltip } from "antd";
|
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useState } from "react";
|
import React, {useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { Link, useNavigate, useLocation } from "react-router-dom";
|
import {Link, useLocation, useNavigate} from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
import {QUERY_ALL_ACTIVE_JOBS} from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
import {onlyUnique} from "../../utils/arrayHelper";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import {alphaSort, statusSort} from "../../utils/sorters";
|
||||||
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
@@ -25,13 +21,13 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsList({ bodyshop }) {
|
export function JobsList({bodyshop}) {
|
||||||
const searchParams = queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
const { selected } = searchParams;
|
const {selected} = searchParams;
|
||||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
.filter((screen) => !!screen[1])
|
.filter((screen) => !!screen[1])
|
||||||
.slice(-1)[0];
|
.slice(-1)[0];
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
const {loading, error, data, refetch} = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||||
variables: {
|
variables: {
|
||||||
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
statuses: bodyshop.md_ro_statuses.active_statuses || ["Open", "Open*"],
|
||||||
},
|
},
|
||||||
@@ -39,16 +35,14 @@ export function JobsList({ bodyshop }) {
|
|||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({sortedInfo: {}});
|
||||||
sortedInfo: {},
|
const [filter, setFilter] = useLocalStorage("filter_jobs_list", null);
|
||||||
filteredInfo: { text: "" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const history = useNavigate();
|
const history = useNavigate();
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||||
|
|
||||||
const jobs = data
|
const jobs = data
|
||||||
? searchText === ""
|
? searchText === ""
|
||||||
@@ -91,7 +85,8 @@ export function JobsList({ bodyshop }) {
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({...state, sortedInfo: sorter});
|
||||||
|
setFilter(filters);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnRowClick = (record) => {
|
const handleOnRowClick = (record) => {
|
||||||
@@ -126,14 +121,14 @@ export function JobsList({ bodyshop }) {
|
|||||||
<Space>
|
<Space>
|
||||||
{record.ro_number || t("general.labels.na")}
|
{record.ro_number || t("general.labels.na")}
|
||||||
{record.production_vars && record.production_vars.alert ? (
|
{record.production_vars && record.production_vars.alert ? (
|
||||||
<ExclamationCircleFilled className="production-alert" />
|
<ExclamationCircleFilled className="production-alert"/>
|
||||||
) : null}
|
) : null}
|
||||||
{record.suspended && (
|
{record.suspended && (
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
<PauseCircleOutlined style={{color: "orangered"}}/>
|
||||||
)}
|
)}
|
||||||
{record.iouparent && (
|
{record.iouparent && (
|
||||||
<Tooltip title={t("jobs.labels.iou")}>
|
<Tooltip title={t("jobs.labels.iou")}>
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
<BranchesOutlined style={{color: "orangered"}}/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
@@ -156,11 +151,11 @@ export function JobsList({ bodyshop }) {
|
|||||||
to={"/manage/owners/" + record.ownerid}
|
to={"/manage/owners/" + record.ownerid}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -172,7 +167,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -182,7 +177,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -195,6 +190,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
|
filteredValue: filter?.status || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
jobs
|
jobs
|
||||||
@@ -205,7 +201,14 @@ export function JobsList({ bodyshop }) {
|
|||||||
text: s || "No Status*",
|
text: s || "No Status*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) =>
|
||||||
|
statusSort(
|
||||||
|
a.text,
|
||||||
|
b.text,
|
||||||
|
bodyshop.md_ro_statuses.active_statuses
|
||||||
|
)
|
||||||
|
)) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
},
|
},
|
||||||
@@ -262,6 +265,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
dataIndex: "ins_co_nm",
|
dataIndex: "ins_co_nm",
|
||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
filteredValue: filter?.ins_co_nm || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
jobs
|
jobs
|
||||||
@@ -269,10 +273,11 @@ export function JobsList({ bodyshop }) {
|
|||||||
.filter(onlyUnique)
|
.filter(onlyUnique)
|
||||||
.map((s) => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s,
|
text: s || "No Ins. Co.*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
@@ -298,6 +303,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["xl"],
|
responsive: ["xl"],
|
||||||
filterSearch: true,
|
filterSearch: true,
|
||||||
|
filteredValue: filter?.estimator || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
jobs
|
jobs
|
||||||
@@ -305,10 +311,11 @@ export function JobsList({ bodyshop }) {
|
|||||||
.filter(onlyUnique)
|
.filter(onlyUnique)
|
||||||
.map((s) => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s || "N/A",
|
text: s || "No Estimator*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) =>
|
onFilter: (value, record) =>
|
||||||
value.includes(
|
value.includes(
|
||||||
@@ -350,7 +357,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
extra={
|
extra={
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder={t("general.labels.search")}
|
placeholder={t("general.labels.search")}
|
||||||
@@ -365,7 +372,7 @@ export function JobsList({ bodyshop }) {
|
|||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
loading={loading}
|
loading={loading}
|
||||||
pagination={{ defaultPageSize: 50 }}
|
pagination={{defaultPageSize: 50}}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={jobs}
|
dataSource={jobs}
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
import {
|
import {BranchesOutlined, ExclamationCircleFilled, PauseCircleOutlined, SyncOutlined,} from "@ant-design/icons";
|
||||||
BranchesOutlined,
|
import {useQuery} from "@apollo/client";
|
||||||
ExclamationCircleFilled,
|
import {Button, Card, Grid, Input, Space, Table, Tooltip} from "antd";
|
||||||
PauseCircleOutlined,
|
|
||||||
SyncOutlined,
|
|
||||||
} from "@ant-design/icons";
|
|
||||||
import { useQuery } from "@apollo/client";
|
|
||||||
import { Button, Card, Grid, Input, Space, Table, Tooltip } from "antd";
|
|
||||||
import queryString from "query-string";
|
import queryString from "query-string";
|
||||||
import React, { useMemo, useState } from "react";
|
import React, {useMemo, useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import {connect} from "react-redux";
|
||||||
import { Link, useNavigate, useLocation } from "react-router-dom";
|
import {Link, useLocation, useNavigate} from "react-router-dom";
|
||||||
import { createStructuredSelector } from "reselect";
|
import {createStructuredSelector} from "reselect";
|
||||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
import {QUERY_ALL_ACTIVE_JOBS} from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import {selectBodyshop} from "../../redux/user/user.selectors";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
import { onlyUnique } from "../../utils/arrayHelper";
|
import {onlyUnique} from "../../utils/arrayHelper";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import {pageLimit} from "../../utils/config";
|
||||||
|
import {alphaSort, statusSort} from "../../utils/sorters";
|
||||||
|
import useLocalStorage from "../../utils/useLocalStorage";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
import ChatOpenButton from "../chat-open-button/chat-open-button.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import {pageLimit} from "../../utils/config";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
});
|
});
|
||||||
|
|
||||||
export function JobsReadyList({ bodyshop }) {
|
export function JobsReadyList({bodyshop}) {
|
||||||
const searchParams =queryString.parse(useLocation().search);
|
const searchParams = queryString.parse(useLocation().search);
|
||||||
const { selected } = searchParams;
|
const {selected} = searchParams;
|
||||||
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
const selectedBreakpoint = Object.entries(Grid.useBreakpoint())
|
||||||
.filter((screen) => !!screen[1])
|
.filter((screen) => !!screen[1])
|
||||||
.slice(-1)[0];
|
.slice(-1)[0];
|
||||||
@@ -44,7 +40,7 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
);
|
);
|
||||||
}, [bodyshop.md_ro_statuses]);
|
}, [bodyshop.md_ro_statuses]);
|
||||||
|
|
||||||
const { loading, error, data, refetch } = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
const {loading, error, data, refetch} = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||||
variables: {
|
variables: {
|
||||||
statuses: readyStatuses,
|
statuses: readyStatuses,
|
||||||
isConverted: true,
|
isConverted: true,
|
||||||
@@ -53,16 +49,14 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
nextFetchPolicy: "network-only",
|
nextFetchPolicy: "network-only",
|
||||||
});
|
});
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({sortedInfo: {}});
|
||||||
sortedInfo: {},
|
const [filter, setFilter] = useLocalStorage("filter_jobs_ready", null);
|
||||||
filteredInfo: { text: "" },
|
|
||||||
});
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const {t} = useTranslation();
|
||||||
const history = useNavigate();
|
const history = useNavigate();
|
||||||
const [searchText, setSearchText] = useState("");
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
if (error) return <AlertComponent message={error.message} type="error" />;
|
if (error) return <AlertComponent message={error.message} type="error"/>;
|
||||||
|
|
||||||
const jobs = data
|
const jobs = data
|
||||||
? searchText === ""
|
? searchText === ""
|
||||||
@@ -105,7 +99,8 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
: [];
|
: [];
|
||||||
|
|
||||||
const handleTableChange = (pagination, filters, sorter) => {
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
setState({...state, sortedInfo: sorter});
|
||||||
|
setFilter(filters);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnRowClick = (record) => {
|
const handleOnRowClick = (record) => {
|
||||||
@@ -129,7 +124,6 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
sorter: (a, b) => alphaSort(a.ro_number, b.ro_number),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "ro_number" && state.sortedInfo.order,
|
||||||
|
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Link
|
<Link
|
||||||
to={"/manage/jobs/" + record.id}
|
to={"/manage/jobs/" + record.id}
|
||||||
@@ -138,14 +132,14 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
<Space>
|
<Space>
|
||||||
{record.ro_number || t("general.labels.na")}
|
{record.ro_number || t("general.labels.na")}
|
||||||
{record.production_vars && record.production_vars.alert ? (
|
{record.production_vars && record.production_vars.alert ? (
|
||||||
<ExclamationCircleFilled className="production-alert" />
|
<ExclamationCircleFilled className="production-alert"/>
|
||||||
) : null}
|
) : null}
|
||||||
{record.suspended && (
|
{record.suspended && (
|
||||||
<PauseCircleOutlined style={{ color: "orangered" }} />
|
<PauseCircleOutlined style={{color: "orangered"}}/>
|
||||||
)}
|
)}
|
||||||
{record.iouparent && (
|
{record.iouparent && (
|
||||||
<Tooltip title={t("jobs.labels.iou")}>
|
<Tooltip title={t("jobs.labels.iou")}>
|
||||||
<BranchesOutlined style={{ color: "orangered" }} />
|
<BranchesOutlined style={{color: "orangered"}}/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
@@ -157,7 +151,6 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
dataIndex: "owner",
|
dataIndex: "owner",
|
||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
@@ -168,11 +161,11 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
to={"/manage/owners/" + record.owner.id}
|
to={"/manage/owners/" + record.owner.id}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
<span>
|
<span>
|
||||||
<OwnerNameDisplay ownerObject={record} />
|
<OwnerNameDisplay ownerObject={record}/>
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -184,7 +177,7 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph1} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -194,19 +187,18 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id} />
|
<ChatOpenButton phone={record.ownr_ph2} jobid={record.id}/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.status"),
|
title: t("jobs.fields.status"),
|
||||||
dataIndex: "status",
|
dataIndex: "status",
|
||||||
key: "status",
|
key: "status",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
sorter: (a, b) => alphaSort(a.status, b.status),
|
sorter: (a, b) => alphaSort(a.status, b.status),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "status" && state.sortedInfo.order,
|
||||||
|
filteredValue: filter?.status || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
jobs
|
jobs
|
||||||
@@ -217,11 +209,17 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
text: s || "No Status*",
|
text: s || "No Status*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) =>
|
||||||
|
statusSort(
|
||||||
|
a.text,
|
||||||
|
b.text,
|
||||||
|
bodyshop.md_ro_statuses.active_statuses
|
||||||
|
)
|
||||||
|
)) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) => value.includes(record.status),
|
onFilter: (value, record) => value.includes(record.status),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
dataIndex: "vehicle",
|
dataIndex: "vehicle",
|
||||||
@@ -274,6 +272,7 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
dataIndex: "ins_co_nm",
|
dataIndex: "ins_co_nm",
|
||||||
key: "ins_co_nm",
|
key: "ins_co_nm",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
filteredValue: filter?.ins_co_nm || null,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
jobs
|
jobs
|
||||||
@@ -281,10 +280,11 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
.filter(onlyUnique)
|
.filter(onlyUnique)
|
||||||
.map((s) => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s,
|
text: s || "No Ins Co.*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
onFilter: (value, record) => value.includes(record.ins_co_nm),
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
@@ -295,7 +295,6 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
key: "clm_total",
|
key: "clm_total",
|
||||||
responsive: ["md"],
|
responsive: ["md"],
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
sorter: (a, b) => a.clm_total - b.clm_total,
|
sorter: (a, b) => a.clm_total - b.clm_total,
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "clm_total" && state.sortedInfo.order,
|
||||||
@@ -306,9 +305,10 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
{
|
{
|
||||||
title: t("jobs.labels.estimator"),
|
title: t("jobs.labels.estimator"),
|
||||||
dataIndex: "jobs.labels.estimator",
|
dataIndex: "jobs.labels.estimator",
|
||||||
key: "jobs.labels.estimator",
|
key: "estimator",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
responsive: ["xl"],
|
responsive: ["xl"],
|
||||||
|
filteredValue: filter?.estimator || null,
|
||||||
filterSearch: true,
|
filterSearch: true,
|
||||||
filters:
|
filters:
|
||||||
(jobs &&
|
(jobs &&
|
||||||
@@ -317,10 +317,11 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
.filter(onlyUnique)
|
.filter(onlyUnique)
|
||||||
.map((s) => {
|
.map((s) => {
|
||||||
return {
|
return {
|
||||||
text: s || "N/A",
|
text: s || "No Estimator*",
|
||||||
value: [s],
|
value: [s],
|
||||||
};
|
};
|
||||||
})) ||
|
})
|
||||||
|
.sort((a, b) => alphaSort(a.text, b.text))) ||
|
||||||
[],
|
[],
|
||||||
onFilter: (value, record) =>
|
onFilter: (value, record) =>
|
||||||
value.includes(
|
value.includes(
|
||||||
@@ -363,7 +364,7 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
<Space wrap>
|
<Space wrap>
|
||||||
<span>({readyStatuses && readyStatuses.join(", ")})</span>
|
<span>({readyStatuses && readyStatuses.join(", ")})</span>
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder={t("general.labels.search")}
|
placeholder={t("general.labels.search")}
|
||||||
@@ -378,7 +379,7 @@ export function JobsReadyList({ bodyshop }) {
|
|||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
loading={loading}
|
loading={loading}
|
||||||
pagination={{ defaultPageSize: pageLimit }}
|
pagination={{defaultPageSize: pageLimit}}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={jobs}
|
dataSource={jobs}
|
||||||
|
|||||||
@@ -2621,6 +2621,7 @@
|
|||||||
"open_orders": "Open Orders by Date",
|
"open_orders": "Open Orders by Date",
|
||||||
"open_orders_csr": "Open Orders by CSR",
|
"open_orders_csr": "Open Orders by CSR",
|
||||||
"open_orders_estimator": "Open Orders by Estimator",
|
"open_orders_estimator": "Open Orders by Estimator",
|
||||||
|
"open_orders_excel": "Open Orders - Excel",
|
||||||
"open_orders_ins_co": "Open Orders by Insurance Company",
|
"open_orders_ins_co": "Open Orders by Insurance Company",
|
||||||
"open_orders_referral": "Open Orders by Referral Source",
|
"open_orders_referral": "Open Orders by Referral Source",
|
||||||
"open_orders_specific_csr": "Open Orders filtered by CSR",
|
"open_orders_specific_csr": "Open Orders filtered by CSR",
|
||||||
|
|||||||
@@ -2621,6 +2621,7 @@
|
|||||||
"open_orders": "",
|
"open_orders": "",
|
||||||
"open_orders_csr": "",
|
"open_orders_csr": "",
|
||||||
"open_orders_estimator": "",
|
"open_orders_estimator": "",
|
||||||
|
"open_orders_excel": "",
|
||||||
"open_orders_ins_co": "",
|
"open_orders_ins_co": "",
|
||||||
"open_orders_referral": "",
|
"open_orders_referral": "",
|
||||||
"open_orders_specific_csr": "",
|
"open_orders_specific_csr": "",
|
||||||
|
|||||||
@@ -2621,6 +2621,7 @@
|
|||||||
"open_orders": "",
|
"open_orders": "",
|
||||||
"open_orders_csr": "",
|
"open_orders_csr": "",
|
||||||
"open_orders_estimator": "",
|
"open_orders_estimator": "",
|
||||||
|
"open_orders_excel": "",
|
||||||
"open_orders_ins_co": "",
|
"open_orders_ins_co": "",
|
||||||
"open_orders_referral": "",
|
"open_orders_referral": "",
|
||||||
"open_orders_specific_csr": "",
|
"open_orders_specific_csr": "",
|
||||||
|
|||||||
@@ -2026,6 +2026,19 @@ export const TemplateList = (type, context) => {
|
|||||||
},
|
},
|
||||||
group: "customers",
|
group: "customers",
|
||||||
},
|
},
|
||||||
|
open_orders_excel: {
|
||||||
|
title: i18n.t("reportcenter.templates.open_orders_excel"),
|
||||||
|
subject: i18n.t("reportcenter.templates.open_orders_excel"),
|
||||||
|
key: "open_orders_excel",
|
||||||
|
//idtype: "vendor",
|
||||||
|
reporttype: "excel",
|
||||||
|
disabled: false,
|
||||||
|
rangeFilter: {
|
||||||
|
object: i18n.t("reportcenter.labels.objects.jobs"),
|
||||||
|
field: i18n.t("jobs.fields.date_open"),
|
||||||
|
},
|
||||||
|
group: "jobs",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
...(!type || type === "courtesycarcontract"
|
...(!type || type === "courtesycarcontract"
|
||||||
|
|||||||
@@ -29,17 +29,24 @@ const ftpSetup = {
|
|||||||
password: process.env.KAIZEN_PASSWORD,
|
password: process.env.KAIZEN_PASSWORD,
|
||||||
debug: (message, ...data) => logger.log(message, "DEBUG", "api", null, data),
|
debug: (message, ...data) => logger.log(message, "DEBUG", "api", null, data),
|
||||||
algorithms: {
|
algorithms: {
|
||||||
serverHostKey: ["ssh-rsa", "ssh-dss", "rsa-sha2-256", "rsa-sha2-512", "ecdsa-sha2-nistp256", "ecdsa-sha2-nistp384"],
|
serverHostKey: [
|
||||||
|
"ssh-rsa",
|
||||||
|
"ssh-dss",
|
||||||
|
"rsa-sha2-256",
|
||||||
|
"rsa-sha2-512",
|
||||||
|
"ecdsa-sha2-nistp256",
|
||||||
|
"ecdsa-sha2-nistp384",
|
||||||
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.default = async (req, res) => {
|
exports.default = async (req, res) => {
|
||||||
//Query for the List of Bodyshop Clients.
|
//Query for the List of Bodyshop Clients.
|
||||||
logger.log("kaizen-start", "DEBUG", "api", null, null);
|
logger.log("kaizen-start", "DEBUG", "api", null, null);
|
||||||
const kaizenShopsNames = ["SUMMIT", "STRATHMORE", "SUNRIDGE"];
|
const kaizenShopsIDs = ["SUMMIT", "STRATHMORE", "SUNRIDGE"];
|
||||||
|
|
||||||
const { bodyshops } = await client.request(queries.GET_KAIZEN_SHOPS, {
|
const { bodyshops } = await client.request(queries.GET_KAIZEN_SHOPS, {
|
||||||
shopname: kaizenShopsNames,
|
imexshopid: kaizenShopsIDs,
|
||||||
});
|
});
|
||||||
|
|
||||||
const specificShopIds = req.body.bodyshopIds; // ['uuid]
|
const specificShopIds = req.body.bodyshopIds; // ['uuid]
|
||||||
|
|||||||
@@ -1739,8 +1739,8 @@ exports.GET_ENTEGRAL_SHOPS = `query GET_ENTEGRAL_SHOPS {
|
|||||||
}
|
}
|
||||||
}`;
|
}`;
|
||||||
|
|
||||||
exports.GET_KAIZEN_SHOPS = `query GET_KAIZEN_SHOPS($shopname: [String]) {
|
exports.GET_KAIZEN_SHOPS = `query GET_KAIZEN_SHOPS($imexshopid: [String]) {
|
||||||
bodyshops(where: {shopname: {_in: $shopname}}){
|
bodyshops(where: {imexshopid: {_in: $imexshopid}}){
|
||||||
id
|
id
|
||||||
shopname
|
shopname
|
||||||
address1
|
address1
|
||||||
|
|||||||
Reference in New Issue
Block a user