@ossy/consultancy 3.30.0 → 3.31.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/package.json +6 -6
- package/src/ForecastWidget.jsx +17 -0
- package/src/RequestStatsPanel.jsx +7 -5
- package/src/current-month.component.jsx +5 -2
- package/src/en.translations.json +7 -1
- package/src/forecast-preview.js +46 -0
- package/src/kpi-trend.component.jsx +4 -2
- package/src/request-stats.component.jsx +17 -0
- package/src/sv.translations.json +7 -1
- package/src/utilization.component.jsx +4 -2
- package/src/year-totals.component.jsx +4 -2
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.31.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
7
7
|
"module": "./src/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"README.md"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@ossy/email": "^3.
|
|
29
|
-
"@ossy/event-store": "^3.
|
|
28
|
+
"@ossy/email": "^3.31.0",
|
|
29
|
+
"@ossy/event-store": "^3.31.0",
|
|
30
30
|
"@ossy/fold": "^3.26.0",
|
|
31
31
|
"@ossy/organisation": "^3.30.0",
|
|
32
|
-
"@ossy/schema": "^3.
|
|
33
|
-
"@ossy/spend": "^3.
|
|
32
|
+
"@ossy/schema": "^3.31.0",
|
|
33
|
+
"@ossy/spend": "^3.31.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@ossy/calendar": "*",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"jest": "^30.2.0"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "4deda2c0f9ec92443728366266b9a81067ea6a12"
|
|
49
49
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { DataLoader } from '@ossy/calendar'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Forecast slot widget. A catalog preview case passes `preview` (a month-report
|
|
6
|
+
* snapshot); the dashboard mount does not, and reads the live report.
|
|
7
|
+
*/
|
|
8
|
+
export function ForecastWidget ({ panel: Panel, preview, ...props }) {
|
|
9
|
+
return (
|
|
10
|
+
<DataLoader
|
|
11
|
+
emptyGuide={false}
|
|
12
|
+
source="projection"
|
|
13
|
+
preview={preview}
|
|
14
|
+
content={<Panel {...props} />}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -17,11 +17,13 @@ const SERIES = [
|
|
|
17
17
|
/**
|
|
18
18
|
* Monthly incoming requests, dated by the email Date header.
|
|
19
19
|
*/
|
|
20
|
-
export function RequestStatsChart () {
|
|
20
|
+
export function RequestStatsChart ({ months: previewMonths } = {}) {
|
|
21
|
+
const usingPreview = Array.isArray(previewMonths)
|
|
21
22
|
const sdk = useSdk()
|
|
22
|
-
const [months, setMonths] = useState([])
|
|
23
|
+
const [months, setMonths] = useState(() => (usingPreview ? previewMonths : []))
|
|
23
24
|
|
|
24
25
|
useEffect(() => {
|
|
26
|
+
if (usingPreview) return undefined
|
|
25
27
|
let cancelled = false
|
|
26
28
|
sdk.invoke(GetRequestStats, {})
|
|
27
29
|
.then((json) => {
|
|
@@ -34,7 +36,7 @@ export function RequestStatsChart () {
|
|
|
34
36
|
return () => {
|
|
35
37
|
cancelled = true
|
|
36
38
|
}
|
|
37
|
-
}, [sdk])
|
|
39
|
+
}, [sdk, usingPreview])
|
|
38
40
|
|
|
39
41
|
return (
|
|
40
42
|
<LineChart
|
|
@@ -46,7 +48,7 @@ export function RequestStatsChart () {
|
|
|
46
48
|
)
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
export function RequestStatsPanel ({ dashboardId, pinnedWidgetId }) {
|
|
51
|
+
export function RequestStatsPanel ({ dashboardId, pinnedWidgetId, months }) {
|
|
50
52
|
return (
|
|
51
53
|
<Panel
|
|
52
54
|
title="consultancy.requests.statsTitle"
|
|
@@ -60,7 +62,7 @@ export function RequestStatsPanel ({ dashboardId, pinnedWidgetId }) {
|
|
|
60
62
|
/>
|
|
61
63
|
)}
|
|
62
64
|
>
|
|
63
|
-
<RequestStatsChart />
|
|
65
|
+
<RequestStatsChart months={months} />
|
|
64
66
|
</Panel>
|
|
65
67
|
)
|
|
66
68
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { Panel, Text, View, useLocale } from '@ossy/design-system'
|
|
3
|
-
import {
|
|
3
|
+
import { useForecast } from '@ossy/calendar'
|
|
4
4
|
import { ForecastFigures } from './forecast-figures.jsx'
|
|
5
5
|
import { ForecastWidgetMenu } from './forecast-widget-menu.jsx'
|
|
6
6
|
import { MonthDayGrid } from './MonthDayGrid.jsx'
|
|
7
7
|
import { spendForMonth } from './spend-for-month.js'
|
|
8
8
|
import { useSpendByMonth } from './use-spend-by-month.js'
|
|
9
|
+
import { ForecastWidget } from './ForecastWidget.jsx'
|
|
10
|
+
import { forecastPreviewMetadata } from './forecast-preview.js'
|
|
9
11
|
|
|
10
12
|
export const CURRENT_MONTH_WIDGET_ID = '@ossy/consultancy/view/current-month'
|
|
11
13
|
|
|
@@ -69,9 +71,10 @@ export const metadata = {
|
|
|
69
71
|
description: 'consultancy.widgets.forecastCurrentMonth.description',
|
|
70
72
|
ownsHeader: true,
|
|
71
73
|
},
|
|
74
|
+
preview: forecastPreviewMetadata('consultancy.widgets.forecastCurrentMonth.title'),
|
|
72
75
|
}
|
|
73
76
|
|
|
74
77
|
/** Slot widget — current-month forecast panel for dashboards. */
|
|
75
78
|
export default function CurrentMonthForecastWidget (props) {
|
|
76
|
-
return <
|
|
79
|
+
return <ForecastWidget panel={CurrentMonthForecastPanel} {...props} />
|
|
77
80
|
}
|
package/src/en.translations.json
CHANGED
|
@@ -252,5 +252,11 @@
|
|
|
252
252
|
"consultancy.widgets.utilization.description": "Forecast and actual hours across the fiscal year.",
|
|
253
253
|
"consultancy.widgets.requestStats.title": "Incoming requests",
|
|
254
254
|
"consultancy.widgets.requestStats.description": "Requests per month, dated by the email's own arrival time.",
|
|
255
|
-
"consultancy.widgets.menu": "More"
|
|
255
|
+
"consultancy.widgets.menu": "More",
|
|
256
|
+
"@ossy/consultancy/actions/extract-request.label": "Extract request",
|
|
257
|
+
"@ossy/consultancy/actions/extract-request.description": "Read an inbound assignment and save it as a consultancy request",
|
|
258
|
+
"@ossy/consultancy/actions/get-request-stats.label": "Request stats",
|
|
259
|
+
"@ossy/consultancy/actions/get-request-stats.description": "Summarize consultancy request counts for the workspace",
|
|
260
|
+
"@ossy/consultancy/actions/get-month-report.label": "Month report",
|
|
261
|
+
"@ossy/consultancy/actions/get-month-report.description": "Build the consultancy report for a month"
|
|
256
262
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const EMPLOYEE_ID = 'preview-employee'
|
|
2
|
+
const CONTRACT_ID = 'preview-contract'
|
|
3
|
+
const RATE = 900
|
|
4
|
+
|
|
5
|
+
const MONTHS = [
|
|
6
|
+
{ year: 2026, monthNumber: 9, projectedIncome: 144000, monthlyCostOfEmployees: 62800, hoursWorked: 160, spend: 4200 },
|
|
7
|
+
{ year: 2026, monthNumber: 10, projectedIncome: 135000, monthlyCostOfEmployees: 62800, hoursWorked: 150, spend: 8100 },
|
|
8
|
+
{ year: 2026, monthNumber: 11, projectedIncome: 126000, monthlyCostOfEmployees: 62800, hoursWorked: 140, spend: 3600 },
|
|
9
|
+
{ year: 2026, monthNumber: 12, projectedIncome: 72000, monthlyCostOfEmployees: 62800, hoursWorked: 80, spend: 1500 },
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
function sheetLines (monthNumber, days) {
|
|
13
|
+
return Array.from({ length: days }, (_, index) => ({
|
|
14
|
+
date: `2026-${String(monthNumber).padStart(2, '0')}-${String(index + 1).padStart(2, '0')}`,
|
|
15
|
+
hours: 8,
|
|
16
|
+
}))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sample month-report snapshot for forecast widget preview cases.
|
|
21
|
+
* Signed-out store and docs previews render this instead of the live read.
|
|
22
|
+
*/
|
|
23
|
+
export const FORECAST_WIDGET_PREVIEW = {
|
|
24
|
+
hasSetup: true,
|
|
25
|
+
employees: [{ id: EMPLOYEE_ID, content: { workHoursPerDay: 8 } }],
|
|
26
|
+
contracts: [{ id: CONTRACT_ID, content: { employeeId: EMPLOYEE_ID, hourlyCompensation: RATE } }],
|
|
27
|
+
vacations: [],
|
|
28
|
+
timesheets: [
|
|
29
|
+
{ id: 'preview-sheet-09', content: { employeeId: EMPLOYEE_ID, contractId: CONTRACT_ID, lines: sheetLines(9, 12) } },
|
|
30
|
+
{ id: 'preview-sheet-10', content: { employeeId: EMPLOYEE_ID, contractId: CONTRACT_ID, lines: sheetLines(10, 11) } },
|
|
31
|
+
{ id: 'preview-sheet-11', content: { employeeId: EMPLOYEE_ID, contractId: CONTRACT_ID, lines: sheetLines(11, 10) } },
|
|
32
|
+
{ id: 'preview-sheet-12', content: { employeeId: EMPLOYEE_ID, contractId: CONTRACT_ID, lines: sheetLines(12, 4) } },
|
|
33
|
+
],
|
|
34
|
+
months: MONTHS,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Catalog preview metadata. `title` is the widget's existing translation key. */
|
|
38
|
+
export function forecastPreviewMetadata (title) {
|
|
39
|
+
return {
|
|
40
|
+
title,
|
|
41
|
+
group: 'Consultancy',
|
|
42
|
+
cases: [
|
|
43
|
+
{ name: 'Sample year', props: { preview: FORECAST_WIDGET_PREVIEW } },
|
|
44
|
+
],
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { DataLoader } from '@ossy/calendar'
|
|
3
2
|
import { KpiTrendPanel } from './forecast-panels.jsx'
|
|
3
|
+
import { ForecastWidget } from './ForecastWidget.jsx'
|
|
4
|
+
import { forecastPreviewMetadata } from './forecast-preview.js'
|
|
4
5
|
|
|
5
6
|
export const metadata = {
|
|
6
7
|
id: '@ossy/consultancy/view/kpi-trend',
|
|
@@ -9,9 +10,10 @@ export const metadata = {
|
|
|
9
10
|
description: 'consultancy.widgets.kpiTrend.description',
|
|
10
11
|
ownsHeader: true,
|
|
11
12
|
},
|
|
13
|
+
preview: forecastPreviewMetadata('consultancy.widgets.kpiTrend.title'),
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** Slot widget — fiscal-year KPI trend for dashboards. */
|
|
15
17
|
export default function KpiTrendWidget (props) {
|
|
16
|
-
return <
|
|
18
|
+
return <ForecastWidget panel={KpiTrendPanel} {...props} />
|
|
17
19
|
}
|
|
@@ -9,6 +9,23 @@ export const metadata = {
|
|
|
9
9
|
span: 8,
|
|
10
10
|
ownsHeader: true,
|
|
11
11
|
},
|
|
12
|
+
preview: {
|
|
13
|
+
title: 'consultancy.widgets.requestStats.title',
|
|
14
|
+
group: 'Consultancy',
|
|
15
|
+
cases: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Sample year',
|
|
18
|
+
props: {
|
|
19
|
+
months: [
|
|
20
|
+
{ year: 2026, monthNumber: 9, count: 6 },
|
|
21
|
+
{ year: 2026, monthNumber: 10, count: 11 },
|
|
22
|
+
{ year: 2026, monthNumber: 11, count: 8 },
|
|
23
|
+
{ year: 2026, monthNumber: 12, count: 4 },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
12
29
|
}
|
|
13
30
|
|
|
14
31
|
export default function RequestStatsWidget (props) {
|
package/src/sv.translations.json
CHANGED
|
@@ -252,5 +252,11 @@
|
|
|
252
252
|
"consultancy.widgets.utilization.description": "Prognostiserade och faktiska timmar under räkenskapsåret.",
|
|
253
253
|
"consultancy.widgets.requestStats.title": "Inkommande förfrågningar",
|
|
254
254
|
"consultancy.widgets.requestStats.description": "Förfrågningar per månad, daterade efter e-postens egen ankomsttid.",
|
|
255
|
-
"consultancy.widgets.menu": "Mer"
|
|
255
|
+
"consultancy.widgets.menu": "Mer",
|
|
256
|
+
"@ossy/consultancy/actions/extract-request.label": "Extrahera förfrågan",
|
|
257
|
+
"@ossy/consultancy/actions/extract-request.description": "Läs ett inkommande uppdrag och spara det som en konsultförfrågan",
|
|
258
|
+
"@ossy/consultancy/actions/get-request-stats.label": "Förfrågningsstatistik",
|
|
259
|
+
"@ossy/consultancy/actions/get-request-stats.description": "Sammanfatta antalet konsultförfrågningar i workspacen",
|
|
260
|
+
"@ossy/consultancy/actions/get-month-report.label": "Månadsrapport",
|
|
261
|
+
"@ossy/consultancy/actions/get-month-report.description": "Ta fram konsultbolagets rapport för en månad"
|
|
256
262
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { DataLoader } from '@ossy/calendar'
|
|
3
2
|
import { UtilizationPanel } from './forecast-panels.jsx'
|
|
3
|
+
import { ForecastWidget } from './ForecastWidget.jsx'
|
|
4
|
+
import { forecastPreviewMetadata } from './forecast-preview.js'
|
|
4
5
|
|
|
5
6
|
export const metadata = {
|
|
6
7
|
id: '@ossy/consultancy/view/utilization',
|
|
@@ -9,9 +10,10 @@ export const metadata = {
|
|
|
9
10
|
description: 'consultancy.widgets.utilization.description',
|
|
10
11
|
ownsHeader: true,
|
|
11
12
|
},
|
|
13
|
+
preview: forecastPreviewMetadata('consultancy.widgets.utilization.title'),
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** Slot widget — fiscal-year utilization for dashboards. */
|
|
15
17
|
export default function UtilizationWidget (props) {
|
|
16
|
-
return <
|
|
18
|
+
return <ForecastWidget panel={UtilizationPanel} {...props} />
|
|
17
19
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { DataLoader } from '@ossy/calendar'
|
|
3
2
|
import { YearTotalsPanel } from './forecast-panels.jsx'
|
|
3
|
+
import { ForecastWidget } from './ForecastWidget.jsx'
|
|
4
|
+
import { forecastPreviewMetadata } from './forecast-preview.js'
|
|
4
5
|
|
|
5
6
|
export const metadata = {
|
|
6
7
|
id: '@ossy/consultancy/view/year-totals',
|
|
@@ -9,9 +10,10 @@ export const metadata = {
|
|
|
9
10
|
description: 'consultancy.widgets.yearTotals.description',
|
|
10
11
|
ownsHeader: true,
|
|
11
12
|
},
|
|
13
|
+
preview: forecastPreviewMetadata('consultancy.widgets.yearTotals.title'),
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/** Slot widget — fiscal-year totals for dashboards. */
|
|
15
17
|
export default function YearTotalsWidget (props) {
|
|
16
|
-
return <
|
|
18
|
+
return <ForecastWidget panel={YearTotalsPanel} {...props} />
|
|
17
19
|
}
|