Implemented jobline upsert modal. Updated allocations display on jobline edit to include removal.
This commit is contained in:
@@ -47,6 +47,53 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>errors</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>deleting</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>saving</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>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>fields</name>
|
<name>fields</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -73,6 +120,53 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>successes</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>deleted</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>
|
||||||
|
<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>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
@@ -1635,6 +1729,79 @@
|
|||||||
<folder_node>
|
<folder_node>
|
||||||
<name>joblines</name>
|
<name>joblines</name>
|
||||||
<children>
|
<children>
|
||||||
|
<folder_node>
|
||||||
|
<name>actions</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>new</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>
|
||||||
|
<folder_node>
|
||||||
|
<name>errors</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>creating</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>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>
|
||||||
|
</children>
|
||||||
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
<name>fields</name>
|
<name>fields</name>
|
||||||
<children>
|
<children>
|
||||||
@@ -1743,6 +1910,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>mod_lbr_ty</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>oem_partno</name>
|
<name>oem_partno</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -1764,6 +1952,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>op_code_desc</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>part_type</name>
|
<name>part_type</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
@@ -1876,6 +2085,53 @@
|
|||||||
</concept_node>
|
</concept_node>
|
||||||
</children>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
|
<folder_node>
|
||||||
|
<name>successes</name>
|
||||||
|
<children>
|
||||||
|
<concept_node>
|
||||||
|
<name>created</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>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>
|
</children>
|
||||||
</folder_node>
|
</folder_node>
|
||||||
<folder_node>
|
<folder_node>
|
||||||
|
|||||||
@@ -20,13 +20,19 @@ export default function AllocationsAssignmentContainer({
|
|||||||
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
|
const [insertAllocation] = useMutation(INSERT_ALLOCATION);
|
||||||
|
|
||||||
const handleAssignment = () => {
|
const handleAssignment = () => {
|
||||||
insertAllocation({ variables: { alloc: { ...assignment } } }).then(r => {
|
insertAllocation({ variables: { alloc: { ...assignment } } })
|
||||||
notification["success"]({
|
.then(r => {
|
||||||
message: t("employees.successes.save")
|
notification["success"]({
|
||||||
|
message: t("allocations.successes.save")
|
||||||
|
});
|
||||||
|
visibilityState[1](false);
|
||||||
|
if (refetch) refetch();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("employees.errors.saving", { message: error.message })
|
||||||
|
});
|
||||||
});
|
});
|
||||||
visibilityState[1](false);
|
|
||||||
if (refetch) refetch();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { Icon } from "antd";
|
||||||
|
import React from "react";
|
||||||
|
import { MdRemoveCircleOutline } from "react-icons/md";
|
||||||
|
|
||||||
|
export default function AllocationsLabelComponent({ allocation, handleClick }) {
|
||||||
|
return (
|
||||||
|
<div style={{ display: "flex" }}>
|
||||||
|
<span>
|
||||||
|
{`${allocation.employee.first_name || ""} ${allocation.employee
|
||||||
|
.last_name || ""} (${allocation.hours || ""})`}
|
||||||
|
</span>
|
||||||
|
<Icon
|
||||||
|
style={{ color: "red", padding: "0px 4px" }}
|
||||||
|
component={MdRemoveCircleOutline}
|
||||||
|
onClick={handleClick}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { useMutation } from "react-apollo";
|
||||||
|
import { DELETE_ALLOCATION } from "../../graphql/allocations.queries";
|
||||||
|
import AllocationsLabelComponent from "./allocations-employee-label.component";
|
||||||
|
import { notification } from "antd";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
export default function AllocationsLabelContainer({ allocation, refetch }) {
|
||||||
|
const [deleteAllocation] = useMutation(DELETE_ALLOCATION);
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const handleClick = e => {
|
||||||
|
e.preventDefault();
|
||||||
|
deleteAllocation({ variables: { id: allocation.id } })
|
||||||
|
.then(r => {
|
||||||
|
notification["success"]({
|
||||||
|
message: t("allocations.successes.deleted")
|
||||||
|
});
|
||||||
|
if (refetch) refetch();
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
notification["error"]({ message: t("allocations.errors.deleting") });
|
||||||
|
});
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<AllocationsLabelComponent
|
||||||
|
allocation={allocation}
|
||||||
|
handleClick={handleClick}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -10,7 +10,7 @@ export default function ResetForm({ resetFields }) {
|
|||||||
message={
|
message={
|
||||||
<div>
|
<div>
|
||||||
{t("general.messages.unsavedchanges")}
|
{t("general.messages.unsavedchanges")}
|
||||||
<Button onClick={() => resetFields()}>
|
<Button style={{ marginLeft: "20px" }} onClick={() => resetFields()}>
|
||||||
{t("general.actions.reset")}
|
{t("general.actions.reset")}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
|||||||
import { alphaSort } from "../../utils/sorters";
|
import { alphaSort } from "../../utils/sorters";
|
||||||
import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
import AllocationsAssignmentContainer from "../allocations-assignment/allocations-assignment.container";
|
||||||
import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
import AllocationsBulkAssignmentContainer from "../allocations-bulk-assignment/allocations-bulk-assignment.container";
|
||||||
|
import AllocationsEmployeeLabelContainer from "../allocations-employee-label/allocations-employee-label.container";
|
||||||
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
import PartsOrderModalContainer from "../parts-order-modal/parts-order-modal.container";
|
||||||
|
|
||||||
export default function JobLinesComponent({
|
export default function JobLinesComponent({
|
||||||
@@ -135,16 +136,26 @@ export default function JobLinesComponent({
|
|||||||
dataIndex: "employee",
|
dataIndex: "employee",
|
||||||
key: "employee",
|
key: "employee",
|
||||||
width: "10%",
|
width: "10%",
|
||||||
sorter: (a, b) => a.act_price - b.act_price, //TODO Fix employee sorting.
|
sorter: (a, b) =>
|
||||||
|
alphaSort(
|
||||||
|
a.allocations[0] &&
|
||||||
|
a.allocations[0].employee.first_name +
|
||||||
|
a.allocations[0].employee.last_name,
|
||||||
|
b.allocations[0] &&
|
||||||
|
b.allocations[0].employee.first_name +
|
||||||
|
b.allocations[0].employee.last_name
|
||||||
|
),
|
||||||
sortOrder:
|
sortOrder:
|
||||||
state.sortedInfo.columnKey === "employee" && state.sortedInfo.order,
|
state.sortedInfo.columnKey === "employee" && state.sortedInfo.order,
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<span>
|
<span>
|
||||||
{record.allocations && record.allocations.length > 0
|
{record.allocations && record.allocations.length > 0
|
||||||
? record.allocations.map(item => (
|
? record.allocations.map(item => (
|
||||||
<div
|
<AllocationsEmployeeLabelContainer
|
||||||
key={item.id}
|
key={item.id}
|
||||||
>{`${item.employee.first_name} ${item.employee.last_name} (${item.hours})`}</div>
|
refetch={refetch}
|
||||||
|
allocation={item}
|
||||||
|
/>
|
||||||
))
|
))
|
||||||
: null}
|
: null}
|
||||||
<AllocationsAssignmentContainer
|
<AllocationsAssignmentContainer
|
||||||
@@ -168,8 +179,6 @@ export default function JobLinesComponent({
|
|||||||
actions: { refetch: refetch },
|
actions: { refetch: refetch },
|
||||||
context: record
|
context: record
|
||||||
});
|
});
|
||||||
//lineToEdit[1](record);
|
|
||||||
//editLineModalVisible[1](true);
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("general.actions.edit")}
|
{t("general.actions.edit")}
|
||||||
@@ -224,6 +233,16 @@ export default function JobLinesComponent({
|
|||||||
jobLines={selectedLines}
|
jobLines={selectedLines}
|
||||||
refetch={refetch}
|
refetch={refetch}
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
onClick={() => {
|
||||||
|
setJobLineEditContext({
|
||||||
|
actions: { refetch: refetch },
|
||||||
|
context: { jobid: jobId }
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{t("joblines.actions.new")}
|
||||||
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { Modal, Form } from "antd";
|
import { Modal, Form, Input, InputNumber } from "antd";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
import ResetForm from "../form-items-formatted/reset-form-item.component";
|
||||||
|
|
||||||
export default function JobLinesUpsertModalComponent({
|
export default function JobLinesUpsertModalComponent({
|
||||||
visible,
|
visible,
|
||||||
@@ -11,8 +12,8 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
form
|
form
|
||||||
}) {
|
}) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
//const { getFieldDecorator, isFieldsTouched, resetFields } = form;
|
const { getFieldDecorator, isFieldsTouched, resetFields } = form;
|
||||||
console.log("jobLine", jobLine);
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
title={
|
title={
|
||||||
@@ -22,11 +23,46 @@ export default function JobLinesUpsertModalComponent({
|
|||||||
}
|
}
|
||||||
visible={visible}
|
visible={visible}
|
||||||
okText={t("general.labels.save")}
|
okText={t("general.labels.save")}
|
||||||
onOk={handleOk}
|
onOk={handleSubmit}
|
||||||
onCancel={handleCancel}
|
onCancel={handleCancel}
|
||||||
>
|
>
|
||||||
|
{isFieldsTouched() ? <ResetForm resetFields={resetFields} /> : null}
|
||||||
<Form onSubmit={handleSubmit} autoComplete={"off"}>
|
<Form onSubmit={handleSubmit} autoComplete={"off"}>
|
||||||
{JSON.stringify(jobLine)}
|
<Form.Item label={t("joblines.fields.line_desc")}>
|
||||||
|
{getFieldDecorator("line_desc", {
|
||||||
|
initialValue: jobLine.line_desc
|
||||||
|
})(<Input name="line_desc" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.oem_partno")}>
|
||||||
|
{getFieldDecorator("oem_partno", {
|
||||||
|
initialValue: jobLine.oem_partno
|
||||||
|
})(<Input name="oem_partno" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.part_type")}>
|
||||||
|
{getFieldDecorator("part_type", {
|
||||||
|
initialValue: jobLine.part_type
|
||||||
|
})(<Input name="part_type" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.mod_lbr_ty")}>
|
||||||
|
{getFieldDecorator("mod_lbr_ty", {
|
||||||
|
initialValue: jobLine.mod_lbr_ty
|
||||||
|
})(<Input name="mod_lbr_ty" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.op_code_desc")}>
|
||||||
|
{getFieldDecorator("op_code_desc", {
|
||||||
|
initialValue: jobLine.op_code_desc
|
||||||
|
})(<Input name="op_code_desc" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.mod_lb_hrs")}>
|
||||||
|
{getFieldDecorator("mod_lb_hrs", {
|
||||||
|
initialValue: jobLine.mod_lb_hrs
|
||||||
|
})(<InputNumber name="mod_lb_hrs" />)}
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item label={t("joblines.fields.act_price")}>
|
||||||
|
{getFieldDecorator("act_price", {
|
||||||
|
initialValue: jobLine.act_price
|
||||||
|
})(<InputNumber name="act_price" />)}
|
||||||
|
</Form.Item>
|
||||||
</Form>
|
</Form>
|
||||||
</Modal>
|
</Modal>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -39,34 +39,46 @@ function JobLinesUpsertModalContainer({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (true) {
|
if (!jobLineEditModal.context.id) {
|
||||||
insertJobLine({
|
insertJobLine({
|
||||||
variables: {
|
variables: {
|
||||||
//lineInput: [{ ...lineState, jobid: jobId }]
|
lineInput: [{ jobid: jobLineEditModal.context.jobid, ...values }]
|
||||||
}
|
}
|
||||||
}).then(r => {
|
})
|
||||||
if (jobLineEditModal.actions.refetch)
|
.then(r => {
|
||||||
jobLineEditModal.actions.refetch();
|
if (jobLineEditModal.actions.refetch)
|
||||||
toggleModalVisible();
|
jobLineEditModal.actions.refetch();
|
||||||
notification["success"]({
|
toggleModalVisible();
|
||||||
message: t("joblines.successes.create")
|
notification["success"]({
|
||||||
|
message: t("joblines.successes.created")
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
notification["error"]({
|
||||||
|
message: t("joblines.errors.creating", {
|
||||||
|
message: error.message
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
} else {
|
||||||
}
|
|
||||||
|
|
||||||
if (false) {
|
|
||||||
//Required, otherwise unable to spread in new note prop.
|
|
||||||
//delete lineState.__typename;
|
|
||||||
updateJobLine({
|
updateJobLine({
|
||||||
variables: {
|
variables: {
|
||||||
//lineId: lineState.id,
|
lineId: jobLineEditModal.context.id,
|
||||||
//line: lineState
|
line: values
|
||||||
}
|
}
|
||||||
}).then(r => {
|
})
|
||||||
notification["success"]({
|
.then(r => {
|
||||||
message: t("joblines.successes.updated")
|
notification["success"]({
|
||||||
|
message: t("joblines.successes.updated")
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
notification["success"]({
|
||||||
|
message: t("joblines.errors.updating", {
|
||||||
|
message: error.message
|
||||||
|
})
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
if (jobLineEditModal.actions.refetch)
|
if (jobLineEditModal.actions.refetch)
|
||||||
jobLineEditModal.actions.refetch();
|
jobLineEditModal.actions.refetch();
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
@@ -75,9 +87,6 @@ function JobLinesUpsertModalContainer({
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOk = () => {
|
|
||||||
//lineState.id ? updateExistingLine() : insertNewLine();
|
|
||||||
};
|
|
||||||
const handleCancel = () => {
|
const handleCancel = () => {
|
||||||
toggleModalVisible();
|
toggleModalVisible();
|
||||||
};
|
};
|
||||||
@@ -87,7 +96,6 @@ function JobLinesUpsertModalContainer({
|
|||||||
visible={jobLineEditModal.visible}
|
visible={jobLineEditModal.visible}
|
||||||
jobLine={jobLineEditModal.context}
|
jobLine={jobLineEditModal.context}
|
||||||
handleSubmit={handleSubmit}
|
handleSubmit={handleSubmit}
|
||||||
handleOk={handleOk}
|
|
||||||
handleCancel={handleCancel}
|
handleCancel={handleCancel}
|
||||||
form={form}
|
form={form}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -9,3 +9,13 @@ export const INSERT_ALLOCATION = gql`
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
export const DELETE_ALLOCATION = gql`
|
||||||
|
mutation DELETE_ALLOCATION($id: uuid!) {
|
||||||
|
delete_allocations(where: { id: { _eq: $id } }) {
|
||||||
|
returning {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import ModalsActionTypes from "./modals.types";
|
|||||||
const INITIAL_STATE = {
|
const INITIAL_STATE = {
|
||||||
jobLineEdit: {
|
jobLineEdit: {
|
||||||
visible: false,
|
visible: false,
|
||||||
context: null,
|
context: {},
|
||||||
actions: {
|
actions: {
|
||||||
refetch: null
|
refetch: null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { createStore, applyMiddleware } from "redux";
|
import { createStore, applyMiddleware } from "redux";
|
||||||
import { persistStore } from "redux-persist";
|
import { persistStore } from "redux-persist";
|
||||||
import logger from "redux-logger";
|
import { createLogger } from "redux-logger";
|
||||||
import createSagaMiddleware from "redux-saga";
|
import createSagaMiddleware from "redux-saga";
|
||||||
import rootReducer from "./root.reducer";
|
import rootReducer from "./root.reducer";
|
||||||
import rootSaga from "./root.saga";
|
import rootSaga from "./root.saga";
|
||||||
@@ -8,7 +8,7 @@ import rootSaga from "./root.saga";
|
|||||||
const sagaMiddleWare = createSagaMiddleware();
|
const sagaMiddleWare = createSagaMiddleware();
|
||||||
const middlewares = [sagaMiddleWare];
|
const middlewares = [sagaMiddleWare];
|
||||||
if (process.env.NODE_ENV === "development") {
|
if (process.env.NODE_ENV === "development") {
|
||||||
middlewares.push(logger);
|
middlewares.push(createLogger({ collapsed: true, diff: true }));
|
||||||
}
|
}
|
||||||
|
|
||||||
export const store = createStore(rootReducer, applyMiddleware(...middlewares));
|
export const store = createStore(rootReducer, applyMiddleware(...middlewares));
|
||||||
|
|||||||
@@ -4,8 +4,16 @@
|
|||||||
"actions": {
|
"actions": {
|
||||||
"assign": "Assign"
|
"assign": "Assign"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"deleting": "Error encountered while deleting allocation. {{message}}",
|
||||||
|
"saving": "Error while allocating. {{message}}"
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"employee": "Allocated To"
|
"employee": "Allocated To"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"deleted": "Allocation deleted successfully.",
|
||||||
|
"save": "Allocated successfully. "
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"appointments": {
|
"appointments": {
|
||||||
@@ -136,13 +144,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"joblines": {
|
"joblines": {
|
||||||
|
"actions": {
|
||||||
|
"new": "New Line"
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"creating": "Error encountered while creating job line. {{message}}",
|
||||||
|
"updating": "Error encountered updating job line. {{message}}"
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"act_price": "Actual Price",
|
"act_price": "Actual Price",
|
||||||
"db_price": "Database Price",
|
"db_price": "Database Price",
|
||||||
"line_desc": "Line Description",
|
"line_desc": "Line Description",
|
||||||
"line_ind": "S#",
|
"line_ind": "S#",
|
||||||
"mod_lb_hrs": "Labor Hours",
|
"mod_lb_hrs": "Labor Hours",
|
||||||
|
"mod_lbr_ty": "Labor Type",
|
||||||
"oem_partno": "OEM Part #",
|
"oem_partno": "OEM Part #",
|
||||||
|
"op_code_desc": "Operation Code Description",
|
||||||
"part_type": "Part Type",
|
"part_type": "Part Type",
|
||||||
"status": "Status",
|
"status": "Status",
|
||||||
"unq_seq": "Seq #"
|
"unq_seq": "Seq #"
|
||||||
@@ -150,6 +167,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"edit": "Edit Line",
|
"edit": "Edit Line",
|
||||||
"new": "New Line"
|
"new": "New Line"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"created": "Job line created successfully.",
|
||||||
|
"updated": "Job line updated successfully."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jobs": {
|
"jobs": {
|
||||||
|
|||||||
@@ -4,8 +4,16 @@
|
|||||||
"actions": {
|
"actions": {
|
||||||
"assign": "Asignar"
|
"assign": "Asignar"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"deleting": "",
|
||||||
|
"saving": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"employee": "Asignado a"
|
"employee": "Asignado a"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"deleted": "",
|
||||||
|
"save": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"appointments": {
|
"appointments": {
|
||||||
@@ -136,13 +144,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"joblines": {
|
"joblines": {
|
||||||
|
"actions": {
|
||||||
|
"new": ""
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"creating": "",
|
||||||
|
"updating": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"act_price": "Precio actual",
|
"act_price": "Precio actual",
|
||||||
"db_price": "Precio de base de datos",
|
"db_price": "Precio de base de datos",
|
||||||
"line_desc": "Descripción de línea",
|
"line_desc": "Descripción de línea",
|
||||||
"line_ind": "S#",
|
"line_ind": "S#",
|
||||||
"mod_lb_hrs": "Horas laborales",
|
"mod_lb_hrs": "Horas laborales",
|
||||||
|
"mod_lbr_ty": "Tipo de trabajo",
|
||||||
"oem_partno": "OEM parte #",
|
"oem_partno": "OEM parte #",
|
||||||
|
"op_code_desc": "",
|
||||||
"part_type": "Tipo de parte",
|
"part_type": "Tipo de parte",
|
||||||
"status": "Estado",
|
"status": "Estado",
|
||||||
"unq_seq": "Seq #"
|
"unq_seq": "Seq #"
|
||||||
@@ -150,6 +167,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"edit": "Línea de edición",
|
"edit": "Línea de edición",
|
||||||
"new": "Nueva línea"
|
"new": "Nueva línea"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"created": "",
|
||||||
|
"updated": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jobs": {
|
"jobs": {
|
||||||
|
|||||||
@@ -4,8 +4,16 @@
|
|||||||
"actions": {
|
"actions": {
|
||||||
"assign": "Attribuer"
|
"assign": "Attribuer"
|
||||||
},
|
},
|
||||||
|
"errors": {
|
||||||
|
"deleting": "",
|
||||||
|
"saving": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"employee": "Alloué à"
|
"employee": "Alloué à"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"deleted": "",
|
||||||
|
"save": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"appointments": {
|
"appointments": {
|
||||||
@@ -136,13 +144,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"joblines": {
|
"joblines": {
|
||||||
|
"actions": {
|
||||||
|
"new": ""
|
||||||
|
},
|
||||||
|
"errors": {
|
||||||
|
"creating": "",
|
||||||
|
"updating": ""
|
||||||
|
},
|
||||||
"fields": {
|
"fields": {
|
||||||
"act_price": "Prix actuel",
|
"act_price": "Prix actuel",
|
||||||
"db_price": "Prix de la base de données",
|
"db_price": "Prix de la base de données",
|
||||||
"line_desc": "Description de la ligne",
|
"line_desc": "Description de la ligne",
|
||||||
"line_ind": "S#",
|
"line_ind": "S#",
|
||||||
"mod_lb_hrs": "Heures de travail",
|
"mod_lb_hrs": "Heures de travail",
|
||||||
|
"mod_lbr_ty": "Type de travail",
|
||||||
"oem_partno": "Pièce OEM #",
|
"oem_partno": "Pièce OEM #",
|
||||||
|
"op_code_desc": "",
|
||||||
"part_type": "Type de pièce",
|
"part_type": "Type de pièce",
|
||||||
"status": "Statut",
|
"status": "Statut",
|
||||||
"unq_seq": "Seq #"
|
"unq_seq": "Seq #"
|
||||||
@@ -150,6 +167,10 @@
|
|||||||
"labels": {
|
"labels": {
|
||||||
"edit": "Ligne d'édition",
|
"edit": "Ligne d'édition",
|
||||||
"new": "Nouvelle ligne"
|
"new": "Nouvelle ligne"
|
||||||
|
},
|
||||||
|
"successes": {
|
||||||
|
"created": "",
|
||||||
|
"updated": ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"jobs": {
|
"jobs": {
|
||||||
|
|||||||
@@ -31,6 +31,6 @@
|
|||||||
"concurrently": "^4.0.1",
|
"concurrently": "^4.0.1",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"hasura-cli": "^1.0.0-beta.10"
|
"hasura-cli": "^1.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1950,10 +1950,10 @@ has-flag@^3.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
|
||||||
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
|
integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
|
||||||
|
|
||||||
hasura-cli@^1.0.0-beta.10:
|
hasura-cli@^1.1.0:
|
||||||
version "1.0.0-rc.1"
|
version "1.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/hasura-cli/-/hasura-cli-1.0.0-rc.1.tgz#481453f88e7624f468f329c75a88fbbde3407f00"
|
resolved "https://registry.yarnpkg.com/hasura-cli/-/hasura-cli-1.1.0.tgz#a095e94c654d30354d8979602b8c0047c7b8a9e1"
|
||||||
integrity sha512-w6DGAhJZ6l7U89SD6QIxYetP3/dDxJc4jEVzjMAYsueeYWQKDeGgtZBFBW1sdgAlUtRmtIa5wbiFLXuagB6JqA==
|
integrity sha512-D1qXoYydx9Mgq7VQdCmOOvTlYhd1RcjQtn4s7pN1wb5w1ORIcDFLm1rS3w97bsx7wPRotIl0reyhc3+FDq+FFg==
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^0.19.0"
|
axios "^0.19.0"
|
||||||
chalk "^2.4.2"
|
chalk "^2.4.2"
|
||||||
|
|||||||
Reference in New Issue
Block a user