Added jobs available screens for new and supplement jobs.
This commit is contained in:
@@ -9,4 +9,4 @@ To Start Hasura CLI:
|
||||
npx hasura console --admin-secret Dev-BodyShopAppBySnaptSoftware!
|
||||
|
||||
Migrating to Staging:
|
||||
npx hasura migrate apply --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware!
|
||||
npx hasura migrate apply --up 10 --endpoint https://bodyshop-staging-db.herokuapp.com/ --admin-secret Staging-BodyShopAppBySnaptSoftware!
|
||||
@@ -217,6 +217,27 @@
|
||||
<folder_node>
|
||||
<name>labels</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>actions</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>
|
||||
<name>in</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -557,6 +578,27 @@
|
||||
<folder_node>
|
||||
<name>errors</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>deleted</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>
|
||||
<name>noaccess</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -814,6 +856,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>cieca_id</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>
|
||||
<name>claim_total</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -2074,6 +2137,48 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>updated_at</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>
|
||||
<name>uploaded_by</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>
|
||||
<name>vehicle</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -2488,6 +2593,27 @@
|
||||
<folder_node>
|
||||
<name>successes</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>all_deleted</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>
|
||||
<name>converted</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -2509,6 +2635,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>deleted</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>
|
||||
<name>save</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
|
||||
@@ -1,46 +1,45 @@
|
||||
import React from "react";
|
||||
import "./header.styles.scss";
|
||||
import { useQuery } from "react-apollo";
|
||||
import {
|
||||
GET_LANDING_NAV_ITEMS,
|
||||
GET_NAV_ITEMS
|
||||
} from "../../graphql/metadata.queries";
|
||||
// //import {
|
||||
// GET_LANDING_NAV_ITEMS,
|
||||
// GET_NAV_ITEMS
|
||||
// } from "../../graphql/metadata.queries";
|
||||
import { GET_CURRENT_SELECTED_NAV_ITEM } from "../../graphql/local.queries";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
//import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
//import AlertComponent from "../alert/alert.component";
|
||||
import HeaderComponent from "./header.component";
|
||||
|
||||
export default ({ landingHeader, signedIn }) => {
|
||||
const hookSelectedNavItem = useQuery(GET_CURRENT_SELECTED_NAV_ITEM);
|
||||
|
||||
let hookNavItems;
|
||||
if (landingHeader) {
|
||||
hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
} else {
|
||||
hookNavItems = useQuery(GET_NAV_ITEMS, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
}
|
||||
// let hookNavItems;
|
||||
// if (landingHeader) {
|
||||
// hookNavItems = useQuery(GET_LANDING_NAV_ITEMS, {
|
||||
// fetchPolicy: "network-only"
|
||||
// });
|
||||
// } else {
|
||||
// hookNavItems = useQuery(GET_NAV_ITEMS, {
|
||||
// fetchPolicy: "network-only"
|
||||
// });
|
||||
// }
|
||||
|
||||
if (hookNavItems.loading || hookSelectedNavItem.loading)
|
||||
return <LoadingSpinner />;
|
||||
if (hookNavItems.error)
|
||||
return <AlertComponent message={hookNavItems.error.message} />;
|
||||
if (hookSelectedNavItem.error)
|
||||
return console.log(
|
||||
"Unable to load Selected Navigation Item.",
|
||||
hookSelectedNavItem.error
|
||||
);
|
||||
// if (hookNavItems.loading || hookSelectedNavItem.loading)
|
||||
// return <LoadingSpinner />;
|
||||
// if (hookNavItems.error)
|
||||
// return <AlertComponent message={hookNavItems.error.message} />;
|
||||
// if (hookSelectedNavItem.error)
|
||||
// return console.log(
|
||||
// "Unable to load Selected Navigation Item.",
|
||||
// hookSelectedNavItem.error
|
||||
// );
|
||||
|
||||
const { selectedNavItem } = hookSelectedNavItem.data;
|
||||
const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value);
|
||||
// const navItems = JSON.parse(hookNavItems.data.masterdata_by_pk.value);
|
||||
|
||||
return (
|
||||
<HeaderComponent
|
||||
landingHeader={landingHeader}
|
||||
navItems={navItems}
|
||||
selectedNavItem={selectedNavItem}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
import { Input, Table, Button, Icon, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
export default function JobsAvailableComponent({
|
||||
loading,
|
||||
data,
|
||||
refetch,
|
||||
deleteJob,
|
||||
deleteAllNewJobs
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" }
|
||||
});
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.cieca_id"),
|
||||
dataIndex: "cieca_id",
|
||||
key: "cieca_id",
|
||||
//width: "8%",
|
||||
// onFilter: (value, record) => record.ro_number.includes(value),
|
||||
// filteredValue: state.filteredInfo.text || null,
|
||||
sorter: (a, b) => alphaSort(a, b),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.owner"),
|
||||
dataIndex: "ownr_name",
|
||||
key: "ownr_name",
|
||||
ellipsis: true,
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
//width: "25%",
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.vehicle"),
|
||||
dataIndex: "vehicle_info",
|
||||
key: "vehicle_info",
|
||||
sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_no"),
|
||||
dataIndex: "clm_no",
|
||||
key: "clm_no",
|
||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
dataIndex: "clm_amt",
|
||||
key: "clm_amt",
|
||||
sorter: (a, b) => a.clm_amt - b.clm_amt,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.uploaded_by"),
|
||||
dataIndex: "uploaded_by",
|
||||
key: "uploaded_by",
|
||||
sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.updated_at"),
|
||||
dataIndex: "updated_at",
|
||||
key: "updated_at",
|
||||
sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<DateTimeFormatter>{record.updated_at}</DateTimeFormatter>
|
||||
)
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
key: "actions",
|
||||
render: (text, record) => (
|
||||
<span>
|
||||
<Button
|
||||
onClick={() => {
|
||||
deleteJob({ variables: { id: record.id } }).then(r => {
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.deleted")
|
||||
});
|
||||
refetch();
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Icon type="delete" />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
alert("Add");
|
||||
}}
|
||||
>
|
||||
<Icon type="plus" />
|
||||
</Button>
|
||||
</span>
|
||||
)
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<Table
|
||||
loading={loading}
|
||||
title={() => {
|
||||
return (
|
||||
<div>
|
||||
<Input.Search
|
||||
placeholder="Search..."
|
||||
onSearch={value => {
|
||||
console.log(value);
|
||||
}}
|
||||
enterButton
|
||||
/>
|
||||
<Button
|
||||
onClick={() => {
|
||||
refetch();
|
||||
}}
|
||||
>
|
||||
<Icon type="sync" />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
deleteAllNewJobs()
|
||||
.then(r => {
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.all_deleted", {
|
||||
count: r.data.delete_available_jobs.affected_rows
|
||||
})
|
||||
});
|
||||
refetch();
|
||||
})
|
||||
.catch(r => {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.deleted") + " " + r.message
|
||||
});
|
||||
});
|
||||
}}
|
||||
>
|
||||
Delete All
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
size="small"
|
||||
pagination={{ position: "top" }}
|
||||
columns={columns.map(item => ({ ...item }))}
|
||||
rowKey="id"
|
||||
dataSource={data && data.available_jobs}
|
||||
onChange={handleTableChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
import React from "react";
|
||||
import { useQuery, useMutation } from "react-apollo";
|
||||
import {
|
||||
QUERY_AVAILABLE_NEW_JOBS,
|
||||
DELETE_AVAILABLE_JOB,
|
||||
DELETE_ALL_AVAILABLE_NEW_JOBS
|
||||
} from "../../graphql/available-jobs.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import JobsAvailableComponent from "./jobs-available-new.component";
|
||||
|
||||
export default function JobsAvailableContainer() {
|
||||
const { loading, error, data, refetch } = useQuery(QUERY_AVAILABLE_NEW_JOBS, {
|
||||
fetchPolicy: "network-only"
|
||||
});
|
||||
const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB);
|
||||
const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_NEW_JOBS);
|
||||
|
||||
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||
return (
|
||||
<JobsAvailableComponent
|
||||
loading={loading}
|
||||
data={data}
|
||||
refetch={refetch}
|
||||
deleteJob={deleteJob}
|
||||
deleteAllNewJobs={deleteAllNewJobs}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
import { Input, Table, Button, Icon, notification } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { alphaSort } from "../../utils/sorters";
|
||||
import { DateTimeFormatter } from "../../utils/DateFormatter";
|
||||
export default function JobsAvailableSupplementComponent({
|
||||
loading,
|
||||
data,
|
||||
refetch,
|
||||
deleteJob,
|
||||
deleteAllNewJobs
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const [state, setState] = useState({
|
||||
sortedInfo: {},
|
||||
filteredInfo: { text: "" }
|
||||
});
|
||||
|
||||
const handleTableChange = (pagination, filters, sorter) => {
|
||||
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||
};
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.cieca_id"),
|
||||
dataIndex: "cieca_id",
|
||||
key: "cieca_id",
|
||||
//width: "8%",
|
||||
// onFilter: (value, record) => record.ro_number.includes(value),
|
||||
// filteredValue: state.filteredInfo.text || null,
|
||||
sorter: (a, b) => alphaSort(a, b),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.ro_number"),
|
||||
dataIndex: "job_id",
|
||||
key: "job_id",
|
||||
//width: "8%",
|
||||
// onFilter: (value, record) => record.ro_number.includes(value),
|
||||
// filteredValue: state.filteredInfo.text || null,
|
||||
sorter: (a, b) => alphaSort(a, b),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order,
|
||||
render: (text, record) => <div>{record.job && record.job.ro_number}</div>
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.owner"),
|
||||
dataIndex: "ownr_name",
|
||||
key: "ownr_name",
|
||||
ellipsis: true,
|
||||
sorter: (a, b) => alphaSort(a.ownr_ln, b.ownr_ln),
|
||||
//width: "25%",
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "ownr_name" && state.sortedInfo.order
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.vehicle"),
|
||||
dataIndex: "vehicle_info",
|
||||
key: "vehicle_info",
|
||||
sorter: (a, b) => alphaSort(a.vehicle_info, b.vehicle_info),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "vehicle_info" && state.sortedInfo.order
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_no"),
|
||||
dataIndex: "clm_no",
|
||||
key: "clm_no",
|
||||
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.clm_total"),
|
||||
dataIndex: "clm_amt",
|
||||
key: "clm_amt",
|
||||
sorter: (a, b) => a.clm_amt - b.clm_amt,
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "clm_amt" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.uploaded_by"),
|
||||
dataIndex: "uploaded_by",
|
||||
key: "uploaded_by",
|
||||
sorter: (a, b) => alphaSort(a.uploaded_by, b.uploaded_by),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "uploaded_by" && state.sortedInfo.order
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("jobs.fields.updated_at"),
|
||||
dataIndex: "updated_at",
|
||||
key: "updated_at",
|
||||
sorter: (a, b) => new Date(a.updated_at) - new Date(b.updated_at),
|
||||
sortOrder:
|
||||
state.sortedInfo.columnKey === "updated_at" && state.sortedInfo.order,
|
||||
render: (text, record) => (
|
||||
<DateTimeFormatter>{record.updated_at}</DateTimeFormatter>
|
||||
)
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
},
|
||||
{
|
||||
title: t("general.labels.actions"),
|
||||
key: "actions",
|
||||
render: (text, record) => (
|
||||
<span>
|
||||
<Button
|
||||
onClick={() => {
|
||||
deleteJob({ variables: { id: record.id } }).then(r => {
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.deleted")
|
||||
});
|
||||
refetch();
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Icon type="delete" />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
alert("Add");
|
||||
}}
|
||||
>
|
||||
<Icon type="plus" />
|
||||
</Button>
|
||||
</span>
|
||||
)
|
||||
//width: "12%",
|
||||
//ellipsis: true
|
||||
}
|
||||
];
|
||||
|
||||
return (
|
||||
<Table
|
||||
loading={loading}
|
||||
title={() => {
|
||||
return (
|
||||
<div>
|
||||
<Input.Search
|
||||
placeholder="Search..."
|
||||
onSearch={value => {
|
||||
console.log(value);
|
||||
}}
|
||||
enterButton
|
||||
/>
|
||||
<Button
|
||||
onClick={() => {
|
||||
refetch();
|
||||
}}
|
||||
>
|
||||
<Icon type="sync" />
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
deleteAllNewJobs()
|
||||
.then(r => {
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.all_deleted", {
|
||||
count: r.data.delete_available_jobs.affected_rows
|
||||
})
|
||||
});
|
||||
refetch();
|
||||
})
|
||||
.catch(r => {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.deleted") + " " + r.message
|
||||
});
|
||||
});
|
||||
}}
|
||||
>
|
||||
Delete All
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
size="small"
|
||||
pagination={{ position: "top" }}
|
||||
columns={columns.map(item => ({ ...item }))}
|
||||
rowKey="id"
|
||||
dataSource={data && data.available_jobs}
|
||||
onChange={handleTableChange}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import React from "react";
|
||||
import { useQuery, useMutation } from "react-apollo";
|
||||
import {
|
||||
QUERY_AVAILABLE_SUPPLEMENT_JOBS,
|
||||
DELETE_AVAILABLE_JOB,
|
||||
DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS
|
||||
} from "../../graphql/available-jobs.queries";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import JobsAvailableSupplementComponent from "./jobs-available-supplement.component";
|
||||
|
||||
export default function JobsAvailableSupplementContainer() {
|
||||
const { loading, error, data, refetch } = useQuery(
|
||||
QUERY_AVAILABLE_SUPPLEMENT_JOBS,
|
||||
{
|
||||
fetchPolicy: "network-only"
|
||||
}
|
||||
);
|
||||
const [deleteJob] = useMutation(DELETE_AVAILABLE_JOB);
|
||||
const [deleteAllNewJobs] = useMutation(DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS);
|
||||
|
||||
if (error) return <AlertComponent type="error" message={error.message} />;
|
||||
return (
|
||||
<JobsAvailableSupplementComponent
|
||||
loading={loading}
|
||||
data={data}
|
||||
refetch={refetch}
|
||||
deleteJob={deleteJob}
|
||||
deleteAllNewJobs={deleteAllNewJobs}
|
||||
/>
|
||||
);
|
||||
}
|
||||
72
client/src/graphql/available-jobs.queries.js
Normal file
72
client/src/graphql/available-jobs.queries.js
Normal file
@@ -0,0 +1,72 @@
|
||||
import { gql } from "apollo-boost";
|
||||
|
||||
export const QUERY_AVAILABLE_NEW_JOBS = gql`
|
||||
query QUERY_AVAILABLE_NEW_JOBS {
|
||||
available_jobs(
|
||||
where: { issupplement: { _eq: false } }
|
||||
order_by: { updated_at: desc }
|
||||
) {
|
||||
cieca_id
|
||||
clm_amt
|
||||
clm_no
|
||||
created_at
|
||||
id
|
||||
issupplement
|
||||
ownr_name
|
||||
source_system
|
||||
supplement_number
|
||||
updated_at
|
||||
uploaded_by
|
||||
vehicle_info
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const QUERY_AVAILABLE_SUPPLEMENT_JOBS = gql`
|
||||
query QUERY_AVAILABLE_SUPPLEMENT_JOBS {
|
||||
available_jobs(
|
||||
where: { issupplement: { _eq: true } }
|
||||
order_by: { updated_at: desc }
|
||||
) {
|
||||
cieca_id
|
||||
clm_amt
|
||||
clm_no
|
||||
created_at
|
||||
id
|
||||
issupplement
|
||||
ownr_name
|
||||
source_system
|
||||
supplement_number
|
||||
updated_at
|
||||
uploaded_by
|
||||
vehicle_info
|
||||
job {
|
||||
ro_number
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_AVAILABLE_JOB = gql`
|
||||
mutation DELETE_AVAILABLE_JOB($id: uuid) {
|
||||
delete_available_jobs(where: { id: { _eq: $id } }) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_ALL_AVAILABLE_NEW_JOBS = gql`
|
||||
mutation DELETE_ALL_AVAILABLE_NEW_JOBS {
|
||||
delete_available_jobs(where: { issupplement: { _eq: false } }) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
export const DELETE_ALL_AVAILABLE_SUPPLEMENT_JOBS = gql`
|
||||
mutation DELETE_ALL_AVAILABLE_NEW_JOBS {
|
||||
delete_available_jobs(where: { issupplement: { _eq: true } }) {
|
||||
affected_rows
|
||||
}
|
||||
}
|
||||
`;
|
||||
@@ -1,9 +1,13 @@
|
||||
import React from 'react'
|
||||
import React from "react";
|
||||
import JobsAvailableContainer from "../../components/jobs-available-new/jobs-available-new.container";
|
||||
import JobsAvailableSupplementContainer from "../../components/jobs-available-supplement/jobs-available-supplement.container";
|
||||
|
||||
export default function JobsAvailablePageComponent() {
|
||||
return (
|
||||
<div>
|
||||
JobsAvailablePageComponent
|
||||
</div>
|
||||
)
|
||||
return (
|
||||
<div>
|
||||
<JobsAvailableContainer />
|
||||
|
||||
<JobsAvailableSupplementContainer />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"reset": "Reset to original."
|
||||
},
|
||||
"labels": {
|
||||
"actions": "Actions",
|
||||
"in": "In",
|
||||
"loading": "Loading...",
|
||||
"na": "N/A",
|
||||
@@ -45,6 +46,7 @@
|
||||
"printCenter": "Print Center"
|
||||
},
|
||||
"errors": {
|
||||
"deleted": "Error deleting job.",
|
||||
"noaccess": "This job does not exist or you do not have access to it.",
|
||||
"nodates": "No dates specified for this job.",
|
||||
"nojobselected": "No job is selected.",
|
||||
@@ -59,6 +61,7 @@
|
||||
"actual_delivery": "Actual Delivery",
|
||||
"actual_in": "Actual In",
|
||||
"adjustment_bottom_line": "Adjustments",
|
||||
"cieca_id": "CIECA ID",
|
||||
"claim_total": "Claim Total",
|
||||
"clm_no": "Claim #",
|
||||
"clm_total": "Claim Total",
|
||||
@@ -119,6 +122,8 @@
|
||||
"storage_payable": "Storage/PVRT",
|
||||
"towing_payable": "Towing Payable",
|
||||
"unitnumber": "Unit #",
|
||||
"updated_at": "Updated At",
|
||||
"uploaded_by": "Uploaded By",
|
||||
"vehicle": "Vehicle"
|
||||
},
|
||||
"labels": {
|
||||
@@ -144,7 +149,9 @@
|
||||
"vehicle_info": "Vehicle"
|
||||
},
|
||||
"successes": {
|
||||
"all_deleted": "{{count}} jobs deleted successfully.",
|
||||
"converted": "Job converted successfully.",
|
||||
"deleted": "Job deleted successfully.",
|
||||
"save": "Record Saved",
|
||||
"savetitle": "Record saved successfully."
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"reset": "Restablecer a original."
|
||||
},
|
||||
"labels": {
|
||||
"actions": "Comportamiento",
|
||||
"in": "en",
|
||||
"loading": "Cargando...",
|
||||
"na": "N / A",
|
||||
@@ -45,6 +46,7 @@
|
||||
"printCenter": "Centro de impresión"
|
||||
},
|
||||
"errors": {
|
||||
"deleted": "Error al eliminar el trabajo.",
|
||||
"noaccess": "Este trabajo no existe o no tiene acceso a él.",
|
||||
"nodates": "No hay fechas especificadas para este trabajo.",
|
||||
"nojobselected": "No hay trabajo seleccionado.",
|
||||
@@ -59,6 +61,7 @@
|
||||
"actual_delivery": "Entrega real",
|
||||
"actual_in": "Real en",
|
||||
"adjustment_bottom_line": "Ajustes",
|
||||
"cieca_id": "CIECA ID",
|
||||
"claim_total": "Reclamar total",
|
||||
"clm_no": "Reclamación #",
|
||||
"clm_total": "Reclamar total",
|
||||
@@ -119,6 +122,8 @@
|
||||
"storage_payable": "Almacenamiento / PVRT",
|
||||
"towing_payable": "Remolque a pagar",
|
||||
"unitnumber": "Unidad #",
|
||||
"updated_at": "Actualizado en",
|
||||
"uploaded_by": "Subido por",
|
||||
"vehicle": "Vehículo"
|
||||
},
|
||||
"labels": {
|
||||
@@ -144,7 +149,9 @@
|
||||
"vehicle_info": "Vehículo"
|
||||
},
|
||||
"successes": {
|
||||
"all_deleted": "{{count}} trabajos eliminados con éxito.",
|
||||
"converted": "Trabajo convertido con éxito.",
|
||||
"deleted": "Trabajo eliminado con éxito.",
|
||||
"save": "Registro guardado",
|
||||
"savetitle": "Registro guardado con éxito."
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"reset": "Rétablir l'original."
|
||||
},
|
||||
"labels": {
|
||||
"actions": "actes",
|
||||
"in": "dans",
|
||||
"loading": "Chargement...",
|
||||
"na": "N / A",
|
||||
@@ -45,6 +46,7 @@
|
||||
"printCenter": "Centre d'impression"
|
||||
},
|
||||
"errors": {
|
||||
"deleted": "Erreur lors de la suppression du travail.",
|
||||
"noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.",
|
||||
"nodates": "Aucune date spécifiée pour ce travail.",
|
||||
"nojobselected": "Aucun travail n'est sélectionné.",
|
||||
@@ -59,6 +61,7 @@
|
||||
"actual_delivery": "Livraison réelle",
|
||||
"actual_in": "En réel",
|
||||
"adjustment_bottom_line": "Ajustements",
|
||||
"cieca_id": "CIECA ID",
|
||||
"claim_total": "Total réclamation",
|
||||
"clm_no": "Prétendre #",
|
||||
"clm_total": "Total réclamation",
|
||||
@@ -119,6 +122,8 @@
|
||||
"storage_payable": "Stockage / PVRT",
|
||||
"towing_payable": "Remorquage à payer",
|
||||
"unitnumber": "Unité #",
|
||||
"updated_at": "Mis à jour à",
|
||||
"uploaded_by": "Telechargé par",
|
||||
"vehicle": "Véhicule"
|
||||
},
|
||||
"labels": {
|
||||
@@ -144,7 +149,9 @@
|
||||
"vehicle_info": "Véhicule"
|
||||
},
|
||||
"successes": {
|
||||
"all_deleted": "{{count}} travaux supprimés avec succès.",
|
||||
"converted": "Travail converti avec succès.",
|
||||
"deleted": "Le travail a bien été supprimé.",
|
||||
"save": "Enregistrement enregistré",
|
||||
"savetitle": "Enregistrement enregistré avec succès."
|
||||
}
|
||||
|
||||
10
client/src/utils/DateFormatter.jsx
Normal file
10
client/src/utils/DateFormatter.jsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from "react";
|
||||
import Moment from "react-moment";
|
||||
|
||||
export function DateFormatter(props) {
|
||||
return <Moment format="MM/DD/YYYY">{props.children || ""}</Moment>;
|
||||
}
|
||||
|
||||
export function DateTimeFormatter(props) {
|
||||
return <Moment format="MM/DD/YYYY @ HH:MM">{props.children || ""}</Moment>;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
- args:
|
||||
sql: DROP TABLE "public"."available_jobs"
|
||||
type: run_sql
|
||||
@@ -0,0 +1,25 @@
|
||||
- args:
|
||||
sql: CREATE EXTENSION IF NOT EXISTS pgcrypto;
|
||||
type: run_sql
|
||||
- args:
|
||||
sql: "CREATE TABLE \"public\".\"available_jobs\"(\"id\" uuid NOT NULL DEFAULT
|
||||
gen_random_uuid(), \"created_at\" timestamptz NOT NULL DEFAULT now(), \"updated_at\"
|
||||
timestamptz NOT NULL DEFAULT now(), \"uploaded_by\" text NOT NULL, \"cieca_id\"
|
||||
text NOT NULL, \"bodyshopid\" uuid NOT NULL, \"est_data\" jsonb NOT NULL, \"issupplement\"
|
||||
boolean NOT NULL DEFAULT false, \"jobid\" uuid, \"supplement_number\" integer,
|
||||
\"ownr_name\" text, \"vehicle_info\" text, \"clm_amt\" numeric, \"clm_no\" text,
|
||||
\"source_system\" text, PRIMARY KEY (\"id\") , FOREIGN KEY (\"bodyshopid\")
|
||||
REFERENCES \"public\".\"bodyshops\"(\"id\") ON UPDATE cascade ON DELETE cascade,
|
||||
FOREIGN KEY (\"jobid\") REFERENCES \"public\".\"jobs\"(\"id\") ON UPDATE restrict
|
||||
ON DELETE cascade);\nCREATE OR REPLACE FUNCTION \"public\".\"set_current_timestamp_updated_at\"()\nRETURNS
|
||||
TRIGGER AS $$\nDECLARE\n _new record;\nBEGIN\n _new := NEW;\n _new.\"updated_at\"
|
||||
= NOW();\n RETURN _new;\nEND;\n$$ LANGUAGE plpgsql;\nCREATE TRIGGER \"set_public_available_jobs_updated_at\"\nBEFORE
|
||||
UPDATE ON \"public\".\"available_jobs\"\nFOR EACH ROW\nEXECUTE PROCEDURE \"public\".\"set_current_timestamp_updated_at\"();\nCOMMENT
|
||||
ON TRIGGER \"set_public_available_jobs_updated_at\" ON \"public\".\"available_jobs\"
|
||||
\nIS 'trigger to set value of column \"updated_at\" to current timestamp on
|
||||
row update';\n"
|
||||
type: run_sql
|
||||
- args:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: add_existing_table_or_view
|
||||
@@ -0,0 +1,24 @@
|
||||
- args:
|
||||
relationship: bodyshop
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: job
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: available_jobs
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
- args:
|
||||
relationship: available_jobs
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
type: drop_relationship
|
||||
@@ -0,0 +1,40 @@
|
||||
- args:
|
||||
name: bodyshop
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: bodyshopid
|
||||
type: create_object_relationship
|
||||
- args:
|
||||
name: job
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on: jobid
|
||||
type: create_object_relationship
|
||||
- args:
|
||||
name: available_jobs
|
||||
table:
|
||||
name: bodyshops
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: bodyshopid
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_array_relationship
|
||||
- args:
|
||||
name: available_jobs
|
||||
table:
|
||||
name: jobs
|
||||
schema: public
|
||||
using:
|
||||
foreign_key_constraint_on:
|
||||
column: jobid
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_array_relationship
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_insert_permission
|
||||
@@ -0,0 +1,37 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_upsert: true
|
||||
check:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
columns:
|
||||
- id
|
||||
- created_at
|
||||
- updated_at
|
||||
- uploaded_by
|
||||
- cieca_id
|
||||
- bodyshopid
|
||||
- est_data
|
||||
- issupplement
|
||||
- jobid
|
||||
- supplement_number
|
||||
- ownr_name
|
||||
- vehicle_info
|
||||
- clm_amt
|
||||
- clm_no
|
||||
- source_system
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_insert_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_select_permission
|
||||
@@ -0,0 +1,34 @@
|
||||
- args:
|
||||
permission:
|
||||
allow_aggregations: false
|
||||
columns:
|
||||
- issupplement
|
||||
- supplement_number
|
||||
- est_data
|
||||
- clm_amt
|
||||
- cieca_id
|
||||
- clm_no
|
||||
- ownr_name
|
||||
- source_system
|
||||
- uploaded_by
|
||||
- vehicle_info
|
||||
- created_at
|
||||
- updated_at
|
||||
- bodyshopid
|
||||
- id
|
||||
- jobid
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
limit: null
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_select_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_update_permission
|
||||
@@ -0,0 +1,21 @@
|
||||
- args:
|
||||
permission:
|
||||
columns: []
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
localPresets:
|
||||
- key: ""
|
||||
value: ""
|
||||
set: {}
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_update_permission
|
||||
@@ -0,0 +1,6 @@
|
||||
- args:
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: drop_delete_permission
|
||||
@@ -0,0 +1,16 @@
|
||||
- args:
|
||||
permission:
|
||||
filter:
|
||||
bodyshop:
|
||||
associations:
|
||||
_and:
|
||||
- user:
|
||||
authid:
|
||||
_eq: X-Hasura-User-Id
|
||||
- active:
|
||||
_eq: true
|
||||
role: user
|
||||
table:
|
||||
name: available_jobs
|
||||
schema: public
|
||||
type: create_delete_permission
|
||||
Reference in New Issue
Block a user