Read Onlt Invoice Screen IO-578
This commit is contained in:
@@ -3,6 +3,7 @@ import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import LaborTypeFormItem from "../form-items-formatted/labor-type-form-item.component";
|
||||
import PartTypeFormItem from "../form-items-formatted/part-type-form-item.component";
|
||||
@@ -11,12 +12,13 @@ import "./jobs-close-lines.styles.scss";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export function JobsCloseLines({ bodyshop, job }) {
|
||||
export function JobsCloseLines({ bodyshop, job, jobRO }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<div>
|
||||
@@ -114,6 +116,7 @@ export function JobsCloseLines({ bodyshop, job }) {
|
||||
allowClear
|
||||
optionFilterProp="children"
|
||||
showSearch
|
||||
disabled={jobRO}
|
||||
filterOption={(input, option) =>
|
||||
option.children
|
||||
.toLowerCase()
|
||||
@@ -146,6 +149,7 @@ export function JobsCloseLines({ bodyshop, job }) {
|
||||
allowClear
|
||||
optionFilterProp="children"
|
||||
showSearch
|
||||
disabled={jobRO}
|
||||
filterOption={(input, option) =>
|
||||
option.children
|
||||
.toLowerCase()
|
||||
|
||||
@@ -240,11 +240,8 @@ export function JobsDetailHeaderActions({
|
||||
>
|
||||
{t("jobs.actions.addtopartsqueue")}
|
||||
</Menu.Item>
|
||||
<Menu.Item
|
||||
disabled={!!job.date_invoiced || !jobInPostProduction || jobRO}
|
||||
key="closejob"
|
||||
>
|
||||
{!!job.date_invoiced || !jobInPostProduction || jobRO ? (
|
||||
<Menu.Item disabled={!jobInPostProduction} key="closejob">
|
||||
{!jobInPostProduction ? (
|
||||
t("menus.jobsactions.closejob")
|
||||
) : (
|
||||
<Link
|
||||
@@ -256,18 +253,14 @@ export function JobsDetailHeaderActions({
|
||||
</Link>
|
||||
)}
|
||||
</Menu.Item>
|
||||
<Menu.Item disabled={!!job.date_invoiced || jobRO} key="admin">
|
||||
{!!job.date_invoiced || jobRO ? (
|
||||
t("menus.jobsactions.admin")
|
||||
) : (
|
||||
<Link
|
||||
to={{
|
||||
pathname: `/manage/jobs/${job.id}/admin`,
|
||||
}}
|
||||
>
|
||||
{t("menus.jobsactions.admin")}
|
||||
</Link>
|
||||
)}
|
||||
<Menu.Item key="admin">
|
||||
<Link
|
||||
to={{
|
||||
pathname: `/manage/jobs/${job.id}/admin`,
|
||||
}}
|
||||
>
|
||||
{t("menus.jobsactions.admin")}
|
||||
</Link>
|
||||
</Menu.Item>
|
||||
<JobsDetaiLheaderCsi job={job} />
|
||||
<Menu.Item
|
||||
|
||||
@@ -6,6 +6,7 @@ import { connect } from "react-redux";
|
||||
import { useParams } from "react-router-dom";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import JobCalculateTotals from "../../components/job-calculate-totals/job-calculate-totals.component";
|
||||
import ScoreboardAddButton from "../../components/job-scoreboard-add-button/job-scoreboard-add-button.component";
|
||||
import JobsAdminClass from "../../components/jobs-admin-class/jobs-admin-class.component";
|
||||
import JobsAdminDatesChange from "../../components/jobs-admin-dates/jobs-admin-dates.component";
|
||||
import JobsAdminDeleteIntake from "../../components/jobs-admin-delete-intake/jobs-admin-delete-intake.component";
|
||||
@@ -70,6 +71,7 @@ export function JobsCloseContainer({ setBreadcrumbs, setSelectedHeader }) {
|
||||
return (
|
||||
<RbacWrapper action="jobs:admin">
|
||||
<div>
|
||||
<ScoreboardAddButton job={data ? data.jobs_by_pk : {}} />
|
||||
<LayoutFormRow grow>
|
||||
<JobAdminOwnerReassociate job={data ? data.jobs_by_pk : {}} />
|
||||
<JobAdminVehicleReassociate job={data ? data.jobs_by_pk : {}} />
|
||||
|
||||
@@ -12,12 +12,14 @@ import JobsCloseExportButton from "../../components/jobs-close-export-button/job
|
||||
import JobsCloseLines from "../../components/jobs-close-lines/jobs-close-lines.component";
|
||||
import { generateJobLinesUpdatesForInvoicing } from "../../graphql/jobs-lines.queries";
|
||||
import { UPDATE_JOB } from "../../graphql/jobs.queries";
|
||||
import { selectJobReadOnly } from "../../redux/application/application.selectors";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
jobRO: selectJobReadOnly,
|
||||
});
|
||||
|
||||
export function JobsCloseComponent({ job, bodyshop }) {
|
||||
export function JobsCloseComponent({ job, bodyshop, jobRO }) {
|
||||
const { t } = useTranslation();
|
||||
const [form] = Form.useForm();
|
||||
const client = useApolloClient();
|
||||
@@ -86,26 +88,31 @@ export function JobsCloseComponent({ job, bodyshop }) {
|
||||
<JobsCloseAutoAllocate
|
||||
joblines={job.joblines}
|
||||
form={form}
|
||||
disabled={!!job.date_exported}
|
||||
disabled={!!job.date_exported || jobRO}
|
||||
/>
|
||||
|
||||
<Button loading={loading} onClick={() => form.submit()}>
|
||||
<Button
|
||||
loading={loading}
|
||||
onClick={() => form.submit()}
|
||||
disabled={jobRO}
|
||||
>
|
||||
{t("general.actions.save")}
|
||||
</Button>
|
||||
|
||||
<Popconfirm
|
||||
onConfirm={handleClose}
|
||||
disabled={jobRO}
|
||||
okText={t("general.labels.yes")}
|
||||
cancelText={t("general.labels.no")}
|
||||
title={t("jobs.labels.closeconfirm")}
|
||||
>
|
||||
<Button loading={loading} type="danger">
|
||||
<Button loading={loading} type="danger" disabled={jobRO}>
|
||||
{t("general.actions.close")}
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
|
||||
<JobsScoreboardAdd job={job} disabled={false} />
|
||||
<JobsCloseExportButton jobId={job.id} disabled={false} />
|
||||
<JobsCloseExportButton jobId={job.id} disabled={job.date_exported} />
|
||||
</Space>
|
||||
<FormsFieldChanged form={form} />
|
||||
<JobsCloseLines job={job} />
|
||||
|
||||
Reference in New Issue
Block a user