Added searching to available jobs page. BOD-199
This commit is contained in:
@@ -6108,6 +6108,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>deleteall</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>edit</name>
|
<name>edit</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
PlusCircleFilled,
|
PlusCircleFilled,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Button, notification, Table } from "antd";
|
import { Button, notification, Table, Input } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
@@ -27,7 +27,7 @@ export default function JobsAvailableComponent({
|
|||||||
estData,
|
estData,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
filteredInfo: { text: "" },
|
filteredInfo: { text: "" },
|
||||||
@@ -156,6 +156,21 @@ export default function JobsAvailableComponent({
|
|||||||
? estData.data.available_jobs_by_pk.est_data.owner.data
|
? estData.data.available_jobs_by_pk.est_data.owner.data
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
const availableJobs = data
|
||||||
|
? searchText
|
||||||
|
? data.available_jobs.filter(
|
||||||
|
(j) =>
|
||||||
|
(j.ownr_name || "")
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase()) ||
|
||||||
|
(j.vehicle_info || "")
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase()) ||
|
||||||
|
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase())
|
||||||
|
)
|
||||||
|
: data.available_jobs
|
||||||
|
: [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<OwnerFindModalContainer
|
<OwnerFindModalContainer
|
||||||
@@ -173,12 +188,9 @@ export default function JobsAvailableComponent({
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
title={() => {
|
title={() => {
|
||||||
return (
|
return (
|
||||||
<div className="imex-flex-row">
|
<div className="imex-table-header">
|
||||||
<strong className="imex-flex-row__margin">
|
<strong>{t("jobs.labels.availablenew")}</strong>
|
||||||
{t("jobs.labels.availablenew")}
|
|
||||||
</strong>
|
|
||||||
<Button
|
<Button
|
||||||
className="imex-flex-row__margin"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
refetch();
|
refetch();
|
||||||
}}
|
}}
|
||||||
@@ -186,7 +198,6 @@ export default function JobsAvailableComponent({
|
|||||||
<SyncOutlined />
|
<SyncOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="imex-flex-row__margin"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
deleteAllNewJobs()
|
deleteAllNewJobs()
|
||||||
.then((r) => {
|
.then((r) => {
|
||||||
@@ -204,16 +215,24 @@ export default function JobsAvailableComponent({
|
|||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Delete All
|
{t("general.actions.deleteall")}
|
||||||
</Button>
|
</Button>
|
||||||
|
<div className="imex-table-header__search">
|
||||||
|
<Input.Search
|
||||||
|
placeholder={t("general.labels.search")}
|
||||||
|
onChange={(e) => {
|
||||||
|
setSearchText(e.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
size="small"
|
size="small"
|
||||||
pagination={{ position: "top" }}
|
pagination={{ position: "top" }}
|
||||||
columns={columns.map((item) => ({ ...item }))}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={data && data.available_jobs}
|
dataSource={availableJobs}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
PlusCircleFilled,
|
PlusCircleFilled,
|
||||||
SyncOutlined,
|
SyncOutlined,
|
||||||
} from "@ant-design/icons";
|
} from "@ant-design/icons";
|
||||||
import { Button, notification, Table } from "antd";
|
import { Button, notification, Table, Input } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||||
@@ -29,6 +29,7 @@ export default function JobsAvailableSupplementComponent({
|
|||||||
modalSearchState,
|
modalSearchState,
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
|
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
sortedInfo: {},
|
sortedInfo: {},
|
||||||
@@ -176,6 +177,21 @@ export default function JobsAvailableSupplementComponent({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const availableJobs = data
|
||||||
|
? searchText
|
||||||
|
? data.available_jobs.filter(
|
||||||
|
(j) =>
|
||||||
|
(j.ownr_name || "")
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase()) ||
|
||||||
|
(j.vehicle_info || "")
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase()) ||
|
||||||
|
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase())
|
||||||
|
)
|
||||||
|
: data.available_jobs
|
||||||
|
: [];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<JobsFindModalContainer
|
<JobsFindModalContainer
|
||||||
@@ -193,24 +209,26 @@ export default function JobsAvailableSupplementComponent({
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
title={() => {
|
title={() => {
|
||||||
return (
|
return (
|
||||||
<div className="imex-flex-row">
|
<div className="imex-table-header">
|
||||||
<strong className="imex-flex-row__margin">
|
<strong>{t("jobs.labels.availablesupplements")}</strong>
|
||||||
{t("jobs.labels.availablesupplements")}
|
|
||||||
</strong>
|
|
||||||
<Button
|
<Button
|
||||||
className="imex-flex-row__margin"
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
refetch();
|
refetch();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SyncOutlined />
|
<SyncOutlined />
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button onClick={handleDeleteAll}>
|
||||||
className="imex-flex-row__margin"
|
{t("general.actions.deleteall")}
|
||||||
onClick={handleDeleteAll}
|
|
||||||
>
|
|
||||||
Delete All
|
|
||||||
</Button>
|
</Button>
|
||||||
|
<div className="imex-table-header__search">
|
||||||
|
<Input.Search
|
||||||
|
placeholder={t("general.labels.search")}
|
||||||
|
onChange={(e) => {
|
||||||
|
setSearchText(e.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
@@ -218,7 +236,7 @@ export default function JobsAvailableSupplementComponent({
|
|||||||
pagination={{ position: "top" }}
|
pagination={{ position: "top" }}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey="id"
|
rowKey="id"
|
||||||
dataSource={data && data.available_jobs}
|
dataSource={availableJobs}
|
||||||
onChange={handleTableChange}
|
onChange={handleTableChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,10 +5,9 @@ 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 { createStructuredSelector } from "reselect";
|
import { createStructuredSelector } from "reselect";
|
||||||
import { auth } from "../../firebase/firebase.utils";
|
import { auth, logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { UPDATE_JOB, UPDATE_JOBS } from "../../graphql/jobs.queries";
|
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({
|
const mapStateToProps = createStructuredSelector({
|
||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
|
|||||||
@@ -408,6 +408,7 @@
|
|||||||
"close": "Close",
|
"close": "Close",
|
||||||
"create": "Create",
|
"create": "Create",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
|
"deleteall": "Delete All",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
"refresh": "Refresh",
|
"refresh": "Refresh",
|
||||||
|
|||||||
@@ -408,6 +408,7 @@
|
|||||||
"close": "",
|
"close": "",
|
||||||
"create": "",
|
"create": "",
|
||||||
"delete": "Borrar",
|
"delete": "Borrar",
|
||||||
|
"deleteall": "",
|
||||||
"edit": "Editar",
|
"edit": "Editar",
|
||||||
"login": "",
|
"login": "",
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
|
|||||||
@@ -408,6 +408,7 @@
|
|||||||
"close": "",
|
"close": "",
|
||||||
"create": "",
|
"create": "",
|
||||||
"delete": "Effacer",
|
"delete": "Effacer",
|
||||||
|
"deleteall": "",
|
||||||
"edit": "modifier",
|
"edit": "modifier",
|
||||||
"login": "",
|
"login": "",
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user