@ossy/consultancy 3.8.0 → 3.10.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ossy/consultancy",
3
3
  "description": "Consultancy feature package — schemas for employees, contracts, opportunities, and proposals",
4
- "version": "3.8.0",
4
+ "version": "3.10.0",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "module": "./src/index.js",
@@ -30,5 +30,5 @@
30
30
  "@ossy/router-react": "*",
31
31
  "react": "*"
32
32
  },
33
- "gitHead": "14548dfc2019e7258e8c75db527acbf66fe829bd"
33
+ "gitHead": "198084eb98871876396ae625d043dd0f03aa0325"
34
34
  }
@@ -3,6 +3,24 @@ import { Button, useLocale } from '@ossy/design-system'
3
3
  import { useRouter } from '@ossy/router-react'
4
4
  import { location } from './locations.js'
5
5
 
6
+ function currentReturnTo (href) {
7
+ const raw = typeof href === 'string' && href
8
+ ? href
9
+ : (typeof window !== 'undefined' ? `${window.location.pathname}${window.location.search}` : '')
10
+ if (!raw || raw.startsWith('//')) return null
11
+ try {
12
+ const url = /^[a-z][a-z0-9+.-]*:/i.test(raw)
13
+ ? new URL(raw)
14
+ : new URL(raw, 'http://ossy.invalid')
15
+ const path = `${url.pathname}${url.search}`
16
+ if (!path.startsWith('/') || path.startsWith('//')) return null
17
+ return path
18
+ } catch {
19
+ if (!raw.startsWith('/') || raw.startsWith('//')) return null
20
+ return raw
21
+ }
22
+ }
23
+
6
24
  /**
7
25
  * Add CTA that opens the generic create-document form for consultancy schemas.
8
26
  * @param {{ schemaId?: string }} [props]
@@ -12,12 +30,8 @@ export function CreateConsultancyButton ({ schemaId, ...props }) {
12
30
  const router = useRouter()
13
31
  const params = new URLSearchParams({ location, category: 'Consultancy' })
14
32
  if (schemaId) params.set('schemaId', schemaId)
15
- if (typeof window !== 'undefined') {
16
- const returnTo = `${window.location.pathname}${window.location.search}`
17
- if (returnTo.startsWith('/') && !returnTo.startsWith('//')) {
18
- params.set('returnTo', returnTo)
19
- }
20
- }
33
+ const returnTo = currentReturnTo(router.href)
34
+ if (returnTo) params.set('returnTo', returnTo)
21
35
 
22
36
  return (
23
37
  <Button
@@ -12,6 +12,7 @@ export default {
12
12
  { name: 'startDate', type: 'date' },
13
13
  { name: 'endDate', type: 'date' },
14
14
  { name: 'noticePeriodInDays', type: 'number' },
15
+ { name: 'billingPeriod', type: 'select', options: ['weekly', 'monthly'] },
15
16
  { name: 'paymentTermsDueDate', type: 'select', options: ['net30'] },
16
17
  { name: 'paymentTermsInvoiceDate', type: 'select', options: ['dayAfterServicePeriodEnd', 'sameDayAsServicePeriodEnd'] },
17
18
  ],
@@ -7,6 +7,7 @@ export default {
7
7
  icon: 'user-add',
8
8
  fields: [
9
9
  { name: 'name', type: 'text' },
10
+ { name: 'email', type: 'email' },
10
11
  { name: 'monthlySalary', type: 'number' },
11
12
  { name: 'workHoursPerDay', type: 'number' },
12
13
  { name: 'holidayDays', type: 'number' },
@@ -32,6 +32,8 @@
32
32
 
33
33
  "@ossy/consultancy/schema/employee.name.label": "Name",
34
34
  "@ossy/consultancy/schema/employee.name.description": "The employee’s full name.",
35
+ "@ossy/consultancy/schema/employee.email.label": "Email",
36
+ "@ossy/consultancy/schema/employee.email.description": "Work email used for timesheet reminders and other notifications.",
35
37
  "@ossy/consultancy/schema/employee.monthlySalary.label": "Monthly salary",
36
38
  "@ossy/consultancy/schema/employee.monthlySalary.description": "Gross monthly salary in SEK, before employer social costs.",
37
39
  "@ossy/consultancy/schema/employee.workHoursPerDay.label": "Work hours per day",
@@ -55,6 +57,10 @@
55
57
  "@ossy/consultancy/schema/contract.endDate.description": "Last day of the contract. Leave empty if it is ongoing.",
56
58
  "@ossy/consultancy/schema/contract.noticePeriodInDays.label": "Notice period (days)",
57
59
  "@ossy/consultancy/schema/contract.noticePeriodInDays.description": "How many days of notice the contract requires.",
60
+ "@ossy/consultancy/schema/contract.billingPeriod.label": "Billing period",
61
+ "@ossy/consultancy/schema/contract.billingPeriod.description": "How often timesheets are generated for this assignment.",
62
+ "@ossy/consultancy/schema/contract.billingPeriod.option.weekly": "Weekly",
63
+ "@ossy/consultancy/schema/contract.billingPeriod.option.monthly": "Monthly",
58
64
  "@ossy/consultancy/schema/contract.paymentTermsDueDate.label": "Payment terms",
59
65
  "@ossy/consultancy/schema/contract.paymentTermsDueDate.description": "When the invoice is due, e.g. net 30 days.",
60
66
  "@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.label": "Invoice date",
@@ -32,6 +32,8 @@
32
32
 
33
33
  "@ossy/consultancy/schema/employee.name.label": "Namn",
34
34
  "@ossy/consultancy/schema/employee.name.description": "Den anställdas fullständiga namn.",
35
+ "@ossy/consultancy/schema/employee.email.label": "E-post",
36
+ "@ossy/consultancy/schema/employee.email.description": "Arbetse-post för tidrapportpåminnelser och andra aviseringar.",
35
37
  "@ossy/consultancy/schema/employee.monthlySalary.label": "Månadslön",
36
38
  "@ossy/consultancy/schema/employee.monthlySalary.description": "Bruttolön per månad i SEK, före arbetsgivaravgifter.",
37
39
  "@ossy/consultancy/schema/employee.workHoursPerDay.label": "Arbetstimmar per dag",
@@ -55,6 +57,10 @@
55
57
  "@ossy/consultancy/schema/contract.endDate.description": "Sista dagen på avtalet. Lämna tomt om det pågår.",
56
58
  "@ossy/consultancy/schema/contract.noticePeriodInDays.label": "Uppsägningstid (dagar)",
57
59
  "@ossy/consultancy/schema/contract.noticePeriodInDays.description": "Hur många dagars uppsägning avtalet kräver.",
60
+ "@ossy/consultancy/schema/contract.billingPeriod.label": "Faktureringsperiod",
61
+ "@ossy/consultancy/schema/contract.billingPeriod.description": "Hur ofta tidrapporter skapas för uppdraget.",
62
+ "@ossy/consultancy/schema/contract.billingPeriod.option.weekly": "Veckovis",
63
+ "@ossy/consultancy/schema/contract.billingPeriod.option.monthly": "Månadsvis",
58
64
  "@ossy/consultancy/schema/contract.paymentTermsDueDate.label": "Betalningsvillkor",
59
65
  "@ossy/consultancy/schema/contract.paymentTermsDueDate.description": "När fakturan förfaller, t.ex. 30 dagar netto.",
60
66
  "@ossy/consultancy/schema/contract.paymentTermsInvoiceDate.label": "Fakturadatum",