Ability to delete job checklist IO-464
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import { Button, notification } from "antd";
|
||||
import gql from "graphql-tag";
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
export default function JobAdminDeleteIntake({ job }) {
|
||||
const { t } = useTranslation();
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [updateJob] = useMutation(gql`
|
||||
mutation UPDATE_JOB($jobId: uuid!) {
|
||||
update_jobs_by_pk(
|
||||
pk_columns: { id: $jobId }
|
||||
_set: { intakechecklist: null }
|
||||
) {
|
||||
id
|
||||
intakechecklist
|
||||
}
|
||||
}
|
||||
`);
|
||||
|
||||
const handleDelete = async (values) => {
|
||||
setLoading(true);
|
||||
const result = await updateJob({
|
||||
variables: { jobId: job.id },
|
||||
});
|
||||
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.save") });
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.saving", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
//Get the owner details, populate it all back into the job.
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>{t("jobs.labels.deleteintake")}</div>
|
||||
|
||||
<Button loading={loading} onClick={handleDelete}>
|
||||
{t("general.actions.delete")}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -14,9 +14,10 @@ import NotFound from "../../components/not-found/not-found.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import { GET_JOB_BY_PK } from "../../graphql/jobs.queries";
|
||||
import {
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader
|
||||
setBreadcrumbs,
|
||||
setSelectedHeader,
|
||||
} from "../../redux/application/application.actions";
|
||||
import JobsAdminDeleteIntake from "../../components/jobs-admin-delete-intake/jobs-admin-delete-intake.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -71,6 +72,9 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
<JobAdminOwnerReassociate job={data ? data.jobs_by_pk : {}} />
|
||||
<JobAdminVehicleReassociate job={data ? data.jobs_by_pk : {}} />
|
||||
</LayoutFormRow>
|
||||
<LayoutFormRow>
|
||||
<JobsAdminDeleteIntake job={data ? data.jobs_by_pk : {}} />
|
||||
</LayoutFormRow>
|
||||
</div>
|
||||
</RbacWrapper>
|
||||
);
|
||||
|
||||
@@ -770,7 +770,7 @@
|
||||
},
|
||||
"fields": {
|
||||
"act_price": "Actual Price",
|
||||
"db_price": "Database Price",
|
||||
"db_price": "List Price",
|
||||
"lbr_types": {
|
||||
"LA1": "LA1",
|
||||
"LA2": "LA2",
|
||||
@@ -1363,7 +1363,7 @@
|
||||
"act_price": "Price",
|
||||
"backordered_eta": "B.O. ETA",
|
||||
"backordered_on": "B.O. On",
|
||||
"db_price": "DB Price",
|
||||
"db_price": "List Price",
|
||||
"deliver_by": "Deliver By",
|
||||
"job_line_id": "Job Line Id",
|
||||
"line_desc": "Line Description",
|
||||
|
||||
@@ -235,7 +235,7 @@ function CalculateTaxesTotals(job, otherTotals) {
|
||||
if (!!!val.tax_part || !!!val.part_type || IsAdditionalCost(val)) {
|
||||
additionalItemsTax = additionalItemsTax.add(
|
||||
Dinero({ amount: Math.round((val.act_price || 0) * 100) })
|
||||
.multiply(val.value.part_qty || 0)
|
||||
.multiply(val.part_qty || 0)
|
||||
.percentage(
|
||||
(job.parts_tax_rates &&
|
||||
job.parts_tax_rates["PAN"] &&
|
||||
|
||||
Reference in New Issue
Block a user