Add German comma decimal input for currency/decimal fields
- New utility module `germanDecimal.js` with parseGermanDecimal(), sanitizeDecimalInput(), and formatGermanDecimal() - New DecimalInput component replacing type="number" inputs - Enables users to enter comma as decimal separator (12,50) - Applied to: hourlyWage, weeklyHours (ContractForm) and billingRate, travelCostRate, travelCostPerKm, mealAllowanceRate, minimumHours, and percent surcharges (FacilityForm) - Display formatting updated in FacilityDetailPanel to show comma decimals Both comma and dot are accepted as decimal separators. Backend decimal types remain unchanged (already decimal?). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Haiku 4.5
parent
fd20b07e83
commit
52fbec3214
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* ==========================================================
|
||||
* OMSORG BUSINESS CONTROLS PRO
|
||||
* Component: DecimalInput
|
||||
* Sprint: 0.2.0
|
||||
* ==========================================================
|
||||
*/
|
||||
|
||||
import { sanitizeDecimalInput } from "../../utils/germanDecimal";
|
||||
|
||||
export default function DecimalInput({
|
||||
value,
|
||||
onChange,
|
||||
placeholder,
|
||||
required = false,
|
||||
disabled = false,
|
||||
id,
|
||||
}) {
|
||||
function handleChange(event) {
|
||||
onChange(sanitizeDecimalInput(event.target.value));
|
||||
}
|
||||
|
||||
return (
|
||||
<input
|
||||
type="text"
|
||||
inputMode="decimal"
|
||||
pattern="[0-9]*[.,]?[0-9]*"
|
||||
value={value}
|
||||
onChange={handleChange}
|
||||
placeholder={placeholder}
|
||||
required={required}
|
||||
disabled={disabled}
|
||||
id={id}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user