Implemented jobline upsert modal. Updated allocations display on jobline edit to include removal.
This commit is contained in:
@@ -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}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user