Minor random fixes

This commit is contained in:
Patrick Fic
2020-07-23 14:39:45 -07:00
parent 8a4f0dda44
commit acd8984d5b
18 changed files with 389 additions and 353 deletions

View File

@@ -14,6 +14,7 @@ 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 LayoutFormRow from "../layout-form-row/layout-form-row.component";
export default function ShopInfoComponent({ form }) {
const { t } = useTranslation();
@@ -24,171 +25,191 @@ export default function ShopInfoComponent({ form }) {
</Button>
<Collapse defaultActiveKey="shopinfo">
<Collapse.Panel key="shopinfo" header={t("bodyshop.labels.shopinfo")}>
<Form.Item label={t("bodyshop.fields.shopname")} name="shopname">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address1")} name="address1">
<Input />
</Form.Item>
<LayoutFormRow>
<Form.Item label={t("bodyshop.fields.shopname")} name="shopname">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address1")} name="address1">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.city")} name="city">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.state")} name="state">
<Input />
</Form.Item>
<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">
<Input />
</Form.Item>
<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"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.insurance_vendor_id")}
name="insurance_vendor_id"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.logo_img_path")}
name="logo_img_path"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.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"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.invoice_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"]}
>
<InputNumber />
</Form.Item>
<Form.Item label={t("bodyshop.fields.address2")} name="address2">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.city")} name="city">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.state")} name="state">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.zip_post")} name="zip_post">
<Input />
</Form.Item>
<Form.Item label={t("bodyshop.fields.country")} name="country">
<Input />
</Form.Item>
<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"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.insurance_vendor_id")}
name="insurance_vendor_id"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.logo_img_path")}
name="logo_img_path"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.state_tax_id")}
name="state_tax_id"
>
<Input />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.invoice_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"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.invoice_local_tax_rate")}
name={["invoice_tax_rates", "local_tax_rate"]}
>
<InputNumber />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.appt_length")}
name={"appt_length"}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={15} precision={0} />
</Form.Item>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.dailypainttarget")}
name={["scoreboard_target", "dailyPaintTarget"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} precision={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.appt_length")}
name={"appt_length"}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={15} precisio={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.dailybodytarget")}
name={["scoreboard_target", "dailyBodyTarget"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} precision={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.dailypainttarget")}
name={["scoreboard_target", "dailyPaintTarget"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} precisio={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.dailybodytarget")}
name={["scoreboard_target", "dailyBodyTarget"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} precisio={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.fields.lastnumberworkingdays")}
name={["scoreboard_target", "lastNumberWorkingDays"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} max={12} precisio={0} />
</Form.Item>
<Form.Item
label={t("bodyshop.labels.accountingtiers")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "tiers"]}
>
<Radio.Group>
<Radio value={2}>2</Radio>
<Radio value={3}>3</Radio>
</Radio.Group>
</Form.Item>
<Form.Item shouldUpdate>
{() => {
return (
<Form.Item
label={t("bodyshop.labels.2tiersetup")}
shouldUpdate
rules={[
{
required:
form.getFieldValue(["accountingconfig", "tiers"]) === 2,
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "twotierpref"]}
>
<Radio.Group
disabled={
form.getFieldValue(["accountingconfig", "tiers"]) === 3
}
<Form.Item
label={t("bodyshop.fields.lastnumberworkingdays")}
name={["scoreboard_target", "lastNumberWorkingDays"]}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
>
<InputNumber min={0} max={12} precision={0} />
</Form.Item>
<Form.Item
name={["md_referral_sources"]}
label={t("bodyshop.fields.md_referral_sources")}
rules={[
{
required: true,
message: t("general.validation.required"),
type: "array",
},
]}
>
<Select mode="tags" />
</Form.Item>
<Form.Item
label={t("bodyshop.labels.accountingtiers")}
rules={[
{
required: true,
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "tiers"]}
>
<Radio.Group>
<Radio value={2}>2</Radio>
<Radio value={3}>3</Radio>
</Radio.Group>
</Form.Item>
<Form.Item shouldUpdate>
{() => {
return (
<Form.Item
label={t("bodyshop.labels.2tiersetup")}
shouldUpdate
rules={[
{
required:
form.getFieldValue(["accountingconfig", "tiers"]) ===
2,
message: t("general.validation.required"),
},
]}
name={["accountingconfig", "twotierpref"]}
>
<Radio value="name">{t("bodyshop.labels.2tiername")}</Radio>
<Radio value="source">
{t("bodyshop.labels.2tiersource")}
</Radio>
</Radio.Group>
</Form.Item>
);
}}
</Form.Item>
<Radio.Group
disabled={
form.getFieldValue(["accountingconfig", "tiers"]) === 3
}
>
<Radio value="name">
{t("bodyshop.labels.2tiername")}
</Radio>
<Radio value="source">
{t("bodyshop.labels.2tiersource")}
</Radio>
</Radio.Group>
</Form.Item>
);
}}
</Form.Item>
</LayoutFormRow>
<Form.List name={["md_messaging_presets"]}>
{(fields, { add, remove }) => {
return (
@@ -250,20 +271,6 @@ export default function ShopInfoComponent({ form }) {
);
}}
</Form.List>
<Form.Item
name={["md_referral_sources"]}
label={t("bodyshop.fields.md_referral_sources")}
rules={[
{
required: true,
message: t("general.validation.required"),
type: "array",
},
]}
>
<Select mode="tags" />
</Form.Item>
</Collapse.Panel>
<Collapse.Panel
key="roStatus"

View File

@@ -43,6 +43,8 @@ export default function ShopInfoContainer() {
return (
<Form
form={form}
layout='vertical'
autoComplete='new-password'
onFinish={handleFinish}
initialValues={data ? data.bodyshops[0] : null}
>

View File

@@ -3,6 +3,7 @@ import { Button, Form, Input, Select, InputNumber } from "antd";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import styled from "styled-components";
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
//TODO Fix up styles.
const SelectorDiv = styled.div`
.ant-form-item .ant-select {
@@ -53,7 +54,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
<div>
{fields.map((field, index) => (
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
<div style={{ display: "flex" }}>
<LayoutFormRow>
<Form.Item
style={{ padding: 0, margin: 2 }}
label={t("bodyshop.fields.responsibilitycenter")}
@@ -137,7 +138,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
remove(field.name);
}}
/>
</div>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
@@ -164,7 +165,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
<div>
{fields.map((field, index) => (
<Form.Item key={field.key} style={{ padding: 0, margin: 2 }}>
<div style={{ display: "flex" }}>
<LayoutFormRow>
<Form.Item
style={{ padding: 0, margin: 2 }}
label={t("bodyshop.fields.responsibilitycenter")}
@@ -248,7 +249,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
remove(field.name);
}}
/>
</div>
</LayoutFormRow>
</Form.Item>
))}
<Form.Item>
@@ -1066,8 +1067,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
</Select>
</Form.Item>
</SelectorDiv>
<div style={{ display: "flex", flexDirection: "column" }}>
<div style={{ display: "flex" }}>
<div>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.responsibilitycenters.federal_tax")}
rules={[
@@ -1160,8 +1161,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
>
<InputNumber precision={2} />
</Form.Item>
</div>
<div style={{ display: "flex" }}>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.responsibilitycenters.state_tax")}
rules={[
@@ -1254,8 +1255,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
>
<InputNumber precision={2} />
</Form.Item>
</div>
<div style={{ display: "flex" }}>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.responsibilitycenters.local_tax")}
rules={[
@@ -1348,9 +1349,9 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
>
<InputNumber precision={2} />
</Form.Item>
</div>
</LayoutFormRow>
<div style={{ display: "flex" }}>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.responsibilitycenters.ar")}
rules={[
@@ -1411,8 +1412,8 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
>
<Input />
</Form.Item>
</div>
<div style={{ display: "flex" }}>
</LayoutFormRow>
<LayoutFormRow>
<Form.Item
label={t("bodyshop.fields.responsibilitycenters.ar")}
rules={[
@@ -1473,7 +1474,7 @@ export default function ShopInfoResponsibilityCenterComponent({ form }) {
>
<Input />
</Form.Item>
</div>
</LayoutFormRow>
</div>
</div>
</div>