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