Finished speed print setup + addition to print center modal. BOD-229

This commit is contained in:
Patrick Fic
2020-07-31 09:46:03 -07:00
parent 4130bd0bdb
commit 23f8243002
13 changed files with 498 additions and 106 deletions

View File

@@ -16,78 +16,86 @@ import ShopInfoResponsibilityCenterComponent from "./shop-info.responsibilitycen
import ShopInfoSchedulingComponent from "./shop-info.scheduling.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";
export default function ShopInfoComponent({ form, saveLoading }) {
const { t } = useTranslation();
return (
<div>
<Button type='primary' loading={saveLoading} htmlType='submit'>
<Button type="primary" loading={saveLoading} htmlType="submit">
{t("general.actions.save")}
</Button>
<Collapse defaultActiveKey='shopinfo'>
<Collapse.Panel key='shopinfo' header={t("bodyshop.labels.shopinfo")}>
<Collapse>
<Collapse.Panel key="shopinfo" header={t("bodyshop.labels.shopinfo")}>
<LayoutFormRow>
<Form.Item label={t("bodyshop.fields.shopname")} name='shopname'>
<Form.Item label={t("bodyshop.fields.shopname")} name="shopname">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address1")} name='address1'>
<Form.Item label={t("bodyshop.fields.address1")} name="address1">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address2")} name='address2'>
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.city")} name='city'>
<Form.Item label={t("bodyshop.fields.city")} name="city">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.state")} name='state'>
<Form.Item label={t("bodyshop.fields.state")} name="state">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.zip_post")} name='zip_post'>
<Form.Item label={t("bodyshop.fields.zip_post")} name="zip_post">
<Input />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item label={t("bodyshop.fields.country")} name='country'>
<Form.Item label={t("bodyshop.fields.country")} name="country">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.email")} name='email'>
<Form.Item label={t("bodyshop.fields.email")} name="email">
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.federal_tax_id")}
name='federal_tax_id'>
name="federal_tax_id"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.insurance_vendor_id")}
name='insurance_vendor_id'>
name="insurance_vendor_id"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.logo_img_path")}
name='logo_img_path'>
name="logo_img_path"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.state_tax_id")}
name='state_tax_id'>
name="state_tax_id"
>
<Input />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.invoice_federal_tax_rate")}
name={["invoice_tax_rates", "federal_tax_rate"]}>
name={["invoice_tax_rates", "federal_tax_rate"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.invoice_state_tax_rate")}
name={["invoice_tax_rates", "state_tax_rate"]}>
name={["invoice_tax_rates", "state_tax_rate"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.invoice_local_tax_rate")}
name={["invoice_tax_rates", "local_tax_rate"]}>
name={["invoice_tax_rates", "local_tax_rate"]}
>
<InputNumber />
</Form.Item>
@@ -99,7 +107,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<InputNumber min={15} precision={0} />
</Form.Item>
</LayoutFormRow>
@@ -112,7 +121,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<InputNumber min={0} precision={0} />
</Form.Item>
@@ -124,7 +134,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<InputNumber min={0} precision={0} />
</Form.Item>
@@ -136,7 +147,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<InputNumber min={0} max={12} precision={0} />
</Form.Item>
<Form.Item
@@ -148,8 +160,9 @@ export default function ShopInfoComponent({ form, saveLoading }) {
message: t("general.validation.required"),
type: "array",
},
]}>
<Select mode='tags' />
]}
>
<Select mode="tags" />
</Form.Item>
<Form.Item
label={t("bodyshop.labels.accountingtiers")}
@@ -159,7 +172,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "tiers"]}>
name={["accountingconfig", "tiers"]}
>
<Radio.Group>
<Radio value={2}>2</Radio>
<Radio value={3}>3</Radio>
@@ -179,15 +193,17 @@ export default function ShopInfoComponent({ form, saveLoading }) {
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "twotierpref"]}>
name={["accountingconfig", "twotierpref"]}
>
<Radio.Group
disabled={
form.getFieldValue(["accountingconfig", "tiers"]) === 3
}>
<Radio value='name'>
}
>
<Radio value="name">
{t("bodyshop.labels.2tiername")}
</Radio>
<Radio value='source'>
<Radio value="source">
{t("bodyshop.labels.2tiersource")}
</Radio>
</Radio.Group>
@@ -203,7 +219,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
{fields.map((field, index) => (
<Form.Item
key={field.key}
style={{ padding: 0, margin: 2 }}>
style={{ padding: 0, margin: 2 }}
>
<div style={{ display: "flex" }}>
<Form.Item
style={{ padding: 0, margin: 2 }}
@@ -215,7 +232,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<Input />
</Form.Item>
<Form.Item
@@ -228,7 +246,8 @@ export default function ShopInfoComponent({ form, saveLoading }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<Input />
</Form.Item>
<DeleteFilled
@@ -241,11 +260,12 @@ export default function ShopInfoComponent({ form, saveLoading }) {
))}
<Form.Item>
<Button
type='dashed'
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}>
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
@@ -255,26 +275,36 @@ export default function ShopInfoComponent({ form, saveLoading }) {
</Form.List>
</Collapse.Panel>
<Collapse.Panel
key='roStatus'
header={t("bodyshop.labels.jobstatuses")}>
key="speedprint"
header={t("bodyshop.labels.speedprint")}
>
<ShopInfoSpeedPrint form={form} />
</Collapse.Panel>
<Collapse.Panel
key="roStatus"
header={t("bodyshop.labels.jobstatuses")}
>
<ShopInfoROStatusComponent form={form} />
</Collapse.Panel>
<Collapse.Panel
key='scheduling'
header={t("bodyshop.labels.scheduling")}>
key="scheduling"
header={t("bodyshop.labels.scheduling")}
>
<ShopInfoSchedulingComponent form={form} />
</Collapse.Panel>
<Collapse.Panel
key='orderStatus'
header={t("bodyshop.labels.orderstatuses")}>
key="orderStatus"
header={t("bodyshop.labels.orderstatuses")}
>
<ShopInfoOrderStatusComponent form={form} />
</Collapse.Panel>
<Collapse.Panel
key='responsibilityCenters'
header={t("bodyshop.labels.responsibilitycenters.title")}>
key="responsibilityCenters"
header={t("bodyshop.labels.responsibilitycenters.title")}
>
<ShopInfoResponsibilityCenterComponent form={form} />
</Collapse.Panel>
<Collapse.Panel key='intake' header={t("bodyshop.labels.intake")}>
<Collapse.Panel key="intake" header={t("bodyshop.labels.intake")}>
<ShopInfoIntakeChecklistComponent form={form} />
</Collapse.Panel>
</Collapse>

View File

@@ -5,6 +5,7 @@ import { useTranslation } from "react-i18next";
import styled from "styled-components";
import { TemplateList } from "../../utils/TemplateConstants";
import ConfigFormTypes from "../config-form-components/config-form-types";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
const SelectorDiv = styled.div`
.ant-form-item .ant-select {
@@ -18,14 +19,14 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
return (
<div>
<Form.List name={["intakechecklist", "form"]}>
{(fields, { add, remove }) => {
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
<div className='imex-flex-row'>
<div className="imex-flex-row">
<Form.Item
className='imex-flex-row__margin'
className="imex-flex-row__margin"
label={t("jobs.fields.intake.name")}
key={`${index}name`}
name={[field.name, "name"]}
@@ -34,12 +35,13 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<Input />
</Form.Item>
<Form.Item
className='imex-flex-row__margin'
className="imex-flex-row__margin"
label={t("jobs.fields.intake.type")}
key={`${index}type`}
name={[field.name, "type"]}
@@ -48,7 +50,8 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<Select>
{Object.keys(ConfigFormTypes).map((i, idx) => (
<Select.Option key={i} value={i}>
@@ -59,7 +62,7 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
</Form.Item>
<Form.Item
className='imex-flex-row__margin'
className="imex-flex-row__margin"
label={t("jobs.fields.intake.label")}
key={`${index}label`}
name={[field.name, "label"]}
@@ -68,16 +71,18 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
required: true,
message: t("general.validation.required"),
},
]}>
]}
>
<Input />
</Form.Item>
<Form.Item
className='imex-flex-row__margin'
label={t("general.fields.required")}
className="imex-flex-row__margin"
label={t("jobs.fields.intake.required")}
key={`${index}required`}
name={[field.name, "required"]}
valuePropName='checked'>
valuePropName="checked"
>
<Switch />
</Form.Item>
@@ -86,16 +91,22 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
remove(field.name);
}}
/>
<FormListMoveArrows
move={move}
index={index}
total={fields.length}
/>
</div>
</Form.Item>
))}
<Form.Item>
<Button
type='dashed'
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}>
style={{ width: "100%" }}
>
{t("general.actions.add")}
</Button>
</Form.Item>
@@ -114,12 +125,14 @@ export default function ShopInfoIntakeChecklistComponent({ form }) {
message: t("general.validation.required"),
type: "array",
},
]}>
<Select mode='multiple'>
]}
>
<Select mode="multiple">
{Object.keys(TemplateList).map((i) => (
<Select.Option
key={TemplateList[i].key}
value={TemplateList[i].key}>
value={TemplateList[i].key}
>
{TemplateList[i].title}
</Select.Option>
))}

View File

@@ -0,0 +1,105 @@
import { DeleteFilled } from "@ant-design/icons";
import { Button, Col, Form, Input, InputNumber, Row, Select } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { TemplateList } from "../../utils/TemplateConstants";
import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.component";
//TODO Fix up styles.
export default function ShopInfoSpeedPrint({ bodyshop, form }) {
const { t } = useTranslation();
return (
<div>
<Form.List name={["speedprint"]}>
{(fields, { add, remove, move }) => {
return (
<div>
{fields.map((field, index) => (
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
<div className="imex-flex-row">
<Form.Item
className="imex-flex-row__margin"
label={t("bodyshop.fields.speedprint.id")}
key={`${index}id`}
name={[field.name, "id"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
label={t("bodyshop.fields.speedprint.label")}
key={`${index}label`}
name={[field.name, "label"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<Input />
</Form.Item>
<Form.Item
className="imex-flex-row__margin"
name={[field.name, "templates"]}
label={t("bodyshop.fields.speedprint.templates")}
rules={[
{
required: true,
message: t("general.validation.required"),
type: "array",
},
]}
>
<Select mode="multiple">
{Object.keys(TemplateList)
.map((key) => TemplateList[key])
.filter((template) => template.drivingId === "job")
.map((template, idx) => (
<Select.Option key={idx} value={template.key}>
{template.title}
</Select.Option>
))}
</Select>
</Form.Item>
<DeleteFilled
className="imex-flex-row__margin"
onClick={() => {
remove(field.name);
}}
/>
<FormListMoveArrows
move={move}
index={index}
total={fields.length}
/>
</div>
</Form.Item>
))}
<Form.Item>
<Button
type="dashed"
onClick={() => {
add();
}}
style={{ width: "100%" }}
>
{t("bodyshop.actions.addspeedprint")}
</Button>
</Form.Item>
</div>
);
}}
</Form.List>
</div>
);
}