BOD-51 Added push vehicle updates to job.
This commit is contained in:
@@ -4450,6 +4450,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>updating</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>validation</name>
|
||||
<definition_loaded>false</definition_loaded>
|
||||
@@ -7268,6 +7289,27 @@
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>updated</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>
|
||||
</children>
|
||||
</folder_node>
|
||||
</children>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React from "react";
|
||||
import { Button } from "antd";
|
||||
import { Button, notification } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
||||
@@ -31,9 +31,17 @@ export default function OwnerDetailUpdateJobsComponent({
|
||||
ownr_zip: owner["ownr_zip"]
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(response => {
|
||||
notification["success"]({ message: t("jobs.successes.updated") });
|
||||
})
|
||||
.catch(error => {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.updating", { error: JSON.stringify(error) })
|
||||
});
|
||||
});
|
||||
};
|
||||
console.log("disabled", disabled);
|
||||
|
||||
return (
|
||||
<Button disabled={disabled} onClick={handlecClick}>
|
||||
{t("owners.actions.update")}
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
import React from "react";
|
||||
import React, { useState } from "react";
|
||||
import { Table } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
export default function VehicleDetailJobsComponent({ vehicle }) {
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import VehicleDetailUpdateJobsComponent from "../vehicle-detail-update-jobs/vehicle-detail-update-jobs.component";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop
|
||||
});
|
||||
|
||||
export function VehicleDetailJobsComponent({ vehicle, bodyshop }) {
|
||||
const { t } = useTranslation();
|
||||
const [selectedJobs, setSelectedJobs] = useState([]);
|
||||
|
||||
const columns = [
|
||||
{
|
||||
title: t("jobs.fields.ro_number"),
|
||||
@@ -50,10 +61,33 @@ export default function VehicleDetailJobsComponent({ vehicle }) {
|
||||
|
||||
return (
|
||||
<Table
|
||||
title={() => (
|
||||
<div>
|
||||
<VehicleDetailUpdateJobsComponent
|
||||
selectedJobs={selectedJobs}
|
||||
vehicle={vehicle}
|
||||
disabled={selectedJobs.length === 0}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
pagination={{ position: "bottom" }}
|
||||
columns={columns.map(item => ({ ...item }))}
|
||||
rowKey="id"
|
||||
dataSource={vehicle.jobs}
|
||||
rowSelection={{
|
||||
onSelect: (record, selected, selectedRows) => {
|
||||
setSelectedJobs(selectedRows ? selectedRows.map(i => i.id) : []);
|
||||
},
|
||||
|
||||
selectedRowKeys: selectedJobs,
|
||||
getCheckboxProps: record => ({
|
||||
disabled: bodyshop.md_ro_statuses.open_statuses
|
||||
? !bodyshop.md_ro_statuses.open_statuses.includes(record.status)
|
||||
: true
|
||||
})
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, null)(VehicleDetailJobsComponent);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
import React from "react";
|
||||
import { Button, notification } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMutation } from "@apollo/react-hooks";
|
||||
import { UPDATE_JOBS } from "../../graphql/jobs.queries";
|
||||
|
||||
export default function VehicleDetailUpdateJobsComponent({
|
||||
vehicle,
|
||||
selectedJobs,
|
||||
disabled
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updateJobs] = useMutation(UPDATE_JOBS);
|
||||
const handlecClick = e => {
|
||||
updateJobs({
|
||||
variables: {
|
||||
jobIds: selectedJobs,
|
||||
fields: {
|
||||
plate_no: vehicle["plate_no"],
|
||||
plate_st: vehicle["plate_st"],
|
||||
v_vin: vehicle["v_vin"],
|
||||
v_model_yr: vehicle["v_model_yr"],
|
||||
v_model_desc: vehicle["v_model_desc"],
|
||||
v_make_desc: vehicle["v_make_desc"],
|
||||
v_color: vehicle["v_color"]
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(response => {
|
||||
notification["success"]({ message: t("jobs.successes.updated") });
|
||||
})
|
||||
.catch(error => {
|
||||
notification["error"]({
|
||||
message: t("jobs.errors.updating", { error: JSON.stringify(error) })
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<Button disabled={disabled} onClick={handlecClick}>
|
||||
{t("owners.actions.update")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -322,6 +322,7 @@
|
||||
"noowner": "No owner associated.",
|
||||
"novehicle": "No vehicle associated.",
|
||||
"saving": "Error encountered while saving record.",
|
||||
"updating": "Error while updating job(s). {{error}}",
|
||||
"validation": "Please ensure all fields are entered correctly.",
|
||||
"validationtitle": "Validation Error"
|
||||
},
|
||||
@@ -464,7 +465,8 @@
|
||||
"deleted": "Job deleted successfully.",
|
||||
"save": "Job saved successfully.",
|
||||
"savetitle": "Record saved successfully.",
|
||||
"supplemented": "Job supplemented successfully. "
|
||||
"supplemented": "Job supplemented successfully. ",
|
||||
"updated": "Job(s) updated successfully."
|
||||
}
|
||||
},
|
||||
"menus": {
|
||||
|
||||
@@ -322,6 +322,7 @@
|
||||
"noowner": "Ningún propietario asociado.",
|
||||
"novehicle": "No hay vehículo asociado.",
|
||||
"saving": "Se encontró un error al guardar el registro.",
|
||||
"updating": "",
|
||||
"validation": "Asegúrese de que todos los campos se ingresen correctamente.",
|
||||
"validationtitle": "Error de validacion"
|
||||
},
|
||||
@@ -464,7 +465,8 @@
|
||||
"deleted": "Trabajo eliminado con éxito.",
|
||||
"save": "Trabajo guardado con éxito.",
|
||||
"savetitle": "Registro guardado con éxito.",
|
||||
"supplemented": "Trabajo complementado con éxito."
|
||||
"supplemented": "Trabajo complementado con éxito.",
|
||||
"updated": ""
|
||||
}
|
||||
},
|
||||
"menus": {
|
||||
|
||||
@@ -322,6 +322,7 @@
|
||||
"noowner": "Aucun propriétaire associé.",
|
||||
"novehicle": "Aucun véhicule associé.",
|
||||
"saving": "Erreur rencontrée lors de la sauvegarde de l'enregistrement.",
|
||||
"updating": "",
|
||||
"validation": "Veuillez vous assurer que tous les champs sont correctement entrés.",
|
||||
"validationtitle": "Erreur de validation"
|
||||
},
|
||||
@@ -464,7 +465,8 @@
|
||||
"deleted": "Le travail a bien été supprimé.",
|
||||
"save": "Le travail a été enregistré avec succès.",
|
||||
"savetitle": "Enregistrement enregistré avec succès.",
|
||||
"supplemented": "Travail complété avec succès."
|
||||
"supplemented": "Travail complété avec succès.",
|
||||
"updated": ""
|
||||
}
|
||||
},
|
||||
"menus": {
|
||||
|
||||
Reference in New Issue
Block a user