@gusto/embedded-react-sdk 0.23.0-rc.2 → 0.23.0-rc.3
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 +5 -6
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +4 -5
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +9 -10
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +6 -7
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +13 -14
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +2 -3
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +8 -9
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +8 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +16 -17
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +35 -36
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/package.json +2 -2
|
@@ -5,7 +5,6 @@ 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";
|
|
9
8
|
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
10
9
|
import { useComponentContext as C } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
10
|
import "react";
|
|
@@ -18,7 +17,7 @@ const s = t.object({
|
|
|
18
17
|
state: t.string().min(1),
|
|
19
18
|
zip: t.string().refine((e) => /(^\d{5}$)|(^\d{5}-\d{4}$)/.test(e)),
|
|
20
19
|
courtesyWithholding: t.boolean()
|
|
21
|
-
}),
|
|
20
|
+
}), L = t.union([
|
|
22
21
|
// Case 1: selfOnboarding is false or undefined
|
|
23
22
|
s.extend({
|
|
24
23
|
selfOnboarding: t.union([t.literal(!1), t.undefined()])
|
|
@@ -27,7 +26,7 @@ const s = t.object({
|
|
|
27
26
|
t.object({
|
|
28
27
|
selfOnboarding: t.literal(!0)
|
|
29
28
|
})
|
|
30
|
-
]),
|
|
29
|
+
]), k = t.union([
|
|
31
30
|
// Case 1: selfOnboarding is false or undefined
|
|
32
31
|
s.extend({
|
|
33
32
|
selfOnboarding: t.union([t.literal(!1), t.undefined()])
|
|
@@ -36,8 +35,8 @@ const s = t.object({
|
|
|
36
35
|
s.extend({
|
|
37
36
|
selfOnboarding: t.literal(!0)
|
|
38
37
|
})
|
|
39
|
-
]),
|
|
40
|
-
const { t: e } = f("Employee.HomeAddress"), r = C(), { isSelfOnboardingIntended: m, isAdmin: c, hasCompletedSelfOnboarding: h } = b(), { watch:
|
|
38
|
+
]), $ = () => {
|
|
39
|
+
const { t: e } = f("Employee.HomeAddress"), r = C(), { isSelfOnboardingIntended: m, isAdmin: c, hasCompletedSelfOnboarding: h } = b(), { watch: u } = g(), p = u("courtesyWithholding");
|
|
41
40
|
return c && m && !h ? null : /* @__PURE__ */ n(a, { children: [
|
|
42
41
|
/* @__PURE__ */ n("div", { children: [
|
|
43
42
|
/* @__PURE__ */ i(r.Heading, { as: "h2", children: e("formTitle") }),
|
|
@@ -117,12 +116,12 @@ const s = t.object({
|
|
|
117
116
|
] })
|
|
118
117
|
}
|
|
119
118
|
),
|
|
120
|
-
|
|
119
|
+
p && /* @__PURE__ */ i(r.Alert, { label: e("withholdingTitle"), status: "warning", children: /* @__PURE__ */ i(d, { t: e, i18nKey: "withholdingNote" }) })
|
|
121
120
|
] });
|
|
122
121
|
};
|
|
123
122
|
export {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
$ as HomeAddress,
|
|
124
|
+
L as HomeAddressSchema,
|
|
125
|
+
k as HomeAddressSchemaWithCompletedOnboarding
|
|
127
126
|
};
|
|
128
127
|
//# 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,4B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AAcA,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,7 +4,6 @@ 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";
|
|
8
7
|
import { TextInputField as o } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
9
8
|
import { DatePickerField as p } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
10
9
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
@@ -18,7 +17,7 @@ const v = t.object({
|
|
|
18
17
|
middleInitial: t.string().optional(),
|
|
19
18
|
lastName: m
|
|
20
19
|
});
|
|
21
|
-
function
|
|
20
|
+
function z() {
|
|
22
21
|
const { t: e } = s("Employee.Profile");
|
|
23
22
|
return /* @__PURE__ */ l(d, { children: [
|
|
24
23
|
/* @__PURE__ */ l(b, { gap: { base: 20, small: 8 }, gridTemplateColumns: { base: "1fr", small: ["1fr", 200] }, children: [
|
|
@@ -49,7 +48,7 @@ const O = t.object({
|
|
|
49
48
|
startDate: t.date().transform((e) => e.toISOString().split("T")[0]),
|
|
50
49
|
email: t.string().email()
|
|
51
50
|
});
|
|
52
|
-
function
|
|
51
|
+
function G({ companyLocations: e }) {
|
|
53
52
|
const { t: r } = s("Employee.Profile"), {
|
|
54
53
|
formState: { errors: n }
|
|
55
54
|
} = c();
|
|
@@ -96,7 +95,7 @@ const R = t.object({
|
|
|
96
95
|
ssn: t.string().transform((e) => S(e)).refine((e) => D.test(e)),
|
|
97
96
|
enableSsn: t.boolean()
|
|
98
97
|
});
|
|
99
|
-
function
|
|
98
|
+
function V({ employee: e, onChange: r }) {
|
|
100
99
|
const { setValue: n } = c(), { t: i } = s("Employee.Profile"), u = h(e?.hasSsn);
|
|
101
100
|
return /* @__PURE__ */ a(
|
|
102
101
|
o,
|
|
@@ -116,7 +115,7 @@ function X({ employee: e, onChange: r }) {
|
|
|
116
115
|
const y = t.object({
|
|
117
116
|
dateOfBirth: t.date().transform((e) => e.toISOString().split("T")[0])
|
|
118
117
|
});
|
|
119
|
-
function
|
|
118
|
+
function X() {
|
|
120
119
|
const { t: e } = s("Employee.Profile");
|
|
121
120
|
return /* @__PURE__ */ a(
|
|
122
121
|
p,
|
|
@@ -133,13 +132,13 @@ v.merge(O).merge(R).merge(y).extend({
|
|
|
133
132
|
enableSsn: t.boolean()
|
|
134
133
|
});
|
|
135
134
|
export {
|
|
136
|
-
|
|
135
|
+
G as AdminInputs,
|
|
137
136
|
O as AdminInputsSchema,
|
|
138
|
-
|
|
137
|
+
X as DateOfBirthInput,
|
|
139
138
|
y as DateOfBirthSchema,
|
|
140
|
-
|
|
139
|
+
z as NameInputs,
|
|
141
140
|
v as NameInputsSchema,
|
|
142
|
-
|
|
141
|
+
V as SocialSecurityNumberInput,
|
|
143
142
|
R as SocialSecurityNumberSchema
|
|
144
143
|
};
|
|
145
144
|
//# 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","DateO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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 l, 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,7 +7,6 @@ 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";
|
|
11
10
|
import { HamburgerMenu as Z } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
12
11
|
import { useComponentContext as $ } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
12
|
import ee from "../../../assets/icons/pencil.svg.js";
|
|
@@ -15,11 +14,11 @@ import te from "../../../assets/icons/x-circle.svg.js";
|
|
|
15
14
|
import re from "../../../assets/icons/plus-circle.svg.js";
|
|
16
15
|
import { formatNumberAsCurrency as f, firstLastName as ne } from "../../../helpers/formattedStrings.js";
|
|
17
16
|
import { useDateFormatter as ie } from "../../../hooks/useDateFormatter.js";
|
|
18
|
-
import { useLoadingIndicator as
|
|
19
|
-
import { useContainerBreakpoints as
|
|
17
|
+
import { useLoadingIndicator as le } from "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
18
|
+
import { useContainerBreakpoints as oe } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
20
19
|
import { DataView as ae } from "../../Common/DataView/DataView.js";
|
|
21
|
-
const se = (
|
|
22
|
-
employeeCompensations:
|
|
20
|
+
const se = (o, u) => o?.startDate && o.endDate ? u.formatPayPeriod(o.startDate, o.endDate) : { startDate: "", endDate: "" }, Ee = ({
|
|
21
|
+
employeeCompensations: o,
|
|
23
22
|
employeeDetails: u,
|
|
24
23
|
payPeriod: y,
|
|
25
24
|
paySchedule: T,
|
|
@@ -36,12 +35,12 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
36
35
|
}) => {
|
|
37
36
|
const { Button: x, Heading: g, Text: i, Badge: R, LoadingSpinner: A, Alert: F } = $();
|
|
38
37
|
Q("Payroll.PayrollConfiguration");
|
|
39
|
-
const { t: r } = S("Payroll.PayrollConfiguration"), B = ie(), { LoadingIndicator: L } =
|
|
38
|
+
const { t: r } = S("Payroll.PayrollConfiguration"), B = ie(), { LoadingIndicator: L } = le(), U = V(), w = N(null), a = oe({ ref: w }).includes("small"), c = new Map(u.map((t) => [t.uuid, t])), j = (t) => {
|
|
40
39
|
const n = c.get(t);
|
|
41
40
|
return n ? ne({ first_name: n.firstName, last_name: n.lastName }) : null;
|
|
42
41
|
};
|
|
43
|
-
return /* @__PURE__ */ e("div", { ref: w, className: k.container, children: /* @__PURE__ */
|
|
44
|
-
/* @__PURE__ */
|
|
42
|
+
return /* @__PURE__ */ e("div", { ref: w, className: k.container, children: /* @__PURE__ */ l(m, { flexDirection: "column", gap: 16, children: [
|
|
43
|
+
/* @__PURE__ */ l(
|
|
45
44
|
m,
|
|
46
45
|
{
|
|
47
46
|
flexDirection: a ? "row" : "column",
|
|
@@ -49,7 +48,7 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
49
48
|
alignItems: a ? "center" : "stretch",
|
|
50
49
|
gap: a ? 0 : 16,
|
|
51
50
|
children: [
|
|
52
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ l(h, { children: [
|
|
53
52
|
/* @__PURE__ */ e(g, { as: "h1", children: r("pageTitle") }),
|
|
54
53
|
/* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
|
|
55
54
|
O,
|
|
@@ -81,15 +80,15 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
81
80
|
]
|
|
82
81
|
}
|
|
83
82
|
),
|
|
84
|
-
(C || d) && /* @__PURE__ */
|
|
83
|
+
(C || d) && /* @__PURE__ */ l(Y, { gap: 16, gridTemplateColumns: "1fr", children: [
|
|
85
84
|
d && /* @__PURE__ */ e(F, { status: "info", label: d.label, children: d.content }),
|
|
86
85
|
C
|
|
87
86
|
] }),
|
|
88
|
-
p ? /* @__PURE__ */ e(L, { children: /* @__PURE__ */
|
|
87
|
+
p ? /* @__PURE__ */ e(L, { children: /* @__PURE__ */ l(m, { flexDirection: "column", alignItems: "center", gap: 4, children: [
|
|
89
88
|
/* @__PURE__ */ e(A, { size: "lg" }),
|
|
90
89
|
/* @__PURE__ */ e(g, { as: "h4", children: r("loadingTitle") }),
|
|
91
90
|
/* @__PURE__ */ e(i, { children: r("loadingDescription") })
|
|
92
|
-
] }) }) : /* @__PURE__ */
|
|
91
|
+
] }) }) : /* @__PURE__ */ l(G, { children: [
|
|
93
92
|
/* @__PURE__ */ e("div", { className: k.payrollBlockerContainer, children: D.length > 0 && /* @__PURE__ */ e(
|
|
94
93
|
J,
|
|
95
94
|
{
|
|
@@ -97,7 +96,7 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
97
96
|
onMultipleViewClick: H
|
|
98
97
|
}
|
|
99
98
|
) }),
|
|
100
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ l(h, { children: [
|
|
101
100
|
/* @__PURE__ */ e(g, { as: "h3", children: r("hoursAndEarningsTitle") }),
|
|
102
101
|
/* @__PURE__ */ e(i, { children: r("hoursAndEarningsDescription") })
|
|
103
102
|
] }),
|
|
@@ -110,7 +109,7 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
110
109
|
title: /* @__PURE__ */ e(i, { weight: "semibold", children: r("tableColumns.employees") }),
|
|
111
110
|
render: (t) => {
|
|
112
111
|
const n = c.get(t.employeeUuid || ""), s = U(n);
|
|
113
|
-
return /* @__PURE__ */
|
|
112
|
+
return /* @__PURE__ */ l(m, { flexDirection: "column", gap: 8, children: [
|
|
114
113
|
/* @__PURE__ */ e(i, { weight: "semibold", children: j(t.employeeUuid || "") }),
|
|
115
114
|
s && /* @__PURE__ */ e(i, { variant: "supporting", children: s }),
|
|
116
115
|
t.excluded && /* @__PURE__ */ e(R, { status: "warning", children: r("skippedBadge") })
|
|
@@ -159,7 +158,7 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
160
|
],
|
|
162
|
-
data:
|
|
161
|
+
data: o,
|
|
163
162
|
itemMenu: (t) => /* @__PURE__ */ e(
|
|
164
163
|
Z,
|
|
165
164
|
{
|
|
@@ -190,6 +189,6 @@ const se = (l, u) => l?.startDate && l.endDate ? u.formatPayPeriod(l.startDate,
|
|
|
190
189
|
] }) });
|
|
191
190
|
};
|
|
192
191
|
export {
|
|
193
|
-
|
|
192
|
+
Ee as PayrollConfigurationPresentation
|
|
194
193
|
};
|
|
195
194
|
//# 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,G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AS,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/B,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AWD,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,13 +9,12 @@ 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";
|
|
13
12
|
import { RadioGroupField as te } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
14
13
|
import { TextInputField as R } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
15
14
|
import { useComponentContext as ne } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
15
|
import { useI18n as re } from "../../../i18n/I18n.js";
|
|
17
|
-
import { Form as
|
|
18
|
-
import { firstLastName as
|
|
16
|
+
import { Form as se } from "../../Common/Form/Form.js";
|
|
17
|
+
import { firstLastName as ie, formatNumberAsCurrency as oe } from "../../../helpers/formattedStrings.js";
|
|
19
18
|
import { getAdditionalEarningsCompensations as ae, getReimbursementCompensation as me, calculateGrossPay as G } from "../helpers.js";
|
|
20
19
|
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";
|
|
21
20
|
import { useContainerBreakpoints as ge } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
@@ -24,46 +23,46 @@ const be = m.object({
|
|
|
24
23
|
timeOffCompensations: m.record(m.string(), m.string().optional()),
|
|
25
24
|
fixedCompensations: m.record(m.string(), m.string().optional()),
|
|
26
25
|
paymentMethod: m.nativeEnum(A).optional()
|
|
27
|
-
}), w = (E, O, d,
|
|
26
|
+
}), w = (E, O, d, i) => {
|
|
28
27
|
const g = {
|
|
29
28
|
...O,
|
|
30
29
|
paymentMethod: E.paymentMethod
|
|
31
30
|
};
|
|
32
31
|
g.hourlyCompensations = O?.hourlyCompensations?.map(
|
|
33
|
-
(
|
|
34
|
-
const l =
|
|
32
|
+
(s) => {
|
|
33
|
+
const l = s.jobUuid && s.name ? E.hourlyCompensations[s.jobUuid]?.[s.name] : void 0;
|
|
35
34
|
return l ? {
|
|
36
|
-
...
|
|
35
|
+
...s,
|
|
37
36
|
hours: l
|
|
38
|
-
} :
|
|
37
|
+
} : s;
|
|
39
38
|
}
|
|
40
|
-
), g.paidTimeOff = d.map((
|
|
41
|
-
...
|
|
42
|
-
hours: E.timeOffCompensations[
|
|
39
|
+
), g.paidTimeOff = d.map((s) => ({
|
|
40
|
+
...s,
|
|
41
|
+
hours: E.timeOffCompensations[s.name]
|
|
43
42
|
}));
|
|
44
43
|
const b = [];
|
|
45
|
-
return Object.entries(E.fixedCompensations).forEach(([
|
|
44
|
+
return Object.entries(E.fixedCompensations).forEach(([s, l]) => {
|
|
46
45
|
const C = O?.fixedCompensations?.find(
|
|
47
|
-
(x) => x.name?.toLowerCase() ===
|
|
46
|
+
(x) => x.name?.toLowerCase() === s.toLowerCase()
|
|
48
47
|
);
|
|
49
48
|
l && (C ? b.push({
|
|
50
49
|
name: C.name,
|
|
51
50
|
jobUuid: C.jobUuid,
|
|
52
51
|
amount: l
|
|
53
52
|
}) : parseFloat(l) !== 0 && b.push({
|
|
54
|
-
name:
|
|
55
|
-
jobUuid:
|
|
53
|
+
name: s,
|
|
54
|
+
jobUuid: i,
|
|
56
55
|
amount: l
|
|
57
56
|
}));
|
|
58
57
|
}), g.fixedCompensations = b, g;
|
|
59
|
-
},
|
|
58
|
+
}, $e = ({
|
|
60
59
|
onSave: E,
|
|
61
60
|
onCancel: O,
|
|
62
61
|
employee: d,
|
|
63
|
-
employeeCompensation:
|
|
62
|
+
employeeCompensation: i,
|
|
64
63
|
isPending: g = !1,
|
|
65
64
|
fixedCompensationTypes: b,
|
|
66
|
-
payPeriodStartDate:
|
|
65
|
+
payPeriodStartDate: s,
|
|
67
66
|
paySchedule: l,
|
|
68
67
|
isOffCycle: C = !1
|
|
69
68
|
}) => {
|
|
@@ -72,21 +71,21 @@ const be = m.object({
|
|
|
72
71
|
const f = d.jobs?.find((e) => e.primary), T = f ? [f] : [], v = X(null), p = ge({
|
|
73
72
|
ref: v
|
|
74
73
|
}).includes("small");
|
|
75
|
-
|
|
74
|
+
i?.hourlyCompensations?.forEach((e) => {
|
|
76
75
|
const n = d.jobs?.find((o) => o.uuid === e.jobUuid);
|
|
77
76
|
n && !T.find((o) => o.uuid === n.uuid) && T.push(n);
|
|
78
77
|
});
|
|
79
|
-
const P = (
|
|
78
|
+
const P = (i?.paidTimeOff || []).filter((e) => e.name), _ = ae({
|
|
80
79
|
flsaStatus: f?.compensations?.[0]?.flsaStatus,
|
|
81
|
-
existingFixedCompensations:
|
|
80
|
+
existingFixedCompensations: i?.fixedCompensations || [],
|
|
82
81
|
primaryJobUuid: f?.uuid,
|
|
83
82
|
fixedCompensationTypes: b,
|
|
84
83
|
excludedTypes: le
|
|
85
84
|
}), N = me(
|
|
86
|
-
|
|
85
|
+
i?.fixedCompensations || [],
|
|
87
86
|
b,
|
|
88
87
|
f?.uuid
|
|
89
|
-
), F = (e, n) =>
|
|
88
|
+
), F = (e, n) => i?.hourlyCompensations?.find(
|
|
90
89
|
(o) => o.jobUuid === e && o.name?.toLowerCase() === n.toLowerCase()
|
|
91
90
|
), $ = (e) => {
|
|
92
91
|
switch (e) {
|
|
@@ -138,7 +137,7 @@ const be = m.object({
|
|
|
138
137
|
e[n.name] = n.amount ? n.amount : "";
|
|
139
138
|
}), N && (e[N.name] = N.amount ? N.amount : ""), e;
|
|
140
139
|
})(),
|
|
141
|
-
paymentMethod:
|
|
140
|
+
paymentMethod: i?.paymentMethod || A.DirectDeposit
|
|
142
141
|
}, I = W({
|
|
143
142
|
resolver: J(be),
|
|
144
143
|
defaultValues: B
|
|
@@ -157,41 +156,41 @@ const be = m.object({
|
|
|
157
156
|
paymentMethod: M.paymentMethod
|
|
158
157
|
}, o = w(
|
|
159
158
|
n,
|
|
160
|
-
|
|
161
|
-
(
|
|
159
|
+
i,
|
|
160
|
+
(i?.paidTimeOff || []).filter((h) => h.name),
|
|
162
161
|
f?.uuid
|
|
163
162
|
);
|
|
164
163
|
return G(
|
|
165
164
|
o,
|
|
166
165
|
d,
|
|
167
|
-
|
|
166
|
+
s,
|
|
168
167
|
l,
|
|
169
168
|
C
|
|
170
169
|
);
|
|
171
170
|
} catch {
|
|
172
|
-
return
|
|
173
|
-
s,
|
|
174
|
-
d,
|
|
171
|
+
return i ? G(
|
|
175
172
|
i,
|
|
173
|
+
d,
|
|
174
|
+
s,
|
|
176
175
|
l,
|
|
177
176
|
C
|
|
178
177
|
) : 0;
|
|
179
178
|
}
|
|
180
179
|
}, [
|
|
181
180
|
M,
|
|
182
|
-
|
|
181
|
+
i,
|
|
183
182
|
f?.uuid,
|
|
184
183
|
d,
|
|
185
|
-
|
|
184
|
+
s,
|
|
186
185
|
l,
|
|
187
186
|
C
|
|
188
|
-
]), V =
|
|
187
|
+
]), V = ie({
|
|
189
188
|
first_name: d.firstName,
|
|
190
189
|
last_name: d.lastName
|
|
191
190
|
}), z = (e) => {
|
|
192
191
|
const n = w(
|
|
193
192
|
e,
|
|
194
|
-
|
|
193
|
+
i,
|
|
195
194
|
P,
|
|
196
195
|
f?.uuid
|
|
197
196
|
);
|
|
@@ -235,7 +234,7 @@ const be = m.object({
|
|
|
235
234
|
}
|
|
236
235
|
),
|
|
237
236
|
/* @__PURE__ */ a(K, { ...I, children: [
|
|
238
|
-
/* @__PURE__ */ a(
|
|
237
|
+
/* @__PURE__ */ a(se, { children: [
|
|
239
238
|
T.length > 0 && /* @__PURE__ */ a("div", { className: u.fieldGroup, children: [
|
|
240
239
|
/* @__PURE__ */ r(c, { as: "h3", children: t("regularHoursTitle") }),
|
|
241
240
|
T.map((e) => /* @__PURE__ */ a(y, { flexDirection: "column", gap: 8, children: [
|
|
@@ -334,6 +333,6 @@ const be = m.object({
|
|
|
334
333
|
};
|
|
335
334
|
export {
|
|
336
335
|
be as PayrollEditEmployeeFormSchema,
|
|
337
|
-
|
|
336
|
+
$e as PayrollEditEmployeePresentation
|
|
338
337
|
};
|
|
339
338
|
//# sourceMappingURL=PayrollEditEmployeePresentation.js.map
|