@gusto/embedded-react-sdk 0.46.0 → 0.46.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/CHANGELOG.md +50 -0
- package/dist/components/Common/DataView/DataCards/DataCards.d.ts +2 -1
- package/dist/components/Common/DataView/DataCards/DataCards.js +14 -13
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.d.ts +2 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +51 -50
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +1 -0
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/useDataView.d.ts +8 -1
- package/dist/components/Common/DataView/useDataView.js +20 -17
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.d.ts +9 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js +76 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.js.map +1 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +57 -202
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.d.ts +25 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +81 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.d.ts +18 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +171 -0
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -0
- package/dist/components/Employee/Compensation/management/index.d.ts +3 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.d.ts +6 -1
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +67 -209
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.d.ts +18 -0
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js +169 -0
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +16 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js +36 -30
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +213 -191
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +65 -53
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +3 -3
- package/dist/components/Employee/Dashboard/DashboardComponents.js +138 -101
- package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.js +340 -320
- package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js +5 -3
- package/dist/components/Employee/Dashboard/JobAndPayView.module.scss.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js +147 -148
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.d.ts +6 -0
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +13 -12
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +2 -2
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +34 -35
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +37 -40
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +1 -2
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +64 -71
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +2 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +25 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +13 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +37 -0
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.d.ts +6 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +69 -0
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -0
- package/dist/components/Employee/EmployeeListFlow/index.d.ts +3 -0
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js +15 -12
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +2 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +86 -83
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js +14 -11
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +2 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +92 -89
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/exports/employeeManagement.d.ts +2 -0
- package/dist/components/Employee/exports/employeeManagement.js +18 -16
- package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
- package/dist/components/Employee/index.d.ts +2 -0
- package/dist/components/Employee/index.js +32 -30
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Flow/FlowHeader.js +34 -31
- package/dist/components/Flow/FlowHeader.js.map +1 -1
- package/dist/components/Flow/useFlow.d.ts +12 -0
- package/dist/components/Flow/useFlow.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +92 -69
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +23 -23
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js +73 -56
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +58 -58
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +91 -87
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +91 -124
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +72 -87
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -6
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +160 -220
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.d.ts +7 -3
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +77 -54
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.test.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js +12 -11
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +177 -147
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.d.ts +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +38 -36
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +2 -0
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +10 -10
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +17 -15
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +9 -9
- package/dist/i18n/en/Employee.Compensation.json.js +64 -56
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.Dashboard.json.js +26 -24
- package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js +12 -10
- package/dist/i18n/en/Employee.HomeAddress.Management.json.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +32 -30
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js +16 -14
- package/dist/i18n/en/Employee.WorkAddress.Management.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +14 -0
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +33 -32
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js.map +1 -1
- package/dist/partner-hook-utils/types.d.ts +4 -0
- package/dist/shared/constants.d.ts +2 -0
- package/dist/shared/constants.js +13 -12
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +26 -12
- package/docs/reference/endpoint-inventory.json +24 -8
- package/package.json +1 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y } from "react";
|
|
3
|
+
import D from "classnames";
|
|
4
|
+
import { useTranslation as I } from "react-i18next";
|
|
5
|
+
import { useJobForm as J } from "../../shared/useJobForm/useJobForm.js";
|
|
6
|
+
import { useCompensationForm as L } from "../../shared/useCompensationForm/useCompensationForm.js";
|
|
7
|
+
import { AddCompensationFormBody as R } from "../../shared/AddCompensationFormBody.js";
|
|
8
|
+
import S from "./AddAnotherJob.module.scss.js";
|
|
9
|
+
import { BaseBoundaries as j, BaseLayout as p } from "../../../../Base/Base.js";
|
|
10
|
+
import "../../../../Base/useBase.js";
|
|
11
|
+
import { Form as A } from "../../../../Common/Form/Form.js";
|
|
12
|
+
import { useComponentDictionary as P, useI18n as T } from "../../../../../i18n/I18n.js";
|
|
13
|
+
import { composeErrorHandler as c } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
14
|
+
import { composeSubmitHandler as H } from "../../../../../partner-hook-utils/form/composeSubmitHandler.js";
|
|
15
|
+
import { componentEvents as l } from "../../../../../shared/constants.js";
|
|
16
|
+
function W({ dictionary: n, ...r }) {
|
|
17
|
+
return P("Employee.Compensation", n), /* @__PURE__ */ e(j, { componentName: "Employee.Compensation", children: /* @__PURE__ */ e(N, { ...r }) });
|
|
18
|
+
}
|
|
19
|
+
function N({
|
|
20
|
+
employeeId: n,
|
|
21
|
+
onCancel: r,
|
|
22
|
+
className: f,
|
|
23
|
+
onEvent: s
|
|
24
|
+
}) {
|
|
25
|
+
T("Employee.Compensation");
|
|
26
|
+
const { t: a } = I("Employee.Compensation"), [m, b] = y(void 0), t = J({
|
|
27
|
+
employeeId: n,
|
|
28
|
+
jobId: m,
|
|
29
|
+
withHireDateField: !1,
|
|
30
|
+
optionalFieldsToRequire: { update: ["title"] },
|
|
31
|
+
shouldFocusError: !1
|
|
32
|
+
}), E = t.isLoading ? void 0 : t.data.currentJob?.currentCompensationUuid ?? void 0, i = L({
|
|
33
|
+
employeeId: n,
|
|
34
|
+
jobId: m,
|
|
35
|
+
compensationId: E,
|
|
36
|
+
withEffectiveDateField: !0,
|
|
37
|
+
optionalFieldsToRequire: { update: ["flsaStatus", "rate", "paymentUnit"] },
|
|
38
|
+
shouldFocusError: !1
|
|
39
|
+
});
|
|
40
|
+
if (t.isLoading || i.isLoading) {
|
|
41
|
+
const o = c([t, i]);
|
|
42
|
+
return /* @__PURE__ */ e(p, { isLoading: !0, error: o.errors });
|
|
43
|
+
}
|
|
44
|
+
const C = t.data.jobs?.find((o) => o.primary)?.hireDate ?? void 0, d = H([t, i], async () => {
|
|
45
|
+
const o = await t.actions.onSubmit({ employeeId: n, hireDate: C });
|
|
46
|
+
if (!o) return;
|
|
47
|
+
s(l.EMPLOYEE_JOB_CREATED, o.data);
|
|
48
|
+
const F = o.data.compensations?.find(
|
|
49
|
+
(g) => g.uuid === o.data.currentCompensationUuid
|
|
50
|
+
), u = await i.actions.onSubmit({
|
|
51
|
+
jobId: o.data.uuid,
|
|
52
|
+
compensationId: o.data.currentCompensationUuid ?? void 0,
|
|
53
|
+
compensationVersion: F?.version ?? void 0
|
|
54
|
+
});
|
|
55
|
+
if (!u) {
|
|
56
|
+
b(o.data.uuid);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
s(l.EMPLOYEE_COMPENSATION_UPDATED, u.data);
|
|
60
|
+
}), h = c([d]), v = t.status.isPending || i.status.isPending;
|
|
61
|
+
return /* @__PURE__ */ e("section", { className: D(S.container, f), children: /* @__PURE__ */ e(p, { error: h.errors, children: /* @__PURE__ */ e(A, { onSubmit: d.handleSubmit, children: /* @__PURE__ */ e(
|
|
62
|
+
R,
|
|
63
|
+
{
|
|
64
|
+
jobForm: t,
|
|
65
|
+
compensationForm: i,
|
|
66
|
+
title: a("addAnotherJobTitle"),
|
|
67
|
+
submitCtaLabel: a("saveNewJobCta"),
|
|
68
|
+
isPending: v,
|
|
69
|
+
onCancel: r
|
|
70
|
+
}
|
|
71
|
+
) }) }) });
|
|
72
|
+
}
|
|
73
|
+
export {
|
|
74
|
+
W as AddAnotherJob
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=AddAnotherJob.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddAnotherJob.js","sources":["../../../../../../src/components/Employee/Compensation/management/AddAnotherJob/AddAnotherJob.tsx"],"sourcesContent":["import { useState } from 'react'\nimport classNames from 'classnames'\nimport { useTranslation } from 'react-i18next'\nimport { useJobForm } from '../../shared/useJobForm'\nimport { useCompensationForm } from '../../shared/useCompensationForm'\nimport { AddCompensationFormBody } from '../../shared/AddCompensationFormBody'\nimport styles from './AddAnotherJob.module.scss'\nimport { BaseBoundaries, BaseLayout, type CommonComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { composeSubmitHandler } from '@/partner-hook-utils/form/composeSubmitHandler'\nimport { componentEvents, type EventType } from '@/shared/constants'\n\nexport interface AddAnotherJobProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n onCancel?: () => void\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function AddAnotherJob({ dictionary, ...props }: AddAnotherJobProps) {\n useComponentDictionary('Employee.Compensation', dictionary)\n return (\n <BaseBoundaries componentName=\"Employee.Compensation\">\n <Root {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction Root({\n employeeId,\n onCancel,\n className,\n onEvent,\n}: Omit<AddAnotherJobProps, 'dictionary'>) {\n useI18n('Employee.Compensation')\n const { t } = useTranslation('Employee.Compensation')\n\n // Track jobId locally so a partial-failure submit chain (job POST succeeds,\n // comp PUT fails) doesn't re-POST and create a duplicate job on retry.\n const [resolvedJobId, setResolvedJobId] = useState<string | undefined>(undefined)\n\n const jobForm = useJobForm({\n employeeId,\n jobId: resolvedJobId,\n withHireDateField: false,\n optionalFieldsToRequire: { update: ['title'] },\n shouldFocusError: false,\n })\n\n const resolvedCompensationId = jobForm.isLoading\n ? undefined\n : (jobForm.data.currentJob?.currentCompensationUuid ?? undefined)\n\n const compensationForm = useCompensationForm({\n employeeId,\n jobId: resolvedJobId,\n compensationId: resolvedCompensationId,\n withEffectiveDateField: true,\n optionalFieldsToRequire: { update: ['flsaStatus', 'rate', 'paymentUnit'] },\n shouldFocusError: false,\n })\n\n if (jobForm.isLoading || compensationForm.isLoading) {\n const loadingErrorHandling = composeErrorHandler([jobForm, compensationForm])\n return <BaseLayout isLoading error={loadingErrorHandling.errors} />\n }\n\n // The API defaults a secondary job's hire_date to the primary job's hire_date\n // when omitted. We pass it explicitly to satisfy the SDK hook's requirement\n // and mirror the API's own default behavior. React Query dedupes this query\n // since useJobForm has already loaded it.\n const primaryHireDate = jobForm.data.jobs?.find(j => j.primary)?.hireDate ?? undefined\n\n const submitResult = composeSubmitHandler([jobForm, compensationForm], async () => {\n const jobResult = await jobForm.actions.onSubmit({ employeeId, hireDate: primaryHireDate })\n if (!jobResult) return\n\n onEvent(componentEvents.EMPLOYEE_JOB_CREATED, jobResult.data)\n\n const stubCompensation = jobResult.data.compensations?.find(\n c => c.uuid === jobResult.data.currentCompensationUuid,\n )\n\n const compensationResult = await compensationForm.actions.onSubmit({\n jobId: jobResult.data.uuid,\n compensationId: jobResult.data.currentCompensationUuid ?? undefined,\n compensationVersion: stubCompensation?.version ?? undefined,\n })\n if (!compensationResult) {\n setResolvedJobId(jobResult.data.uuid)\n return\n }\n\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensationResult.data)\n })\n\n const errorHandling = composeErrorHandler([submitResult])\n const isPending = jobForm.status.isPending || compensationForm.status.isPending\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={errorHandling.errors}>\n <Form onSubmit={submitResult.handleSubmit}>\n <AddCompensationFormBody\n jobForm={jobForm}\n compensationForm={compensationForm}\n title={t('addAnotherJobTitle')}\n submitCtaLabel={t('saveNewJobCta')}\n isPending={isPending}\n onCancel={onCancel}\n />\n </Form>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["AddAnotherJob","dictionary","props","useComponentDictionary","jsx","BaseBoundaries","Root","employeeId","onCancel","className","onEvent","useI18n","t","useTranslation","resolvedJobId","setResolvedJobId","useState","jobForm","useJobForm","resolvedCompensationId","compensationForm","useCompensationForm","loadingErrorHandling","composeErrorHandler","BaseLayout","primaryHireDate","j","submitResult","composeSubmitHandler","jobResult","componentEvents","stubCompensation","c","compensationResult","errorHandling","isPending","classNames","styles","Form","AddCompensationFormBody"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAc,EAAE,YAAAC,GAAY,GAAGC,KAA6B;AAC1E,SAAAC,EAAuB,yBAAyBF,CAAU,GAExD,gBAAAG,EAACC,KAAe,eAAc,yBAC5B,4BAACC,GAAA,EAAM,GAAGJ,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASI,EAAK;AAAA,EACZ,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AACF,GAA2C;AACzC,EAAAC,EAAQ,uBAAuB;AAC/B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAI9C,CAACC,GAAeC,CAAgB,IAAIC,EAA6B,MAAS,GAE1EC,IAAUC,EAAW;AAAA,IACzB,YAAAX;AAAA,IACA,OAAOO;AAAA,IACP,mBAAmB;AAAA,IACnB,yBAAyB,EAAE,QAAQ,CAAC,OAAO,EAAA;AAAA,IAC3C,kBAAkB;AAAA,EAAA,CACnB,GAEKK,IAAyBF,EAAQ,YACnC,SACCA,EAAQ,KAAK,YAAY,2BAA2B,QAEnDG,IAAmBC,EAAoB;AAAA,IAC3C,YAAAd;AAAA,IACA,OAAOO;AAAA,IACP,gBAAgBK;AAAA,IAChB,wBAAwB;AAAA,IACxB,yBAAyB,EAAE,QAAQ,CAAC,cAAc,QAAQ,aAAa,EAAA;AAAA,IACvE,kBAAkB;AAAA,EAAA,CACnB;AAED,MAAIF,EAAQ,aAAaG,EAAiB,WAAW;AACnD,UAAME,IAA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eAAe;AAAA,MACjC,WAAAuB;AAAA,MACA,UAAA3B;AAAA,IAAA;AAAA,EAAA,EACF,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddAnotherJob.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js
CHANGED
|
@@ -1,230 +1,85 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { useTranslation as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import C from "classnames";
|
|
3
|
+
import { useTranslation as F } from "react-i18next";
|
|
4
4
|
import { useJobsAndCompensationsGetJobs as L } from "@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs";
|
|
5
5
|
import { useJobForm as h } from "../../shared/useJobForm/useJobForm.js";
|
|
6
|
-
import { useCompensationForm as
|
|
6
|
+
import { useCompensationForm as D } from "../../shared/useCompensationForm/useCompensationForm.js";
|
|
7
|
+
import { ManagementCompensationFormBody as P } from "../ManagementCompensationFormBody.js";
|
|
7
8
|
import y from "./EditCompensation.module.scss.js";
|
|
8
|
-
import { BaseBoundaries as
|
|
9
|
+
import { BaseBoundaries as M, BaseLayout as c } from "../../../../Base/Base.js";
|
|
9
10
|
import "../../../../Base/useBase.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
import { composeSubmitHandler as O } from "../../../../../partner-hook-utils/form/composeSubmitHandler.js";
|
|
18
|
-
import _ from "../../../../../hooks/useNumberFormatter.js";
|
|
19
|
-
import { addDays as U } from "../../../../../helpers/dateFormatting.js";
|
|
20
|
-
function oe({ dictionary: r, ...i }) {
|
|
21
|
-
return w("Employee.Compensation", r), /* @__PURE__ */ t(W, { componentName: "Employee.Compensation.Management", children: /* @__PURE__ */ t(A, { ...i }) });
|
|
11
|
+
import { Form as N } from "../../../../Common/Form/Form.js";
|
|
12
|
+
import { useComponentDictionary as O, useI18n as S } from "../../../../../i18n/I18n.js";
|
|
13
|
+
import { composeErrorHandler as p } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
14
|
+
import { composeSubmitHandler as T } from "../../../../../partner-hook-utils/form/composeSubmitHandler.js";
|
|
15
|
+
import { componentEvents as d } from "../../../../../shared/constants.js";
|
|
16
|
+
function k({ dictionary: n, ...r }) {
|
|
17
|
+
return O("Employee.Compensation", n), /* @__PURE__ */ e(M, { componentName: "Employee.Compensation.Management", children: /* @__PURE__ */ e(_, { ...r }) });
|
|
22
18
|
}
|
|
23
|
-
function
|
|
24
|
-
employeeId:
|
|
25
|
-
jobId:
|
|
26
|
-
defaultValues:
|
|
27
|
-
...
|
|
19
|
+
function _({
|
|
20
|
+
employeeId: n,
|
|
21
|
+
jobId: r,
|
|
22
|
+
defaultValues: f,
|
|
23
|
+
...u
|
|
28
24
|
}) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
return /* @__PURE__ */
|
|
25
|
+
const s = L({ employeeId: n }, { enabled: !!n });
|
|
26
|
+
if (s.isLoading || !s.data) {
|
|
27
|
+
const o = p([s]);
|
|
28
|
+
return /* @__PURE__ */ e(c, { isLoading: !0, error: o.errors });
|
|
33
29
|
}
|
|
34
|
-
const
|
|
35
|
-
title:
|
|
36
|
-
flsaStatus:
|
|
37
|
-
rate: Number(
|
|
38
|
-
paymentUnit:
|
|
39
|
-
adjustForMinimumWage:
|
|
40
|
-
minimumWageId:
|
|
30
|
+
const a = s.data.jobs?.find((o) => o.uuid === r), t = a?.compensations?.find((o) => o.uuid === a.currentCompensationUuid), i = t ? {
|
|
31
|
+
title: t.title ?? a?.title ?? void 0,
|
|
32
|
+
flsaStatus: t.flsaStatus ?? void 0,
|
|
33
|
+
rate: Number(t.rate),
|
|
34
|
+
paymentUnit: t.paymentUnit ?? void 0,
|
|
35
|
+
adjustForMinimumWage: t.adjustForMinimumWage ?? !1,
|
|
36
|
+
minimumWageId: t.minimumWages?.[0]?.uuid ?? ""
|
|
41
37
|
// effectiveDate intentionally omitted — user must choose a future date
|
|
42
38
|
} : void 0;
|
|
43
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ e(j, { employeeId: n, jobId: r, defaultValues: i, ...u });
|
|
44
40
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
employeeId:
|
|
49
|
-
jobId:
|
|
41
|
+
function j({ employeeId: n, jobId: r, defaultValues: f, onCancel: u, className: s, onEvent: a }) {
|
|
42
|
+
S("Employee.Compensation");
|
|
43
|
+
const { t } = F("Employee.Compensation"), i = h({
|
|
44
|
+
employeeId: n,
|
|
45
|
+
jobId: r,
|
|
50
46
|
withTitleField: !1,
|
|
51
47
|
withHireDateField: !1,
|
|
52
48
|
shouldFocusError: !1
|
|
53
|
-
}),
|
|
54
|
-
employeeId:
|
|
55
|
-
jobId:
|
|
56
|
-
defaultValues:
|
|
49
|
+
}), o = D({
|
|
50
|
+
employeeId: n,
|
|
51
|
+
jobId: r,
|
|
52
|
+
defaultValues: f,
|
|
57
53
|
withEffectiveDateField: !0,
|
|
58
54
|
optionalFieldsToRequire: {
|
|
59
55
|
create: ["title"]
|
|
60
56
|
},
|
|
61
57
|
shouldFocusError: !1
|
|
62
58
|
});
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
return /* @__PURE__ */
|
|
59
|
+
if (i.isLoading || o.isLoading) {
|
|
60
|
+
const m = p([i, o]);
|
|
61
|
+
return /* @__PURE__ */ e(c, { isLoading: !0, error: m.errors });
|
|
66
62
|
}
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
if (!
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
}),
|
|
74
|
-
return /* @__PURE__ */
|
|
63
|
+
const E = T([i, o], async () => {
|
|
64
|
+
const m = await i.actions.onSubmit();
|
|
65
|
+
if (!m) return;
|
|
66
|
+
a(d.EMPLOYEE_JOB_UPDATED, m.data);
|
|
67
|
+
const l = await o.actions.onSubmit();
|
|
68
|
+
l && (a(d.EMPLOYEE_COMPENSATION_UPDATED, l.data), a(d.EMPLOYEE_COMPENSATION_DONE, l.data));
|
|
69
|
+
}), g = p([E]), b = i.status.isPending || o.status.isPending;
|
|
70
|
+
return /* @__PURE__ */ e("section", { className: C(y.container, s), children: /* @__PURE__ */ e(c, { error: g.errors, children: /* @__PURE__ */ e(N, { onSubmit: E.handleSubmit, children: /* @__PURE__ */ e(
|
|
75
71
|
P,
|
|
76
72
|
{
|
|
77
|
-
jobForm:
|
|
78
|
-
compensationForm:
|
|
79
|
-
|
|
80
|
-
|
|
73
|
+
jobForm: i,
|
|
74
|
+
compensationForm: o,
|
|
75
|
+
title: t("management.editCompensationTitle"),
|
|
76
|
+
submitCtaLabel: t("management.saveCta"),
|
|
77
|
+
isPending: b,
|
|
78
|
+
onCancel: u
|
|
81
79
|
}
|
|
82
80
|
) }) }) });
|
|
83
81
|
}
|
|
84
|
-
function P({ jobForm: r, compensationForm: i, isPending: d, onCancel: m }) {
|
|
85
|
-
const { t: e } = R("Employee.Compensation"), n = H(), o = _("currency"), s = r.form.Fields, a = i.form.Fields;
|
|
86
|
-
return /* @__PURE__ */ g(S, { flexDirection: "column", gap: 32, children: [
|
|
87
|
-
/* @__PURE__ */ t(n.Heading, { as: "h2", children: e("management.editCompensationTitle") }),
|
|
88
|
-
i.status.willDeleteSecondaryJobs && /* @__PURE__ */ t(
|
|
89
|
-
n.Alert,
|
|
90
|
-
{
|
|
91
|
-
label: e("management.scheduledClassificationChangeNotification"),
|
|
92
|
-
status: "warning"
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ t(
|
|
96
|
-
a.Title,
|
|
97
|
-
{
|
|
98
|
-
label: e("management.jobTitleLabel"),
|
|
99
|
-
validationMessages: { REQUIRED: e("validations.jobTitleSentence") },
|
|
100
|
-
formHookResult: i
|
|
101
|
-
}
|
|
102
|
-
),
|
|
103
|
-
a.FlsaStatus && /* @__PURE__ */ t(
|
|
104
|
-
a.FlsaStatus,
|
|
105
|
-
{
|
|
106
|
-
label: e("employeeClassification"),
|
|
107
|
-
description: /* @__PURE__ */ t(
|
|
108
|
-
b,
|
|
109
|
-
{
|
|
110
|
-
t: e,
|
|
111
|
-
i18nKey: "classificationLink",
|
|
112
|
-
components: { ClassificationLink: /* @__PURE__ */ t(n.Link, {}) }
|
|
113
|
-
}
|
|
114
|
-
),
|
|
115
|
-
validationMessages: {
|
|
116
|
-
REQUIRED: e("validations.exemptThreshold", {
|
|
117
|
-
limit: o(C)
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
getOptionLabel: (l) => e(`flsaStatusLabels.${l}`),
|
|
121
|
-
formHookResult: i
|
|
122
|
-
}
|
|
123
|
-
),
|
|
124
|
-
/* @__PURE__ */ t(
|
|
125
|
-
a.Rate,
|
|
126
|
-
{
|
|
127
|
-
label: e("management.wageLabel"),
|
|
128
|
-
validationMessages: {
|
|
129
|
-
REQUIRED: e("validations.rate"),
|
|
130
|
-
RATE_MINIMUM: e("validations.nonZeroRate"),
|
|
131
|
-
RATE_EXEMPT_THRESHOLD: e("validations.rateExemptThreshold", {
|
|
132
|
-
limit: o(C)
|
|
133
|
-
})
|
|
134
|
-
},
|
|
135
|
-
formHookResult: i
|
|
136
|
-
}
|
|
137
|
-
),
|
|
138
|
-
/* @__PURE__ */ t(
|
|
139
|
-
a.PaymentUnit,
|
|
140
|
-
{
|
|
141
|
-
label: e("management.wageFrequencyLabel"),
|
|
142
|
-
description: e("paymentUnitDescription"),
|
|
143
|
-
validationMessages: { REQUIRED: e("validations.paymentUnit") },
|
|
144
|
-
getOptionLabel: (l) => e(`management.wageFrequencyOptions.${l}`),
|
|
145
|
-
formHookResult: i
|
|
146
|
-
}
|
|
147
|
-
),
|
|
148
|
-
a.EffectiveDate && /* @__PURE__ */ t(
|
|
149
|
-
a.EffectiveDate,
|
|
150
|
-
{
|
|
151
|
-
label: e("effectiveDateLabel"),
|
|
152
|
-
minDate: U(/* @__PURE__ */ new Date(), 1),
|
|
153
|
-
maxDate: i.data.maximumEffectiveDate ? new Date(i.data.maximumEffectiveDate) : void 0,
|
|
154
|
-
validationMessages: {
|
|
155
|
-
REQUIRED: e("validations.effectiveDate"),
|
|
156
|
-
EFFECTIVE_DATE_BEFORE_HIRE: e("validations.effectiveDateBeforeHire")
|
|
157
|
-
},
|
|
158
|
-
formHookResult: i
|
|
159
|
-
}
|
|
160
|
-
),
|
|
161
|
-
a.AdjustForMinimumWage && /* @__PURE__ */ t(
|
|
162
|
-
a.AdjustForMinimumWage,
|
|
163
|
-
{
|
|
164
|
-
label: e("adjustForMinimumWage"),
|
|
165
|
-
description: e("adjustForMinimumWageDescription"),
|
|
166
|
-
formHookResult: i
|
|
167
|
-
}
|
|
168
|
-
),
|
|
169
|
-
a.MinimumWageId && /* @__PURE__ */ t(
|
|
170
|
-
a.MinimumWageId,
|
|
171
|
-
{
|
|
172
|
-
label: e("minimumWageLabel"),
|
|
173
|
-
description: e("minimumWageDescription"),
|
|
174
|
-
validationMessages: { REQUIRED: e("validations.minimumWage") },
|
|
175
|
-
getOptionLabel: (l) => `${o(Number(l.wage))} - ${l.authority}: ${l.notes ?? ""}`,
|
|
176
|
-
formHookResult: i
|
|
177
|
-
}
|
|
178
|
-
),
|
|
179
|
-
s.TwoPercentShareholder && /* @__PURE__ */ t(
|
|
180
|
-
s.TwoPercentShareholder,
|
|
181
|
-
{
|
|
182
|
-
label: e("management.twoPercentShareholderLabel"),
|
|
183
|
-
formHookResult: r
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
s.StateWcCovered && /* @__PURE__ */ t(
|
|
187
|
-
s.StateWcCovered,
|
|
188
|
-
{
|
|
189
|
-
label: e("stateWcCoveredLabel"),
|
|
190
|
-
description: /* @__PURE__ */ t(
|
|
191
|
-
b,
|
|
192
|
-
{
|
|
193
|
-
t: e,
|
|
194
|
-
i18nKey: "stateWcCoveredDescription",
|
|
195
|
-
components: {
|
|
196
|
-
wcLink: /* @__PURE__ */ t(
|
|
197
|
-
n.Link,
|
|
198
|
-
{
|
|
199
|
-
href: "https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/",
|
|
200
|
-
target: "_blank",
|
|
201
|
-
rel: "noopener noreferrer"
|
|
202
|
-
}
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
getOptionLabel: (l) => e(l ? "stateWcCoveredOptions.yes" : "stateWcCoveredOptions.no"),
|
|
208
|
-
formHookResult: r
|
|
209
|
-
}
|
|
210
|
-
),
|
|
211
|
-
s.StateWcClassCode && /* @__PURE__ */ t(
|
|
212
|
-
s.StateWcClassCode,
|
|
213
|
-
{
|
|
214
|
-
label: e("stateWcClassCodeLabel"),
|
|
215
|
-
description: e("stateWcClassCodeDescription"),
|
|
216
|
-
placeholder: e("stateWcClassCodeLabel"),
|
|
217
|
-
validationMessages: { REQUIRED: e("validations.stateWcClassCode") },
|
|
218
|
-
formHookResult: r
|
|
219
|
-
}
|
|
220
|
-
),
|
|
221
|
-
/* @__PURE__ */ g(T, { children: [
|
|
222
|
-
m && /* @__PURE__ */ t(n.Button, { variant: "secondary", onClick: m, isDisabled: d, children: e("cancelCta") }),
|
|
223
|
-
/* @__PURE__ */ t(n.Button, { type: "submit", isLoading: d, children: e("management.saveCta") })
|
|
224
|
-
] })
|
|
225
|
-
] });
|
|
226
|
-
}
|
|
227
82
|
export {
|
|
228
|
-
|
|
83
|
+
k as EditCompensation
|
|
229
84
|
};
|
|
230
85
|
//# sourceMappingURL=EditCompensation.js.map
|
package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditCompensation.js","sources":["../../../../../../src/components/Employee/Compensation/management/EditCompensation/EditCompensation.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PaymentUnit } from '@gusto/embedded-api/models/components/compensation'\nimport type { FlsaStatusType } from '@gusto/embedded-api/models/components/flsastatustype'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport { useJobsAndCompensationsGetJobs } from '@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs'\nimport { useJobForm, type UseJobFormReady } from '../../shared/useJobForm'\nimport {\n useCompensationForm,\n type UseCompensationFormReady,\n type CompensationFormData,\n} from '../../shared/useCompensationForm'\nimport styles from './EditCompensation.module.scss'\nimport { BaseBoundaries, BaseLayout, type CommonComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { composeSubmitHandler } from '@/partner-hook-utils/form/composeSubmitHandler'\nimport { componentEvents, FLSA_OVERTIME_SALARY_LIMIT, type EventType } from '@/shared/constants'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { addDays } from '@/helpers/dateFormatting'\n\nexport interface EditCompensationProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n jobId: string\n onCancel?: () => void\n /** Called with `EMPLOYEE_COMPENSATION_UPDATED` then `EMPLOYEE_COMPENSATION_DONE` on a successful save. Use `EMPLOYEE_COMPENSATION_DONE` to trigger navigation. */\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function EditCompensation({ dictionary, ...props }: EditCompensationProps) {\n useComponentDictionary('Employee.Compensation', dictionary)\n return (\n <BaseBoundaries componentName=\"Employee.Compensation.Management\">\n <CompensationDefaultsLoader {...props} />\n </BaseBoundaries>\n )\n}\n\ntype LoaderProps = Omit<EditCompensationProps, 'dictionary'>\n\n// Fetches the current job's compensation data to pre-populate the form as\n// defaultValues before rendering Root. Uses the same non-suspense query that\n// useCompensationForm uses internally — React Query dedupes the request so no\n// extra network call is made once Root mounts.\n// defaultValues from CommonComponentInterface (unknown) is excluded from the\n// spread so it doesn't conflict with Root's typed defaultValues prop.\nfunction CompensationDefaultsLoader({\n employeeId,\n jobId,\n defaultValues: _baseDefaults,\n ...rest\n}: LoaderProps) {\n const jobsQuery = useJobsAndCompensationsGetJobs({ employeeId }, { enabled: !!employeeId })\n\n if (jobsQuery.isLoading || !jobsQuery.data) {\n const errorHandling = composeErrorHandler([jobsQuery])\n return <BaseLayout isLoading error={errorHandling.errors} />\n }\n\n const job = jobsQuery.data.jobs?.find(j => j.uuid === jobId)\n const currentComp = job?.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n\n const defaultValues: Partial<CompensationFormData> | undefined = currentComp\n ? {\n title: currentComp.title ?? job?.title ?? undefined,\n flsaStatus: currentComp.flsaStatus ?? undefined,\n rate: Number(currentComp.rate),\n paymentUnit: currentComp.paymentUnit ?? undefined,\n adjustForMinimumWage: currentComp.adjustForMinimumWage ?? false,\n minimumWageId: currentComp.minimumWages?.[0]?.uuid ?? '',\n // effectiveDate intentionally omitted — user must choose a future date\n }\n : undefined\n\n return <Root employeeId={employeeId} jobId={jobId} defaultValues={defaultValues} {...rest} />\n}\n\ninterface RootProps extends LoaderProps {\n defaultValues?: Partial<CompensationFormData>\n}\n\nfunction Root({ employeeId, jobId, defaultValues, onCancel, className, onEvent }: RootProps) {\n useI18n('Employee.Compensation')\n\n // Job form handles the non-effective-dated fields: 2% shareholder + WA WC.\n // Title is suppressed here because the compensation form owns title\n // (effective-dated alongside rate/unit/FLSA on the future-dated row).\n // Hire-date is suppressed because this surface never edits it.\n const jobForm = useJobForm({\n employeeId,\n jobId,\n withTitleField: false,\n withHireDateField: false,\n shouldFocusError: false,\n })\n\n // Compensation form runs in create mode (no compensationId) → POST\n // /v1/jobs/:jobId/compensations, creating a new future-dated compensation.\n // The form is pre-populated with the current comp's values via defaultValues\n // (fetched by CompensationDefaultsLoader) so the user can edit from the\n // current state, and picks a future effectiveDate to schedule the change.\n const compensationForm = useCompensationForm({\n employeeId,\n jobId,\n defaultValues,\n withEffectiveDateField: true,\n optionalFieldsToRequire: {\n create: ['title'],\n },\n shouldFocusError: false,\n })\n\n if (jobForm.isLoading || compensationForm.isLoading) {\n const loadingErrorHandling = composeErrorHandler([jobForm, compensationForm])\n return <BaseLayout isLoading error={loadingErrorHandling.errors} />\n }\n\n // PUT job first (immediate mutation of 2% shareholder / WC), then POST\n // the new compensation (the future-dated change). composeSubmitHandler\n // validates both forms in parallel and short-circuits before any network\n // I/O if either fails.\n const submitResult = composeSubmitHandler([jobForm, compensationForm], async () => {\n const jobResult = await jobForm.actions.onSubmit()\n if (!jobResult) return\n\n onEvent(componentEvents.EMPLOYEE_JOB_UPDATED, jobResult.data)\n\n const compensationResult = await compensationForm.actions.onSubmit()\n if (!compensationResult) return\n\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensationResult.data)\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE, compensationResult.data)\n })\n\n const errorHandling = composeErrorHandler([submitResult])\n const isPending = jobForm.status.isPending || compensationForm.status.isPending\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={errorHandling.errors}>\n <Form onSubmit={submitResult.handleSubmit}>\n <FormBody\n jobForm={jobForm}\n compensationForm={compensationForm}\n isPending={isPending}\n onCancel={onCancel}\n />\n </Form>\n </BaseLayout>\n </section>\n )\n}\n\ninterface FormBodyProps {\n jobForm: UseJobFormReady\n compensationForm: UseCompensationFormReady\n isPending: boolean\n onCancel?: () => void\n}\n\nfunction FormBody({ jobForm, compensationForm, isPending, onCancel }: FormBodyProps) {\n const { t } = useTranslation('Employee.Compensation')\n const Components = useComponentContext()\n const format = useNumberFormatter('currency')\n\n const JobFields = jobForm.form.Fields\n const CompFields = compensationForm.form.Fields\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h2\">{t('management.editCompensationTitle')}</Components.Heading>\n\n {compensationForm.status.willDeleteSecondaryJobs && (\n <Components.Alert\n label={t('management.scheduledClassificationChangeNotification')}\n status=\"warning\"\n />\n )}\n\n <CompFields.Title\n label={t('management.jobTitleLabel')}\n validationMessages={{ REQUIRED: t('validations.jobTitleSentence') }}\n formHookResult={compensationForm}\n />\n\n {CompFields.FlsaStatus && (\n <CompFields.FlsaStatus\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationLink\"\n components={{ ClassificationLink: <Components.Link /> }}\n />\n }\n validationMessages={{\n REQUIRED: t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n }),\n }}\n getOptionLabel={(status: FlsaStatusType) => t(`flsaStatusLabels.${status}`)}\n formHookResult={compensationForm}\n />\n )}\n\n <CompFields.Rate\n label={t('management.wageLabel')}\n validationMessages={{\n REQUIRED: t('validations.rate'),\n RATE_MINIMUM: t('validations.nonZeroRate'),\n RATE_EXEMPT_THRESHOLD: t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n }),\n }}\n formHookResult={compensationForm}\n />\n\n <CompFields.PaymentUnit\n label={t('management.wageFrequencyLabel')}\n description={t('paymentUnitDescription')}\n validationMessages={{ REQUIRED: t('validations.paymentUnit') }}\n getOptionLabel={(unit: PaymentUnit) =>\n t(`management.wageFrequencyOptions.${unit}` as const)\n }\n formHookResult={compensationForm}\n />\n\n {CompFields.EffectiveDate && (\n <CompFields.EffectiveDate\n label={t('effectiveDateLabel')}\n minDate={addDays(new Date(), 1)}\n maxDate={\n compensationForm.data.maximumEffectiveDate\n ? new Date(compensationForm.data.maximumEffectiveDate)\n : undefined\n }\n validationMessages={{\n REQUIRED: t('validations.effectiveDate'),\n EFFECTIVE_DATE_BEFORE_HIRE: t('validations.effectiveDateBeforeHire'),\n }}\n formHookResult={compensationForm}\n />\n )}\n\n {CompFields.AdjustForMinimumWage && (\n <CompFields.AdjustForMinimumWage\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n formHookResult={compensationForm}\n />\n )}\n\n {CompFields.MinimumWageId && (\n <CompFields.MinimumWageId\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n validationMessages={{ REQUIRED: t('validations.minimumWage') }}\n getOptionLabel={(wage: MinimumWage) =>\n `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`\n }\n formHookResult={compensationForm}\n />\n )}\n\n {JobFields.TwoPercentShareholder && (\n <JobFields.TwoPercentShareholder\n label={t('management.twoPercentShareholderLabel')}\n formHookResult={jobForm}\n />\n )}\n\n {JobFields.StateWcCovered && (\n <JobFields.StateWcCovered\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n getOptionLabel={(covered: boolean) =>\n covered ? t('stateWcCoveredOptions.yes') : t('stateWcCoveredOptions.no')\n }\n formHookResult={jobForm}\n />\n )}\n\n {JobFields.StateWcClassCode && (\n <JobFields.StateWcClassCode\n label={t('stateWcClassCodeLabel')}\n description={t('stateWcClassCodeDescription')}\n placeholder={t('stateWcClassCodeLabel')}\n validationMessages={{ REQUIRED: t('validations.stateWcClassCode') }}\n formHookResult={jobForm}\n />\n )}\n\n <ActionsLayout>\n {onCancel && (\n <Components.Button variant=\"secondary\" onClick={onCancel} isDisabled={isPending}>\n {t('cancelCta')}\n </Components.Button>\n )}\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('management.saveCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n )\n}\n"],"names":["EditCompensation","dictionary","props","useComponentDictionary","jsx","BaseBoundaries","CompensationDefaultsLoader","employeeId","jobId","_baseDefaults","rest","jobsQuery","useJobsAndCompensationsGetJobs","errorHandling","composeErrorHandler","BaseLayout","job","j","currentComp","c","defaultValues","Root","onCancel","className","onEvent","useI18n","jobForm","useJobForm","compensationForm","useCompensationForm","loadingErrorHandling","submitResult","composeSubmitHandler","jobResult","componentEvents","compensationResult","isPending","classNames","styles","Form","FormBody","t","useTranslation","Components","useComponentContext","format","useNumberFormatter","JobFields","CompFields","jsxs","Flex","Trans","FLSA_OVERTIME_SALARY_LIMIT","status","unit","addDays","wage","covered","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;AAiCO,SAASA,GAAiB,EAAE,YAAAC,GAAY,GAAGC,KAAgC;AAChF,SAAAC,EAAuB,yBAAyBF,CAAU,GAExD,gBAAAG,EAACC,KAAe,eAAc,oCAC5B,4BAACC,GAAA,EAA4B,GAAGJ,GAAO,EAAA,CACzC;AAEJ;AAUA,SAASI,EAA2B;AAAA,EAClC,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAeC;AAAA,EACf,GAAGC;AACL,GAAgB;AACd,QAAMC,IAAYC,EAA+B,EAAE,YAAAL,EAAA,GAAc,EAAE,SAAS,CAAC,CAACA,GAAY;AAE1F,MAAII,EAAU,aAAa,CAACA,EAAU,MAAM;AAC1C,UAAME,IAAgBC,EAAoB,CAACH,CAAS,CAAC;AACrD,6BAAQI,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAc,QAAQ;AAAA,EAC5D;AAEA,QAAMG,IAAML,EAAU,KAAK,MAAM,KAAK,CAAAM,MAAKA,EAAE,SAAST,CAAK,GACrDU,IAAcF,GAAK,eAAe,KAAK,OAAKG,EAAE,SAASH,EAAI,uBAAuB,GAElFI,IAA2DF,IAC7D;AAAA,IACE,OAAOA,EAAY,SAASF,GAAK,SAAS;AAAA,IAC1C,YAAYE,EAAY,cAAc;AAAA,IACtC,MAAM,OAAOA,EAAY,IAAI;AA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YACN;AAAA,UAEJ;AAAA,QAAA;AAAA,QAGJ,gBAAgB,CAACc,MACLhB,EAAVgB,IAAY,8BAAiC,0BAAN;AAAA,QAEzC,gBAAgB/B;AAAA,MAAA;AAAA,IAAA;AAAA,IAInBqB,EAAU,oBACT,gBAAA3C;AAAA,MAAC2C,EAAU;AAAA,MAAV;AAAA,QACC,OAAON,EAAE,uBAAuB;AAAA,QAChC,aAAaA,EAAE,6BAA6B;AAAA,QAC5C,aAAaA,EAAE,uBAAuB;AAAA,QACtC,oBAAoB,EAAE,UAAUA,EAAE,8BAA8B,EAAA;AAAA,QAChE,gBAAgBf;AAAA,MAAA;AAAA,IAAA;AAAA,sBAInBgC,GAAA,EACE,UAAA;AAAA,MAAApC,KACC,gBAAAlB,EAACuC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASrB,GAAU,YAAYc,GACnE,UAAAK,EAAE,WAAW,EAAA,CAChB;AAAA,MAEF,gBAAArC,EAACuC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWP,GACzC,UAAAK,EAAE,oBAAoB,EAAA,CACzB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"EditCompensation.js","sources":["../../../../../../src/components/Employee/Compensation/management/EditCompensation/EditCompensation.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { useTranslation } from 'react-i18next'\nimport { useJobsAndCompensationsGetJobs } from '@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs'\nimport { useJobForm } from '../../shared/useJobForm'\nimport { useCompensationForm, type CompensationFormData } from '../../shared/useCompensationForm'\nimport { ManagementCompensationFormBody } from '../ManagementCompensationFormBody'\nimport styles from './EditCompensation.module.scss'\nimport { BaseBoundaries, BaseLayout, type CommonComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { composeSubmitHandler } from '@/partner-hook-utils/form/composeSubmitHandler'\nimport { componentEvents, type EventType } from '@/shared/constants'\n\nexport interface EditCompensationProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n jobId: string\n onCancel?: () => void\n /** Called with `EMPLOYEE_COMPENSATION_UPDATED` then `EMPLOYEE_COMPENSATION_DONE` on a successful save. Use `EMPLOYEE_COMPENSATION_DONE` to trigger navigation. */\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function EditCompensation({ dictionary, ...props }: EditCompensationProps) {\n useComponentDictionary('Employee.Compensation', dictionary)\n return (\n <BaseBoundaries componentName=\"Employee.Compensation.Management\">\n <CompensationDefaultsLoader {...props} />\n </BaseBoundaries>\n )\n}\n\ntype LoaderProps = Omit<EditCompensationProps, 'dictionary'>\n\n// Fetches the current job's compensation data to pre-populate the form as\n// defaultValues before rendering Root. Uses the same non-suspense query that\n// useCompensationForm uses internally — React Query dedupes the request so no\n// extra network call is made once Root mounts.\n// defaultValues from CommonComponentInterface (unknown) is excluded from the\n// spread so it doesn't conflict with Root's typed defaultValues prop.\nfunction CompensationDefaultsLoader({\n employeeId,\n jobId,\n defaultValues: _baseDefaults,\n ...rest\n}: LoaderProps) {\n const jobsQuery = useJobsAndCompensationsGetJobs({ employeeId }, { enabled: !!employeeId })\n\n if (jobsQuery.isLoading || !jobsQuery.data) {\n const errorHandling = composeErrorHandler([jobsQuery])\n return <BaseLayout isLoading error={errorHandling.errors} />\n }\n\n const job = jobsQuery.data.jobs?.find(j => j.uuid === jobId)\n const currentComp = job?.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n\n const defaultValues: Partial<CompensationFormData> | undefined = currentComp\n ? {\n title: currentComp.title ?? job?.title ?? undefined,\n flsaStatus: currentComp.flsaStatus ?? undefined,\n rate: Number(currentComp.rate),\n paymentUnit: currentComp.paymentUnit ?? undefined,\n adjustForMinimumWage: currentComp.adjustForMinimumWage ?? false,\n minimumWageId: currentComp.minimumWages?.[0]?.uuid ?? '',\n // effectiveDate intentionally omitted — user must choose a future date\n }\n : undefined\n\n return <Root employeeId={employeeId} jobId={jobId} defaultValues={defaultValues} {...rest} />\n}\n\ninterface RootProps extends LoaderProps {\n defaultValues?: Partial<CompensationFormData>\n}\n\nfunction Root({ employeeId, jobId, defaultValues, onCancel, className, onEvent }: RootProps) {\n useI18n('Employee.Compensation')\n const { t } = useTranslation('Employee.Compensation')\n\n // Job form handles the non-effective-dated fields: 2% shareholder + WA WC.\n // Title is suppressed here because the compensation form owns title\n // (effective-dated alongside rate/unit/FLSA on the future-dated row).\n // Hire-date is suppressed because this surface never edits it.\n const jobForm = useJobForm({\n employeeId,\n jobId,\n withTitleField: false,\n withHireDateField: false,\n shouldFocusError: false,\n })\n\n // Compensation form runs in create mode (no compensationId) → POST\n // /v1/jobs/:jobId/compensations, creating a new future-dated compensation.\n // The form is pre-populated with the current comp's values via defaultValues\n // (fetched by CompensationDefaultsLoader) so the user can edit from the\n // current state, and picks a future effectiveDate to schedule the change.\n const compensationForm = useCompensationForm({\n employeeId,\n jobId,\n defaultValues,\n withEffectiveDateField: true,\n optionalFieldsToRequire: {\n create: ['title'],\n },\n shouldFocusError: false,\n })\n\n if (jobForm.isLoading || compensationForm.isLoading) {\n const loadingErrorHandling = composeErrorHandler([jobForm, compensationForm])\n return <BaseLayout isLoading error={loadingErrorHandling.errors} />\n }\n\n // PUT job first (immediate mutation of 2% shareholder / WC), then POST\n // the new compensation (the future-dated change). composeSubmitHandler\n // validates both forms in parallel and short-circuits before any network\n // I/O if either fails.\n const submitResult = composeSubmitHandler([jobForm, compensationForm], async () => {\n const jobResult = await jobForm.actions.onSubmit()\n if (!jobResult) return\n\n onEvent(componentEvents.EMPLOYEE_JOB_UPDATED, jobResult.data)\n\n const compensationResult = await compensationForm.actions.onSubmit()\n if (!compensationResult) return\n\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensationResult.data)\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE, compensationResult.data)\n })\n\n const errorHandling = composeErrorHandler([submitResult])\n const isPending = jobForm.status.isPending || compensationForm.status.isPending\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={errorHandling.errors}>\n <Form onSubmit={submitResult.handleSubmit}>\n <ManagementCompensationFormBody\n jobForm={jobForm}\n compensationForm={compensationForm}\n title={t('management.editCompensationTitle')}\n submitCtaLabel={t('management.saveCta')}\n isPending={isPending}\n onCancel={onCancel}\n />\n </Form>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["EditCompensation","dictionary","props","useComponentDictionary","jsx","BaseBoundaries","CompensationDefaultsLoader","employeeId","jobId","_baseDefaults","rest","jobsQuery","useJobsAndCompensationsGetJobs","errorHandling","composeErrorHandler","BaseLayout","job","j","currentComp","c","defaultValues","Root","onCancel","className","onEvent","useI18n","useTranslation","jobForm","useJobForm","compensationForm","useCompensationForm","loadingErrorHandling","submitResult","composeSubmitHandler","jobResult","componentEvents","compensationResult","isPending","classNames","styles","Form","ManagementCompensationFormBody"],"mappings":";;;;;;;;;;;;;;;AAuBO,SAASA,EAAiB,EAAE,YAAAC,GAAY,GAAGC,KAAgC;AAChF,SAAAC,EAAuB,yBAAyBF,CAAU,GAExD,gBAAAG,EAACC,KAAe,eAAc,oCAC5B,4BAACC,GAAA,EAA4B,GAAGJ,GAAO,EAAA,CACzC;AAEJ;AAUA,SAASI,EAA2B;AAAA,EAClC,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAeC;AAAA,EACf,GAAGC;AACL,GAAgB;AACd,QAAMC,IAAYC,EAA+B,EAAE,YAAAL,EAAA,GAAc,EAAE,SAAS,CAAC,CAACA,GAAY;AAE1F,MAAII,EAAU,aAAa,CAACA,EAAU,MAAM;AAC1C,UAAME,IAAgBC,EAAoB,CAACH,CAAS,CAAC;AACrD,6BAAQI,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAc,QAAQ;AAAA,EAC5D;AAEA,QAAMG,IAAML,EAAU,K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AY;AACjF,UAAMK,IAAY,MAAMP,EAAQ,QAAQ,SAAA;AACxC,QAAI,CAACO,EAAW;AAEhB,IAAAV,EAAQW,EAAgB,sBAAsBD,EAAU,IAAI;AAE5D,UAAME,IAAqB,MAAMP,EAAiB,QAAQ,SAAA;AAC1D,IAAKO,MAELZ,EAAQW,EAAgB,+BAA+BC,EAAmB,IAAI,GAC9EZ,EAAQW,EAAgB,4BAA4BC,EAAmB,IAAI;AAAA,EAC7E,CAAC,GAEKvB,IAAgBC,EAAoB,CAACkB,CAAY,CAAC,GAClDK,IAAYV,EAAQ,OAAO,aAAaE,EAAiB,OAAO;AAEtE,2BACG,WAAA,EAAQ,WAAWS,EAAWC,EAAO,WAAWhB,CAAS,GACxD,UAAA,gBAAAnB,EAACW,GAAA,EAAW,OAAOF,EAAc,QAC/B,4BAAC2B,GAAA,EAAK,UAAUR,EAAa,cAC3B,UAAA,gBAAA5B;AAAA,IAACqC;AAAA,IAAA;AAAA,MACC,SAAAd;AAAA,MACA,kBAAAE;AAAA,MACA,OAAO,EAAE,kCAAkC;AAAA,MAC3C,gBAAgB,EAAE,oBAAoB;AAAA,MACtC,WAAAQ;AAAA,MACA,UAAAf;AAAA,IAAA;AAAA,EAAA,EACF,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CommonComponentInterface } from '../../../../Base';
|
|
2
|
+
import { OnEventType } from '../../../../Base/useBase';
|
|
3
|
+
import { EventType } from '../../../../../shared/constants';
|
|
4
|
+
export interface EditPendingCompensationProps extends CommonComponentInterface<'Employee.Compensation'> {
|
|
5
|
+
employeeId: string;
|
|
6
|
+
jobId: string;
|
|
7
|
+
/** The UUID of the pending (future-dated) compensation to update. Always required — this
|
|
8
|
+
* component only operates in update mode. */
|
|
9
|
+
compensationId: string;
|
|
10
|
+
/**
|
|
11
|
+
* True when the job has no current (on-or-before-today) compensation — i.e. it hasn't
|
|
12
|
+
* started yet. Drives which date field is shown and how the submit syncs hire_date.
|
|
13
|
+
*/
|
|
14
|
+
isNewJob: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* True when this is the employee's primary job. Combined with `isNewJob`, determines
|
|
17
|
+
* whether to show a Hire date field (primary) or Effective date field (secondary/change).
|
|
18
|
+
*/
|
|
19
|
+
isPrimaryJob: boolean;
|
|
20
|
+
onCancel?: () => void;
|
|
21
|
+
/** Called with `EMPLOYEE_COMPENSATION_UPDATED` then `EMPLOYEE_COMPENSATION_DONE` on a
|
|
22
|
+
* successful save. Use `EMPLOYEE_COMPENSATION_DONE` to trigger navigation. */
|
|
23
|
+
onEvent: OnEventType<EventType, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export declare function EditPendingCompensation({ dictionary, ...props }: EditPendingCompensationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import O from "classnames";
|
|
3
|
+
import { useTranslation as N } from "react-i18next";
|
|
4
|
+
import { useJobForm as S } from "../../shared/useJobForm/useJobForm.js";
|
|
5
|
+
import { useCompensationForm as T } from "../../shared/useCompensationForm/useCompensationForm.js";
|
|
6
|
+
import { ManagementCompensationFormBody as v } from "../ManagementCompensationFormBody.js";
|
|
7
|
+
import L from "./EditPendingCompensation.module.scss.js";
|
|
8
|
+
import { BaseBoundaries as M, BaseLayout as f } from "../../../../Base/Base.js";
|
|
9
|
+
import "../../../../Base/useBase.js";
|
|
10
|
+
import { Form as w } from "../../../../Common/Form/Form.js";
|
|
11
|
+
import { useComponentDictionary as R, useI18n as _ } from "../../../../../i18n/I18n.js";
|
|
12
|
+
import { composeErrorHandler as E } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
13
|
+
import { composeSubmitHandler as B } from "../../../../../partner-hook-utils/form/composeSubmitHandler.js";
|
|
14
|
+
import { componentEvents as p } from "../../../../../shared/constants.js";
|
|
15
|
+
function W({ dictionary: n, ...r }) {
|
|
16
|
+
return R("Employee.Compensation", n), /* @__PURE__ */ e(M, { componentName: "Employee.Compensation.Management", children: /* @__PURE__ */ e(H, { ...r }) });
|
|
17
|
+
}
|
|
18
|
+
function H({
|
|
19
|
+
employeeId: n,
|
|
20
|
+
jobId: r,
|
|
21
|
+
compensationId: u,
|
|
22
|
+
isNewJob: h,
|
|
23
|
+
isPrimaryJob: g,
|
|
24
|
+
onCancel: C,
|
|
25
|
+
className: F,
|
|
26
|
+
onEvent: s
|
|
27
|
+
}) {
|
|
28
|
+
_("Employee.Compensation");
|
|
29
|
+
const { t: c } = N("Employee.Compensation"), i = h && g, o = S({
|
|
30
|
+
employeeId: n,
|
|
31
|
+
jobId: r,
|
|
32
|
+
withTitleField: !1,
|
|
33
|
+
withHireDateField: i,
|
|
34
|
+
// hireDate is optional by default in update mode — promote it so the form
|
|
35
|
+
// validates it and the label doesn't show "(optional)".
|
|
36
|
+
optionalFieldsToRequire: i ? { update: ["hireDate"] } : void 0,
|
|
37
|
+
shouldFocusError: !1
|
|
38
|
+
}), t = T({
|
|
39
|
+
employeeId: n,
|
|
40
|
+
jobId: r,
|
|
41
|
+
compensationId: u,
|
|
42
|
+
// Primary new job: comp date is set via jobForm's hire date on submit —
|
|
43
|
+
// hide it here to avoid showing two date fields.
|
|
44
|
+
withEffectiveDateField: !i,
|
|
45
|
+
optionalFieldsToRequire: {
|
|
46
|
+
update: i ? ["title", "flsaStatus", "rate", "paymentUnit"] : ["title", "flsaStatus", "rate", "paymentUnit", "effectiveDate"]
|
|
47
|
+
},
|
|
48
|
+
shouldFocusError: !1
|
|
49
|
+
});
|
|
50
|
+
if (o.isLoading || t.isLoading) {
|
|
51
|
+
const a = E([o, t]);
|
|
52
|
+
return /* @__PURE__ */ e(f, { isLoading: !0, error: a.errors });
|
|
53
|
+
}
|
|
54
|
+
const d = B([o, t], async () => {
|
|
55
|
+
const a = i ? o.form.hookFormInternals.formMethods.getValues("hireDate") ?? void 0 : void 0, m = await o.actions.onSubmit();
|
|
56
|
+
if (!m) return;
|
|
57
|
+
s(p.EMPLOYEE_JOB_UPDATED, m.data);
|
|
58
|
+
const b = m.data.compensations?.find(
|
|
59
|
+
(y) => y.uuid === u
|
|
60
|
+
)?.version, l = await t.actions.onSubmit({
|
|
61
|
+
...a ? { effectiveDate: a } : {},
|
|
62
|
+
compensationVersion: b
|
|
63
|
+
});
|
|
64
|
+
l && (s(p.EMPLOYEE_COMPENSATION_UPDATED, l.data), s(p.EMPLOYEE_COMPENSATION_DONE, l.data));
|
|
65
|
+
}), D = E([d]), P = o.status.isPending || t.status.isPending;
|
|
66
|
+
return /* @__PURE__ */ e("section", { className: O(L.container, F), children: /* @__PURE__ */ e(f, { error: D.errors, children: /* @__PURE__ */ e(w, { onSubmit: d.handleSubmit, children: /* @__PURE__ */ e(
|
|
67
|
+
v,
|
|
68
|
+
{
|
|
69
|
+
jobForm: o,
|
|
70
|
+
compensationForm: t,
|
|
71
|
+
title: c("management.editCompensationTitle"),
|
|
72
|
+
submitCtaLabel: c("management.saveCta"),
|
|
73
|
+
isPending: P,
|
|
74
|
+
onCancel: C
|
|
75
|
+
}
|
|
76
|
+
) }) }) });
|
|
77
|
+
}
|
|
78
|
+
export {
|
|
79
|
+
W as EditPendingCompensation
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=EditPendingCompensation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditPendingCompensation.js","sources":["../../../../../../src/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.tsx"],"sourcesContent":["import classNames from 'classnames'\nimport { useTranslation } from 'react-i18next'\nimport { useJobForm } from '../../shared/useJobForm'\nimport { useCompensationForm } from '../../shared/useCompensationForm'\nimport { ManagementCompensationFormBody } from '../ManagementCompensationFormBody'\nimport styles from './EditPendingCompensation.module.scss'\nimport { BaseBoundaries, BaseLayout, type CommonComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { composeSubmitHandler } from '@/partner-hook-utils/form/composeSubmitHandler'\nimport { componentEvents, type EventType } from '@/shared/constants'\n\nexport interface EditPendingCompensationProps extends CommonComponentInterface<'Employee.Compensation'> {\n employeeId: string\n jobId: string\n /** The UUID of the pending (future-dated) compensation to update. Always required — this\n * component only operates in update mode. */\n compensationId: string\n /**\n * True when the job has no current (on-or-before-today) compensation — i.e. it hasn't\n * started yet. Drives which date field is shown and how the submit syncs hire_date.\n */\n isNewJob: boolean\n /**\n * True when this is the employee's primary job. Combined with `isNewJob`, determines\n * whether to show a Hire date field (primary) or Effective date field (secondary/change).\n */\n isPrimaryJob: boolean\n onCancel?: () => void\n /** Called with `EMPLOYEE_COMPENSATION_UPDATED` then `EMPLOYEE_COMPENSATION_DONE` on a\n * successful save. Use `EMPLOYEE_COMPENSATION_DONE` to trigger navigation. */\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function EditPendingCompensation({ dictionary, ...props }: EditPendingCompensationProps) {\n useComponentDictionary('Employee.Compensation', dictionary)\n return (\n <BaseBoundaries componentName=\"Employee.Compensation.Management\">\n <Root {...props} />\n </BaseBoundaries>\n )\n}\n\ntype RootProps = Omit<EditPendingCompensationProps, 'dictionary'>\n\nfunction Root({\n employeeId,\n jobId,\n compensationId,\n isNewJob,\n isPrimaryJob,\n onCancel,\n className,\n onEvent,\n}: RootProps) {\n useI18n('Employee.Compensation')\n const { t } = useTranslation('Employee.Compensation')\n\n // For a primary new job (hire date in the future, no current comp), the hire\n // date field is shown instead of the effective date field. This keeps\n // hire_date and comp effective_date in sync so the API doesn't auto-create a\n // second compensation when the initial comp moves off the hire date.\n const isPrimaryNewJob = isNewJob && isPrimaryJob\n\n const jobForm = useJobForm({\n employeeId,\n jobId,\n withTitleField: false,\n withHireDateField: isPrimaryNewJob,\n // hireDate is optional by default in update mode — promote it so the form\n // validates it and the label doesn't show \"(optional)\".\n optionalFieldsToRequire: isPrimaryNewJob ? { update: ['hireDate'] } : undefined,\n shouldFocusError: false,\n })\n\n const compensationForm = useCompensationForm({\n employeeId,\n jobId,\n compensationId,\n // Primary new job: comp date is set via jobForm's hire date on submit —\n // hide it here to avoid showing two date fields.\n withEffectiveDateField: !isPrimaryNewJob,\n optionalFieldsToRequire: {\n update: isPrimaryNewJob\n ? ['title', 'flsaStatus', 'rate', 'paymentUnit']\n : ['title', 'flsaStatus', 'rate', 'paymentUnit', 'effectiveDate'],\n },\n shouldFocusError: false,\n })\n\n if (jobForm.isLoading || compensationForm.isLoading) {\n const loadingErrorHandling = composeErrorHandler([jobForm, compensationForm])\n return <BaseLayout isLoading error={loadingErrorHandling.errors} />\n }\n\n const submitResult = composeSubmitHandler([jobForm, compensationForm], async () => {\n // For a primary new job, the user edits the hire date field. We read it\n // back here and pass it to the comp submit so both the job's hire_date and\n // the comp's effective_date land on the same value — preventing the API\n // from auto-creating a second compensation to fill the gap at the old date.\n const hireDateOverride = isPrimaryNewJob\n ? (jobForm.form.hookFormInternals.formMethods.getValues('hireDate') ?? undefined)\n : undefined\n\n const jobResult = await jobForm.actions.onSubmit()\n if (!jobResult) return\n\n onEvent(componentEvents.EMPLOYEE_JOB_UPDATED, jobResult.data)\n\n // When the hire date moves forward, the API auto-syncs the compensation's\n // effective_date to the new hire_date as part of the job PUT, which bumps\n // the compensation's version. Read it from the job response so the\n // subsequent compensation PUT doesn't send a stale version.\n const freshCompVersion = jobResult.data.compensations?.find(\n c => c.uuid === compensationId,\n )?.version\n\n const compensationResult = await compensationForm.actions.onSubmit({\n ...(hireDateOverride ? { effectiveDate: hireDateOverride } : {}),\n compensationVersion: freshCompVersion,\n })\n if (!compensationResult) return\n\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_UPDATED, compensationResult.data)\n onEvent(componentEvents.EMPLOYEE_COMPENSATION_DONE, compensationResult.data)\n })\n\n const errorHandling = composeErrorHandler([submitResult])\n const isPending = jobForm.status.isPending || compensationForm.status.isPending\n\n return (\n <section className={classNames(styles.container, className)}>\n <BaseLayout error={errorHandling.errors}>\n <Form onSubmit={submitResult.handleSubmit}>\n <ManagementCompensationFormBody\n jobForm={jobForm}\n compensationForm={compensationForm}\n title={t('management.editCompensationTitle')}\n submitCtaLabel={t('management.saveCta')}\n isPending={isPending}\n onCancel={onCancel}\n />\n </Form>\n </BaseLayout>\n </section>\n )\n}\n"],"names":["EditPendingCompensation","dictionary","props","useComponentDictionary","jsx","BaseBoundaries","Root","employeeId","jobId","compensationId","isNewJob","isPrimaryJob","onCancel","className","onEvent","useI18n","t","useTranslation","isPrimaryNewJob","jobForm","useJobForm","compensationForm","useCompensationForm","loadingErrorHandling","composeErrorHandler","BaseLayout","submitResult","composeSubmitHandler","hireDateOverride","jobResult","componentEvents","freshCompVersion","c","compensationResult","errorHandling","isPending","classNames","styles","Form","ManagementCompensationFormBody"],"mappings":";;;;;;;;;;;;;;AAoCO,SAASA,EAAwB,EAAE,YAAAC,GAAY,GAAGC,KAAuC;AAC9F,SAAAC,EAAuB,yBAAyBF,CAAU,GAExD,gBAAAG,EAACC,KAAe,eAAc,oCAC5B,4BAACC,GAAA,EAAM,GAAGJ,GAAO,EAAA,CACnB;AAEJ;AAIA,SAASI,EAAK;AAAA,EACZ,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AACF,GAAc;AACZ,EAAAC,EAAQ,uBAAuB;AAC/B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAM9CC,IAAkBR,KAAYC,GAE9BQ,IAAUC,EAAW;AAAA,IACzB,YAAAb;AAAA,IACA,OAAAC;AAAA,IACA,gBAAgB;AAAA,IAChB,mBAAmBU;AAAA;AAAA;AAAA,IAGnB,yBAAyBA,IAAkB,EAAE,QAAQ,CAAC,UAAU,MAAM;AAAA,IACtE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