Add OSHA Form 301 and Osha page components
- Implemented Form301 component for displaying OSHA Form 301 equivalent, including employee and case information. - Created Osha component to manage OSHA recordkeeping, including tabs for 300 Log, 300A Summary, Hours & rates, and Submit to OSHA. - Added functionality for printing and downloading CSV files for OSHA submissions. - Integrated loading and error handling states for data fetching.
This commit is contained in:
1 parent
3e964d1176
commit
61c876edec
59 files changed
+9180
-183
No files matched your search
@@ -0,0 +1,12 @@
|
||||
/** Round axis ticks (0, 5, 10… / 0, 0.5, 1…) covering 0..max, about `count` of them. */
|
||||
export function niceTicks(max: number, count = 4): number[] {
|
||||
if (!(max > 0)) return [0, 1]
|
||||
const raw = max / count
|
||||
const magnitude = 10 ** Math.floor(Math.log10(raw))
|
||||
const step = [1, 2, 2.5, 5, 10].map((m) => m * magnitude).find((s) => s >= raw) ?? raw
|
||||
const ticks: number[] = []
|
||||
for (let v = 0; v <= max + step * 0.999; v += step) ticks.push(Math.round(v * 1000) / 1000)
|
||||
return ticks
|
||||
}
|
||||
|
||||
export const formatNumber = (value: number) => value.toLocaleString('en-US', { maximumFractionDigits: 2 })
|
||||
Reference in new issue
Block a user