Added ins co, classes, categories to shop info + job conversion BOD-255 BOD-258 BOD-259
This commit is contained in:
@@ -0,0 +1,99 @@
|
||||
import { Button, notification, Popover, Form, Select } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import { useMutation } from "react-apollo";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { CONVERT_JOB_TO_RO } from "../../graphql/jobs.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export function JobsConvertButton({ bodyshop, job, refetch }) {
|
||||
const [visible, setVisible] = useState(false);
|
||||
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleConvert = (values) => {
|
||||
mutationConvertJob({
|
||||
variables: { jobId: job.id, ...values },
|
||||
}).then((r) => {
|
||||
refetch();
|
||||
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.converted"),
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const popMenu = (
|
||||
<div>
|
||||
<Form layout="vertical" onFinish={handleConvert}>
|
||||
<Form.Item
|
||||
name={["ins_co_nm"]}
|
||||
label={t("jobs.fields.ins_co_nm")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{bodyshop.md_ins_cos.map((s) => (
|
||||
<Select.Option key={s} value={s}>
|
||||
{s}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["class"]}
|
||||
label={t("jobs.fields.class")}
|
||||
rules={[
|
||||
{
|
||||
required: bodyshop.enforce_class,
|
||||
message: t("general.validation.required"),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select>
|
||||
{bodyshop.md_classes.map((s) => (
|
||||
<Select.Option key={s} value={s}>
|
||||
{s}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
<Button type="danger" htmlType="submit">
|
||||
{t("jobs.actions.convert")}
|
||||
</Button>
|
||||
<Button onClick={() => setVisible(false)}>
|
||||
{t("general.actions.close")}
|
||||
</Button>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
|
||||
return (
|
||||
<Popover visible={visible} content={popMenu}>
|
||||
<Button
|
||||
key="convert"
|
||||
className="imex-flex-row__margin"
|
||||
type="danger"
|
||||
style={{ display: job.converted ? "none" : "" }}
|
||||
disabled={job.converted}
|
||||
onClick={() => setVisible(true)}
|
||||
>
|
||||
{t("jobs.actions.convert")}
|
||||
</Button>
|
||||
</Popover>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsConvertButton);
|
||||
@@ -1,12 +1,23 @@
|
||||
import { Collapse, Form, Input, InputNumber, Switch } from "antd";
|
||||
import { Collapse, Form, Input, InputNumber, Select, Switch } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import FormDatePicker from "../form-date-picker/form-date-picker.component";
|
||||
import FormItemEmail from "../form-items-formatted/email-form-item.component";
|
||||
import FormItemPhone from "../form-items-formatted/phone-form-item.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
|
||||
export default function JobsCreateJobsInfo({ form, selected }) {
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
//currentUser: selectCurrentUser
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||
});
|
||||
|
||||
export function JobsCreateJobsInfo({ bodyshop, form, selected }) {
|
||||
const { t } = useTranslation();
|
||||
const { getFieldValue } = form;
|
||||
return (
|
||||
@@ -168,7 +179,13 @@ export default function JobsCreateJobsInfo({ form, selected }) {
|
||||
label={t("jobs.fields.referralsource")}
|
||||
name="referral_source"
|
||||
>
|
||||
<Input />
|
||||
<Select>
|
||||
{bodyshop.md_referral_sources.map((s) => (
|
||||
<Select.Option key={s} value={s}>
|
||||
{s}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
</LayoutFormRow>
|
||||
TODO How to handle different taxes and marking them as exempt?
|
||||
@@ -311,3 +328,4 @@ export default function JobsCreateJobsInfo({ form, selected }) {
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(JobsCreateJobsInfo);
|
||||
|
||||
@@ -116,10 +116,10 @@ export function JobsDetailGeneral({ bodyshop, job, form }) {
|
||||
<FormDatePicker />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.kmin")} name="kmin">
|
||||
<InputNumber precision={1} />
|
||||
<InputNumber precision={1} min={0} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.kmout")} name="kmout">
|
||||
<InputNumber precision={1} />
|
||||
<InputNumber precision={1} min={0} />
|
||||
</Form.Item>
|
||||
<Form.Item label={t("jobs.fields.ponumber")} name="po_number">
|
||||
<Input />
|
||||
@@ -173,7 +173,13 @@ export function JobsDetailGeneral({ bodyshop, job, form }) {
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item label={t("jobs.fields.category")} name="category">
|
||||
<Select />
|
||||
<Select>
|
||||
{bodyshop.md_categories.map((s) => (
|
||||
<Select.Option key={s} value={s}>
|
||||
{s}
|
||||
</Select.Option>
|
||||
))}
|
||||
</Select>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { DownCircleFilled, PrinterFilled } from "@ant-design/icons";
|
||||
import { Button, Dropdown, Menu, notification, PageHeader, Tag } from "antd";
|
||||
import { Button, Dropdown, Menu, PageHeader, Tag } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
@@ -7,11 +7,12 @@ import { createStructuredSelector } from "reselect";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import CurrencyFormatter from "../../utils/CurrencyFormatter";
|
||||
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
|
||||
import JobsConvertButton from "../jobs-convert-button/jobs-convert-button.component";
|
||||
import JobsDetailHeaderActions from "../jobs-detail-header-actions/jobs-detail-header-actions.component";
|
||||
import OwnerTagPopoverComponent from "../owner-tag-popover/owner-tag-popover.component";
|
||||
import VehicleTagPopoverComponent from "../vehicle-tag-popover/vehicle-tag-popover.component";
|
||||
import "./jobs-detail-header.styles.scss";
|
||||
import JobEmployeeAssignments from "../job-employee-assignments/job-employee-assignments.container";
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
@@ -24,7 +25,7 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function JobsDetailHeader({
|
||||
job,
|
||||
mutationConvertJob,
|
||||
|
||||
refetch,
|
||||
setPrintCenterContext,
|
||||
bodyshop,
|
||||
@@ -74,26 +75,7 @@ export function JobsDetailHeader({
|
||||
<PrinterFilled />
|
||||
{t("jobs.actions.printCenter")}
|
||||
</Button>
|
||||
<Button
|
||||
key="convert"
|
||||
className="imex-flex-row__margin"
|
||||
type="danger"
|
||||
style={{ display: job.converted ? "none" : "" }}
|
||||
disabled={job.converted}
|
||||
onClick={() => {
|
||||
mutationConvertJob({
|
||||
variables: { jobId: job.id },
|
||||
}).then((r) => {
|
||||
refetch();
|
||||
|
||||
notification["success"]({
|
||||
message: t("jobs.successes.converted"),
|
||||
});
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t("jobs.actions.convert")}
|
||||
</Button>
|
||||
<JobsConvertButton job={job} refetch={refetch} />
|
||||
<JobsDetailHeaderActions key="actions" job={job} refetch={refetch} />
|
||||
<Button
|
||||
type="primary"
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import React from "react";
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import {
|
||||
Form,
|
||||
Input,
|
||||
Button,
|
||||
Collapse,
|
||||
Form,
|
||||
Input,
|
||||
InputNumber,
|
||||
Radio,
|
||||
Select,
|
||||
Switch,
|
||||
} from "antd";
|
||||
import { DeleteFilled } from "@ant-design/icons";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
||||
import ShopInfoOrderStatusComponent from "./shop-info.orderstatus.component";
|
||||
import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycenters.component";
|
||||
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
|
||||
import ShopInfoIntakeChecklistComponent from "./shop-info.intake.component";
|
||||
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
||||
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
|
||||
import ShopInfoOrderStatusComponent from "./shop-info.orderstatus.component";
|
||||
import ShopInfoRbacComponent from "./shop-info.rbac.component";
|
||||
import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycenters.component";
|
||||
import ShopInfoROStatusComponent from "./shop-info.rostatus.component";
|
||||
import ShopInfoSchedulingComponent from "./shop-info.scheduling.component";
|
||||
import ShopInfoSpeedPrint from "./shop-info.speedprint.component";
|
||||
|
||||
export default function ShopInfoComponent({ form, saveLoading }) {
|
||||
const { t } = useTranslation();
|
||||
@@ -414,6 +415,53 @@ export default function ShopInfoComponent({ form, saveLoading }) {
|
||||
);
|
||||
}}
|
||||
</Form.List>
|
||||
|
||||
<Form.Item
|
||||
name={["md_classes"]}
|
||||
label={t("bodyshop.fields.md_classes")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_categories"]}
|
||||
label={t("bodyshop.fields.md_categories")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["md_ins_cos"]}
|
||||
label={t("bodyshop.fields.md_ins_cos")}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: t("general.validation.required"),
|
||||
type: "array",
|
||||
},
|
||||
]}
|
||||
>
|
||||
<Select mode="tags" />
|
||||
</Form.Item>
|
||||
<Form.Item
|
||||
name={["enforce_class"]}
|
||||
label={t("bodyshop.fields.enforce_class")}
|
||||
valuePropName="checked"
|
||||
>
|
||||
<Switch />
|
||||
</Form.Item>
|
||||
</Collapse.Panel>
|
||||
<Collapse.Panel
|
||||
key="speedprint"
|
||||
|
||||
@@ -54,6 +54,10 @@ export const QUERY_BODYSHOP = gql`
|
||||
md_notes_presets
|
||||
md_rbac
|
||||
prodtargethrs
|
||||
md_classes
|
||||
md_ins_cos
|
||||
md_categories
|
||||
enforce_class
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
@@ -114,6 +118,10 @@ export const UPDATE_SHOP = gql`
|
||||
md_notes_presets
|
||||
md_rbac
|
||||
prodtargethrs
|
||||
md_classes
|
||||
md_ins_cos
|
||||
md_categories
|
||||
enforce_class
|
||||
employees {
|
||||
id
|
||||
first_name
|
||||
|
||||
@@ -616,12 +616,21 @@ export const UPDATE_JOBS = gql`
|
||||
`;
|
||||
|
||||
export const CONVERT_JOB_TO_RO = gql`
|
||||
mutation CONVERT_JOB_TO_RO($jobId: uuid!) {
|
||||
update_jobs(where: { id: { _eq: $jobId } }, _set: { converted: true }) {
|
||||
mutation CONVERT_JOB_TO_RO(
|
||||
$jobId: uuid!
|
||||
$class: String
|
||||
$ins_co_nm: String!
|
||||
) {
|
||||
update_jobs(
|
||||
where: { id: { _eq: $jobId } }
|
||||
_set: { converted: true, ins_co_nm: $ins_co_nm, class: $class }
|
||||
) {
|
||||
returning {
|
||||
id
|
||||
ro_number
|
||||
converted
|
||||
class
|
||||
ins_co_nm
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,7 +81,6 @@ const mapStateToProps = createStructuredSelector({
|
||||
export function JobsDetailPage({
|
||||
job,
|
||||
mutationUpdateJob,
|
||||
mutationConvertJob,
|
||||
handleSubmit,
|
||||
refetch,
|
||||
updateJobStatus,
|
||||
@@ -144,7 +143,6 @@ export function JobsDetailPage({
|
||||
|
||||
<JobsDetailHeader
|
||||
job={job}
|
||||
mutationConvertJob={mutationConvertJob}
|
||||
refetch={refetch}
|
||||
handleSubmit={handleSubmit}
|
||||
updateJobStatus={updateJobStatus}
|
||||
|
||||
@@ -5,8 +5,8 @@ import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import AlertComponent from "../../components/alert/alert.component";
|
||||
import SpinComponent from "../../components/loading-spinner/loading-spinner.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
import {
|
||||
CONVERT_JOB_TO_RO,
|
||||
GET_JOB_BY_PK,
|
||||
UPDATE_JOB,
|
||||
UPDATE_JOB_STATUS,
|
||||
@@ -17,7 +17,6 @@ import {
|
||||
} from "../../redux/application/application.actions";
|
||||
import { CreateRecentItem } from "../../utils/create-recent-item";
|
||||
import JobsDetailPage from "./jobs-detail.page.component";
|
||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||
|
||||
const mapDispatchToProps = (dispatch) => ({
|
||||
setBreadcrumbs: (breadcrumbs) => dispatch(setBreadcrumbs(breadcrumbs)),
|
||||
@@ -33,7 +32,6 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
fetchPolicy: "network-only",
|
||||
});
|
||||
const [mutationUpdateJob] = useMutation(UPDATE_JOB);
|
||||
const [mutationConvertJob] = useMutation(CONVERT_JOB_TO_RO);
|
||||
const [mutationUpdateJobstatus] = useMutation(UPDATE_JOB_STATUS);
|
||||
|
||||
const updateJobStatus = (status) => {
|
||||
@@ -94,7 +92,6 @@ function JobsDetailPageContainer({ match, setBreadcrumbs, addRecentItem }) {
|
||||
<RbacWrapper action="jobs:detail">
|
||||
<JobsDetailPage
|
||||
job={data.jobs_by_pk}
|
||||
mutationConvertJob={mutationConvertJob}
|
||||
mutationUpdateJob={mutationUpdateJob}
|
||||
refetch={refetch}
|
||||
updateJobStatus={updateJobStatus}
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"dailybodytarget": "Scoreboard - Daily Body Target",
|
||||
"dailypainttarget": "Scoreboard - Daily Paint Target",
|
||||
"email": "General Shop Email",
|
||||
"enforce_class": "Enforce Class on Conversion?",
|
||||
"federal_tax_id": "Federal Tax ID (GST/HST)",
|
||||
"insurance_vendor_id": "Insurance Vendor ID",
|
||||
"invoice_federal_tax_rate": "Invoices - Federal Tax Rate %",
|
||||
@@ -100,6 +101,9 @@
|
||||
"invoice_state_tax_rate": "Invoices - State Tax Rate %",
|
||||
"lastnumberworkingdays": "Scoreboard - Last Number of Working Days",
|
||||
"logo_img_path": "Shop Logo",
|
||||
"md_categories": "Categories",
|
||||
"md_classes": "Classes",
|
||||
"md_ins_cos": "Insurance Companies",
|
||||
"md_referral_sources": "Referral Sources",
|
||||
"messaginglabel": "Messaging Preset Label",
|
||||
"messagingtext": "Messaging Preset Text",
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"dailybodytarget": "",
|
||||
"dailypainttarget": "",
|
||||
"email": "",
|
||||
"enforce_class": "",
|
||||
"federal_tax_id": "",
|
||||
"insurance_vendor_id": "",
|
||||
"invoice_federal_tax_rate": "",
|
||||
@@ -100,6 +101,9 @@
|
||||
"invoice_state_tax_rate": "",
|
||||
"lastnumberworkingdays": "",
|
||||
"logo_img_path": "",
|
||||
"md_categories": "",
|
||||
"md_classes": "",
|
||||
"md_ins_cos": "",
|
||||
"md_referral_sources": "",
|
||||
"messaginglabel": "",
|
||||
"messagingtext": "",
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
"dailybodytarget": "",
|
||||
"dailypainttarget": "",
|
||||
"email": "",
|
||||
"enforce_class": "",
|
||||
"federal_tax_id": "",
|
||||
"insurance_vendor_id": "",
|
||||
"invoice_federal_tax_rate": "",
|
||||
@@ -100,6 +101,9 @@
|
||||
"invoice_state_tax_rate": "",
|
||||
"lastnumberworkingdays": "",
|
||||
"logo_img_path": "",
|
||||
"md_categories": "",
|
||||
"md_classes": "",
|
||||
"md_ins_cos": "",
|
||||
"md_referral_sources": "",
|
||||
"messaginglabel": "",
|
||||
"messagingtext": "",
|
||||
|
||||
Reference in New Issue
Block a user