Added saving of basic invoicing data for job BOD-131
This commit is contained in:
@@ -1151,6 +1151,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>federal_tax</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>lab</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -1340,6 +1361,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>local_tax</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>mapa</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -1571,6 +1613,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>state_tax</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>tow</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -4426,6 +4489,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>close</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>create</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -6981,6 +7065,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>invoicing</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>
|
||||
@@ -10954,6 +11059,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>invoiced</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>
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
import React, { useState } from "react";
|
||||
import { Button, notification } from "antd";
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
|
||||
export function JobsCloseSaveButton({
|
||||
bodyshop,
|
||||
suspenseAmount,
|
||||
jobId,
|
||||
jobTotals,
|
||||
labMatAllocations,
|
||||
partsAllocations,
|
||||
}) {
|
||||
const [loading, setLoading] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
const handleSave = async () => {
|
||||
setLoading(true);
|
||||
|
||||
const result = await updateJob({
|
||||
variables: {
|
||||
jobId: jobId,
|
||||
job: {
|
||||
date_invoiced: new Date(),
|
||||
status: bodyshop.md_ro_statuses.default_invoiced || "Invoiced*",
|
||||
invoice_allocation: {
|
||||
labMatAllocations,
|
||||
partsAllocations,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
if (!!!result.errors) {
|
||||
notification["success"]({ message: t("jobs.successes.invoiced") });
|
||||
} else {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.invoicing", {
|
||||
error: JSON.stringify(result.errors),
|
||||
}),
|
||||
});
|
||||
}
|
||||
setLoading(false);
|
||||
};
|
||||
console.log("suspense", suspenseAmount);
|
||||
return (
|
||||
<Button
|
||||
onClick={handleSave}
|
||||
disabled={suspenseAmount > 0}
|
||||
loading={loading}
|
||||
>
|
||||
{t("general.actions.close")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(JobsCloseSaveButton);
|
||||
@@ -7,6 +7,7 @@ import JobsClosePartsAllocation from "../../components/jobs-close-parts-allocati
|
||||
import Dinero from "dinero.js";
|
||||
import JobsCloseTotals from "../../components/jobs-close-totals/jobs-close-totals.component";
|
||||
import JobsCloseAutoAllocate from "../../components/jobs-close-auto-allocate/jobs-close-auto-allocate.component";
|
||||
import JobsCloseSaveButton from "../../components/jobs-close-save-button/jobs-close-save-button.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -58,6 +59,16 @@ export function JobsCloseComponent({ job, bodyshop, jobTotals }) {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<JobsCloseSaveButton
|
||||
jobId={job.id}
|
||||
partsAllocations={partsAllocations}
|
||||
labMatAllocations={labmatAllocations}
|
||||
jobTotals={jobTotals}
|
||||
suspenseAmount={jobTotals.totals.subtotal
|
||||
.subtract(labmatAllocatedTotal)
|
||||
.subtract(partsAllocatedTotal)
|
||||
.getAmount()}
|
||||
/>
|
||||
<JobsCloseTotals
|
||||
jobTotals={jobTotals}
|
||||
labMatTotal={labmatAllocatedTotal}
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"responsibilitycenter_accountnumber": "Account Number",
|
||||
"responsibilitycenters": {
|
||||
"atp": "ATP",
|
||||
"federal_tax": "Federal Tax",
|
||||
"lab": "Body",
|
||||
"lad": "Diagnostic",
|
||||
"lae": "Electrical",
|
||||
@@ -99,6 +100,7 @@
|
||||
"lar": "Refinish",
|
||||
"las": "Structural",
|
||||
"lau": "Detail",
|
||||
"local_tax": "Local Tax",
|
||||
"mapa": "Paint Materials",
|
||||
"mash": "Shop Materials",
|
||||
"paa": "Aftermarket",
|
||||
@@ -110,6 +112,7 @@
|
||||
"pap": "OEM Partial",
|
||||
"par": "Recored",
|
||||
"pas": "Sublet",
|
||||
"state_tax": "State Tax",
|
||||
"tow": "Towing"
|
||||
},
|
||||
"shopname": "Shop Name",
|
||||
@@ -305,6 +308,7 @@
|
||||
"general": {
|
||||
"actions": {
|
||||
"cancel": "Cancel",
|
||||
"close": "Close",
|
||||
"create": "Create",
|
||||
"delete": "Delete",
|
||||
"edit": "Edit",
|
||||
@@ -476,6 +480,7 @@
|
||||
"addingtoproduction": "Error adding to production. {{error}}",
|
||||
"creating": "Error encountered while creating job. {{error}}",
|
||||
"deleted": "Error deleting job.",
|
||||
"invoicing": "Error invoicing job. {{error}}",
|
||||
"noaccess": "This job does not exist or you do not have access to it.",
|
||||
"nodamage": "No damage points on estimate.",
|
||||
"nodates": "No dates specified for this job.",
|
||||
@@ -674,6 +679,7 @@
|
||||
"created_subtitle": "Estimate Number {{est_number}} has been created.",
|
||||
"creatednoclick": "Job created successfully. ",
|
||||
"deleted": "Job deleted successfully.",
|
||||
"invoiced": "Job closed and invoiced successfully.",
|
||||
"save": "Job saved successfully.",
|
||||
"savetitle": "Record saved successfully.",
|
||||
"supplemented": "Job supplemented successfully. ",
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"responsibilitycenter_accountnumber": "",
|
||||
"responsibilitycenters": {
|
||||
"atp": "",
|
||||
"federal_tax": "",
|
||||
"lab": "",
|
||||
"lad": "",
|
||||
"lae": "",
|
||||
@@ -99,6 +100,7 @@
|
||||
"lar": "",
|
||||
"las": "",
|
||||
"lau": "",
|
||||
"local_tax": "",
|
||||
"mapa": "",
|
||||
"mash": "",
|
||||
"paa": "",
|
||||
@@ -110,6 +112,7 @@
|
||||
"pap": "",
|
||||
"par": "",
|
||||
"pas": "",
|
||||
"state_tax": "",
|
||||
"tow": ""
|
||||
},
|
||||
"shopname": "",
|
||||
@@ -305,6 +308,7 @@
|
||||
"general": {
|
||||
"actions": {
|
||||
"cancel": "",
|
||||
"close": "",
|
||||
"create": "",
|
||||
"delete": "Borrar",
|
||||
"edit": "Editar",
|
||||
@@ -476,6 +480,7 @@
|
||||
"addingtoproduction": "",
|
||||
"creating": "",
|
||||
"deleted": "Error al eliminar el trabajo.",
|
||||
"invoicing": "",
|
||||
"noaccess": "Este trabajo no existe o no tiene acceso a él.",
|
||||
"nodamage": "",
|
||||
"nodates": "No hay fechas especificadas para este trabajo.",
|
||||
@@ -674,6 +679,7 @@
|
||||
"created_subtitle": "",
|
||||
"creatednoclick": "",
|
||||
"deleted": "Trabajo eliminado con éxito.",
|
||||
"invoiced": "",
|
||||
"save": "Trabajo guardado con éxito.",
|
||||
"savetitle": "Registro guardado con éxito.",
|
||||
"supplemented": "Trabajo complementado con éxito.",
|
||||
|
||||
@@ -90,6 +90,7 @@
|
||||
"responsibilitycenter_accountnumber": "",
|
||||
"responsibilitycenters": {
|
||||
"atp": "",
|
||||
"federal_tax": "",
|
||||
"lab": "",
|
||||
"lad": "",
|
||||
"lae": "",
|
||||
@@ -99,6 +100,7 @@
|
||||
"lar": "",
|
||||
"las": "",
|
||||
"lau": "",
|
||||
"local_tax": "",
|
||||
"mapa": "",
|
||||
"mash": "",
|
||||
"paa": "",
|
||||
@@ -110,6 +112,7 @@
|
||||
"pap": "",
|
||||
"par": "",
|
||||
"pas": "",
|
||||
"state_tax": "",
|
||||
"tow": ""
|
||||
},
|
||||
"shopname": "",
|
||||
@@ -305,6 +308,7 @@
|
||||
"general": {
|
||||
"actions": {
|
||||
"cancel": "",
|
||||
"close": "",
|
||||
"create": "",
|
||||
"delete": "Effacer",
|
||||
"edit": "modifier",
|
||||
@@ -476,6 +480,7 @@
|
||||
"addingtoproduction": "",
|
||||
"creating": "",
|
||||
"deleted": "Erreur lors de la suppression du travail.",
|
||||
"invoicing": "",
|
||||
"noaccess": "Ce travail n'existe pas ou vous n'y avez pas accès.",
|
||||
"nodamage": "",
|
||||
"nodates": "Aucune date spécifiée pour ce travail.",
|
||||
@@ -674,6 +679,7 @@
|
||||
"created_subtitle": "",
|
||||
"creatednoclick": "",
|
||||
"deleted": "Le travail a bien été supprimé.",
|
||||
"invoiced": "",
|
||||
"save": "Le travail a été enregistré avec succès.",
|
||||
"savetitle": "Enregistrement enregistré avec succès.",
|
||||
"supplemented": "Travail complété avec succès.",
|
||||
|
||||
Reference in New Issue
Block a user