IO-747 Update CCC auto pagination
IO-751 Resolve job close hang with unsaved changes
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Input, Table } from "antd";
|
import { Input, Table } from "antd";
|
||||||
import React, { useState, useMemo } from "react";
|
import React, { useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
import LoadingSkeleton from "../loading-skeleton/loading-skeleton.component";
|
||||||
@@ -160,11 +160,12 @@ export default function ContractsJobsComponent({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const defaultCurrent = useMemo(() => {
|
const defaultCurrent = useMemo(() => {
|
||||||
return (
|
const page =
|
||||||
Math.round(
|
Math.floor(
|
||||||
((filteredData.findIndex((v) => v.id === selectedJob) || 0) + 1) / 10
|
(filteredData.findIndex((v) => v.id === selectedJob) || 0) / 3
|
||||||
) + 1
|
) + 1;
|
||||||
);
|
|
||||||
|
return page;
|
||||||
}, [filteredData, selectedJob]);
|
}, [filteredData, selectedJob]);
|
||||||
|
|
||||||
if (loading) return <LoadingSkeleton />;
|
if (loading) return <LoadingSkeleton />;
|
||||||
@@ -181,6 +182,7 @@ export default function ContractsJobsComponent({
|
|||||||
size="small"
|
size="small"
|
||||||
pagination={{
|
pagination={{
|
||||||
position: "top",
|
position: "top",
|
||||||
|
defaultPageSize: 3,
|
||||||
defaultCurrent: defaultCurrent,
|
defaultCurrent: defaultCurrent,
|
||||||
}}
|
}}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
import { useApolloClient, useMutation } from "@apollo/client";
|
||||||
import { Button, Form, notification, Popconfirm, Space } from "antd";
|
import { Button, Form, notification, Popconfirm, Space } from "antd";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { useApolloClient, useMutation } from "@apollo/client";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { useHistory } from "react-router-dom";
|
import { useHistory } from "react-router-dom";
|
||||||
@@ -34,6 +34,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
setLoading(true);
|
setLoading(true);
|
||||||
const result = await client.mutate({
|
const result = await client.mutate({
|
||||||
mutation: generateJobLinesUpdatesForInvoicing(values.joblines),
|
mutation: generateJobLinesUpdatesForInvoicing(values.joblines),
|
||||||
|
refetchQueries: ["QUERY_JOB_CLOSE_DETAILS"],
|
||||||
|
awaitRefetchQueries: true,
|
||||||
});
|
});
|
||||||
if (!!!result.errors) {
|
if (!!!result.errors) {
|
||||||
notification["success"]({ message: t("jobs.successes.save") });
|
notification["success"]({ message: t("jobs.successes.save") });
|
||||||
@@ -45,8 +47,8 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// form.resetFields();
|
form.resetFields();
|
||||||
// form.resetFields();
|
form.resetFields();
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -63,7 +65,11 @@ export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!!!result.errors) {
|
if (!!!result.errors) {
|
||||||
notification["success"]({ message: t("job.successes.closed") });
|
setLoading(false);
|
||||||
|
|
||||||
|
notification["success"]({
|
||||||
|
message: t("jobs.successes.closed"),
|
||||||
|
});
|
||||||
history.push(`/manage/jobs/${job.id}`);
|
history.push(`/manage/jobs/${job.id}`);
|
||||||
} else {
|
} else {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user