@gusto/embedded-react-sdk 0.23.0-rc.1 → 0.23.0-rc.2
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/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +6 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +5 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +5 -4
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +10 -9
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +7 -6
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +14 -13
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +9 -8
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +17 -16
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -35
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ import { z as t } from "zod";
|
|
|
5
5
|
import { useProfile as b } from "./useProfile.js";
|
|
6
6
|
import { STATES_ABBR as y } from "../../../shared/constants.js";
|
|
7
7
|
import { Grid as x } from "../../Common/Grid/Grid.js";
|
|
8
|
+
import "classnames";
|
|
8
9
|
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
9
10
|
import { useComponentContext as C } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
11
|
import "react";
|
|
@@ -17,7 +18,7 @@ const s = t.object({
|
|
|
17
18
|
state: t.string().min(1),
|
|
18
19
|
zip: t.string().refine((e) => /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(e)),
|
|
19
20
|
courtesyWithholding: t.boolean()
|
|
20
|
-
}),
|
|
21
|
+
}), k = t.union([
|
|
21
22
|
// Case 1: selfOnboarding is false or undefined
|
|
22
23
|
s.extend({
|
|
23
24
|
selfOnboarding: t.union([t.literal(!1), t.undefined()])
|
|
@@ -26,7 +27,7 @@ const s = t.object({
|
|
|
26
27
|
t.object({
|
|
27
28
|
selfOnboarding: t.literal(!0)
|
|
28
29
|
})
|
|
29
|
-
]),
|
|
30
|
+
]), $ = t.union([
|
|
30
31
|
// Case 1: selfOnboarding is false or undefined
|
|
31
32
|
s.extend({
|
|
32
33
|
selfOnboarding: t.union([t.literal(!1), t.undefined()])
|
|
@@ -35,8 +36,8 @@ const s = t.object({
|
|
|
35
36
|
s.extend({
|
|
36
37
|
selfOnboarding: t.literal(!0)
|
|
37
38
|
})
|
|
38
|
-
]),
|
|
39
|
-
const { t: e } = f("Employee.HomeAddress"), r = C(), { isSelfOnboardingIntended: m, isAdmin: c, hasCompletedSelfOnboarding: h } = b(), { watch:
|
|
39
|
+
]), B = () => {
|
|
40
|
+
const { t: e } = f("Employee.HomeAddress"), r = C(), { isSelfOnboardingIntended: m, isAdmin: c, hasCompletedSelfOnboarding: h } = b(), { watch: p } = g(), u = p("courtesyWithholding");
|
|
40
41
|
return c && m && !h ? null : /* @__PURE__ */ n(a, { children: [
|
|
41
42
|
/* @__PURE__ */ n("div", { children: [
|
|
42
43
|
/* @__PURE__ */ i(r.Heading, { as: "h2", children: e("formTitle") }),
|
|
@@ -116,12 +117,12 @@ const s = t.object({
|
|
|
116
117
|
] })
|
|
117
118
|
}
|
|
118
119
|
),
|
|
119
|
-
|
|
120
|
+
u && /* @__PURE__ */ i(r.Alert, { label: e("withholdingTitle"), status: "warning", children: /* @__PURE__ */ i(d, { t: e, i18nKey: "withholdingNote" }) })
|
|
120
121
|
] });
|
|
121
122
|
};
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
B as HomeAddress,
|
|
125
|
+
k as HomeAddressSchema,
|
|
126
|
+
$ as HomeAddressSchemaWithCompletedOnboarding
|
|
126
127
|
};
|
|
127
128
|
//# sourceMappingURL=HomeAddress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HomeAddress.js","sources":["../../../../src/components/Employee/Profile/HomeAddress.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { useProfile } from './useProfile'\nimport { STATES_ABBR } from '@/shared/constants'\nimport { CheckboxField, Grid, SelectField, TextInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst HomeAddressFieldsSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().refine(zip => /(^\\d{5}$)|(^\\d{5}-\\d{4}$)/.test(zip)),\n courtesyWithholding: z.boolean(),\n})\n\nexport const HomeAddressSchema = z.union([\n // Case 1: selfOnboarding is false or undefined\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.union([z.literal(false), z.undefined()]),\n }),\n // Case 2: selfOnboarding is true\n z.object({\n selfOnboarding: z.literal(true),\n }),\n])\n\nexport const HomeAddressSchemaWithCompletedOnboarding = z.union([\n // Case 1: selfOnboarding is false or undefined\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.union([z.literal(false), z.undefined()]),\n }),\n // Case 2: selfOnboarding is true but admin can update completed onboarding\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.literal(true),\n }),\n])\n\nexport type HomeAddressInputs = z.infer<typeof HomeAddressSchema>\n\nexport const HomeAddress = () => {\n const { t } = useTranslation('Employee.HomeAddress')\n const Components = useComponentContext()\n const { isSelfOnboardingIntended, isAdmin, hasCompletedSelfOnboarding } = useProfile()\n\n const { watch } = useFormContext<HomeAddressInputs>()\n const watchedCourtesyWithholding = watch('courtesyWithholding')\n\n if (isAdmin && isSelfOnboardingIntended && !hasCompletedSelfOnboarding) {\n return null\n }\n\n return (\n <>\n <div>\n <Components.Heading as=\"h2\">{t('formTitle')}</Components.Heading>\n <Components.Text>{t('desc')}</Components.Text>\n </div>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: ['1fr', '1fr'],\n }}\n gap={20}\n >\n <TextInputField\n name=\"street1\"\n label={t('street1')}\n isRequired\n errorMessage={t('validations.street1')}\n />\n <TextInputField name=\"street2\" label={t('street2')} />\n <TextInputField\n name=\"city\"\n isRequired\n label={t('city')}\n errorMessage={t('validations.city')}\n />\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map((stateAbbr: (typeof STATES_ABBR)[number]) => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common' }),\n value: stateAbbr,\n }))}\n label={t('state')}\n placeholder={t('statePlaceholder')}\n errorMessage={t('validations.state')}\n isRequired\n />\n <TextInputField\n name=\"zip\"\n isRequired\n label={t('zip')}\n errorMessage={t('validations.zip')}\n />\n </Grid>\n <CheckboxField\n name=\"courtesyWithholding\"\n label={t('courtesyWithholdingLabel')}\n description={\n <>\n {t('courtesyWithholdingDescription')}\n <Trans\n t={t}\n i18nKey=\"learnMoreCta\"\n components={{\n LearnMoreLink: <Components.Link />,\n }}\n />\n </>\n }\n />\n {watchedCourtesyWithholding && (\n <Components.Alert label={t('withholdingTitle')} status=\"warning\">\n <Trans t={t} i18nKey=\"withholdingNote\" />\n </Components.Alert>\n )}\n </>\n )\n}\n"],"names":["HomeAddressFieldsSchema","z","zip","HomeAddressSchema","HomeAddressSchemaWithCompletedOnboarding","HomeAddress","t","useTranslation","Components","useComponentContext","isSelfOnboardingIntended","isAdmin","hasCompletedSelfOnboarding","useProfile","watch","useFormContext","watchedCourtesyWithholding","jsxs","Fragment","jsx","Grid","TextInputField","SelectField","STATES_ABBR","stateAbbr","CheckboxField","Trans"],"mappings":"
|
|
1
|
+
{"version":3,"file":"HomeAddress.js","sources":["../../../../src/components/Employee/Profile/HomeAddress.tsx"],"sourcesContent":["import { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { useProfile } from './useProfile'\nimport { STATES_ABBR } from '@/shared/constants'\nimport { CheckboxField, Grid, SelectField, TextInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst HomeAddressFieldsSchema = z.object({\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().refine(zip => /(^\\d{5}$)|(^\\d{5}-\\d{4}$)/.test(zip)),\n courtesyWithholding: z.boolean(),\n})\n\nexport const HomeAddressSchema = z.union([\n // Case 1: selfOnboarding is false or undefined\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.union([z.literal(false), z.undefined()]),\n }),\n // Case 2: selfOnboarding is true\n z.object({\n selfOnboarding: z.literal(true),\n }),\n])\n\nexport const HomeAddressSchemaWithCompletedOnboarding = z.union([\n // Case 1: selfOnboarding is false or undefined\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.union([z.literal(false), z.undefined()]),\n }),\n // Case 2: selfOnboarding is true but admin can update completed onboarding\n HomeAddressFieldsSchema.extend({\n selfOnboarding: z.literal(true),\n }),\n])\n\nexport type HomeAddressInputs = z.infer<typeof HomeAddressSchema>\n\nexport const HomeAddress = () => {\n const { t } = useTranslation('Employee.HomeAddress')\n const Components = useComponentContext()\n const { isSelfOnboardingIntended, isAdmin, hasCompletedSelfOnboarding } = useProfile()\n\n const { watch } = useFormContext<HomeAddressInputs>()\n const watchedCourtesyWithholding = watch('courtesyWithholding')\n\n if (isAdmin && isSelfOnboardingIntended && !hasCompletedSelfOnboarding) {\n return null\n }\n\n return (\n <>\n <div>\n <Components.Heading as=\"h2\">{t('formTitle')}</Components.Heading>\n <Components.Text>{t('desc')}</Components.Text>\n </div>\n <Grid\n gridTemplateColumns={{\n base: '1fr',\n small: ['1fr', '1fr'],\n }}\n gap={20}\n >\n <TextInputField\n name=\"street1\"\n label={t('street1')}\n isRequired\n errorMessage={t('validations.street1')}\n />\n <TextInputField name=\"street2\" label={t('street2')} />\n <TextInputField\n name=\"city\"\n isRequired\n label={t('city')}\n errorMessage={t('validations.city')}\n />\n <SelectField\n name=\"state\"\n options={STATES_ABBR.map((stateAbbr: (typeof STATES_ABBR)[number]) => ({\n label: t(`statesHash.${stateAbbr}`, { ns: 'common' }),\n value: stateAbbr,\n }))}\n label={t('state')}\n placeholder={t('statePlaceholder')}\n errorMessage={t('validations.state')}\n isRequired\n />\n <TextInputField\n name=\"zip\"\n isRequired\n label={t('zip')}\n errorMessage={t('validations.zip')}\n />\n </Grid>\n <CheckboxField\n name=\"courtesyWithholding\"\n label={t('courtesyWithholdingLabel')}\n description={\n <>\n {t('courtesyWithholdingDescription')}\n <Trans\n t={t}\n i18nKey=\"learnMoreCta\"\n components={{\n LearnMoreLink: <Components.Link />,\n }}\n />\n </>\n }\n />\n {watchedCourtesyWithholding && (\n <Components.Alert label={t('withholdingTitle')} status=\"warning\">\n <Trans t={t} i18nKey=\"withholdingNote\" />\n </Components.Alert>\n )}\n </>\n )\n}\n"],"names":["HomeAddressFieldsSchema","z","zip","HomeAddressSchema","HomeAddressSchemaWithCompletedOnboarding","HomeAddress","t","useTranslation","Components","useComponentContext","isSelfOnboardingIntended","isAdmin","hasCompletedSelfOnboarding","useProfile","watch","useFormContext","watchedCourtesyWithholding","jsxs","Fragment","jsx","Grid","TextInputField","SelectField","STATES_ABBR","stateAbbr","CheckboxField","Trans"],"mappings":";;;;;;;;;;;;;AAQA,MAAMA,IAA0BC,EAAE,OAAO;AAAA,EACvC,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,KAAKA,EAAE,OAAA,EAAS,OAAO,CAAAC,MAAO,4BAA4B,KAAKA,CAAG,CAAC;AAAA,EACnE,qBAAqBD,EAAE,QAAA;AACzB,CAAC,GAEYE,IAAoBF,EAAE,MAAM;AAAA;AAAA,EAEvCD,EAAwB,OAAO;AAAA,IAC7B,gBAAgBC,EAAE,MAAM,CAACA,EAAE,QAAQ,EAAK,GAAGA,EAAE,WAAW,CAAC;AAAA,EAAA,CAC1D;AAAA;AAAA,EAEDA,EAAE,OAAO;AAAA,IACP,gBAAgBA,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC/B;AACH,CAAC,GAEYG,IAA2CH,EAAE,MAAM;AAAA;AAAA,EAE9DD,EAAwB,OAAO;AAAA,IAC7B,gBAAgBC,EAAE,MAAM,CAACA,EAAE,QAAQ,EAAK,GAAGA,EAAE,WAAW,CAAC;AAAA,EAAA,CAC1D;AAAA;AAAA,EAEDD,EAAwB,OAAO;AAAA,IAC7B,gBAAgBC,EAAE,QAAQ,EAAI;AAAA,EAAA,CAC/B;AACH,CAAC,GAIYI,IAAc,MAAM;AAC/B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7CC,IAAaC,EAAA,GACb,EAAE,0BAAAC,GAA0B,SAAAC,GAAS,4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cAAcA,EAAE,mBAAmB;AAAA,cACnC,YAAU;AAAA,YAAA;AAAA,UAAA;AAAA,UAEZ,gBAAAa;AAAA,YAACE;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,YAAU;AAAA,cACV,OAAOf,EAAE,KAAK;AAAA,cACd,cAAcA,EAAE,iBAAiB;AAAA,YAAA;AAAA,UAAA;AAAA,QACnC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAAa;AAAA,MAACM;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOnB,EAAE,0BAA0B;AAAA,QACnC,aACE,gBAAAW,EAAAC,GAAA,EACG,UAAA;AAAA,UAAAZ,EAAE,gCAAgC;AAAA,UACnC,gBAAAa;AAAA,YAACO;AAAA,YAAA;AAAA,cACC,GAAApB;AAAA,cACA,SAAQ;AAAA,cACR,YAAY;AAAA,gBACV,eAAe,gBAAAa,EAACX,EAAW,MAAX,CAAA,CAAgB;AAAA,cAAA;AAAA,YAClC;AAAA,UAAA;AAAA,QACF,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,IAGHQ,KACC,gBAAAG,EAACX,EAAW,OAAX,EAAiB,OAAOF,EAAE,kBAAkB,GAAG,QAAO,WACrD,UAAA,gBAAAa,EAACO,GAAA,EAAM,GAAApB,GAAM,SAAQ,mBAAkB,EAAA,CACzC;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -4,6 +4,7 @@ import { useFormContext as c } from "react-hook-form";
|
|
|
4
4
|
import { useTranslation as s } from "react-i18next";
|
|
5
5
|
import "../../../shared/constants.js";
|
|
6
6
|
import { Grid as b } from "../../Common/Grid/Grid.js";
|
|
7
|
+
import "classnames";
|
|
7
8
|
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
8
9
|
import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
9
10
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
@@ -17,7 +18,7 @@ const v = t.object({
|
|
|
17
18
|
middleInitial: t.string().optional(),
|
|
18
19
|
lastName: m
|
|
19
20
|
});
|
|
20
|
-
function
|
|
21
|
+
function G() {
|
|
21
22
|
const { t: e } = s("Employee.Profile");
|
|
22
23
|
return /* @__PURE__ */ l(d, { children: [
|
|
23
24
|
/* @__PURE__ */ l(b, { gap: { base: 20, small: 8 }, gridTemplateColumns: { base: "1fr", small: ["1fr", 200] }, children: [
|
|
@@ -48,7 +49,7 @@ const O = t.object({
|
|
|
48
49
|
startDate: t.date().transform((e) => e.toISOString().split("T")[0]),
|
|
49
50
|
email: t.string().email()
|
|
50
51
|
});
|
|
51
|
-
function
|
|
52
|
+
function V({ companyLocations: e }) {
|
|
52
53
|
const { t: r } = s("Employee.Profile"), {
|
|
53
54
|
formState: { errors: n }
|
|
54
55
|
} = c();
|
|
@@ -95,7 +96,7 @@ const R = t.object({
|
|
|
95
96
|
ssn: t.string().transform((e) => S(e)).refine((e) => D.test(e)),
|
|
96
97
|
enableSsn: t.boolean()
|
|
97
98
|
});
|
|
98
|
-
function
|
|
99
|
+
function X({ employee: e, onChange: r }) {
|
|
99
100
|
const { setValue: n } = c(), { t: i } = s("Employee.Profile"), u = h(e?.hasSsn);
|
|
100
101
|
return /* @__PURE__ */ a(
|
|
101
102
|
o,
|
|
@@ -115,7 +116,7 @@ function V({ employee: e, onChange: r }) {
|
|
|
115
116
|
const y = t.object({
|
|
116
117
|
dateOfBirth: t.date().transform((e) => e.toISOString().split("T")[0])
|
|
117
118
|
});
|
|
118
|
-
function
|
|
119
|
+
function _() {
|
|
119
120
|
const { t: e } = s("Employee.Profile");
|
|
120
121
|
return /* @__PURE__ */ a(
|
|
121
122
|
p,
|
|
@@ -132,13 +133,13 @@ v.merge(O).merge(R).merge(y).extend({
|
|
|
132
133
|
enableSsn: t.boolean()
|
|
133
134
|
});
|
|
134
135
|
export {
|
|
135
|
-
|
|
136
|
+
V as AdminInputs,
|
|
136
137
|
O as AdminInputsSchema,
|
|
137
|
-
|
|
138
|
+
_ as DateOfBirthInput,
|
|
138
139
|
y as DateOfBirthSchema,
|
|
139
|
-
|
|
140
|
+
G as NameInputs,
|
|
140
141
|
v as NameInputsSchema,
|
|
141
|
-
|
|
142
|
+
X as SocialSecurityNumberInput,
|
|
142
143
|
R as SocialSecurityNumberSchema
|
|
143
144
|
};
|
|
144
145
|
//# sourceMappingURL=PersonalDetailsInputs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n isRequired\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n isRequired\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","DateOfBirthSchema","DateOfBirthInput"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PersonalDetailsInputs.js","sources":["../../../../src/components/Employee/Profile/PersonalDetailsInputs.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { type Location } from '@gusto/embedded-api/models/components/location'\nimport { type Employee } from '@gusto/embedded-api/models/components/employee'\nimport { SelectField, TextInputField, Grid, DatePickerField } from '@/components/Common'\nimport { addressInline, removeNonDigits } from '@/helpers/formattedStrings'\nimport { normalizeSSN, usePlaceholderSSN } from '@/helpers/ssn'\nimport { nameValidation, SSN_REGEX } from '@/helpers/validations'\n\nexport const NameInputsSchema = z.object({\n firstName: nameValidation,\n middleInitial: z.string().optional(),\n lastName: nameValidation,\n})\n\nexport function NameInputs() {\n const { t } = useTranslation('Employee.Profile')\n\n return (\n <>\n <Grid gap={{ base: 20, small: 8 }} gridTemplateColumns={{ base: '1fr', small: ['1fr', 200] }}>\n <TextInputField\n name=\"firstName\"\n isRequired\n label={t('firstName')}\n errorMessage={t('validations.firstName')}\n />\n <TextInputField name=\"middleInitial\" label={t('middleInitial')} />\n </Grid>\n <TextInputField\n name=\"lastName\"\n isRequired\n label={t('lastName')}\n errorMessage={t('validations.lastName')}\n />\n </>\n )\n}\n\nexport const AdminInputsSchema = z.object({\n workAddress: z.string().min(1),\n startDate: z.date().transform(date => date.toISOString().split('T')[0]),\n email: z.string().email(),\n})\n\ntype AdminInputsSchemaType = z.infer<typeof AdminInputsSchema>\n\ninterface AdminInputsProps {\n companyLocations: Location[]\n}\n\nexport function AdminInputs({ companyLocations }: AdminInputsProps) {\n const { t } = useTranslation('Employee.Profile')\n const {\n formState: { errors },\n } = useFormContext<AdminInputsSchemaType>()\n\n return (\n <>\n <SelectField\n name=\"workAddress\"\n options={companyLocations.map(location => ({\n value: location.uuid,\n label: addressInline(location),\n }))}\n label={t('workAddress')}\n description={t('workAddressDescription')}\n placeholder={t('workAddressPlaceholder')}\n errorMessage={t('validations.location', { ns: 'common' })}\n isRequired\n />\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n description={t('startDateDescription')}\n isRequired\n errorMessage={\n errors.startDate?.type === 'custom'\n ? t('validations.startDateOutOfRange')\n : t('validations.startDate')\n }\n />\n <TextInputField\n name=\"email\"\n label={t('email')}\n description={t('emailDescription')}\n errorMessage={t('validations.email')}\n isRequired\n type=\"email\"\n />\n </>\n )\n}\n\nexport const SocialSecurityNumberSchema = z.object({\n ssn: z\n .string()\n .transform(input => removeNonDigits(input))\n .refine(input => SSN_REGEX.test(input)),\n enableSsn: z.boolean(),\n})\n\ntype SocialSecurityNumberSchemaType = z.infer<typeof SocialSecurityNumberSchema>\n\ninterface SocialSecurityNumberInputProps {\n employee?: Employee\n onChange?: (updatedValue: string) => void\n}\n\nexport function SocialSecurityNumberInput({ employee, onChange }: SocialSecurityNumberInputProps) {\n const { setValue } = useFormContext<SocialSecurityNumberSchemaType>()\n const { t } = useTranslation('Employee.Profile')\n const placeholderSSN = usePlaceholderSSN(employee?.hasSsn)\n return (\n <TextInputField\n isRequired\n name=\"ssn\"\n label={t('ssnLabel')}\n errorMessage={t('validations.ssn', { ns: 'common' })}\n placeholder={placeholderSSN}\n transform={normalizeSSN}\n onChange={updatedValue => {\n setValue('enableSsn', true)\n onChange?.(updatedValue)\n }}\n />\n )\n}\n\nexport const DateOfBirthSchema = z.object({\n dateOfBirth: z.date().transform(date => date.toISOString().split('T')[0]),\n})\n\nexport function DateOfBirthInput() {\n const { t } = useTranslation('Employee.Profile')\n return (\n <DatePickerField\n name=\"dateOfBirth\"\n label={t('dobLabel')}\n isRequired\n errorMessage={t('validations.dob', { ns: 'common' })}\n />\n )\n}\n\n// All possible inputs for PersonalDetails forms\nconst PersonalDetailsTotalSchema = NameInputsSchema.merge(AdminInputsSchema)\n .merge(SocialSecurityNumberSchema)\n .merge(DateOfBirthSchema)\n .extend({\n selfOnboarding: z.boolean(),\n enableSsn: z.boolean(),\n })\n\ntype NullableDatesMapper<Source> = {\n [Property in keyof Source]: Source[Property] extends Date\n ? Source[Property] | null\n : Source[Property]\n}\n\nexport type PersonalDetailsPayload = z.infer<typeof PersonalDetailsTotalSchema>\n\n//Typescript magic to mark date fields as nullable for correct defaultvalues\nexport type PersonalDetailsInputs = NullableDatesMapper<z.input<typeof PersonalDetailsTotalSchema>>\n"],"names":["NameInputsSchema","z","nameValidation","NameInputs","t","useTranslation","jsxs","Fragment","Grid","jsx","TextInputField","AdminInputsSchema","date","AdminInputs","companyLocations","errors","useFormContext","SelectField","location","addressInline","DatePickerField","SocialSecurityNumberSchema","input","removeNonDigits","SSN_REGEX","SocialSecurityNumberInput","employee","onChange","setValue","placeholderSSN","usePlaceholderSSN","normalizeSSN","updatedValue","D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AA,IAAaZ,EAAA,GACf,EAAE,GAAAZ,EAAA,IAAMC,EAAe,kBAAkB,GACzCwB,IAAiBC,EAAkBJ,GAAU,MAAM;AACzD,SACE,gBAAAjB;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,YAAU;AAAA,MACV,MAAK;AAAA,MACL,OAAON,EAAE,UAAU;AAAA,MACnB,cAAcA,EAAE,mBAAmB,EAAE,IAAI,UAAU;AAAA,MACnD,aAAayB;AAAA,MACb,WAAWE;AAAA,MACX,UAAU,CAAAC,MAAgB;AACxB,QAAAJ,EAAS,aAAa,EAAI,GAC1BD,IAAWK,CAAY;AAAA,MACzB;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,MAAMC,IAAoBhC,EAAE,OAAO;AAAA,EACxC,aAAaA,EAAE,KAAA,EAAO,UAAU,CAAAW,MAAQA,EAAK,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,CAAC;AAC1E,CAAC;AAEM,SAASsB,IAAmB;AACjC,QAAM,EAAE,GAAA9B,EAAA,IAAMC,EAAe,kBAAkB;AAC/C,SACE,gBAAAI;AAAA,IAACW;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,OAAOhB,EAAE,UAAU;AAAA,MACnB,YAAU;AAAA,MACV,cAAcA,EAAE,mBAAmB,EAAE,IAAI,UAAU;AAAA,IAAA;AAAA,EAAA;AAGzD;AAGmCJ,EAAiB,MAAMW,CAAiB,EACxE,MAAMU,CAA0B,EAChC,MAAMY,CAAiB,EACvB,OAAO;AAAA,EACN,gBAAgBhC,EAAE,QAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AACf,CAAC;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as G } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as N } from "react";
|
|
3
3
|
import { useTranslation as S, Trans as O } from "react-i18next";
|
|
4
4
|
import { useFormatEmployeePayRate as V, getRegularHours as _, getOvertimeHours as z, formatHoursDisplay as P, getTotalPtoHours as K, getAdditionalEarnings as W, getReimbursements as X, calculateGrossPay as q } from "../helpers.js";
|
|
@@ -7,6 +7,7 @@ import k from "./PayrollConfigurationPresentation.module.scss.js";
|
|
|
7
7
|
import { useI18n as Q } from "../../../i18n/I18n.js";
|
|
8
8
|
import { Flex as m, FlexItem as h } from "../../Common/Flex/Flex.js";
|
|
9
9
|
import { Grid as Y } from "../../Common/Grid/Grid.js";
|
|
10
|
+
import "classnames";
|
|
10
11
|
import { HamburgerMenu as Z } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
11
12
|
import { useComponentContext as $ } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
13
|
import ee from "../../../assets/icons/pencil.svg.js";
|
|
@@ -14,11 +15,11 @@ import te from "../../../assets/icons/x-circle.svg.js";
|
|
|
14
15
|
import re from "../../../assets/icons/plus-circle.svg.js";
|
|
15
16
|
import { formatNumberAsCurrency as f, firstLastName as ne } from "../../../helpers/formattedStrings.js";
|
|
16
17
|
import { useDateFormatter as ie } from "../../../hooks/useDateFormatter.js";
|
|
17
|
-
import { useLoadingIndicator as
|
|
18
|
-
import { useContainerBreakpoints as
|
|
18
|
+
import { useLoadingIndicator as oe } from "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
19
|
+
import { useContainerBreakpoints as le } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
19
20
|
import { DataView as ae } from "../../Common/DataView/DataView.js";
|
|
20
|
-
const se = (
|
|
21
|
-
employeeCompensations:
|
|
21
|
+
const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate, l.endDate) : { startDate: "", endDate: "" }, Ie = ({
|
|
22
|
+
employeeCompensations: l,
|
|
22
23
|
employeeDetails: u,
|
|
23
24
|
payPeriod: y,
|
|
24
25
|
paySchedule: T,
|
|
@@ -35,12 +36,12 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
35
36
|
}) => {
|
|
36
37
|
const { Button: x, Heading: g, Text: i, Badge: R, LoadingSpinner: A, Alert: F } = $();
|
|
37
38
|
Q("Payroll.PayrollConfiguration");
|
|
38
|
-
const { t: r } = S("Payroll.PayrollConfiguration"), B = ie(), { LoadingIndicator: L } =
|
|
39
|
+
const { t: r } = S("Payroll.PayrollConfiguration"), B = ie(), { LoadingIndicator: L } = oe(), U = V(), w = N(null), a = le({ ref: w }).includes("small"), c = new Map(u.map((t) => [t.uuid, t])), j = (t) => {
|
|
39
40
|
const n = c.get(t);
|
|
40
41
|
return n ? ne({ first_name: n.firstName, last_name: n.lastName }) : null;
|
|
41
42
|
};
|
|
42
|
-
return /* @__PURE__ */ e("div", { ref: w, className: k.container, children: /* @__PURE__ */
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
return /* @__PURE__ */ e("div", { ref: w, className: k.container, children: /* @__PURE__ */ o(m, { flexDirection: "column", gap: 16, children: [
|
|
44
|
+
/* @__PURE__ */ o(
|
|
44
45
|
m,
|
|
45
46
|
{
|
|
46
47
|
flexDirection: a ? "row" : "column",
|
|
@@ -48,7 +49,7 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
48
49
|
alignItems: a ? "center" : "stretch",
|
|
49
50
|
gap: a ? 0 : 16,
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ o(h, { children: [
|
|
52
53
|
/* @__PURE__ */ e(g, { as: "h1", children: r("pageTitle") }),
|
|
53
54
|
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
54
55
|
O,
|
|
@@ -80,15 +81,15 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
80
81
|
]
|
|
81
82
|
}
|
|
82
83
|
),
|
|
83
|
-
(C || d) && /* @__PURE__ */
|
|
84
|
+
(C || d) && /* @__PURE__ */ o(Y, { gap: 16, gridTemplateColumns: "1fr", children: [
|
|
84
85
|
d && /* @__PURE__ */ e(F, { status: "info", label: d.label, children: d.content }),
|
|
85
86
|
C
|
|
86
87
|
] }),
|
|
87
|
-
p ? /* @__PURE__ */ e(L, { children: /* @__PURE__ */
|
|
88
|
+
p ? /* @__PURE__ */ e(L, { children: /* @__PURE__ */ o(m, { flexDirection: "column", alignItems: "center", gap: 4, children: [
|
|
88
89
|
/* @__PURE__ */ e(A, { size: "lg" }),
|
|
89
90
|
/* @__PURE__ */ e(g, { as: "h4", children: r("loadingTitle") }),
|
|
90
91
|
/* @__PURE__ */ e(i, { children: r("loadingDescription") })
|
|
91
|
-
] }) }) : /* @__PURE__ */
|
|
92
|
+
] }) }) : /* @__PURE__ */ o(G, { children: [
|
|
92
93
|
/* @__PURE__ */ e("div", { className: k.payrollBlockerContainer, children: D.length > 0 && /* @__PURE__ */ e(
|
|
93
94
|
J,
|
|
94
95
|
{
|
|
@@ -96,7 +97,7 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
96
97
|
onMultipleViewClick: H
|
|
97
98
|
}
|
|
98
99
|
) }),
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
+
/* @__PURE__ */ o(h, { children: [
|
|
100
101
|
/* @__PURE__ */ e(g, { as: "h3", children: r("hoursAndEarningsTitle") }),
|
|
101
102
|
/* @__PURE__ */ e(i, { children: r("hoursAndEarningsDescription") })
|
|
102
103
|
] }),
|
|
@@ -109,7 +110,7 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
109
110
|
title: /* @__PURE__ */ e(i, { weight: "semibold", children: r("tableColumns.employees") }),
|
|
110
111
|
render: (t) => {
|
|
111
112
|
const n = c.get(t.employeeUuid || ""), s = U(n);
|
|
112
|
-
return /* @__PURE__ */
|
|
113
|
+
return /* @__PURE__ */ o(m, { flexDirection: "column", gap: 8, children: [
|
|
113
114
|
/* @__PURE__ */ e(i, { weight: "semibold", children: j(t.employeeUuid || "") }),
|
|
114
115
|
s && /* @__PURE__ */ e(i, { variant: "supporting", children: s }),
|
|
115
116
|
t.excluded && /* @__PURE__ */ e(R, { status: "warning", children: r("skippedBadge") })
|
|
@@ -158,7 +159,7 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
],
|
|
161
|
-
data:
|
|
162
|
+
data: l,
|
|
162
163
|
itemMenu: (t) => /* @__PURE__ */ e(
|
|
163
164
|
Z,
|
|
164
165
|
{
|
|
@@ -189,6 +190,6 @@ const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate,
|
|
|
189
190
|
] }) });
|
|
190
191
|
};
|
|
191
192
|
export {
|
|
192
|
-
|
|
193
|
+
Ie as PayrollConfigurationPresentation
|
|
193
194
|
};
|
|
194
195
|
//# sourceMappingURL=PayrollConfigurationPresentation.js.map
|
package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useLoadingIndicator } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n isOffCycle?: boolean\n alerts?: ReactNode\n payrollDeadlineNotice?: {\n label: string\n content?: ReactNode\n }\n isPending?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n isOffCycle = false,\n alerts,\n payrollDeadlineNotice,\n isPending,\n payrollBlockers = [],\n pagination,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, LoadingSpinner, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const { LoadingIndicator } = useLoadingIndicator()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n <Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={getPayrollConfigurationTitle(payPeriod, dateFormatter)}\n />\n </Text>\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollDeadlineNotice) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollDeadlineNotice && (\n <Alert status=\"info\" label={payrollDeadlineNotice.label}>\n {payrollDeadlineNotice.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <LoadingIndicator>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={4}>\n <LoadingSpinner size=\"lg\" />\n <Heading as=\"h4\">{t('loadingTitle')}</Heading>\n <Text>{t('loadingDescription')}</Text>\n </Flex>\n </LoadingIndicator>\n ) : (\n <>\n <div className={styles.payrollBlockerContainer}>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onMultipleViewClick={onViewBlockers}\n />\n )}\n </div>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return <Text>{formatHoursDisplay(hours + overtimeHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","isOffCycle","alerts","payrollDeadlineNotice","isPending","payrollBlockers","pagination","Button","Heading","Text","Badge","LoadingSpinner","Alert","useComponentContext","useI18n","t","useTranslation","useDateFormatter","LoadingIndicator","useLoadingIndicator","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle"],"mappings":";;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,aAAaA,EAAU,UAC7BC,EAAc,gBAAgBD,EAAU,WAAWA,EAAU,OAAO,IAEtE,EAAE,WAAW,IAAI,SAAS,GAAA,GAGtBE,KAAmC,CAAC;AAAA,EAC/C,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAJ;AAAA,EACA,aAAAK;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,YAAAC;AACF,MAA6C;AAC3C,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,gBAAAC,GAAgB,OAAAC,EAAA,IAAUC,EAAA;AAChE,EAAAC,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrDxB,IAAgByB,GAAA,GAChB,EAAE,kBAAAC,EAAA,IAAqBC,GAAA,GACvBC,IAAwBC,EAAA,GACxBC,IAAeC,EAAuB,IAAI,GAE1CC,IADcC,GAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO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SAAS,MAAM;AACb,0BAAM/B,IAAWD,EAAY,IAAIe,EAAK,gBAAgB,EAAE;AACxD,oBAAId,KACF9B,EAAO8B,CAAQ;AAAA,kBAEnB;AAAA,gBAAA;AAAA,gBAEF;AAAA,kBACE,OAAOZ,EAAE0B,EAAK,WAAW,oBAAoB,eAAe;AAAA,kBAC5D,MAAMA,EAAK,WAAW,gBAAAV,EAAC4B,IAAA,EAAW,eAAW,GAAA,CAAC,IAAK,gBAAA5B,EAAC6B,IAAA,EAAQ,eAAW,GAAA,CAAC;AAAA,kBACxE,SAAS,MAAM;AAEb,oBADiBlC,EAAY,IAAIe,EAAK,gBAAgB,EAAE,KAEtD3C,EAAgB2C,CAAI;AAAA,kBAExB;AAAA,gBAAA;AAAA,cACF;AAAA,cAEF,cAAc1B,EAAE,eAAe;AAAA,YAAA;AAAA,UAAA;AAAA,UAGnC,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useLoadingIndicator } from '@/contexts/LoadingIndicatorProvider/useLoadingIndicator'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n isOffCycle?: boolean\n alerts?: ReactNode\n payrollDeadlineNotice?: {\n label: string\n content?: ReactNode\n }\n isPending?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n isOffCycle = false,\n alerts,\n payrollDeadlineNotice,\n isPending,\n payrollBlockers = [],\n pagination,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, LoadingSpinner, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const { LoadingIndicator } = useLoadingIndicator()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n <Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={getPayrollConfigurationTitle(payPeriod, dateFormatter)}\n />\n </Text>\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollDeadlineNotice) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollDeadlineNotice && (\n <Alert status=\"info\" label={payrollDeadlineNotice.label}>\n {payrollDeadlineNotice.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <LoadingIndicator>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={4}>\n <LoadingSpinner size=\"lg\" />\n <Heading as=\"h4\">{t('loadingTitle')}</Heading>\n <Text>{t('loadingDescription')}</Text>\n </Flex>\n </LoadingIndicator>\n ) : (\n <>\n <div className={styles.payrollBlockerContainer}>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onMultipleViewClick={onViewBlockers}\n />\n )}\n </div>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return <Text>{formatHoursDisplay(hours + overtimeHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","isOffCycle","alerts","payrollDeadlineNotice","isPending","payrollBlockers","pagination","Button","Heading","Text","Badge","LoadingSpinner","Alert","useComponentContext","useI18n","t","useTranslation","useDateFormatter","LoadingIndicator","useLoadingIndicator","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,aAAaA,EAAU,UAC7BC,EAAc,gBAAgBD,EAAU,WAAWA,EAAU,OAAO,IAEtE,EAAE,WAAW,IAAI,SAAS,GAAA,GAGtBE,KAAmC,CAAC;AAAA,EAC/C,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAJ;AAAA,EACA,aAAAK;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,YAAAC;AACF,MAA6C;AAC3C,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,gBAAAC,GAAgB,OAAAC,EAAA,IAAUC,EAAA;AAChE,EAAAC,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrDxB,IAAgByB,GAAA,GAChB,EAAE,kBAAAC,EAAA,IAAqBC,GAAA,GACvBC,IAAwBC,EAAA,GACxBC,IAAeC,EAAuB,IAAI,GAE1CC,IADcC,GAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO,GAExCI,IAAc,IAAI,IAAI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,IAAWD,EAAY,IAAIe,EAAK,gBAAgB,EAAE;AACxD,oBAAId,KACF9B,EAAO8B,CAAQ;AAAA,kBAEnB;AAAA,gBAAA;AAAA,gBAEF;AAAA,kBACE,OAAOZ,EAAE0B,EAAK,WAAW,oBAAoB,eAAe;AAAA,kBAC5D,MAAMA,EAAK,WAAW,gBAAAV,EAAC4B,IAAA,EAAW,eAAW,GAAA,CAAC,IAAK,gBAAA5B,EAAC6B,IAAA,EAAQ,eAAW,GAAA,CAAC;AAAA,kBACxE,SAAS,MAAM;AAEb,oBADiBlC,EAAY,IAAIe,EAAK,gBAAgB,EAAE,KAEtD3C,EAAgB2C,CAAI;AAAA,kBAExB;AAAA,gBAAA;AAAA,cACF;AAAA,cAEF,cAAc1B,EAAE,eAAe;AAAA,YAAA;AAAA,UAAA;AAAA,UAGnC,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
@@ -9,12 +9,13 @@ import u from "./PayrollEditEmployeePresentation.module.scss.js";
|
|
|
9
9
|
import { TimeOffField as ee } from "./TimeOffField.js";
|
|
10
10
|
import { Flex as y } from "../../Common/Flex/Flex.js";
|
|
11
11
|
import { Grid as S } from "../../Common/Grid/Grid.js";
|
|
12
|
+
import "classnames";
|
|
12
13
|
import { RadioGroupField as te } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
13
14
|
import { TextInputField as R } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
14
15
|
import { useComponentContext as ne } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
16
|
import { useI18n as re } from "../../../i18n/I18n.js";
|
|
16
|
-
import { Form as
|
|
17
|
-
import { firstLastName as
|
|
17
|
+
import { Form as ie } from "../../Common/Form/Form.js";
|
|
18
|
+
import { firstLastName as se, formatNumberAsCurrency as oe } from "../../../helpers/formattedStrings.js";
|
|
18
19
|
import { getAdditionalEarningsCompensations as ae, getReimbursementCompensation as me, calculateGrossPay as G } from "../helpers.js";
|
|
19
20
|
import { HOURS_COMPENSATION_NAMES as k, EXCLUDED_ADDITIONAL_EARNINGS as le, COMPENSATION_NAME_DOUBLE_OVERTIME as de, COMPENSATION_NAME_OVERTIME as ue, COMPENSATION_NAME_REGULAR_HOURS as ce, COMPENSATION_NAME_REIMBURSEMENT as pe, COMPENSATION_NAME_CASH_TIPS as fe, COMPENSATION_NAME_COMMISSION as he, COMPENSATION_NAME_CORRECTION_PAYMENT as Ce, COMPENSATION_NAME_PAYCHECK_TIPS as Ne, COMPENSATION_NAME_BONUS as Ee } from "../../../shared/constants.js";
|
|
20
21
|
import { useContainerBreakpoints as ge } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
@@ -23,46 +24,46 @@ const be = m.object({
|
|
|
23
24
|
timeOffCompensations: m.record(m.string(), m.string().optional()),
|
|
24
25
|
fixedCompensations: m.record(m.string(), m.string().optional()),
|
|
25
26
|
paymentMethod: m.nativeEnum(A).optional()
|
|
26
|
-
}), w = (E, O, d,
|
|
27
|
+
}), w = (E, O, d, s) => {
|
|
27
28
|
const g = {
|
|
28
29
|
...O,
|
|
29
30
|
paymentMethod: E.paymentMethod
|
|
30
31
|
};
|
|
31
32
|
g.hourlyCompensations = O?.hourlyCompensations?.map(
|
|
32
|
-
(
|
|
33
|
-
const l =
|
|
33
|
+
(i) => {
|
|
34
|
+
const l = i.jobUuid && i.name ? E.hourlyCompensations[i.jobUuid]?.[i.name] : void 0;
|
|
34
35
|
return l ? {
|
|
35
|
-
...
|
|
36
|
+
...i,
|
|
36
37
|
hours: l
|
|
37
|
-
} :
|
|
38
|
+
} : i;
|
|
38
39
|
}
|
|
39
|
-
), g.paidTimeOff = d.map((
|
|
40
|
-
...
|
|
41
|
-
hours: E.timeOffCompensations[
|
|
40
|
+
), g.paidTimeOff = d.map((i) => ({
|
|
41
|
+
...i,
|
|
42
|
+
hours: E.timeOffCompensations[i.name]
|
|
42
43
|
}));
|
|
43
44
|
const b = [];
|
|
44
|
-
return Object.entries(E.fixedCompensations).forEach(([
|
|
45
|
+
return Object.entries(E.fixedCompensations).forEach(([i, l]) => {
|
|
45
46
|
const C = O?.fixedCompensations?.find(
|
|
46
|
-
(x) => x.name?.toLowerCase() ===
|
|
47
|
+
(x) => x.name?.toLowerCase() === i.toLowerCase()
|
|
47
48
|
);
|
|
48
49
|
l && (C ? b.push({
|
|
49
50
|
name: C.name,
|
|
50
51
|
jobUuid: C.jobUuid,
|
|
51
52
|
amount: l
|
|
52
53
|
}) : parseFloat(l) !== 0 && b.push({
|
|
53
|
-
name:
|
|
54
|
-
jobUuid:
|
|
54
|
+
name: i,
|
|
55
|
+
jobUuid: s,
|
|
55
56
|
amount: l
|
|
56
57
|
}));
|
|
57
58
|
}), g.fixedCompensations = b, g;
|
|
58
|
-
},
|
|
59
|
+
}, Be = ({
|
|
59
60
|
onSave: E,
|
|
60
61
|
onCancel: O,
|
|
61
62
|
employee: d,
|
|
62
|
-
employeeCompensation:
|
|
63
|
+
employeeCompensation: s,
|
|
63
64
|
isPending: g = !1,
|
|
64
65
|
fixedCompensationTypes: b,
|
|
65
|
-
payPeriodStartDate:
|
|
66
|
+
payPeriodStartDate: i,
|
|
66
67
|
paySchedule: l,
|
|
67
68
|
isOffCycle: C = !1
|
|
68
69
|
}) => {
|
|
@@ -71,21 +72,21 @@ const be = m.object({
|
|
|
71
72
|
const f = d.jobs?.find((e) => e.primary), T = f ? [f] : [], v = X(null), p = ge({
|
|
72
73
|
ref: v
|
|
73
74
|
}).includes("small");
|
|
74
|
-
|
|
75
|
+
s?.hourlyCompensations?.forEach((e) => {
|
|
75
76
|
const n = d.jobs?.find((o) => o.uuid === e.jobUuid);
|
|
76
77
|
n && !T.find((o) => o.uuid === n.uuid) && T.push(n);
|
|
77
78
|
});
|
|
78
|
-
const P = (
|
|
79
|
+
const P = (s?.paidTimeOff || []).filter((e) => e.name), _ = ae({
|
|
79
80
|
flsaStatus: f?.compensations?.[0]?.flsaStatus,
|
|
80
|
-
existingFixedCompensations:
|
|
81
|
+
existingFixedCompensations: s?.fixedCompensations || [],
|
|
81
82
|
primaryJobUuid: f?.uuid,
|
|
82
83
|
fixedCompensationTypes: b,
|
|
83
84
|
excludedTypes: le
|
|
84
85
|
}), N = me(
|
|
85
|
-
|
|
86
|
+
s?.fixedCompensations || [],
|
|
86
87
|
b,
|
|
87
88
|
f?.uuid
|
|
88
|
-
), F = (e, n) =>
|
|
89
|
+
), F = (e, n) => s?.hourlyCompensations?.find(
|
|
89
90
|
(o) => o.jobUuid === e && o.name?.toLowerCase() === n.toLowerCase()
|
|
90
91
|
), $ = (e) => {
|
|
91
92
|
switch (e) {
|
|
@@ -137,7 +138,7 @@ const be = m.object({
|
|
|
137
138
|
e[n.name] = n.amount ? n.amount : "";
|
|
138
139
|
}), N && (e[N.name] = N.amount ? N.amount : ""), e;
|
|
139
140
|
})(),
|
|
140
|
-
paymentMethod:
|
|
141
|
+
paymentMethod: s?.paymentMethod || A.DirectDeposit
|
|
141
142
|
}, I = W({
|
|
142
143
|
resolver: J(be),
|
|
143
144
|
defaultValues: B
|
|
@@ -156,41 +157,41 @@ const be = m.object({
|
|
|
156
157
|
paymentMethod: M.paymentMethod
|
|
157
158
|
}, o = w(
|
|
158
159
|
n,
|
|
159
|
-
|
|
160
|
-
(
|
|
160
|
+
s,
|
|
161
|
+
(s?.paidTimeOff || []).filter((h) => h.name),
|
|
161
162
|
f?.uuid
|
|
162
163
|
);
|
|
163
164
|
return G(
|
|
164
165
|
o,
|
|
165
166
|
d,
|
|
166
|
-
|
|
167
|
+
i,
|
|
167
168
|
l,
|
|
168
169
|
C
|
|
169
170
|
);
|
|
170
171
|
} catch {
|
|
171
|
-
return
|
|
172
|
-
i,
|
|
173
|
-
d,
|
|
172
|
+
return s ? G(
|
|
174
173
|
s,
|
|
174
|
+
d,
|
|
175
|
+
i,
|
|
175
176
|
l,
|
|
176
177
|
C
|
|
177
178
|
) : 0;
|
|
178
179
|
}
|
|
179
180
|
}, [
|
|
180
181
|
M,
|
|
181
|
-
|
|
182
|
+
s,
|
|
182
183
|
f?.uuid,
|
|
183
184
|
d,
|
|
184
|
-
|
|
185
|
+
i,
|
|
185
186
|
l,
|
|
186
187
|
C
|
|
187
|
-
]), V =
|
|
188
|
+
]), V = se({
|
|
188
189
|
first_name: d.firstName,
|
|
189
190
|
last_name: d.lastName
|
|
190
191
|
}), z = (e) => {
|
|
191
192
|
const n = w(
|
|
192
193
|
e,
|
|
193
|
-
|
|
194
|
+
s,
|
|
194
195
|
P,
|
|
195
196
|
f?.uuid
|
|
196
197
|
);
|
|
@@ -234,7 +235,7 @@ const be = m.object({
|
|
|
234
235
|
}
|
|
235
236
|
),
|
|
236
237
|
/* @__PURE__ */ a(K, { ...I, children: [
|
|
237
|
-
/* @__PURE__ */ a(
|
|
238
|
+
/* @__PURE__ */ a(ie, { children: [
|
|
238
239
|
T.length > 0 && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
|
|
239
240
|
/* @__PURE__ */ r(c, { as: "h3", children: t("regularHoursTitle") }),
|
|
240
241
|
T.map((e) => /* @__PURE__ */ a(y, { flexDirection: "column", gap: 8, children: [
|
|
@@ -333,6 +334,6 @@ const be = m.object({
|
|
|
333
334
|
};
|
|
334
335
|
export {
|
|
335
336
|
be as PayrollEditEmployeeFormSchema,
|
|
336
|
-
|
|
337
|
+
Be as PayrollEditEmployeePresentation
|
|
337
338
|
};
|
|
338
339
|
//# sourceMappingURL=PayrollEditEmployeePresentation.js.map
|