import { PropertyWithDetails } from "~/utils/db/entities/entities.db.server"; import { DateFormatType } from "~/utils/shared/DateUtils"; import { NumberFormatType } from "~/utils/shared/NumberUtils"; import RowNumberCell from "../rows/cells/RowNumberCell"; import RowDateCell from "../rows/cells/RowDateCell"; import { PropertyAttributeName } from "~/application/enums/entities/PropertyAttributeName"; import { FormulaValueType } from "~/modules/formulas/dtos/FormulaDto"; import { BooleanFormatType } from "~/utils/shared/BooleanUtils"; import RowBooleanCell from "../rows/cells/RowBooleanCell"; interface Props { property: PropertyWithDetails; value: FormulaValueType; } export default function PropertyFormulaValueBadge({ property, value }: Props) { const getNumberFormat = () => { return property.attributes.find((f) => f.name === PropertyAttributeName.FormatNumber)?.value as NumberFormatType; }; const getBooleanFormat = () => { return property.attributes.find((f) => f.name === PropertyAttributeName.FormatBoolean)?.value as BooleanFormatType; }; const getDateFormat = () => { return property.attributes.find((f) => f.name === PropertyAttributeName.FormatDate)?.value as DateFormatType; }; return (
{/*
[resultAs:{property.formula?.resultAs}]
[calculationTrigger:{property.formula?.calculationTrigger}]
value: {JSON.stringify(value)}
*/} {property.formula?.resultAs === "number" ? ( ) : property.formula?.resultAs === "boolean" ? ( ) : property.formula?.resultAs === "date" ? ( ) : (
{value?.toString()}
)}
); }