@ossy/consultancy 3.17.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/package.json +5 -3
- package/src/ConsultancyNav.jsx +5 -4
- package/src/Definition.js +1 -0
- package/src/Forecast.jsx +175 -5
- package/src/admin-leakage.component.jsx +12 -0
- package/src/assignment-margin-results.component.jsx +12 -0
- package/src/consultancy.page.jsx +42 -5
- package/src/create-company.flow.js +3 -2
- package/src/current-month.component.jsx +66 -0
- package/src/en.translations.json +28 -14
- package/src/forecast-kpi-chart.js +134 -0
- package/src/forecast-kpi-chart.spec.js +116 -0
- package/src/margin-panels.jsx +216 -0
- package/src/margins.page.jsx +49 -3
- package/src/{forecasts.page.jsx → org.page.jsx} +11 -12
- package/src/sv.translations.json +28 -14
- package/src/view-forecasts.flow.js +4 -3
package/README.md
CHANGED
|
@@ -9,12 +9,12 @@ Consultancy **feature package** for the Ossy platform — schemas and UI for emp
|
|
|
9
9
|
| File | Page id | Default paths |
|
|
10
10
|
|---|---|---|
|
|
11
11
|
| `consultancy.page.jsx` | `consultancy/home` | `/consultancy` (en), `/konsultverksamhet` (sv) |
|
|
12
|
-
| `
|
|
12
|
+
| `org.page.jsx` | `consultancy/org` | `/consultancy/org`, `/konsultverksamhet/orgdetaljer` |
|
|
13
13
|
| `margins.page.jsx` | `consultancy/margins` | `/consultancy/margins`, `/konsultverksamhet/marginaler` |
|
|
14
14
|
|
|
15
|
-
One sidebar item (**Consultancy**). Overview,
|
|
15
|
+
One sidebar item (**Consultancy**). Overview (home), Margins, and Org Details are in-product tabs under that surface.
|
|
16
16
|
|
|
17
|
-
The
|
|
17
|
+
The home Overview tab shows fiscal-year KPIs via `@ossy/calendar`'s `useForecast` / `ForecastClient` (engine stays in calendar). Org Details shows company data (fiscal years, registration, VAT) via `@ossy/calendar`'s `useCompany` hook. Margins is a standalone calculator (not yet wired to live resources).
|
|
18
18
|
|
|
19
19
|
### Schemas (ADR 0006)
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/consultancy",
|
|
3
3
|
"description": "Consultancy feature package — schemas, forecasts UI, and assignment margins",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.20.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"module": "./src/index.js",
|
|
@@ -25,16 +25,18 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ossy/schema": "^3.
|
|
28
|
+
"@ossy/schema": "^3.20.0"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@ossy/calendar": "*",
|
|
32
|
+
"@ossy/dashboard": "*",
|
|
32
33
|
"@ossy/design-system": "*",
|
|
33
34
|
"@ossy/router-react": "*",
|
|
35
|
+
"@ossy/sdk-react": "*",
|
|
34
36
|
"react": "*"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"jest": "^30.2.0"
|
|
38
40
|
},
|
|
39
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "edab6a966f41c07a68bdd86f3864cc2ad02e3406"
|
|
40
42
|
}
|
package/src/ConsultancyNav.jsx
CHANGED
|
@@ -2,19 +2,20 @@ import React from 'react'
|
|
|
2
2
|
import { Tabs } from '@ossy/design-system'
|
|
3
3
|
import { useRouter } from '@ossy/router-react'
|
|
4
4
|
|
|
5
|
+
/** Overview (home) first, Margins middle, Org Details last. */
|
|
5
6
|
const TABS = [
|
|
6
7
|
{
|
|
7
8
|
id: 'consultancy/home',
|
|
8
9
|
label: 'consultancy.nav.overview',
|
|
9
10
|
},
|
|
10
|
-
{
|
|
11
|
-
id: 'consultancy/forecasts',
|
|
12
|
-
label: 'consultancy.nav.forecasts',
|
|
13
|
-
},
|
|
14
11
|
{
|
|
15
12
|
id: 'consultancy/margins',
|
|
16
13
|
label: 'consultancy.nav.margins',
|
|
17
14
|
},
|
|
15
|
+
{
|
|
16
|
+
id: 'consultancy/org',
|
|
17
|
+
label: 'consultancy.nav.orgDetails',
|
|
18
|
+
},
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
/**
|
package/src/Definition.js
CHANGED
package/src/Forecast.jsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Text, Separator, useLocale } from '@ossy/design-system'
|
|
3
|
-
import { CalendarDaySurfaceStyles, useForecast } from '@ossy/calendar'
|
|
1
|
+
import React, { useMemo } from 'react'
|
|
2
|
+
import { View, Text, Separator, useLocale } from '@ossy/design-system'
|
|
3
|
+
import { CalendarDaySurfaceStyles, sumFiscalYearTotals, useForecast } from '@ossy/calendar'
|
|
4
|
+
import { buildKpiChartLayout } from './forecast-kpi-chart.js'
|
|
4
5
|
|
|
5
6
|
const grid = {
|
|
6
7
|
width: '100%',
|
|
@@ -33,6 +34,172 @@ const calendarDayLayout = {
|
|
|
33
34
|
margin: 0,
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
const KPI_SERIES = [
|
|
38
|
+
// --color-primary is paper white in Cloud themes; income must stay visible on surface-primary.
|
|
39
|
+
{ key: 'projectedIncome', label: 'consultancy.forecasts.income', color: 'var(--color-info, hsl(199, 89%, 43%))' },
|
|
40
|
+
{ key: 'monthlyCostOfEmployees', label: 'consultancy.forecasts.salaryCost', color: 'var(--color-warning, hsl(38, 92%, 50%))' },
|
|
41
|
+
{ key: 'revenue', label: 'consultancy.forecasts.revenue', color: 'var(--color-accent, hsl(167, 89%, 43%))' },
|
|
42
|
+
{ key: 'hoursWorked', label: 'consultancy.forecasts.hoursWorked', color: 'var(--fg-secondary, hsl(220, 10%, 45%))', dashed: true },
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
function SectionPanel ({ title, children }) {
|
|
46
|
+
return (
|
|
47
|
+
<View surface="primary" roundness="xs" style={{ minWidth: 0, overflow: 'hidden', height: '100%' }}>
|
|
48
|
+
<View stack bordered>
|
|
49
|
+
<View.Item
|
|
50
|
+
data-surface="primary"
|
|
51
|
+
layout="row"
|
|
52
|
+
style={{
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
padding: 'var(--space-s) var(--space-m)',
|
|
56
|
+
gap: 'var(--space-m)',
|
|
57
|
+
height: '48px',
|
|
58
|
+
flexShrink: 0,
|
|
59
|
+
}}
|
|
60
|
+
>
|
|
61
|
+
<Text variant="small" as="h2" style={{ fontWeight: 'bold' }}>{title}</Text>
|
|
62
|
+
</View.Item>
|
|
63
|
+
<View.Item>
|
|
64
|
+
{children}
|
|
65
|
+
</View.Item>
|
|
66
|
+
</View>
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Hand-rolled multi-series line chart for fiscal-year KPIs.
|
|
73
|
+
* Matches the no-dependency SVG approach from analytics DailyBarChart (#917).
|
|
74
|
+
* Money KPIs share one Y-scale; hours use a secondary scale (dashed stroke).
|
|
75
|
+
*/
|
|
76
|
+
function ForecastKpiChart ({ months }) {
|
|
77
|
+
const { language } = useLocale()
|
|
78
|
+
const chart = useMemo(
|
|
79
|
+
() => buildKpiChartLayout({ months, series: KPI_SERIES, language }),
|
|
80
|
+
[months, language],
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
if (!chart) {
|
|
84
|
+
return (
|
|
85
|
+
<View inset="m">
|
|
86
|
+
<Text variant="small" text="consultancy.forecasts.yearChartEmpty" />
|
|
87
|
+
</View>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<View gap="s" inset="m" style={{ width: '100%' }}>
|
|
93
|
+
<View layout="row-wrap" gap="m" style={{ alignItems: 'center' }}>
|
|
94
|
+
{KPI_SERIES.map((series) => (
|
|
95
|
+
<View key={series.key} layout="row" gap="s" style={{ alignItems: 'center' }}>
|
|
96
|
+
<span
|
|
97
|
+
aria-hidden
|
|
98
|
+
style={{
|
|
99
|
+
width: 10,
|
|
100
|
+
height: 10,
|
|
101
|
+
borderRadius: 2,
|
|
102
|
+
background: series.color,
|
|
103
|
+
display: 'inline-block',
|
|
104
|
+
flexShrink: 0,
|
|
105
|
+
...(series.dashed
|
|
106
|
+
? {
|
|
107
|
+
background: 'transparent',
|
|
108
|
+
borderTop: `2px dashed ${series.color}`,
|
|
109
|
+
height: 0,
|
|
110
|
+
borderRadius: 0,
|
|
111
|
+
}
|
|
112
|
+
: null),
|
|
113
|
+
}}
|
|
114
|
+
/>
|
|
115
|
+
<Text variant="small" style={{ marginBottom: 0 }} text={series.label} />
|
|
116
|
+
</View>
|
|
117
|
+
))}
|
|
118
|
+
</View>
|
|
119
|
+
<svg
|
|
120
|
+
data-consultancy-kpi-chart
|
|
121
|
+
viewBox={`0 0 ${chart.viewWidth} ${chart.viewHeight}`}
|
|
122
|
+
width="100%"
|
|
123
|
+
height={chart.viewHeight}
|
|
124
|
+
style={{ display: 'block', width: '100%' }}
|
|
125
|
+
preserveAspectRatio="none"
|
|
126
|
+
>
|
|
127
|
+
{chart.seriesPaths.map((series) => (
|
|
128
|
+
series.path ? (
|
|
129
|
+
<path
|
|
130
|
+
key={series.key}
|
|
131
|
+
d={series.path}
|
|
132
|
+
fill="none"
|
|
133
|
+
stroke={series.color}
|
|
134
|
+
strokeWidth={2}
|
|
135
|
+
strokeLinejoin="round"
|
|
136
|
+
strokeLinecap="round"
|
|
137
|
+
strokeDasharray={series.dashed ? '4 3' : undefined}
|
|
138
|
+
vectorEffect="non-scaling-stroke"
|
|
139
|
+
/>
|
|
140
|
+
) : null
|
|
141
|
+
))}
|
|
142
|
+
{chart.monthLabels.map((label) => (
|
|
143
|
+
<text
|
|
144
|
+
key={`month-${label.index}`}
|
|
145
|
+
data-consultancy-kpi-month={label.label}
|
|
146
|
+
x={label.x}
|
|
147
|
+
y={label.y}
|
|
148
|
+
textAnchor="middle"
|
|
149
|
+
fill="var(--fg-secondary, currentColor)"
|
|
150
|
+
fontSize={7}
|
|
151
|
+
style={{ opacity: 0.75 }}
|
|
152
|
+
>
|
|
153
|
+
{label.label}
|
|
154
|
+
</text>
|
|
155
|
+
))}
|
|
156
|
+
</svg>
|
|
157
|
+
</View>
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function YearSummary ({ months, money, hours }) {
|
|
162
|
+
const { t } = useLocale()
|
|
163
|
+
const totals = useMemo(() => sumFiscalYearTotals(months), [months])
|
|
164
|
+
|
|
165
|
+
return (
|
|
166
|
+
<View
|
|
167
|
+
data-consultancy-year-summary
|
|
168
|
+
layout="row-wrap"
|
|
169
|
+
gap="m"
|
|
170
|
+
style={{ alignItems: 'stretch', width: '100%' }}
|
|
171
|
+
>
|
|
172
|
+
<View style={{ flex: '2 1 320px', minWidth: 0 }}>
|
|
173
|
+
<SectionPanel title={t('consultancy.forecasts.yearChart')}>
|
|
174
|
+
<ForecastKpiChart months={months} />
|
|
175
|
+
</SectionPanel>
|
|
176
|
+
</View>
|
|
177
|
+
<View style={{ flex: '1 1 240px', minWidth: 0 }}>
|
|
178
|
+
<SectionPanel title={t('consultancy.forecasts.yearSummary')}>
|
|
179
|
+
<View gap="s" inset="m">
|
|
180
|
+
<View layout="row" gap="s" style={{ justifyContent: 'space-between' }}>
|
|
181
|
+
<Text variant="m" style={{ marginBottom: 0 }} text="consultancy.forecasts.income" />
|
|
182
|
+
<Text variant="m" style={{ marginBottom: 0 }}>{money(totals.projectedIncome)}</Text>
|
|
183
|
+
</View>
|
|
184
|
+
<View layout="row" gap="s" style={{ justifyContent: 'space-between' }}>
|
|
185
|
+
<Text variant="m" style={{ marginBottom: 0 }} text="consultancy.forecasts.salaryCost" />
|
|
186
|
+
<Text variant="m" style={{ marginBottom: 0 }}>{money(totals.monthlyCostOfEmployees)}</Text>
|
|
187
|
+
</View>
|
|
188
|
+
<View layout="row" gap="s" style={{ justifyContent: 'space-between' }}>
|
|
189
|
+
<Text variant="m" style={{ marginBottom: 0 }} text="consultancy.forecasts.revenue" />
|
|
190
|
+
<Text variant="m" style={{ marginBottom: 0 }}>{money(totals.revenue)}</Text>
|
|
191
|
+
</View>
|
|
192
|
+
<View layout="row" gap="s" style={{ justifyContent: 'space-between' }}>
|
|
193
|
+
<Text variant="m" style={{ marginBottom: 0 }} text="consultancy.forecasts.hoursWorked" />
|
|
194
|
+
<Text variant="m" style={{ marginBottom: 0 }}>{hours(totals.hoursWorked)}</Text>
|
|
195
|
+
</View>
|
|
196
|
+
</View>
|
|
197
|
+
</SectionPanel>
|
|
198
|
+
</View>
|
|
199
|
+
</View>
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
|
|
36
203
|
export const Forecast = () => {
|
|
37
204
|
const months = useForecast()
|
|
38
205
|
const { language } = useLocale()
|
|
@@ -49,7 +216,9 @@ export const Forecast = () => {
|
|
|
49
216
|
}
|
|
50
217
|
`}
|
|
51
218
|
</style>
|
|
52
|
-
<
|
|
219
|
+
<View gap="m" style={{ width: '100%' }}>
|
|
220
|
+
<YearSummary months={months} money={money} hours={hours} />
|
|
221
|
+
<div style={grid}>
|
|
53
222
|
|
|
54
223
|
{months.map(month => {
|
|
55
224
|
const startPad = month.days[0].isoWeekday - 1
|
|
@@ -130,7 +299,8 @@ export const Forecast = () => {
|
|
|
130
299
|
</View>
|
|
131
300
|
)
|
|
132
301
|
})}
|
|
133
|
-
|
|
302
|
+
</div>
|
|
303
|
+
</View>
|
|
134
304
|
</>
|
|
135
305
|
)
|
|
136
306
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AdminLeakagePanel } from './margin-panels.jsx'
|
|
2
|
+
|
|
3
|
+
export const metadata = {
|
|
4
|
+
id: '@ossy/consultancy/view/admin-leakage',
|
|
5
|
+
widget: {
|
|
6
|
+
title: 'consultancy.widgets.adminLeakage.title',
|
|
7
|
+
description: 'consultancy.widgets.adminLeakage.description',
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Slot widget — standalone admin leakage panel for dashboards. */
|
|
12
|
+
export default AdminLeakagePanel
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AssignmentMarginResultsPanel } from './margin-panels.jsx'
|
|
2
|
+
|
|
3
|
+
export const metadata = {
|
|
4
|
+
id: '@ossy/consultancy/view/assignment-margin-results',
|
|
5
|
+
widget: {
|
|
6
|
+
title: 'consultancy.widgets.marginResults.title',
|
|
7
|
+
description: 'consultancy.widgets.marginResults.description',
|
|
8
|
+
},
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** Slot widget — standalone assignment margin panel for dashboards. */
|
|
12
|
+
export default AssignmentMarginResultsPanel
|
package/src/consultancy.page.jsx
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Text, View, Page, Tags } from '@ossy/design-system'
|
|
3
|
-
import {
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Button, Text, View, Page, Tags } from '@ossy/design-system'
|
|
3
|
+
import { useSdk } from '@ossy/sdk-react'
|
|
4
|
+
import { PinWidget } from '@ossy/dashboard'
|
|
5
|
+
import { Forecast } from './Forecast.jsx'
|
|
4
6
|
import { DataLoader } from '@ossy/calendar'
|
|
5
7
|
import { Definition } from './Definition.js'
|
|
6
8
|
import { CreateConsultancyButton } from './CreateConsultancyButton.jsx'
|
|
@@ -14,22 +16,57 @@ export const metadata = {
|
|
|
14
16
|
},
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
const FORECAST_WIDGET_ID = '@ossy/consultancy/view/current-month'
|
|
20
|
+
|
|
17
21
|
export const ConsultancyPage = () => {
|
|
22
|
+
const sdk = useSdk()
|
|
23
|
+
const [pinState, setPinState] = useState('idle')
|
|
24
|
+
|
|
18
25
|
const statusTags = (Definition.status ?? [])
|
|
19
26
|
.map((s) => ({ beta: 'Beta', 'coming-soon': 'Coming Soon' }[s]))
|
|
20
27
|
.filter(Boolean)
|
|
21
28
|
|
|
29
|
+
const pinToDashboard = async () => {
|
|
30
|
+
if (pinState === 'pending') return
|
|
31
|
+
setPinState('pending')
|
|
32
|
+
try {
|
|
33
|
+
await sdk.invoke(PinWidget, { componentId: FORECAST_WIDGET_ID })
|
|
34
|
+
setPinState('done')
|
|
35
|
+
} catch {
|
|
36
|
+
setPinState('error')
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
22
40
|
return (
|
|
23
41
|
<Page
|
|
42
|
+
data-forecasts-status="on"
|
|
24
43
|
title="consultancy.home.title"
|
|
25
44
|
near={statusTags.length > 0 ? <Tags tags={statusTags} size="s" /> : undefined}
|
|
26
45
|
description="consultancy.home.description"
|
|
27
|
-
far={
|
|
46
|
+
far={(
|
|
47
|
+
<View layout="row" gap="s" style={{ flexWrap: 'wrap' }}>
|
|
48
|
+
<Button
|
|
49
|
+
{...PinWidget}
|
|
50
|
+
variant="primary"
|
|
51
|
+
disabled={pinState === 'pending' || pinState === 'done'}
|
|
52
|
+
label={
|
|
53
|
+
pinState === 'done'
|
|
54
|
+
? 'consultancy.forecasts.pin.done'
|
|
55
|
+
: pinState === 'error'
|
|
56
|
+
? 'consultancy.forecasts.pin.error'
|
|
57
|
+
: 'consultancy.forecasts.pin.forecast'
|
|
58
|
+
}
|
|
59
|
+
onClick={pinToDashboard}
|
|
60
|
+
data-forecasts-pin
|
|
61
|
+
/>
|
|
62
|
+
<CreateConsultancyButton />
|
|
63
|
+
</View>
|
|
64
|
+
)}
|
|
28
65
|
>
|
|
29
66
|
<View gap="m">
|
|
30
67
|
<ConsultancyNav active="consultancy/home" />
|
|
31
68
|
<Text variant="heading-secondary" as="h2" text="design-system.overview" />
|
|
32
|
-
<DataLoader content={<
|
|
69
|
+
<DataLoader content={<Forecast />} />
|
|
33
70
|
</View>
|
|
34
71
|
</Page>
|
|
35
72
|
)
|
|
@@ -15,7 +15,7 @@ export const metadata = {
|
|
|
15
15
|
export default {
|
|
16
16
|
title: 'Create company',
|
|
17
17
|
description:
|
|
18
|
-
'Signed-in user sees consultancy empty, creates company-basic-info via create-document, then sees the ready overview',
|
|
18
|
+
'Signed-in user sees consultancy empty, creates company-basic-info via create-document, then sees the ready home overview',
|
|
19
19
|
steps: [
|
|
20
20
|
...signUpFlow.steps,
|
|
21
21
|
{ page: '@consultancy/home' },
|
|
@@ -41,6 +41,7 @@ export default {
|
|
|
41
41
|
{ result: { page: '@storage/home', timeout: 20000 } },
|
|
42
42
|
{ page: '@consultancy/home' },
|
|
43
43
|
{ result: { selector: '[data-consultancy-status="ready"]', timeout: 15000 } },
|
|
44
|
-
{ result: { selector: '[data-
|
|
44
|
+
{ result: { selector: '[data-forecasts-status="on"]', timeout: 10000 } },
|
|
45
|
+
{ result: { selector: '[data-consultancy-year-summary]', timeout: 10000 } },
|
|
45
46
|
],
|
|
46
47
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { View, Text, useLocale } from '@ossy/design-system'
|
|
3
|
+
import { DataLoader, useForecast } from '@ossy/calendar'
|
|
4
|
+
|
|
5
|
+
function MetricRow ({ label, value }) {
|
|
6
|
+
return (
|
|
7
|
+
<View layout="row" gap="s" style={{ justifyContent: 'space-between' }}>
|
|
8
|
+
<Text variant="m" style={{ marginBottom: 0 }} text={label} />
|
|
9
|
+
<Text variant="m" style={{ marginBottom: 0 }}>{value}</Text>
|
|
10
|
+
</View>
|
|
11
|
+
)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Compact current-month forecast metrics (standalone dashboard panel).
|
|
16
|
+
*/
|
|
17
|
+
export function CurrentMonthForecastPanel () {
|
|
18
|
+
const months = useForecast()
|
|
19
|
+
const { language } = useLocale()
|
|
20
|
+
const money = (value) => new Intl.NumberFormat(language === 'sv' ? 'sv-SE' : 'en-SE', {
|
|
21
|
+
style: 'currency',
|
|
22
|
+
currency: 'SEK',
|
|
23
|
+
}).format(value)
|
|
24
|
+
const hours = (value) => new Intl.NumberFormat(language === 'sv' ? 'sv-SE' : 'en-GB', {
|
|
25
|
+
style: 'unit',
|
|
26
|
+
unit: 'hour',
|
|
27
|
+
}).format(value)
|
|
28
|
+
|
|
29
|
+
const current = (Array.isArray(months) ? months : []).find((m) => m.isCurrentMonth)
|
|
30
|
+
?? (Array.isArray(months) ? months[0] : null)
|
|
31
|
+
|
|
32
|
+
if (!current) {
|
|
33
|
+
return (
|
|
34
|
+
<Text
|
|
35
|
+
color="secondary"
|
|
36
|
+
text="consultancy.forecasts.widget.empty"
|
|
37
|
+
data-forecasts-widget="current-month"
|
|
38
|
+
/>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<View gap="s" data-forecasts-widget="current-month">
|
|
44
|
+
<Text variant="heading-tertiary" as="h3">
|
|
45
|
+
{current.year} {current.month}
|
|
46
|
+
</Text>
|
|
47
|
+
<MetricRow label="consultancy.forecasts.income" value={money(current.projectedIncome)} />
|
|
48
|
+
<MetricRow label="consultancy.forecasts.salaryCost" value={money(current.monthlyCostOfEmployees)} />
|
|
49
|
+
<MetricRow label="consultancy.forecasts.revenue" value={money(current.revenue)} />
|
|
50
|
+
<MetricRow label="consultancy.forecasts.hoursWorked" value={hours(current.hoursWorked)} />
|
|
51
|
+
</View>
|
|
52
|
+
)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const metadata = {
|
|
56
|
+
id: '@ossy/consultancy/view/current-month',
|
|
57
|
+
widget: {
|
|
58
|
+
title: 'consultancy.widgets.forecastCurrentMonth.title',
|
|
59
|
+
description: 'consultancy.widgets.forecastCurrentMonth.description',
|
|
60
|
+
},
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Slot widget — current-month forecast panel for dashboards. */
|
|
64
|
+
export default function CurrentMonthForecastWidget () {
|
|
65
|
+
return <DataLoader content={<CurrentMonthForecastPanel />} />
|
|
66
|
+
}
|
package/src/en.translations.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"consultancy/home.documentTitle": "
|
|
3
|
-
"consultancy/
|
|
2
|
+
"consultancy/home.documentTitle": "Overview",
|
|
3
|
+
"consultancy/org.documentTitle": "Org Details",
|
|
4
4
|
"consultancy/margins.documentTitle": "Margins",
|
|
5
|
-
"consultancy.home.title": "
|
|
6
|
-
"consultancy.home.description": "
|
|
5
|
+
"consultancy.home.title": "Overview",
|
|
6
|
+
"consultancy.home.description": "Fiscal-year KPIs, year totals, and monthly capacity from contracts, employees, and vacations",
|
|
7
|
+
"consultancy.org.title": "Org Details",
|
|
8
|
+
"consultancy.org.description": "Company and fiscal-year details",
|
|
9
|
+
"consultancy.nav.title": "Consultancy",
|
|
7
10
|
"consultancy.nav.overview": "Overview",
|
|
8
11
|
"consultancy.nav.forecasts": "Forecasts",
|
|
9
12
|
"consultancy.nav.margins": "Margins",
|
|
10
|
-
"consultancy.forecasts.title": "
|
|
11
|
-
"consultancy.forecasts.description": "
|
|
13
|
+
"consultancy.forecasts.title": "Overview",
|
|
14
|
+
"consultancy.forecasts.description": "Fiscal-year KPIs, year totals, and monthly capacity from contracts, employees, and vacations",
|
|
12
15
|
"consultancy.forecasts.income": "Income",
|
|
13
16
|
"consultancy.forecasts.salaryCost": "Salary cost",
|
|
14
17
|
"consultancy.forecasts.revenue": "Revenue",
|
|
@@ -39,7 +42,6 @@
|
|
|
39
42
|
"consultancy.overview.noFiscalYears": "No fiscal years yet.",
|
|
40
43
|
"consultancy.empty.title": "Looks empty",
|
|
41
44
|
"consultancy.empty.text": "Add company info, employees, contracts, and vacations to get started.",
|
|
42
|
-
|
|
43
45
|
"@ossy/consultancy/form/calculator.label": "Assignment margin calculator",
|
|
44
46
|
"@ossy/consultancy/schema/calculator.hourlyRate.label": "Client hourly rate (SEK)",
|
|
45
47
|
"@ossy/consultancy/schema/calculator.billableHours.label": "Billable hours this period",
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
"@ossy/consultancy/schema/calculator.availableHours.label": "Available hours this month",
|
|
48
50
|
"@ossy/consultancy/schema/calculator.teamSize.label": "Team size",
|
|
49
51
|
"@ossy/consultancy/schema/calculator.adminHoursPerWeek.label": "Admin hours per person / week",
|
|
50
|
-
|
|
51
52
|
"@ossy/consultancy/schema/company-basic-info.name.label": "Company name",
|
|
52
53
|
"@ossy/consultancy/schema/company-basic-info.name.description": "The registered legal name of the company.",
|
|
53
54
|
"@ossy/consultancy/schema/company-basic-info.registrationDate.label": "Registration date",
|
|
@@ -69,7 +70,6 @@
|
|
|
69
70
|
"@ossy/consultancy/schema/company-basic-info.financialYearEnd.description": "Month the financial year ends.",
|
|
70
71
|
"@ossy/consultancy/schema/company-basic-info.holidayLocale.label": "Holiday calendar",
|
|
71
72
|
"@ossy/consultancy/schema/company-basic-info.holidayLocale.description": "Country used for public holidays and red days in forecasts and timesheets.",
|
|
72
|
-
|
|
73
73
|
"@ossy/consultancy/schema/employee.name.label": "Name",
|
|
74
74
|
"@ossy/consultancy/schema/employee.name.description": "The employee’s full name.",
|
|
75
75
|
"@ossy/consultancy/schema/employee.email.label": "Email",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"@ossy/consultancy/schema/employee.startDate.description": "First day of employment. Forecasts start from this date.",
|
|
85
85
|
"@ossy/consultancy/schema/employee.endDate.label": "Employment end",
|
|
86
86
|
"@ossy/consultancy/schema/employee.endDate.description": "Last day of employment. Leave empty if still employed.",
|
|
87
|
-
|
|
88
87
|
"@ossy/consultancy/schema/contract.employeeId.label": "Employee",
|
|
89
88
|
"@ossy/consultancy/schema/contract.employeeId.description": "Who this contract belongs to.",
|
|
90
89
|
"@ossy/consultancy/schema/contract.clientName.label": "Client",
|
|
@@ -105,14 +104,12 @@
|
|
|
105
104
|
"@ossy/consultancy/schema/contract.paymentTermsDueDate.description": "When the invoice is due, e.g. net 30 days.",
|
|
106
105
|
"@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.label": "Invoice date",
|
|
107
106
|
"@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.description": "When the invoice is issued relative to the service period.",
|
|
108
|
-
|
|
109
107
|
"@ossy/consultancy/schema/vacation.employeeId.label": "Employee",
|
|
110
108
|
"@ossy/consultancy/schema/vacation.employeeId.description": "Who is taking time off.",
|
|
111
109
|
"@ossy/consultancy/schema/vacation.start.label": "First day off",
|
|
112
110
|
"@ossy/consultancy/schema/vacation.start.description": "First day of vacation (inclusive). These days are not billed.",
|
|
113
111
|
"@ossy/consultancy/schema/vacation.end.label": "Last day off",
|
|
114
112
|
"@ossy/consultancy/schema/vacation.end.description": "Last day of vacation (inclusive).",
|
|
115
|
-
|
|
116
113
|
"@ossy/consultancy/schema/opportunity.title.label": "Title",
|
|
117
114
|
"@ossy/consultancy/schema/opportunity.title.description": "Short name for this lead or opportunity.",
|
|
118
115
|
"@ossy/consultancy/schema/opportunity.source.label": "Source",
|
|
@@ -133,7 +130,6 @@
|
|
|
133
130
|
"@ossy/consultancy/schema/opportunity.linkedProposalId.description": "Related proposal, if one exists.",
|
|
134
131
|
"@ossy/consultancy/schema/opportunity.feedRef.label": "Feed reference",
|
|
135
132
|
"@ossy/consultancy/schema/opportunity.feedRef.description": "Id or URL from the original listing.",
|
|
136
|
-
|
|
137
133
|
"@ossy/consultancy/schema/proposal.opportunityId.label": "Opportunity",
|
|
138
134
|
"@ossy/consultancy/schema/proposal.opportunityId.description": "The opportunity this proposal belongs to.",
|
|
139
135
|
"@ossy/consultancy/schema/proposal.title.label": "Title",
|
|
@@ -147,5 +143,23 @@
|
|
|
147
143
|
"@ossy/consultancy/schema/proposal.timeline.label": "Timeline",
|
|
148
144
|
"@ossy/consultancy/schema/proposal.timeline.description": "When the work would start and finish.",
|
|
149
145
|
"@ossy/consultancy/schema/proposal.body.label": "Body",
|
|
150
|
-
"@ossy/consultancy/schema/proposal.body.description": "Full proposal text."
|
|
146
|
+
"@ossy/consultancy/schema/proposal.body.description": "Full proposal text.",
|
|
147
|
+
"consultancy.nav.orgDetails": "Org Details",
|
|
148
|
+
"consultancy.forecasts.yearChart": "KPI trend",
|
|
149
|
+
"consultancy.forecasts.yearSummary": "Fiscal year totals",
|
|
150
|
+
"consultancy.forecasts.yearChartEmpty": "No forecast months to chart yet.",
|
|
151
|
+
"consultancy.margins.pin.done": "Pinned to dashboard",
|
|
152
|
+
"consultancy.margins.pin.error": "Pin failed — try again",
|
|
153
|
+
"consultancy.margins.pin.results": "Pin margin panel",
|
|
154
|
+
"consultancy.margins.pin.leakage": "Pin leakage panel",
|
|
155
|
+
"consultancy.forecasts.pin.done": "Pinned to dashboard",
|
|
156
|
+
"consultancy.forecasts.pin.error": "Pin failed — try again",
|
|
157
|
+
"consultancy.forecasts.pin.forecast": "Pin this month",
|
|
158
|
+
"consultancy.forecasts.widget.empty": "No forecast month available yet.",
|
|
159
|
+
"consultancy.widgets.marginResults.title": "Assignment margin",
|
|
160
|
+
"consultancy.widgets.marginResults.description": "Gross margin and utilization for a consulting assignment.",
|
|
161
|
+
"consultancy.widgets.adminLeakage.title": "Admin leakage",
|
|
162
|
+
"consultancy.widgets.adminLeakage.description": "Annual hours and revenue lost to recurring admin work.",
|
|
163
|
+
"consultancy.widgets.forecastCurrentMonth.title": "This month forecast",
|
|
164
|
+
"consultancy.widgets.forecastCurrentMonth.description": "Projected income, salary cost, revenue, and hours for the current month."
|
|
151
165
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure layout helpers for the consultancy fiscal-year KPI line chart.
|
|
3
|
+
* Money series share one Y-scale; hours use a secondary scale so shapes stay distinct.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const MONEY_KEYS = ['projectedIncome', 'monthlyCostOfEmployees', 'revenue']
|
|
7
|
+
export const HOURS_KEY = 'hoursWorked'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 3-letter month label for chart axis (locale-aware short month, truncated).
|
|
11
|
+
*
|
|
12
|
+
* @param {{ year?: number|string, monthNumber?: number|string, month?: string }} month
|
|
13
|
+
* @param {string} [language='en']
|
|
14
|
+
* @returns {string}
|
|
15
|
+
*/
|
|
16
|
+
export function shortMonthLabel (month, language = 'en') {
|
|
17
|
+
const year = Number(month?.year)
|
|
18
|
+
const monthNumber = Number(month?.monthNumber)
|
|
19
|
+
if (Number.isFinite(year) && Number.isFinite(monthNumber) && monthNumber >= 1 && monthNumber <= 12) {
|
|
20
|
+
const locale = language === 'sv' ? 'sv-SE' : 'en'
|
|
21
|
+
const date = new Date(Date.UTC(year, monthNumber - 1, 1))
|
|
22
|
+
const short = new Intl.DateTimeFormat(locale, { month: 'short' }).format(date)
|
|
23
|
+
const letters = short.replace(/\./g, '').trim()
|
|
24
|
+
if (letters.length >= 3) {
|
|
25
|
+
return letters.slice(0, 3).replace(/^./, (c) => c.toUpperCase())
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const fallback = String(month?.month || '').replace(/\./g, '').trim()
|
|
29
|
+
return fallback.slice(0, 3).replace(/^./, (c) => c.toUpperCase())
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {Array<Record<string, unknown>>} months
|
|
34
|
+
* @param {string[]} keys
|
|
35
|
+
* @returns {{ min: number, max: number } | null}
|
|
36
|
+
*/
|
|
37
|
+
export function extentForKeys (months, keys) {
|
|
38
|
+
if (!months?.length || !keys?.length) return null
|
|
39
|
+
let min = Infinity
|
|
40
|
+
let max = -Infinity
|
|
41
|
+
for (const month of months) {
|
|
42
|
+
for (const key of keys) {
|
|
43
|
+
const value = Number(month[key]) || 0
|
|
44
|
+
if (value < min) min = value
|
|
45
|
+
if (value > max) max = value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (!Number.isFinite(min) || !Number.isFinite(max)) return null
|
|
49
|
+
if (min === max) {
|
|
50
|
+
min -= 1
|
|
51
|
+
max += 1
|
|
52
|
+
}
|
|
53
|
+
return { min, max }
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* @param {number} value
|
|
58
|
+
* @param {{ min: number, max: number }} extent
|
|
59
|
+
* @param {number} padY
|
|
60
|
+
* @param {number} innerH
|
|
61
|
+
*/
|
|
62
|
+
export function valueToY (value, extent, padY, innerH) {
|
|
63
|
+
const span = extent.max - extent.min
|
|
64
|
+
return padY + innerH - ((value - extent.min) / span) * innerH
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Build SVG path strings for KPI series plus all-month X labels.
|
|
69
|
+
*
|
|
70
|
+
* @param {object} options
|
|
71
|
+
* @param {Array<Record<string, unknown>>} options.months
|
|
72
|
+
* @param {Array<{ key: string, label: string, color: string, dashed?: boolean }>} options.series
|
|
73
|
+
* @param {string} [options.language='en']
|
|
74
|
+
* @param {number} [options.viewWidth=100]
|
|
75
|
+
* @param {number} [options.plotHeight=100]
|
|
76
|
+
* @param {number} [options.padX=8]
|
|
77
|
+
* @param {number} [options.padTop=10]
|
|
78
|
+
* @param {number} [options.padBottom=22]
|
|
79
|
+
* @returns {{ viewWidth: number, viewHeight: number, seriesPaths: Array<object>, monthLabels: Array<object> } | null}
|
|
80
|
+
*/
|
|
81
|
+
export function buildKpiChartLayout ({
|
|
82
|
+
months,
|
|
83
|
+
series,
|
|
84
|
+
language = 'en',
|
|
85
|
+
viewWidth = 100,
|
|
86
|
+
plotHeight = 100,
|
|
87
|
+
padX = 8,
|
|
88
|
+
padTop = 10,
|
|
89
|
+
padBottom = 22,
|
|
90
|
+
}) {
|
|
91
|
+
if (!months?.length || !series?.length) return null
|
|
92
|
+
|
|
93
|
+
const viewHeight = padTop + plotHeight + padBottom
|
|
94
|
+
const innerW = viewWidth - padX * 2
|
|
95
|
+
const innerH = plotHeight
|
|
96
|
+
const step = months.length === 1 ? 0 : innerW / (months.length - 1)
|
|
97
|
+
|
|
98
|
+
const moneyExtent = extentForKeys(months, MONEY_KEYS)
|
|
99
|
+
const hoursExtent = extentForKeys(months, [HOURS_KEY])
|
|
100
|
+
|
|
101
|
+
const seriesPaths = series.map((entry) => {
|
|
102
|
+
const extent = entry.key === HOURS_KEY ? hoursExtent : moneyExtent
|
|
103
|
+
if (!extent) return { ...entry, path: null }
|
|
104
|
+
|
|
105
|
+
const points = months.map((month, index) => {
|
|
106
|
+
const value = Number(month[entry.key]) || 0
|
|
107
|
+
const x = padX + index * step
|
|
108
|
+
const y = valueToY(value, extent, padTop, innerH)
|
|
109
|
+
return `${x},${y}`
|
|
110
|
+
})
|
|
111
|
+
return { ...entry, path: `M ${points.join(' L ')}` }
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
const monthLabels = months.map((month, index) => ({
|
|
115
|
+
index,
|
|
116
|
+
label: shortMonthLabel(month, language),
|
|
117
|
+
x: padX + index * step,
|
|
118
|
+
y: viewHeight - 6,
|
|
119
|
+
}))
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
viewWidth,
|
|
123
|
+
viewHeight,
|
|
124
|
+
seriesPaths,
|
|
125
|
+
monthLabels,
|
|
126
|
+
step,
|
|
127
|
+
padX,
|
|
128
|
+
padTop,
|
|
129
|
+
padBottom,
|
|
130
|
+
plotHeight,
|
|
131
|
+
innerW,
|
|
132
|
+
innerH,
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MONEY_KEYS,
|
|
3
|
+
HOURS_KEY,
|
|
4
|
+
extentForKeys,
|
|
5
|
+
valueToY,
|
|
6
|
+
buildKpiChartLayout,
|
|
7
|
+
shortMonthLabel,
|
|
8
|
+
} from './forecast-kpi-chart.js'
|
|
9
|
+
|
|
10
|
+
const sampleMonths = [
|
|
11
|
+
{ year: 2026, monthNumber: '01', month: 'January', projectedIncome: 100, monthlyCostOfEmployees: 50, revenue: 50, hoursWorked: 10 },
|
|
12
|
+
{ year: 2026, monthNumber: '02', month: 'February', projectedIncome: 200, monthlyCostOfEmployees: 50, revenue: 150, hoursWorked: 20 },
|
|
13
|
+
{ year: 2026, monthNumber: '03', month: 'March', projectedIncome: 150, monthlyCostOfEmployees: 50, revenue: 100, hoursWorked: 15 },
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
const series = [
|
|
17
|
+
{ key: 'projectedIncome', label: 'income', color: 'blue' },
|
|
18
|
+
{ key: 'monthlyCostOfEmployees', label: 'salary', color: 'orange' },
|
|
19
|
+
{ key: 'revenue', label: 'revenue', color: 'green' },
|
|
20
|
+
{ key: 'hoursWorked', label: 'hours', color: 'gray', dashed: true },
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
describe('shortMonthLabel', () => {
|
|
24
|
+
it('formats English months as three letters', () => {
|
|
25
|
+
expect(shortMonthLabel({ year: 2026, monthNumber: '01' }, 'en')).toBe('Jan')
|
|
26
|
+
expect(shortMonthLabel({ year: 2026, monthNumber: '09' }, 'en')).toBe('Sep')
|
|
27
|
+
expect(shortMonthLabel({ year: 2026, monthNumber: 12 }, 'en')).toBe('Dec')
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('formats Swedish months as three letters without trailing punctuation', () => {
|
|
31
|
+
expect(shortMonthLabel({ year: 2026, monthNumber: '01' }, 'sv')).toBe('Jan')
|
|
32
|
+
expect(shortMonthLabel({ year: 2026, monthNumber: '02' }, 'sv')).toBe('Feb')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('falls back to the long month name when numbers are missing', () => {
|
|
36
|
+
expect(shortMonthLabel({ month: 'January' }, 'en')).toBe('Jan')
|
|
37
|
+
})
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
describe('extentForKeys', () => {
|
|
41
|
+
it('returns shared min/max across money keys', () => {
|
|
42
|
+
const extent = extentForKeys(sampleMonths, MONEY_KEYS)
|
|
43
|
+
expect(extent).toEqual({ min: 50, max: 200 })
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
it('expands a constant series so a flat line stays mid-range', () => {
|
|
47
|
+
const flat = [
|
|
48
|
+
{ monthlyCostOfEmployees: 50 },
|
|
49
|
+
{ monthlyCostOfEmployees: 50 },
|
|
50
|
+
]
|
|
51
|
+
const extent = extentForKeys(flat, ['monthlyCostOfEmployees'])
|
|
52
|
+
expect(extent.min).toBe(49)
|
|
53
|
+
expect(extent.max).toBe(51)
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
describe('buildKpiChartLayout', () => {
|
|
58
|
+
it('spans the full viewBox width for N months', () => {
|
|
59
|
+
const layout = buildKpiChartLayout({ months: sampleMonths, series, viewWidth: 100 })
|
|
60
|
+
expect(layout).not.toBeNull()
|
|
61
|
+
expect(layout.padX + (sampleMonths.length - 1) * layout.step).toBeCloseTo(100 - layout.padX)
|
|
62
|
+
expect(layout.viewWidth).toBe(100)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
it('keeps salary flat and distinct from income under a shared money scale', () => {
|
|
66
|
+
const layout = buildKpiChartLayout({ months: sampleMonths, series })
|
|
67
|
+
const income = layout.seriesPaths.find((s) => s.key === 'projectedIncome')
|
|
68
|
+
const salary = layout.seriesPaths.find((s) => s.key === 'monthlyCostOfEmployees')
|
|
69
|
+
const revenue = layout.seriesPaths.find((s) => s.key === 'revenue')
|
|
70
|
+
const hours = layout.seriesPaths.find((s) => s.key === HOURS_KEY)
|
|
71
|
+
|
|
72
|
+
expect(income.path).not.toBe(salary.path)
|
|
73
|
+
expect(income.path).not.toBe(revenue.path)
|
|
74
|
+
expect(salary.path).not.toBe(revenue.path)
|
|
75
|
+
|
|
76
|
+
// Constant salary → identical Y across months
|
|
77
|
+
const salaryYs = salary.path.match(/[\d.]+,([\d.]+)/g).map((p) => p.split(',')[1])
|
|
78
|
+
expect(new Set(salaryYs).size).toBe(1)
|
|
79
|
+
|
|
80
|
+
// Hours secondary scale is not forced onto the money path
|
|
81
|
+
expect(hours.path).not.toBe(income.path)
|
|
82
|
+
expect(hours.dashed).toBe(true)
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
it('maps shared money extent extremes to plot top/bottom', () => {
|
|
86
|
+
const extent = extentForKeys(sampleMonths, MONEY_KEYS)
|
|
87
|
+
const padTop = 10
|
|
88
|
+
const plotHeight = 100
|
|
89
|
+
expect(valueToY(extent.max, extent, padTop, plotHeight)).toBeCloseTo(padTop)
|
|
90
|
+
expect(valueToY(extent.min, extent, padTop, plotHeight)).toBeCloseTo(padTop + plotHeight)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('labels every month with a 3-letter abbreviation', () => {
|
|
94
|
+
const fiscalYear = Array.from({ length: 12 }, (_, i) => ({
|
|
95
|
+
year: 2026,
|
|
96
|
+
monthNumber: String(i + 1).padStart(2, '0'),
|
|
97
|
+
month: 'placeholder',
|
|
98
|
+
projectedIncome: 100 + i,
|
|
99
|
+
monthlyCostOfEmployees: 50,
|
|
100
|
+
revenue: 50 + i,
|
|
101
|
+
hoursWorked: 10,
|
|
102
|
+
}))
|
|
103
|
+
const layout = buildKpiChartLayout({ months: fiscalYear, series, language: 'en' })
|
|
104
|
+
expect(layout.monthLabels).toHaveLength(12)
|
|
105
|
+
expect(layout.monthLabels.map((entry) => entry.label)).toEqual([
|
|
106
|
+
'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
|
107
|
+
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
|
|
108
|
+
])
|
|
109
|
+
expect(layout.monthLabels[0].x).toBe(layout.padX)
|
|
110
|
+
expect(layout.monthLabels[11].x).toBeCloseTo(layout.padX + 11 * layout.step)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it('returns null for empty months', () => {
|
|
114
|
+
expect(buildKpiChartLayout({ months: [], series })).toBeNull()
|
|
115
|
+
})
|
|
116
|
+
})
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import React, { useMemo, useState } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
Separator,
|
|
6
|
+
Input,
|
|
7
|
+
useLocale,
|
|
8
|
+
} from '@ossy/design-system'
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_AVAILABLE_HOURS_PER_MONTH,
|
|
11
|
+
DEFAULT_WEEKS_PER_YEAR,
|
|
12
|
+
calculateAssignmentMargin,
|
|
13
|
+
estimateAdminLeakage,
|
|
14
|
+
} from './assignment-margin.js'
|
|
15
|
+
|
|
16
|
+
export const MARGIN_RESULTS_DEFAULTS = {
|
|
17
|
+
hourlyRate: '900',
|
|
18
|
+
billableHours: '120',
|
|
19
|
+
monthlySalary: '47000',
|
|
20
|
+
availableHours: String(DEFAULT_AVAILABLE_HOURS_PER_MONTH),
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const LEAKAGE_DEFAULTS = {
|
|
24
|
+
hourlyRate: '900',
|
|
25
|
+
teamSize: '10',
|
|
26
|
+
adminHoursPerWeek: '5',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function parseNumber (value, fallback = 0) {
|
|
30
|
+
const trimmed = String(value ?? '').replace(/\s/g, '').replace(',', '.')
|
|
31
|
+
if (trimmed === '') return fallback
|
|
32
|
+
const parsed = Number(trimmed)
|
|
33
|
+
return Number.isFinite(parsed) ? parsed : fallback
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function SectionPanel ({ title, children, ...props }) {
|
|
37
|
+
return (
|
|
38
|
+
<View surface="primary" roundness="xs" style={{ minWidth: 0, overflow: 'hidden' }} {...props}>
|
|
39
|
+
<View stack bordered>
|
|
40
|
+
<View.Item
|
|
41
|
+
data-surface="primary"
|
|
42
|
+
layout="row"
|
|
43
|
+
style={{
|
|
44
|
+
alignItems: 'center',
|
|
45
|
+
justifyContent: 'space-between',
|
|
46
|
+
padding: 'var(--space-s) var(--space-m)',
|
|
47
|
+
gap: 'var(--space-m)',
|
|
48
|
+
height: '48px',
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
}}
|
|
51
|
+
>
|
|
52
|
+
<Text variant="small" as="h2" style={{ fontWeight: 'bold' }} text={title} />
|
|
53
|
+
</View.Item>
|
|
54
|
+
<View.Item>
|
|
55
|
+
{children}
|
|
56
|
+
</View.Item>
|
|
57
|
+
</View>
|
|
58
|
+
</View>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function MetricRow ({ label, value }) {
|
|
63
|
+
return (
|
|
64
|
+
<View layout="row" justifyContent="space-between" gap="s">
|
|
65
|
+
<Text variant="small" text={label} />
|
|
66
|
+
<Text variant="small">{value}</Text>
|
|
67
|
+
</View>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function Field ({ label, value, onChange, name }) {
|
|
72
|
+
return (
|
|
73
|
+
<View gap="xs">
|
|
74
|
+
<Text variant="small" text={label} />
|
|
75
|
+
<Input
|
|
76
|
+
name={name}
|
|
77
|
+
value={value}
|
|
78
|
+
onChange={(event) => onChange(event?.target?.value ?? event)}
|
|
79
|
+
/>
|
|
80
|
+
</View>
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function useMoneyFormatters () {
|
|
85
|
+
const { language } = useLocale()
|
|
86
|
+
const locale = language === 'sv' ? 'sv-SE' : 'en-SE'
|
|
87
|
+
return useMemo(() => ({
|
|
88
|
+
money: (value) => new Intl.NumberFormat(locale, {
|
|
89
|
+
style: 'currency',
|
|
90
|
+
currency: 'SEK',
|
|
91
|
+
maximumFractionDigits: 0,
|
|
92
|
+
}).format(Number.isFinite(value) ? value : 0),
|
|
93
|
+
percent: (value) => new Intl.NumberFormat(locale, {
|
|
94
|
+
style: 'percent',
|
|
95
|
+
maximumFractionDigits: 1,
|
|
96
|
+
}).format(Number.isFinite(value) ? value : 0),
|
|
97
|
+
hoursFormat: (value) => `${new Intl.NumberFormat(locale, {
|
|
98
|
+
maximumFractionDigits: 1,
|
|
99
|
+
}).format(Number.isFinite(value) ? value : 0)} h`,
|
|
100
|
+
}), [locale])
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Standalone assignment-margin panel for dashboard pinning.
|
|
105
|
+
*/
|
|
106
|
+
export function AssignmentMarginResultsPanel () {
|
|
107
|
+
const [data, setData] = useState(MARGIN_RESULTS_DEFAULTS)
|
|
108
|
+
const { money, percent, hoursFormat } = useMoneyFormatters()
|
|
109
|
+
const setField = (name) => (value) => setData((prev) => ({ ...prev, [name]: value }))
|
|
110
|
+
|
|
111
|
+
const margin = calculateAssignmentMargin({
|
|
112
|
+
hourlyRate: parseNumber(data.hourlyRate, 900),
|
|
113
|
+
billableHours: parseNumber(data.billableHours, 120),
|
|
114
|
+
monthlySalary: parseNumber(data.monthlySalary, 47000),
|
|
115
|
+
availableHoursPerMonth: parseNumber(data.availableHours, DEFAULT_AVAILABLE_HOURS_PER_MONTH),
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<View gap="m" data-margins-widget="results">
|
|
120
|
+
<SectionPanel title="consultancy.margins.inputs.title">
|
|
121
|
+
<View inset="m" gap="m">
|
|
122
|
+
<Field
|
|
123
|
+
name="hourlyRate"
|
|
124
|
+
label="@ossy/consultancy/schema/calculator.hourlyRate.label"
|
|
125
|
+
value={data.hourlyRate}
|
|
126
|
+
onChange={setField('hourlyRate')}
|
|
127
|
+
/>
|
|
128
|
+
<Field
|
|
129
|
+
name="billableHours"
|
|
130
|
+
label="@ossy/consultancy/schema/calculator.billableHours.label"
|
|
131
|
+
value={data.billableHours}
|
|
132
|
+
onChange={setField('billableHours')}
|
|
133
|
+
/>
|
|
134
|
+
<Field
|
|
135
|
+
name="monthlySalary"
|
|
136
|
+
label="@ossy/consultancy/schema/calculator.monthlySalary.label"
|
|
137
|
+
value={data.monthlySalary}
|
|
138
|
+
onChange={setField('monthlySalary')}
|
|
139
|
+
/>
|
|
140
|
+
<Field
|
|
141
|
+
name="availableHours"
|
|
142
|
+
label="@ossy/consultancy/schema/calculator.availableHours.label"
|
|
143
|
+
value={data.availableHours}
|
|
144
|
+
onChange={setField('availableHours')}
|
|
145
|
+
/>
|
|
146
|
+
</View>
|
|
147
|
+
</SectionPanel>
|
|
148
|
+
<SectionPanel
|
|
149
|
+
title="consultancy.margins.results.title"
|
|
150
|
+
data-margins-status={margin.isProfitable ? 'profitable' : 'unprofitable'}
|
|
151
|
+
>
|
|
152
|
+
<View gap="s" inset="m">
|
|
153
|
+
<MetricRow label="consultancy.margins.results.revenue" value={money(margin.revenue)} />
|
|
154
|
+
<MetricRow label="consultancy.margins.results.deliveryCost" value={money(margin.deliveryCost)} />
|
|
155
|
+
<MetricRow label="consultancy.margins.results.grossMargin" value={money(margin.grossMargin)} />
|
|
156
|
+
<MetricRow label="consultancy.margins.results.marginPercent" value={percent(margin.marginPercent)} />
|
|
157
|
+
<Separator />
|
|
158
|
+
<MetricRow label="consultancy.margins.results.employerCost" value={money(margin.employerCost)} />
|
|
159
|
+
<MetricRow label="consultancy.margins.results.monthPnl" value={money(margin.monthPnl)} />
|
|
160
|
+
<MetricRow label="consultancy.margins.results.breakEvenHours" value={hoursFormat(margin.breakEvenHours)} />
|
|
161
|
+
<MetricRow label="consultancy.margins.results.utilization" value={percent(margin.utilization)} />
|
|
162
|
+
<MetricRow label="consultancy.margins.results.forgoneRevenue" value={money(margin.forgoneRevenue)} />
|
|
163
|
+
<Text
|
|
164
|
+
variant="small"
|
|
165
|
+
color="secondary"
|
|
166
|
+
text={margin.coversEmployerCost ? 'consultancy.margins.results.coversCost' : 'consultancy.margins.results.missesCost'}
|
|
167
|
+
/>
|
|
168
|
+
</View>
|
|
169
|
+
</SectionPanel>
|
|
170
|
+
</View>
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Standalone admin-leakage panel for dashboard pinning.
|
|
176
|
+
*/
|
|
177
|
+
export function AdminLeakagePanel () {
|
|
178
|
+
const [data, setData] = useState(LEAKAGE_DEFAULTS)
|
|
179
|
+
const { money, hoursFormat } = useMoneyFormatters()
|
|
180
|
+
const setField = (name) => (value) => setData((prev) => ({ ...prev, [name]: value }))
|
|
181
|
+
|
|
182
|
+
const leakage = estimateAdminLeakage({
|
|
183
|
+
teamSize: parseNumber(data.teamSize, 10),
|
|
184
|
+
adminHoursPerPersonPerWeek: parseNumber(data.adminHoursPerWeek, 5),
|
|
185
|
+
hourlyRate: parseNumber(data.hourlyRate, 900),
|
|
186
|
+
weeksPerYear: DEFAULT_WEEKS_PER_YEAR,
|
|
187
|
+
})
|
|
188
|
+
|
|
189
|
+
return (
|
|
190
|
+
<SectionPanel title="consultancy.margins.leakage.title" data-margins-widget="leakage">
|
|
191
|
+
<View gap="m" inset="m">
|
|
192
|
+
<Text variant="small" color="secondary" text="consultancy.margins.leakage.description" />
|
|
193
|
+
<Field
|
|
194
|
+
name="hourlyRate"
|
|
195
|
+
label="@ossy/consultancy/schema/calculator.hourlyRate.label"
|
|
196
|
+
value={data.hourlyRate}
|
|
197
|
+
onChange={setField('hourlyRate')}
|
|
198
|
+
/>
|
|
199
|
+
<Field
|
|
200
|
+
name="teamSize"
|
|
201
|
+
label="@ossy/consultancy/schema/calculator.teamSize.label"
|
|
202
|
+
value={data.teamSize}
|
|
203
|
+
onChange={setField('teamSize')}
|
|
204
|
+
/>
|
|
205
|
+
<Field
|
|
206
|
+
name="adminHoursPerWeek"
|
|
207
|
+
label="@ossy/consultancy/schema/calculator.adminHoursPerWeek.label"
|
|
208
|
+
value={data.adminHoursPerWeek}
|
|
209
|
+
onChange={setField('adminHoursPerWeek')}
|
|
210
|
+
/>
|
|
211
|
+
<MetricRow label="consultancy.margins.leakage.hours" value={hoursFormat(leakage.leakedHours)} />
|
|
212
|
+
<MetricRow label="consultancy.margins.leakage.revenue" value={money(leakage.leakedRevenue)} />
|
|
213
|
+
</View>
|
|
214
|
+
</SectionPanel>
|
|
215
|
+
)
|
|
216
|
+
}
|
package/src/margins.page.jsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { View, Page, Tags } from '@ossy/design-system'
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { Button, View, Page, Tags } from '@ossy/design-system'
|
|
3
|
+
import { useSdk } from '@ossy/sdk-react'
|
|
4
|
+
import { PinWidget } from '@ossy/dashboard'
|
|
3
5
|
import { AssignmentMarginCalculator } from './AssignmentMarginCalculator.jsx'
|
|
4
6
|
import { Definition } from './Definition.js'
|
|
5
7
|
import { CreateConsultancyButton } from './CreateConsultancyButton.jsx'
|
|
@@ -13,18 +15,62 @@ export const metadata = {
|
|
|
13
15
|
},
|
|
14
16
|
}
|
|
15
17
|
|
|
18
|
+
const MARGIN_RESULTS_WIDGET_ID = '@ossy/consultancy/view/assignment-margin-results'
|
|
19
|
+
const LEAKAGE_WIDGET_ID = '@ossy/consultancy/view/admin-leakage'
|
|
20
|
+
|
|
16
21
|
export const MarginsPage = () => {
|
|
22
|
+
const sdk = useSdk()
|
|
23
|
+
const [pinState, setPinState] = useState({})
|
|
24
|
+
|
|
17
25
|
const statusTags = (Definition.status ?? [])
|
|
18
26
|
.map((s) => ({ beta: 'Beta', 'coming-soon': 'Coming Soon' }[s]))
|
|
19
27
|
.filter(Boolean)
|
|
20
28
|
|
|
29
|
+
const pin = async (componentId) => {
|
|
30
|
+
if (pinState[componentId] === 'pending') return
|
|
31
|
+
setPinState((prev) => ({ ...prev, [componentId]: 'pending' }))
|
|
32
|
+
try {
|
|
33
|
+
await sdk.invoke(PinWidget, { componentId })
|
|
34
|
+
setPinState((prev) => ({ ...prev, [componentId]: 'done' }))
|
|
35
|
+
} catch {
|
|
36
|
+
setPinState((prev) => ({ ...prev, [componentId]: 'error' }))
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const pinLabel = (componentId, idleKey) => {
|
|
41
|
+
const state = pinState[componentId]
|
|
42
|
+
if (state === 'done') return 'consultancy.margins.pin.done'
|
|
43
|
+
if (state === 'error') return 'consultancy.margins.pin.error'
|
|
44
|
+
return idleKey
|
|
45
|
+
}
|
|
46
|
+
|
|
21
47
|
return (
|
|
22
48
|
<Page
|
|
23
49
|
scroll
|
|
24
50
|
title="consultancy.margins.title"
|
|
25
51
|
near={statusTags.length > 0 ? <Tags tags={statusTags} size="s" /> : undefined}
|
|
26
52
|
description="consultancy.margins.description"
|
|
27
|
-
far={
|
|
53
|
+
far={(
|
|
54
|
+
<View layout="row" gap="s" style={{ flexWrap: 'wrap' }}>
|
|
55
|
+
<Button
|
|
56
|
+
{...PinWidget}
|
|
57
|
+
variant="primary"
|
|
58
|
+
disabled={pinState[MARGIN_RESULTS_WIDGET_ID] === 'pending' || pinState[MARGIN_RESULTS_WIDGET_ID] === 'done'}
|
|
59
|
+
label={pinLabel(MARGIN_RESULTS_WIDGET_ID, 'consultancy.margins.pin.results')}
|
|
60
|
+
onClick={() => pin(MARGIN_RESULTS_WIDGET_ID)}
|
|
61
|
+
data-margins-pin="results"
|
|
62
|
+
/>
|
|
63
|
+
<Button
|
|
64
|
+
{...PinWidget}
|
|
65
|
+
variant="default"
|
|
66
|
+
disabled={pinState[LEAKAGE_WIDGET_ID] === 'pending' || pinState[LEAKAGE_WIDGET_ID] === 'done'}
|
|
67
|
+
label={pinLabel(LEAKAGE_WIDGET_ID, 'consultancy.margins.pin.leakage')}
|
|
68
|
+
onClick={() => pin(LEAKAGE_WIDGET_ID)}
|
|
69
|
+
data-margins-pin="leakage"
|
|
70
|
+
/>
|
|
71
|
+
<CreateConsultancyButton />
|
|
72
|
+
</View>
|
|
73
|
+
)}
|
|
28
74
|
>
|
|
29
75
|
<View gap="m">
|
|
30
76
|
<ConsultancyNav active="consultancy/margins" />
|
|
@@ -1,39 +1,38 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Text, View, Page, Tags } from '@ossy/design-system'
|
|
3
|
-
import {
|
|
3
|
+
import { Overview } from './Overview.jsx'
|
|
4
4
|
import { DataLoader } from '@ossy/calendar'
|
|
5
5
|
import { Definition } from './Definition.js'
|
|
6
6
|
import { CreateConsultancyButton } from './CreateConsultancyButton.jsx'
|
|
7
7
|
import { ConsultancyNav } from './ConsultancyNav.jsx'
|
|
8
8
|
|
|
9
9
|
export const metadata = {
|
|
10
|
-
id: 'consultancy/
|
|
10
|
+
id: 'consultancy/org',
|
|
11
11
|
path: {
|
|
12
|
-
sv: '/konsultverksamhet/
|
|
13
|
-
en: '/consultancy/
|
|
12
|
+
sv: '/konsultverksamhet/orgdetaljer',
|
|
13
|
+
en: '/consultancy/org',
|
|
14
14
|
},
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export const
|
|
17
|
+
export const OrgPage = () => {
|
|
18
18
|
const statusTags = (Definition.status ?? [])
|
|
19
19
|
.map((s) => ({ beta: 'Beta', 'coming-soon': 'Coming Soon' }[s]))
|
|
20
20
|
.filter(Boolean)
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<Page
|
|
24
|
-
|
|
25
|
-
title="consultancy.forecasts.title"
|
|
24
|
+
title="consultancy.org.title"
|
|
26
25
|
near={statusTags.length > 0 ? <Tags tags={statusTags} size="s" /> : undefined}
|
|
27
|
-
description="consultancy.
|
|
26
|
+
description="consultancy.org.description"
|
|
28
27
|
far={<CreateConsultancyButton />}
|
|
29
28
|
>
|
|
30
29
|
<View gap="m">
|
|
31
|
-
<ConsultancyNav active="consultancy/
|
|
32
|
-
<Text variant="heading-secondary" as="h2" text="
|
|
33
|
-
<DataLoader content={<
|
|
30
|
+
<ConsultancyNav active="consultancy/org" />
|
|
31
|
+
<Text variant="heading-secondary" as="h2" text="consultancy.nav.orgDetails" />
|
|
32
|
+
<DataLoader content={<Overview />} />
|
|
34
33
|
</View>
|
|
35
34
|
</Page>
|
|
36
35
|
)
|
|
37
36
|
}
|
|
38
37
|
|
|
39
|
-
export default
|
|
38
|
+
export default OrgPage
|
package/src/sv.translations.json
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"consultancy/home.documentTitle": "
|
|
3
|
-
"consultancy/
|
|
2
|
+
"consultancy/home.documentTitle": "Översikt",
|
|
3
|
+
"consultancy/org.documentTitle": "Orgdetaljer",
|
|
4
4
|
"consultancy/margins.documentTitle": "Marginaler",
|
|
5
|
-
"consultancy.home.title": "
|
|
6
|
-
"consultancy.home.description": "
|
|
5
|
+
"consultancy.home.title": "Översikt",
|
|
6
|
+
"consultancy.home.description": "KPIer för räkenskapsåret, års totalsummor och månadskapacitet från avtal, anställda och semester",
|
|
7
|
+
"consultancy.org.title": "Orgdetaljer",
|
|
8
|
+
"consultancy.org.description": "Företags- och räkenskapsårsdetaljer",
|
|
9
|
+
"consultancy.nav.title": "Konsultverksamhet",
|
|
7
10
|
"consultancy.nav.overview": "Översikt",
|
|
8
11
|
"consultancy.nav.forecasts": "Prognoser",
|
|
9
12
|
"consultancy.nav.margins": "Marginaler",
|
|
10
|
-
"consultancy.forecasts.title": "
|
|
11
|
-
"consultancy.forecasts.description": "
|
|
13
|
+
"consultancy.forecasts.title": "Översikt",
|
|
14
|
+
"consultancy.forecasts.description": "KPIer för räkenskapsåret, års totalsummor och månadskapacitet från avtal, anställda och semester",
|
|
12
15
|
"consultancy.forecasts.income": "Intäkt",
|
|
13
16
|
"consultancy.forecasts.salaryCost": "Lönekostnad",
|
|
14
17
|
"consultancy.forecasts.revenue": "Resultat",
|
|
@@ -39,7 +42,6 @@
|
|
|
39
42
|
"consultancy.overview.noFiscalYears": "Inga räkenskapsår ännu.",
|
|
40
43
|
"consultancy.empty.title": "Här är tomt",
|
|
41
44
|
"consultancy.empty.text": "Lägg till företagsinfo, anställda, avtal och semester för att komma igång.",
|
|
42
|
-
|
|
43
45
|
"@ossy/consultancy/form/calculator.label": "Uppdragsmarginalkalkylator",
|
|
44
46
|
"@ossy/consultancy/schema/calculator.hourlyRate.label": "Kundens timpris (SEK)",
|
|
45
47
|
"@ossy/consultancy/schema/calculator.billableHours.label": "Fakturerbara timmar denna period",
|
|
@@ -47,7 +49,6 @@
|
|
|
47
49
|
"@ossy/consultancy/schema/calculator.availableHours.label": "Tillgängliga timmar denna månad",
|
|
48
50
|
"@ossy/consultancy/schema/calculator.teamSize.label": "Teamstorlek",
|
|
49
51
|
"@ossy/consultancy/schema/calculator.adminHoursPerWeek.label": "Admintimmar per person / vecka",
|
|
50
|
-
|
|
51
52
|
"@ossy/consultancy/schema/company-basic-info.name.label": "Företagsnamn",
|
|
52
53
|
"@ossy/consultancy/schema/company-basic-info.name.description": "Bolagets registrerade namn.",
|
|
53
54
|
"@ossy/consultancy/schema/company-basic-info.registrationDate.label": "Registreringsdatum",
|
|
@@ -69,7 +70,6 @@
|
|
|
69
70
|
"@ossy/consultancy/schema/company-basic-info.financialYearEnd.description": "Månad då räkenskapsåret slutar.",
|
|
70
71
|
"@ossy/consultancy/schema/company-basic-info.holidayLocale.label": "Helgdagskalender",
|
|
71
72
|
"@ossy/consultancy/schema/company-basic-info.holidayLocale.description": "Land som används för röda dagar och helgdagar i prognoser och tidrapporter.",
|
|
72
|
-
|
|
73
73
|
"@ossy/consultancy/schema/employee.name.label": "Namn",
|
|
74
74
|
"@ossy/consultancy/schema/employee.name.description": "Den anställdas fullständiga namn.",
|
|
75
75
|
"@ossy/consultancy/schema/employee.email.label": "E-post",
|
|
@@ -84,7 +84,6 @@
|
|
|
84
84
|
"@ossy/consultancy/schema/employee.startDate.description": "Första anställningsdagen. Prognosen räknas från detta datum.",
|
|
85
85
|
"@ossy/consultancy/schema/employee.endDate.label": "Anställningens slut",
|
|
86
86
|
"@ossy/consultancy/schema/employee.endDate.description": "Sista anställningsdagen. Lämna tomt om anställningen pågår.",
|
|
87
|
-
|
|
88
87
|
"@ossy/consultancy/schema/contract.employeeId.label": "Anställd",
|
|
89
88
|
"@ossy/consultancy/schema/contract.employeeId.description": "Vem avtalet gäller.",
|
|
90
89
|
"@ossy/consultancy/schema/contract.clientName.label": "Kund",
|
|
@@ -105,14 +104,12 @@
|
|
|
105
104
|
"@ossy/consultancy/schema/contract.paymentTermsDueDate.description": "När fakturan förfaller, t.ex. 30 dagar netto.",
|
|
106
105
|
"@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.label": "Fakturadatum",
|
|
107
106
|
"@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.description": "När fakturan ställs ut i förhållande till leveransperioden.",
|
|
108
|
-
|
|
109
107
|
"@ossy/consultancy/schema/vacation.employeeId.label": "Anställd",
|
|
110
108
|
"@ossy/consultancy/schema/vacation.employeeId.description": "Vem som är ledig.",
|
|
111
109
|
"@ossy/consultancy/schema/vacation.start.label": "Första lediga dagen",
|
|
112
110
|
"@ossy/consultancy/schema/vacation.start.description": "Första semesterdagen (inklusive). De här dagarna faktureras inte.",
|
|
113
111
|
"@ossy/consultancy/schema/vacation.end.label": "Sista lediga dagen",
|
|
114
112
|
"@ossy/consultancy/schema/vacation.end.description": "Sista semesterdagen (inklusive).",
|
|
115
|
-
|
|
116
113
|
"@ossy/consultancy/schema/opportunity.title.label": "Titel",
|
|
117
114
|
"@ossy/consultancy/schema/opportunity.title.description": "Kort namn på leadet eller möjligheten.",
|
|
118
115
|
"@ossy/consultancy/schema/opportunity.source.label": "Källa",
|
|
@@ -133,7 +130,6 @@
|
|
|
133
130
|
"@ossy/consultancy/schema/opportunity.linkedProposalId.description": "Relaterat anbud, om det finns.",
|
|
134
131
|
"@ossy/consultancy/schema/opportunity.feedRef.label": "Källreferens",
|
|
135
132
|
"@ossy/consultancy/schema/opportunity.feedRef.description": "Id eller URL från originalannonsen.",
|
|
136
|
-
|
|
137
133
|
"@ossy/consultancy/schema/proposal.opportunityId.label": "Möjlighet",
|
|
138
134
|
"@ossy/consultancy/schema/proposal.opportunityId.description": "Möjligheten det här anbudet tillhör.",
|
|
139
135
|
"@ossy/consultancy/schema/proposal.title.label": "Titel",
|
|
@@ -147,5 +143,23 @@
|
|
|
147
143
|
"@ossy/consultancy/schema/proposal.timeline.label": "Tidplan",
|
|
148
144
|
"@ossy/consultancy/schema/proposal.timeline.description": "När arbetet skulle starta och sluta.",
|
|
149
145
|
"@ossy/consultancy/schema/proposal.body.label": "Brödtext",
|
|
150
|
-
"@ossy/consultancy/schema/proposal.body.description": "Hela anbudstexten."
|
|
146
|
+
"@ossy/consultancy/schema/proposal.body.description": "Hela anbudstexten.",
|
|
147
|
+
"consultancy.nav.orgDetails": "Orgdetaljer",
|
|
148
|
+
"consultancy.forecasts.yearChart": "KPI-trend",
|
|
149
|
+
"consultancy.forecasts.yearSummary": "Totalsummor för räkenskapsåret",
|
|
150
|
+
"consultancy.forecasts.yearChartEmpty": "Inga prognosmånader att visa ännu.",
|
|
151
|
+
"consultancy.margins.pin.done": "Nålad på instrumentpanel",
|
|
152
|
+
"consultancy.margins.pin.error": "Nålning misslyckades — försök igen",
|
|
153
|
+
"consultancy.margins.pin.results": "Nåla marginalpanel",
|
|
154
|
+
"consultancy.margins.pin.leakage": "Nåla läckagepanel",
|
|
155
|
+
"consultancy.forecasts.pin.done": "Nålad på instrumentpanel",
|
|
156
|
+
"consultancy.forecasts.pin.error": "Nålning misslyckades — försök igen",
|
|
157
|
+
"consultancy.forecasts.pin.forecast": "Nåla denna månad",
|
|
158
|
+
"consultancy.forecasts.widget.empty": "Ingen prognosmånad tillgänglig ännu.",
|
|
159
|
+
"consultancy.widgets.marginResults.title": "Uppdragsmarginal",
|
|
160
|
+
"consultancy.widgets.marginResults.description": "Bruttomarginal och beläggning för ett konsultuppdrag.",
|
|
161
|
+
"consultancy.widgets.adminLeakage.title": "Adminläckage",
|
|
162
|
+
"consultancy.widgets.adminLeakage.description": "Årliga timmar och intäkter som går förlorade på återkommande admin.",
|
|
163
|
+
"consultancy.widgets.forecastCurrentMonth.title": "Prognos denna månad",
|
|
164
|
+
"consultancy.widgets.forecastCurrentMonth.description": "Prognostiserad intäkt, lönekostnad, omsättning och timmar för innevarande månad."
|
|
151
165
|
}
|
|
@@ -8,16 +8,17 @@ export const metadata = {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* After enabling consultancy from the catalog, open
|
|
11
|
+
* After enabling consultancy from the catalog, open the home overview and assert
|
|
12
12
|
* the workspace forecasts surface is mounted.
|
|
13
13
|
*/
|
|
14
14
|
export default {
|
|
15
15
|
title: 'View forecasts',
|
|
16
16
|
description:
|
|
17
|
-
'Signed-in user enables consultancy and opens the
|
|
17
|
+
'Signed-in user enables consultancy and opens the consultancy home overview',
|
|
18
18
|
steps: [
|
|
19
19
|
...enableConsultancyFlow.steps,
|
|
20
|
-
{ page: '@consultancy/
|
|
20
|
+
{ page: '@consultancy/home' },
|
|
21
21
|
{ result: { selector: '[data-forecasts-status="on"]', timeout: 20000 } },
|
|
22
|
+
{ result: { selector: '[data-consultancy-nav]', timeout: 10000 } },
|
|
22
23
|
],
|
|
23
24
|
}
|