Implemented jobline upsert modal. Updated allocations display on jobline edit to include removal.

This commit is contained in:
Patrick Fic
2020-02-24 13:49:39 -08:00
parent c21f3c0098
commit 13faf47044
16 changed files with 495 additions and 49 deletions

View File

@@ -39,34 +39,46 @@ function JobLinesUpsertModalContainer({
});
}
if (!err) {
if (true) {
if (!jobLineEditModal.context.id) {
insertJobLine({
variables: {
//lineInput: [{ ...lineState, jobid: jobId }]
lineInput: [{ jobid: jobLineEditModal.context.jobid, ...values }]
}
}).then(r => {
if (jobLineEditModal.actions.refetch)
jobLineEditModal.actions.refetch();
toggleModalVisible();
notification["success"]({
message: t("joblines.successes.create")
})
.then(r => {
if (jobLineEditModal.actions.refetch)
jobLineEditModal.actions.refetch();
toggleModalVisible();
notification["success"]({
message: t("joblines.successes.created")
});
})
.catch(error => {
notification["error"]({
message: t("joblines.errors.creating", {
message: error.message
})
});
});
});
}
if (false) {
//Required, otherwise unable to spread in new note prop.
//delete lineState.__typename;
} else {
updateJobLine({
variables: {
//lineId: lineState.id,
//line: lineState
lineId: jobLineEditModal.context.id,
line: values
}
}).then(r => {
notification["success"]({
message: t("joblines.successes.updated")
})
.then(r => {
notification["success"]({
message: t("joblines.successes.updated")
});
})
.catch(error => {
notification["success"]({
message: t("joblines.errors.updating", {
message: error.message
})
});
});
});
if (jobLineEditModal.actions.refetch)
jobLineEditModal.actions.refetch();
toggleModalVisible();
@@ -75,9 +87,6 @@ function JobLinesUpsertModalContainer({
});
};
const handleOk = () => {
//lineState.id ? updateExistingLine() : insertNewLine();
};
const handleCancel = () => {
toggleModalVisible();
};
@@ -87,7 +96,6 @@ function JobLinesUpsertModalContainer({
visible={jobLineEditModal.visible}
jobLine={jobLineEditModal.context}
handleSubmit={handleSubmit}
handleOk={handleOk}
handleCancel={handleCancel}
form={form}
/>