Compare commits
1 Commits
feature/IO
...
feature/IO
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da26954c3b |
@@ -33,7 +33,7 @@ import JobLinesBillRefernece from "../job-lines-bill-reference/job-lines-bill-re
|
|||||||
import { useTreatmentsWithConfig } from "@splitsoftware/splitio-react";
|
import { useTreatmentsWithConfig } from "@splitsoftware/splitio-react";
|
||||||
import _ from "lodash";
|
import _ from "lodash";
|
||||||
import { FaTasks } from "react-icons/fa";
|
import { FaTasks } from "react-icons/fa";
|
||||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
import { selectAuthLevel, selectBodyshop } from "../../redux/user/user.selectors";
|
||||||
import dayjs from "../../utils/day";
|
import dayjs from "../../utils/day";
|
||||||
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
import InstanceRenderManager from "../../utils/instanceRenderMgr";
|
||||||
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
import { HasFeatureAccess } from "../feature-wrapper/feature-wrapper.component";
|
||||||
@@ -49,6 +49,7 @@ import JobLinesPartPriceChange from "./job-lines-part-price-change.component";
|
|||||||
import JobLinesExpanderSimple from "./jobs-lines-expander-simple.component";
|
import JobLinesExpanderSimple from "./jobs-lines-expander-simple.component";
|
||||||
import { logImEXEvent } from "../../firebase/firebase.utils";
|
import { logImEXEvent } from "../../firebase/firebase.utils";
|
||||||
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
import { useNotification } from "../../contexts/Notifications/notificationContext.jsx";
|
||||||
|
import { HasRbacAccess } from "../rbac-wrapper/rbac-wrapper.component.jsx";
|
||||||
|
|
||||||
const UPDATE_JOB_LINES_LOCATION_BULK = gql`
|
const UPDATE_JOB_LINES_LOCATION_BULK = gql`
|
||||||
mutation UPDATE_JOB_LINES_LOCATION_BULK($ids: [uuid!]!, $location: String!) {
|
mutation UPDATE_JOB_LINES_LOCATION_BULK($ids: [uuid!]!, $location: String!) {
|
||||||
@@ -66,7 +67,8 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
bodyshop: selectBodyshop,
|
bodyshop: selectBodyshop,
|
||||||
jobRO: selectJobReadOnly,
|
jobRO: selectJobReadOnly,
|
||||||
technician: selectTechnician,
|
technician: selectTechnician,
|
||||||
isPartsEntry: selectIsPartsEntry
|
isPartsEntry: selectIsPartsEntry,
|
||||||
|
authLevel: selectAuthLevel
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -94,7 +96,8 @@ export function JobLinesComponent({
|
|||||||
setTaskUpsertContext,
|
setTaskUpsertContext,
|
||||||
billsQuery,
|
billsQuery,
|
||||||
handlePartsOrderOnRowClick,
|
handlePartsOrderOnRowClick,
|
||||||
isPartsEntry
|
isPartsEntry,
|
||||||
|
authLevel
|
||||||
}) {
|
}) {
|
||||||
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
const [deleteJobLine] = useMutation(DELETE_JOB_LINE_BY_PK);
|
||||||
const [bulkUpdateLocations] = useMutation(UPDATE_JOB_LINES_LOCATION_BULK);
|
const [bulkUpdateLocations] = useMutation(UPDATE_JOB_LINES_LOCATION_BULK);
|
||||||
@@ -386,18 +389,20 @@ export function JobLinesComponent({
|
|||||||
key: "actions",
|
key: "actions",
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
<Space>
|
<Space>
|
||||||
{(record.manual_line || jobIsPrivate) && !technician && (
|
{(record.manual_line || jobIsPrivate) &&
|
||||||
<Button
|
!technician &&
|
||||||
disabled={jobRO}
|
HasRbacAccess({ bodyshop, authLevel, action: "jobs:manual-line" }) && (
|
||||||
onClick={() => {
|
<Button
|
||||||
setJobLineEditContext({
|
disabled={jobRO}
|
||||||
actions: { refetch: refetch, submit: form && form.submit },
|
onClick={() => {
|
||||||
context: { ...record, jobid: job.id }
|
setJobLineEditContext({
|
||||||
});
|
actions: { refetch: refetch, submit: form && form.submit },
|
||||||
}}
|
context: { ...record, jobid: job.id }
|
||||||
icon={<EditFilled />}
|
});
|
||||||
/>
|
}}
|
||||||
)}
|
icon={<EditFilled />}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
title={t("tasks.buttons.create")}
|
title={t("tasks.buttons.create")}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -410,29 +415,30 @@ export function JobLinesComponent({
|
|||||||
}}
|
}}
|
||||||
icon={<FaTasks />}
|
icon={<FaTasks />}
|
||||||
/>
|
/>
|
||||||
|
{(record.manual_line || jobIsPrivate) &&
|
||||||
{(record.manual_line || jobIsPrivate) && !technician && (
|
!technician &&
|
||||||
<Button
|
HasRbacAccess({ bodyshop, authLevel, action: "jobs:manual-line" }) && (
|
||||||
disabled={jobRO}
|
<Button
|
||||||
onClick={async () => {
|
disabled={jobRO}
|
||||||
await deleteJobLine({
|
onClick={async () => {
|
||||||
variables: { joblineId: record.id },
|
await deleteJobLine({
|
||||||
update(cache) {
|
variables: { joblineId: record.id },
|
||||||
cache.modify({
|
update(cache) {
|
||||||
fields: {
|
cache.modify({
|
||||||
joblines(existingJobLines, { readField }) {
|
fields: {
|
||||||
return existingJobLines.filter((jlRef) => record.id !== readField("id", jlRef));
|
joblines(existingJobLines, { readField }) {
|
||||||
|
return existingJobLines.filter((jlRef) => record.id !== readField("id", jlRef));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
await axios.post("/job/totalsssu", { id: job.id });
|
||||||
await axios.post("/job/totalsssu", { id: job.id });
|
if (refetch) refetch();
|
||||||
if (refetch) refetch();
|
}}
|
||||||
}}
|
icon={<DeleteFilled />}
|
||||||
icon={<DeleteFilled />}
|
/>
|
||||||
/>
|
)}
|
||||||
)}
|
|
||||||
</Space>
|
</Space>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -657,7 +663,7 @@ export function JobLinesComponent({
|
|||||||
<Button id="repair-data-mark-button">{t("jobs.actions.mark")}</Button>
|
<Button id="repair-data-mark-button">{t("jobs.actions.mark")}</Button>
|
||||||
</Dropdown>
|
</Dropdown>
|
||||||
|
|
||||||
{!isPartsEntry && (
|
{!isPartsEntry && HasRbacAccess({ bodyshop, authLevel, action: "jobs:manual-line" }) && (
|
||||||
<Button
|
<Button
|
||||||
disabled={jobRO || technician}
|
disabled={jobRO || technician}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const ret = {
|
|||||||
"jobs:partsqueue": 4,
|
"jobs:partsqueue": 4,
|
||||||
"jobs:checklist-view": 2,
|
"jobs:checklist-view": 2,
|
||||||
"jobs:list-ready": 1,
|
"jobs:list-ready": 1,
|
||||||
|
"jobs:manual-line": 1,
|
||||||
"jobs:void": 5,
|
"jobs:void": 5,
|
||||||
|
|
||||||
"bills:enter": 2,
|
"bills:enter": 2,
|
||||||
|
|||||||
@@ -435,6 +435,19 @@ export function ShopInfoRbacComponent({ bodyshop }) {
|
|||||||
>
|
>
|
||||||
<InputNumber />
|
<InputNumber />
|
||||||
</Form.Item>,
|
</Form.Item>,
|
||||||
|
<Form.Item
|
||||||
|
key="jobs:manual-line"
|
||||||
|
label={t("bodyshop.fields.rbac.jobs.manual-line")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true
|
||||||
|
//message: t("general.validation.required"),
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
name={["md_rbac", "jobs:manual-line"]}
|
||||||
|
>
|
||||||
|
<InputNumber />
|
||||||
|
</Form.Item>,
|
||||||
<Form.Item
|
<Form.Item
|
||||||
key="jobs:partsqueue"
|
key="jobs:partsqueue"
|
||||||
label={t("bodyshop.fields.rbac.jobs.partsqueue")}
|
label={t("bodyshop.fields.rbac.jobs.partsqueue")}
|
||||||
|
|||||||
@@ -10,12 +10,14 @@ import JobsCreateOwnerInfoContainer from "../../components/jobs-create-owner-inf
|
|||||||
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
import JobsCreateVehicleInfoContainer from "../../components/jobs-create-vehicle-info/jobs-create-vehicle-info.container";
|
||||||
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
import JobCreateContext from "../../pages/jobs-create/jobs-create.context";
|
||||||
|
|
||||||
export default function JobsCreateComponent({ form, isSubmitting }) {
|
export default function JobsCreateComponent({ form }) {
|
||||||
const [pageIndex, setPageIndex] = useState(0);
|
const [pageIndex, setPageIndex] = useState(0);
|
||||||
const [errorMessage, setErrorMessage] = useState(null);
|
|
||||||
const [state] = useContext(JobCreateContext);
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
|
const [errorMessage, setErrorMessage] = useState(null);
|
||||||
|
|
||||||
|
const [state] = useContext(JobCreateContext);
|
||||||
|
|
||||||
|
const { t } = useTranslation();
|
||||||
const steps = [
|
const steps = [
|
||||||
{
|
{
|
||||||
title: t("jobs.labels.create.vehicleinfo"),
|
title: t("jobs.labels.create.vehicleinfo"),
|
||||||
@@ -40,9 +42,11 @@ export default function JobsCreateComponent({ form, isSubmitting }) {
|
|||||||
|
|
||||||
const next = () => {
|
const next = () => {
|
||||||
setPageIndex(pageIndex + 1);
|
setPageIndex(pageIndex + 1);
|
||||||
|
console.log("Next");
|
||||||
};
|
};
|
||||||
const prev = () => {
|
const prev = () => {
|
||||||
setPageIndex(pageIndex - 1);
|
setPageIndex(pageIndex - 1);
|
||||||
|
console.log("Previous");
|
||||||
};
|
};
|
||||||
|
|
||||||
const ProgressButtons = ({ top }) => {
|
const ProgressButtons = ({ top }) => {
|
||||||
@@ -75,19 +79,17 @@ export default function JobsCreateComponent({ form, isSubmitting }) {
|
|||||||
{pageIndex === steps.length - 1 && (
|
{pageIndex === steps.length - 1 && (
|
||||||
<Button
|
<Button
|
||||||
type="primary"
|
type="primary"
|
||||||
loading={isSubmitting}
|
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
form
|
form
|
||||||
.validateFields()
|
.validateFields()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
form.submit();
|
// NO OP
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => console.log("error", error));
|
||||||
console.log("error", error);
|
form.submit();
|
||||||
});
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t("general.actions.done")}
|
Done
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
@@ -144,11 +146,13 @@ export default function JobsCreateComponent({ form, isSubmitting }) {
|
|||||||
) : (
|
) : (
|
||||||
<div>
|
<div>
|
||||||
<ProgressButtons top />
|
<ProgressButtons top />
|
||||||
|
|
||||||
{errorMessage ? (
|
{errorMessage ? (
|
||||||
<div>
|
<div>
|
||||||
<AlertComponent title={errorMessage} type="error" />
|
<AlertComponent title={errorMessage} type="error" />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{steps.map((item, idx) => (
|
{steps.map((item, idx) => (
|
||||||
<div
|
<div
|
||||||
key={idx}
|
key={idx}
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ function JobsCreateContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, curr
|
|||||||
});
|
});
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const [state, setState] = contextState;
|
const [state, setState] = contextState;
|
||||||
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
||||||
const [insertJob] = useMutation(INSERT_NEW_JOB);
|
const [insertJob] = useMutation(INSERT_NEW_JOB);
|
||||||
const [loadOwner, remoteOwnerData] = useLazyQuery(QUERY_OWNER_FOR_JOB_CREATION);
|
const [loadOwner, remoteOwnerData] = useLazyQuery(QUERY_OWNER_FOR_JOB_CREATION);
|
||||||
|
|
||||||
@@ -84,19 +83,16 @@ function JobsCreateContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, curr
|
|||||||
newJobId: resp.data.insert_jobs.returning[0].id
|
newJobId: resp.data.insert_jobs.returning[0].id
|
||||||
});
|
});
|
||||||
logImEXEvent("manual_job_create_completed", {});
|
logImEXEvent("manual_job_create_completed", {});
|
||||||
setIsSubmitting(false);
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
notification.error({
|
notification.error({
|
||||||
title: t("jobs.errors.creating", { error: error })
|
title: t("jobs.errors.creating", { error: error })
|
||||||
});
|
});
|
||||||
setState({ ...state, error: error });
|
setState({ ...state, error: error });
|
||||||
setIsSubmitting(false);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleFinish = (values) => {
|
const handleFinish = (values) => {
|
||||||
setIsSubmitting(true);
|
|
||||||
let job = Object.assign(
|
let job = Object.assign(
|
||||||
{},
|
{},
|
||||||
values,
|
values,
|
||||||
@@ -301,7 +297,7 @@ function JobsCreateContainer({ bodyshop, setBreadcrumbs, setSelectedHeader, curr
|
|||||||
})
|
})
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<JobsCreateComponent form={form} isSubmitting={isSubmitting} />
|
<JobsCreateComponent form={form} />
|
||||||
</Form>
|
</Form>
|
||||||
</RbacWrapper>
|
</RbacWrapper>
|
||||||
</JobCreateContext.Provider>
|
</JobCreateContext.Provider>
|
||||||
|
|||||||
@@ -519,6 +519,7 @@
|
|||||||
"list-active": "Jobs -> List Active",
|
"list-active": "Jobs -> List Active",
|
||||||
"list-all": "Jobs -> List All",
|
"list-all": "Jobs -> List All",
|
||||||
"list-ready": "Jobs -> List Ready",
|
"list-ready": "Jobs -> List Ready",
|
||||||
|
"manual-line": "Jobs -> Manual Line",
|
||||||
"partsqueue": "Jobs -> Parts Queue",
|
"partsqueue": "Jobs -> Parts Queue",
|
||||||
"void": "Jobs -> Void"
|
"void": "Jobs -> Void"
|
||||||
},
|
},
|
||||||
@@ -1295,7 +1296,6 @@
|
|||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"deleteall": "Delete All",
|
"deleteall": "Delete All",
|
||||||
"deselectall": "Deselect All",
|
"deselectall": "Deselect All",
|
||||||
"done": "Done",
|
|
||||||
"download": "Download",
|
"download": "Download",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"gotoadmin": "Go to Admin Panel",
|
"gotoadmin": "Go to Admin Panel",
|
||||||
|
|||||||
@@ -519,6 +519,7 @@
|
|||||||
"list-active": "",
|
"list-active": "",
|
||||||
"list-all": "",
|
"list-all": "",
|
||||||
"list-ready": "",
|
"list-ready": "",
|
||||||
|
"manual-line": "",
|
||||||
"partsqueue": "",
|
"partsqueue": "",
|
||||||
"void": ""
|
"void": ""
|
||||||
},
|
},
|
||||||
@@ -1295,7 +1296,6 @@
|
|||||||
"delete": "Borrar",
|
"delete": "Borrar",
|
||||||
"deleteall": "",
|
"deleteall": "",
|
||||||
"deselectall": "",
|
"deselectall": "",
|
||||||
"done": "",
|
|
||||||
"download": "",
|
"download": "",
|
||||||
"edit": "Editar",
|
"edit": "Editar",
|
||||||
"gotoadmin": "",
|
"gotoadmin": "",
|
||||||
|
|||||||
@@ -519,6 +519,7 @@
|
|||||||
"list-active": "",
|
"list-active": "",
|
||||||
"list-all": "",
|
"list-all": "",
|
||||||
"list-ready": "",
|
"list-ready": "",
|
||||||
|
"manual-line": "",
|
||||||
"partsqueue": "",
|
"partsqueue": "",
|
||||||
"void": ""
|
"void": ""
|
||||||
},
|
},
|
||||||
@@ -1295,7 +1296,6 @@
|
|||||||
"delete": "Effacer",
|
"delete": "Effacer",
|
||||||
"deleteall": "",
|
"deleteall": "",
|
||||||
"deselectall": "",
|
"deselectall": "",
|
||||||
"done": "",
|
|
||||||
"download": "",
|
"download": "",
|
||||||
"edit": "modifier",
|
"edit": "modifier",
|
||||||
"gotoadmin": "",
|
"gotoadmin": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user