feature/IO-3357-Reynolds-and-Reynolds-DMS-API-Integration - Checkpoint

This commit is contained in:
Dave
2025-10-07 16:45:06 -04:00
parent c149d457e7
commit 2ffc4b81f4
28 changed files with 2594 additions and 1642 deletions

View File

@@ -14,6 +14,7 @@ import FormListMoveArrows from "../form-list-move-arrows/form-list-move-arrows.c
import LayoutFormRow from "../layout-form-row/layout-form-row.component";
import RbacWrapper from "../rbac-wrapper/rbac-wrapper.component";
import ShopInfoResponsibilitycentersTaxesComponent from "./shop-info.responsibilitycenters.taxes.component";
import ShopInfoRRConfigurationComponent from "./shop-info.rr-configuration.component";
const SelectorDiv = styled.div`
.ant-form-item .ant-select {
@@ -63,6 +64,8 @@ export function ShopInfoResponsibilityCenterComponent({ bodyshop, form }) {
<RbacWrapper action="shop:responsibilitycenter">
{(bodyshop.cdk_dealerid || bodyshop.pbs_serialnumber || bodyshop.rr_dealerid) && (
<>
{bodyshop.rr_dealerid && <ShopInfoRRConfigurationComponent form={form} />}
{bodyshop.cdk_dealerid && (
<DataLabel label={t("bodyshop.labels.dms.cdk_dealerid")}>{form.getFieldValue("cdk_dealerid")}</DataLabel>
)}

View File

@@ -0,0 +1,130 @@
import { Card, Divider, Form, Input, Select, Switch, Tooltip } from "antd";
const { Option } = Select;
/**
* Reynolds & Reynolds Configuration Section
* Stored under bodyshop.rr_configuration (JSONB)
*
* NOTE:
* - Do NOT put credentials/endpoints here. Those live in env secrets.
* - These are dealer/location-specific values that the backend reads from rr_configuration.
* Keys match server usage: dealer_code, dealer_name, location_id, store_number, branch_number, etc.
*/
export default function ShopInfoRRConfigurationComponent() {
return (
<Card title="Reynolds & Reynolds Configuration" variant={false}>
{/* Dealer / Location identifiers (dealer-specific, not secrets) */}
<Form.Item
label="Dealer Code"
name={["rr_configuration", "dealer_code"]}
tooltip="Your RR Dealer Code / Dealer Number provided in the welcome kit."
rules={[{ required: true, message: "Dealer Code is required for RR integration" }]}
>
<Input placeholder="e.g. 12345" />
</Form.Item>
<Form.Item
label="Dealer Name"
name={["rr_configuration", "dealer_name"]}
tooltip="Optional display name for this dealer as it should appear on outbound requests."
>
<Input placeholder="e.g. Rome Collision Centre" />
</Form.Item>
<Form.Item
label="Location ID"
name={["rr_configuration", "location_id"]}
tooltip="If your RR account uses Location/Branch identifiers, enter the Location ID here."
>
<Input placeholder="e.g. 01" />
</Form.Item>
<Form.Item
label="Store Number"
name={["rr_configuration", "store_number"]}
tooltip="Optional: RR Store # (from welcome kit)."
>
<Input placeholder="e.g. 0001" />
</Form.Item>
<Form.Item
label="Branch Number"
name={["rr_configuration", "branch_number"]}
tooltip="Optional: RR Branch # (from welcome kit)."
>
<Input placeholder="e.g. 10" />
</Form.Item>
<Form.Item
label="Default Advisor ID"
name={["rr_configuration", "default_advisor_id"]}
tooltip="Default Service Advisor to assign on RO export (can be overridden per export)."
>
<Input placeholder="e.g. 007" />
</Form.Item>
<Divider />
{/* Feature flags (safe to store in config) */}
<Form.Item
label="Enable RR Integration"
name={["rr_configuration", "enable_rr_integration"]}
valuePropName="checked"
tooltip="Master switch to enable/disable RR export for this shop."
>
<Switch />
</Form.Item>
<Form.Item
label="Sandbox Mode"
name={["rr_configuration", "sandbox_mode"]}
valuePropName="checked"
tooltip="Toggles sandbox behavior on the app side. Credentials and URLs remain in env secrets."
>
<Switch />
</Form.Item>
<Form.Item
label="Log XML Requests/Responses"
name={["rr_configuration", "log_xml"]}
valuePropName="checked"
tooltip="When enabled, request/response XML is logged (masked where applicable)."
>
<Switch />
</Form.Item>
<Divider />
{/* Optional UX/format defaults */}
<Form.Item
label="Default RO Prefix"
name={["rr_configuration", "default_ro_prefix"]}
tooltip="Optional Repair Order prefix used when generating RO numbers."
>
<Input placeholder="e.g. RO" />
</Form.Item>
<Form.Item
label={
<span>
Timezone{" "}
<Tooltip title="Used for date/time fields when building RR payloads.">
<span style={{ cursor: "help", color: "var(--ant-color-text-tertiary)" }}></span>
</Tooltip>
</span>
}
name={["rr_configuration", "timezone"]}
rules={[{ required: true, message: "Timezone is required" }]}
>
<Select showSearch placeholder="Select timezone">
<Option value="America/Toronto">America/Toronto</Option>
<Option value="America/New_York">America/New_York</Option>
<Option value="America/Chicago">America/Chicago</Option>
<Option value="America/Los_Angeles">America/Los_Angeles</Option>
<Option value="UTC">UTC</Option>
</Select>
</Form.Item>
</Card>
);
}