Merged in feature/IO-1828-Front-End-Package-Updates (pull request #1163)
- Scoreboard fixes
This commit is contained in:
@@ -33,7 +33,12 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const popContent = (
|
|
||||||
|
const menu = {
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
key: '1',
|
||||||
|
label: (
|
||||||
<Card style={{ padding: "1rem" }}>
|
<Card style={{ padding: "1rem" }}>
|
||||||
<Form
|
<Form
|
||||||
layout="vertical"
|
layout="vertical"
|
||||||
@@ -86,13 +91,14 @@ export default function ScoreboardEntryEdit({ entry }) {
|
|||||||
</Button>
|
</Button>
|
||||||
</Form>
|
</Form>
|
||||||
</Card>
|
</Card>
|
||||||
);
|
)
|
||||||
|
}
|
||||||
// TODO Client Update, why is this a card
|
]
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Dropdown open={open} overlay={popContent}>
|
<Dropdown open={open} menu={menu}>
|
||||||
<Button
|
<Button
|
||||||
onClick={(e) => {
|
onClick={(e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|||||||
@@ -1,18 +1,19 @@
|
|||||||
import { useQuery } from "@apollo/client";
|
import {useQuery} from "@apollo/client";
|
||||||
import { Button, Card, Input, Modal, Space, Table, Typography } from "antd";
|
import {Button, Card, Input, Modal, Space, Table, Typography} from "antd";
|
||||||
import React, { useState } from "react";
|
import React, {useState} from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import {useTranslation} from "react-i18next";
|
||||||
import { Link } from "react-router-dom";
|
import {Link} from "react-router-dom";
|
||||||
import { QUERY_SCOREBOARD_PAGINATED } from "../../graphql/scoreboard.queries";
|
import {QUERY_SCOREBOARD_PAGINATED} from "../../graphql/scoreboard.queries";
|
||||||
import { DateFormatter } from "../../utils/DateFormatter";
|
import {DateFormatter} from "../../utils/DateFormatter";
|
||||||
import AlertComponent from "../alert/alert.component";
|
import AlertComponent from "../alert/alert.component";
|
||||||
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
import OwnerNameDisplay from "../owner-name-display/owner-name-display.component";
|
||||||
import ScoreboardEntryEdit from "../scoreboard-entry-edit/scoreboard-entry-edit.component";
|
import ScoreboardEntryEdit from "../scoreboard-entry-edit/scoreboard-entry-edit.component";
|
||||||
import ScoreboardRemoveButton from "../scoreboard-remove-button/scorebard-remove-button.component";
|
import ScoreboardRemoveButton from "../scoreboard-remove-button/scorebard-remove-button.component";
|
||||||
import { SyncOutlined } from "@ant-design/icons";
|
import {SyncOutlined} from "@ant-design/icons";
|
||||||
import {pageLimit} from "../../utils/config";
|
import {pageLimit} from "../../utils/config";
|
||||||
export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|
||||||
const { t } = useTranslation();
|
export default function ScoreboardJobsList({scoreBoardlist}) {
|
||||||
|
const {t} = useTranslation();
|
||||||
const [state, setState] = useState({
|
const [state, setState] = useState({
|
||||||
open: false,
|
open: false,
|
||||||
search: "",
|
search: "",
|
||||||
@@ -20,7 +21,7 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
pageSize: pageLimit,
|
pageSize: pageLimit,
|
||||||
});
|
});
|
||||||
|
|
||||||
const { loading, error, data, refetch } = useQuery(
|
const {loading, error, data, refetch} = useQuery(
|
||||||
QUERY_SCOREBOARD_PAGINATED,
|
QUERY_SCOREBOARD_PAGINATED,
|
||||||
{
|
{
|
||||||
fetchPolicy: "network-only",
|
fetchPolicy: "network-only",
|
||||||
@@ -56,7 +57,7 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
key: "owner",
|
key: "owner",
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
|
||||||
render: (text, record) => <OwnerNameDisplay ownerObject={record.job} />,
|
render: (text, record) => <OwnerNameDisplay ownerObject={record.job}/>,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: t("jobs.fields.vehicle"),
|
title: t("jobs.fields.vehicle"),
|
||||||
@@ -91,8 +92,8 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
<ScoreboardEntryEdit entry={record} style={{ zIndex: 15 }} />
|
<ScoreboardEntryEdit entry={record} style={{zIndex: 15}}/>
|
||||||
<ScoreboardRemoveButton scoreboardId={record.id} />
|
<ScoreboardRemoveButton scoreboardId={record.id}/>
|
||||||
</Space>
|
</Space>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -104,7 +105,10 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
open={state.open}
|
open={state.open}
|
||||||
destroyOnClose
|
destroyOnClose
|
||||||
width="80%"
|
width="80%"
|
||||||
cancelButtonProps={{ style: { display: "none" } }}
|
cancelButtonProps={{style: {display: "none"}}}
|
||||||
|
onOk={() => {
|
||||||
|
setState((state) => ({ ...state, open: false }));
|
||||||
|
}}
|
||||||
onCancel={() =>
|
onCancel={() =>
|
||||||
setState((state) => ({
|
setState((state) => ({
|
||||||
...state,
|
...state,
|
||||||
@@ -115,22 +119,22 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
{error && (
|
{error && (
|
||||||
<AlertComponent type="error" message={JSON.stringify(error)} />
|
<AlertComponent type="error" message={JSON.stringify(error)}/>
|
||||||
)}
|
)}
|
||||||
<Card
|
<Card
|
||||||
extra={
|
extra={
|
||||||
<Space align="middle" wrap>
|
<Space align="middle" wrap>
|
||||||
<Button onClick={() => refetch()}>
|
<Button onClick={() => refetch()}>
|
||||||
<SyncOutlined />
|
<SyncOutlined/>
|
||||||
</Button>
|
</Button>
|
||||||
<Typography.Title level={4}>
|
<Typography.Title level={4}>
|
||||||
{t("general.labels.searchresults", { search: state.search })}
|
{t("general.labels.searchresults", {search: state.search})}
|
||||||
</Typography.Title>
|
</Typography.Title>
|
||||||
<Input.Search
|
<Input.Search
|
||||||
placeholder={t("jobs.fields.ro_number")}
|
placeholder={t("jobs.fields.ro_number")}
|
||||||
allowClear
|
allowClear
|
||||||
onSearch={(value) => {
|
onSearch={(value) => {
|
||||||
setState((state) => ({ ...state, search: value }));
|
setState((state) => ({...state, search: value}));
|
||||||
}}
|
}}
|
||||||
//value={state.search}
|
//value={state.search}
|
||||||
enterButton
|
enterButton
|
||||||
@@ -145,7 +149,7 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
onChange={(tableArgs) =>
|
onChange={(tableArgs) =>
|
||||||
setState((state) => ({ ...state, ...tableArgs }))
|
setState((state) => ({...state, ...tableArgs}))
|
||||||
}
|
}
|
||||||
pagination={{
|
pagination={{
|
||||||
position: "top",
|
position: "top",
|
||||||
@@ -157,7 +161,9 @@ export default function ScoreboardJobsList({ scoreBoardlist }) {
|
|||||||
</Card>
|
</Card>
|
||||||
</Modal>
|
</Modal>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setState((state) => ({ ...state, open: true }))}
|
onClick={() => {
|
||||||
|
setState((state) => ({...state, open: true}))
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{t("scoreboard.labels.entries")}
|
{t("scoreboard.labels.entries")}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
Reference in New Issue
Block a user