Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: add hint to order date

Brad Barbin2cfbdaff5e5b
diff --git a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
index ea4849a433..73244bdeed 100644
--- a/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
+++ b/apps/erp/app/modules/sales/ui/SalesOrder/SalesOrderProperties.tsx
@@ -298,6 +298,7 @@ const SalesOrderProperties = () => {
<DatePicker
name="orderDate"
label="Order Date"
+ helperText="This is typically the date the purchase order was received from the customer"
inline
isDisabled={isDisabled}
onChange={(date) => {
diff --git a/packages/form/src/components/DatePicker.tsx b/packages/form/src/components/DatePicker.tsx
index 044f9becaf..77b181e482 100644
--- a/packages/form/src/components/DatePicker.tsx
+++ b/packages/form/src/components/DatePicker.tsx
@@ -19,6 +19,7 @@ type DatePickerProps = {
minValue?: CalendarDate;
maxValue?: CalendarDate;
inline?: boolean;
+ helperText?: string;
value?: string;
onChange?: (date: string | null) => void;
};
@@ -30,6 +31,7 @@ const DatePicker = ({
minValue,
maxValue,
inline = false,
+ helperText,
value,
onChange,
}: DatePickerProps) => {
@@ -84,6 +86,7 @@ const DatePicker = ({
maxValue={maxValue}
onChange={handleChange}
inline={inline ? DatePickerPreview : undefined}
+ helperText={helperText}
/>
{error && <FormErrorMessage>{error}</FormErrorMessage>}
</FormControl>
diff --git a/packages/react/src/Date/DatePicker.tsx b/packages/react/src/Date/DatePicker.tsx
index 507ee63610..bf15266669 100644
--- a/packages/react/src/Date/DatePicker.tsx
+++ b/packages/react/src/Date/DatePicker.tsx
@@ -4,7 +4,7 @@ import { useDatePickerState } from "@react-stately/datepicker";
import type { DatePickerProps } from "@react-types/datepicker";
import type { ReactNode } from "react";
import { useRef } from "react";
-import { LuBan, LuCalendarClock } from "react-icons/lu";
+import { LuBan, LuCalendarClock, LuInfo } from "react-icons/lu";
import { Button } from "../Button";
import { HStack } from "../HStack";
import { IconButton } from "../IconButton";
@@ -15,13 +15,17 @@ import {
PopoverFooter,
PopoverTrigger,
} from "../Popover";
+import { Tooltip, TooltipContent, TooltipTrigger } from "../Tooltip";
import { useOutsideClick } from "../hooks";
import { FieldButton } from "./components/Button";
import { Calendar } from "./components/Calendar";
import DateField from "./components/DateField";
const DatePicker = (
- props: DatePickerProps<CalendarDate> & { inline?: ReactNode }
+ props: DatePickerProps<CalendarDate> & {
+ inline?: ReactNode;
+ helperText?: string;
+ }
) => {
const state = useDatePickerState({
...props,
@@ -44,16 +48,31 @@ const DatePicker = (
{props.inline ? (
<>
<div className="flex-grow">{props.inline}</div>
- <PopoverTrigger asChild>
- <IconButton
- icon={<LuCalendarClock />}
- variant="secondary"
- size="sm"
- aria-label="Open date picker"
- isDisabled={props.isDisabled}
- {...buttonProps}
- />
- </PopoverTrigger>
+ <HStack spacing={0}>
+ {props.helperText && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <IconButton
+ icon={<LuInfo />}
+ variant="ghost"
+ size="sm"
+ aria-label="Helper information"
+ />
+ </TooltipTrigger>
+ <TooltipContent>{props.helperText}</TooltipContent>
+ </Tooltip>
+ )}
+ <PopoverTrigger asChild>
+ <IconButton
+ icon={<LuCalendarClock />}
+ variant="secondary"
+ size="sm"
+ aria-label="Open date picker"
+ isDisabled={props.isDisabled}
+ {...buttonProps}
+ />
+ </PopoverTrigger>
+ </HStack>
</>
) : (
<>