@gusto/embedded-react-sdk 0.37.0-rc.3 → 0.37.0-rc.4
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 +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.d.ts +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.js +88 -69
- package/dist/components/Common/UI/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +13 -0
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +6 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +11 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +60 -58
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +39 -36
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +1 -0
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +3 -2
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/List.js +6 -5
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +16 -16
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +5 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +10 -10
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +3 -2
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +4 -4
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -4
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +7 -6
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +48 -48
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +10 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +15 -14
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +4 -4
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +12 -11
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -0
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +3 -2
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +10 -10
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +44 -55
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js +9 -8
- package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js +12 -11
- package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js +3 -2
- package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js +8 -7
- package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js +9 -8
- package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js +13 -12
- package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js +4 -4
- package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js +1 -1
- package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +6 -6
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +8 -8
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +2 -1
- package/docs/reference/endpoint-inventory.json +9 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst Rev2020Schema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n})\n\nexport const FederalFormSchema = Rev2020Schema\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFilingStatusPlaceholder')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n isRequired\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n IrsLink: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["Rev2020Schema","z","FederalFormSchema","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusOptions","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst Rev2020Schema = z.object({\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n})\n\nexport const FederalFormSchema = Rev2020Schema\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFilingStatusPlaceholder')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n isRequired\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n IrsLink: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["Rev2020Schema","z","FederalFormSchema","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusOptions","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":";;;;;;;;AAKA,MAAMA,IAAgBC,EAAE,OAAO;AAAA,EAC7B,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,kBAAkBA,EAAE,SAAS,UAAU,MAAM;AAAA,EAC7C,aAAaA,EAAE,SAAS,UAAU,MAAM;AAAA,EACxC,YAAYA,EAAE,SAAS,UAAU,MAAM;AAAA,EACvC,kBAAkBA,EAAE,OAAA,EAAS,UAAU,MAAM;AAC/C,CAAC,GAEYC,IAAoBF;AAK1B,SAASG,IAAc;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,gBAAgB,GACvCC,IAAaC,EAAA,GAEbC,IAAsB;AAAA,IAC1B,EAAE,OAAO,UAAU,OAAOJ,EAAE,oBAAoB,EAAA;AAAA,IAChD,EAAE,OAAO,WAAW,OAAOA,EAAE,qBAAqB,EAAA;AAAA,IAClD,EAAE,OAAO,qBAAqB,OAAOA,EAAE,6BAA6B,EAAA;AAAA,IACpE,EAAE,OAAO,2BAA2B,OAAOA,EAAE,mCAAmC,EAAA;AAAA,EAAE;AAGpF,SACE,gBAAAK,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOR,EAAE,uBAAuB;AAAA,QAChC,aAAaA,EAAE,gCAAgC;AAAA,QAC/C,SAASI;AAAA,QACT,YAAU;AAAA,QACV,cAAcJ,EAAE,iCAAiC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnD,gBAAAO;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOT,EAAE,gBAAgB;AAAA,QACzB,cAAcA,EAAE,4BAA4B;AAAA,QAC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;"}
|
|
@@ -11,10 +11,11 @@ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../shared/constants.js";
|
|
13
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
14
15
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
15
|
-
const [
|
|
16
|
+
const [f, v] = o("TaxesContext");
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
v as TaxesProvider,
|
|
19
|
+
f as useTaxes
|
|
19
20
|
};
|
|
20
21
|
//# sourceMappingURL=useTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
2
|
import { useQueryClient as S } from "@tanstack/react-query";
|
|
3
3
|
import { useEmployeesGetSuspense as Y } from "@gusto/embedded-api/react-query/employeesGet";
|
|
4
4
|
import { useEmployeeEmploymentsGetTerminationsSuspense as q, invalidateAllEmployeeEmploymentsGetTerminations as I } from "@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations";
|
|
@@ -8,7 +8,7 @@ import { usePayrollsCreateOffCycleMutation as G } from "@gusto/embedded-api/reac
|
|
|
8
8
|
import { usePaySchedulesGetUnprocessedTerminationPeriods as k, invalidateAllPaySchedulesGetUnprocessedTerminationPeriods as x } from "@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods";
|
|
9
9
|
import { invalidateAllPayrollsList as W } from "@gusto/embedded-api/react-query/payrollsList";
|
|
10
10
|
import { OffCycleReason as F } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
|
|
11
|
-
import { RFCDate as
|
|
11
|
+
import { RFCDate as p } from "@gusto/embedded-api/types/rfcdate";
|
|
12
12
|
import { TerminateEmployeePresentation as H } from "./TerminateEmployeePresentation.js";
|
|
13
13
|
import { BaseComponent as j } from "../../../Base/Base.js";
|
|
14
14
|
import { useBase as Q } from "../../../Base/useBase.js";
|
|
@@ -16,93 +16,93 @@ import { componentEvents as n } from "../../../../shared/constants.js";
|
|
|
16
16
|
import { useComponentDictionary as V, useI18n as z } from "../../../../i18n/I18n.js";
|
|
17
17
|
import { firstLastName as J } from "../../../../helpers/formattedStrings.js";
|
|
18
18
|
function Te(e) {
|
|
19
|
-
return /* @__PURE__ */
|
|
19
|
+
return /* @__PURE__ */ y(j, { ...e, children: /* @__PURE__ */ y(K, { ...e, children: e.children }) });
|
|
20
20
|
}
|
|
21
|
-
const K = ({ employeeId: e, companyId:
|
|
22
|
-
V("Employee.Terminations.TerminateEmployee",
|
|
23
|
-
const c = S(), { onEvent: i, baseSubmitHandler:
|
|
24
|
-
data: { employee:
|
|
25
|
-
} = Y({ employeeId: e }), { data:
|
|
26
|
-
if (
|
|
21
|
+
const K = ({ employeeId: e, companyId: f, dictionary: D }) => {
|
|
22
|
+
V("Employee.Terminations.TerminateEmployee", D), z("Employee.Terminations.TerminateEmployee");
|
|
23
|
+
const c = S(), { onEvent: i, baseSubmitHandler: C } = Q(), {
|
|
24
|
+
data: { employee: u }
|
|
25
|
+
} = Y({ employeeId: e }), { data: r } = q({ employeeId: e });
|
|
26
|
+
if (u?.terminated && r.terminationList?.[0])
|
|
27
27
|
return i(n.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {
|
|
28
28
|
employeeId: e,
|
|
29
|
-
effectiveDate:
|
|
30
|
-
termination:
|
|
29
|
+
effectiveDate: r.terminationList[0].effectiveDate,
|
|
30
|
+
termination: r.terminationList[0]
|
|
31
31
|
}), null;
|
|
32
|
-
const { mutateAsync:
|
|
33
|
-
{ companyId:
|
|
32
|
+
const { mutateAsync: O, isPending: A } = b(), { mutateAsync: L, isPending: h } = B(), { mutateAsync: N, isPending: M } = G(), { refetch: _ } = k(
|
|
33
|
+
{ companyId: f },
|
|
34
34
|
{ enabled: !1 }
|
|
35
|
-
),
|
|
36
|
-
first_name:
|
|
37
|
-
last_name:
|
|
38
|
-
}),
|
|
39
|
-
return /* @__PURE__ */
|
|
35
|
+
), R = J({
|
|
36
|
+
first_name: u?.firstName,
|
|
37
|
+
last_name: u?.lastName
|
|
38
|
+
}), s = r.terminationList?.[0];
|
|
39
|
+
return /* @__PURE__ */ y(
|
|
40
40
|
H,
|
|
41
41
|
{
|
|
42
|
-
employeeName:
|
|
43
|
-
existingTermination:
|
|
44
|
-
onSubmit: async (
|
|
45
|
-
const { lastDayOfWork:
|
|
46
|
-
await
|
|
47
|
-
const
|
|
42
|
+
employeeName: R,
|
|
43
|
+
existingTermination: s,
|
|
44
|
+
onSubmit: async (g) => {
|
|
45
|
+
const { lastDayOfWork: U, payrollOption: o } = g, m = U.toISOString().split("T")[0];
|
|
46
|
+
await C({ effectiveDate: m, payrollOption: o }, async () => {
|
|
47
|
+
const l = o === "dismissalPayroll", d = s ? await L({
|
|
48
48
|
request: {
|
|
49
49
|
employeeId: e,
|
|
50
50
|
requestBody: {
|
|
51
|
-
version:
|
|
52
|
-
effectiveDate:
|
|
53
|
-
runTerminationPayroll:
|
|
51
|
+
version: s.version,
|
|
52
|
+
effectiveDate: m,
|
|
53
|
+
runTerminationPayroll: l
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
}) : await
|
|
56
|
+
}) : await O({
|
|
57
57
|
request: {
|
|
58
58
|
employeeId: e,
|
|
59
59
|
requestBody: {
|
|
60
|
-
effectiveDate:
|
|
61
|
-
runTerminationPayroll:
|
|
60
|
+
effectiveDate: m,
|
|
61
|
+
runTerminationPayroll: l
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
65
|
await I(c);
|
|
66
66
|
let T;
|
|
67
|
-
if (
|
|
67
|
+
if (l)
|
|
68
68
|
try {
|
|
69
|
-
const { data:
|
|
69
|
+
const { data: E } = await _(), w = E?.unprocessedTerminationPayPeriodList?.filter(
|
|
70
70
|
(t) => t.employeeUuid === e
|
|
71
|
-
) ?? [],
|
|
72
|
-
for (const t of
|
|
71
|
+
) ?? [], a = [];
|
|
72
|
+
for (const t of w)
|
|
73
73
|
if (t.startDate && t.endDate) {
|
|
74
|
-
const
|
|
74
|
+
const P = await N({
|
|
75
75
|
request: {
|
|
76
|
-
companyId:
|
|
76
|
+
companyId: f,
|
|
77
77
|
requestBody: {
|
|
78
78
|
offCycle: !0,
|
|
79
79
|
offCycleReason: F.DismissedEmployee,
|
|
80
|
-
startDate: new
|
|
81
|
-
endDate: new
|
|
80
|
+
startDate: new p(t.startDate),
|
|
81
|
+
endDate: new p(t.endDate),
|
|
82
82
|
employeeUuids: [e],
|
|
83
|
-
checkDate: t.checkDate ? new
|
|
83
|
+
checkDate: t.checkDate ? new p(t.checkDate) : void 0
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
|
-
|
|
87
|
+
P.payrollUnprocessed && a.push(P.payrollUnprocessed);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
payrolls:
|
|
89
|
+
a.length > 0 && (T = a[0]?.payrollUuid ?? a[0]?.uuid, await W(c), await x(c), i(n.EMPLOYEE_TERMINATION_PAYROLL_CREATED, {
|
|
90
|
+
payrolls: a
|
|
91
91
|
}));
|
|
92
|
-
} catch (
|
|
92
|
+
} catch (E) {
|
|
93
93
|
i(n.EMPLOYEE_TERMINATION_PAYROLL_FAILED, {
|
|
94
|
-
error:
|
|
94
|
+
error: E,
|
|
95
95
|
employeeId: e
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
|
-
const v =
|
|
98
|
+
const v = s ? n.EMPLOYEE_TERMINATION_UPDATED : n.EMPLOYEE_TERMINATION_CREATED;
|
|
99
99
|
i(v, {
|
|
100
100
|
termination: d.termination,
|
|
101
101
|
payrollOption: o,
|
|
102
|
-
runTerminationPayroll:
|
|
102
|
+
runTerminationPayroll: l
|
|
103
103
|
}), i(n.EMPLOYEE_TERMINATION_DONE, {
|
|
104
104
|
employeeId: e,
|
|
105
|
-
effectiveDate:
|
|
105
|
+
effectiveDate: m,
|
|
106
106
|
payrollOption: o,
|
|
107
107
|
payrollUuid: T,
|
|
108
108
|
termination: d.termination,
|
|
@@ -113,7 +113,7 @@ const K = ({ employeeId: e, companyId: p, dictionary: P }) => {
|
|
|
113
113
|
onCancel: () => {
|
|
114
114
|
i(n.CANCEL);
|
|
115
115
|
},
|
|
116
|
-
isLoading:
|
|
116
|
+
isLoading: A || h || M
|
|
117
117
|
}
|
|
118
118
|
);
|
|
119
119
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TerminateEmployee.js","sources":["../../../../../src/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.tsx"],"sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsCreateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsCreateTermination'\nimport { useEmployeeEmploymentsUpdateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsUpdateTermination'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n usePaySchedulesGetUnprocessedTerminationPeriods,\n invalidateAllPaySchedulesGetUnprocessedTerminationPeriods,\n} from '@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods'\nimport { invalidateAllPayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { OffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport type { PayrollOption } from '../types'\nimport { TerminateEmployeePresentation } from './TerminateEmployeePresentation'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\nexport interface TerminateEmployeeProps extends BaseComponentInterface<'Employee.Terminations.TerminateEmployee'> {\n employeeId: string\n companyId: string\n}\n\nexport interface TerminateEmployeeFormData {\n lastDayOfWork: Date\n payrollOption: PayrollOption\n}\n\nexport function TerminateEmployee(props: TerminateEmployeeProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, dictionary }: TerminateEmployeeProps) => {\n useComponentDictionary('Employee.Terminations.TerminateEmployee', dictionary)\n useI18n('Employee.Terminations.TerminateEmployee')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n // If employee is already terminated, redirect to summary with existing termination data\n // Don't pass payrollOption to avoid showing the success alert\n if (employee?.terminated && terminationsData.terminationList?.[0]) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {\n employeeId,\n effectiveDate: terminationsData.terminationList[0].effectiveDate!,\n termination: terminationsData.terminationList[0],\n })\n return null\n }\n\n const { mutateAsync: createTermination, isPending: isCreatingTermination } =\n useEmployeeEmploymentsCreateTerminationMutation()\n\n const { mutateAsync: updateTermination, isPending: isUpdatingTermination } =\n useEmployeeEmploymentsUpdateTerminationMutation()\n\n const { mutateAsync: createOffCyclePayroll, isPending: isCreatingPayroll } =\n usePayrollsCreateOffCycleMutation()\n\n const { refetch: fetchTerminationPeriods } = usePaySchedulesGetUnprocessedTerminationPeriods(\n { companyId },\n { enabled: false },\n )\n\n const employeeName = firstLastName({\n first_name: employee?.firstName,\n last_name: employee?.lastName,\n })\n\n const existingTermination = terminationsData.terminationList?.[0]\n\n const handleSubmit = async (formData: TerminateEmployeeFormData) => {\n const { lastDayOfWork, payrollOption } = formData\n const effectiveDate = lastDayOfWork.toISOString().split('T')[0]!\n\n await baseSubmitHandler({ effectiveDate, payrollOption }, async () => {\n const runTerminationPayroll = payrollOption === 'dismissalPayroll'\n\n const result = existingTermination\n ? await updateTermination({\n request: {\n employeeId,\n requestBody: {\n version: existingTermination.version!,\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n : await createTermination({\n request: {\n employeeId,\n requestBody: {\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n\n let firstPayrollUuid: string | undefined\n\n if (runTerminationPayroll) {\n try {\n const { data: terminationPeriodsData } = await fetchTerminationPeriods()\n\n const employeePeriods =\n terminationPeriodsData?.unprocessedTerminationPayPeriodList?.filter(\n period => period.employeeUuid === employeeId,\n ) ?? []\n\n const createdPayrolls = []\n\n for (const terminationPeriod of employeePeriods) {\n if (terminationPeriod.startDate && terminationPeriod.endDate) {\n const payrollResult = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: OffCycleReason.DismissedEmployee,\n startDate: new RFCDate(terminationPeriod.startDate),\n endDate: new RFCDate(terminationPeriod.endDate),\n employeeUuids: [employeeId],\n checkDate: terminationPeriod.checkDate\n ? new RFCDate(terminationPeriod.checkDate)\n : undefined,\n },\n },\n })\n\n createdPayrolls.push(payrollResult.payrollUnprocessed)\n }\n }\n\n if (createdPayrolls.length > 0) {\n firstPayrollUuid = createdPayrolls[0]?.payrollUuid\n\n await invalidateAllPayrollsList(queryClient)\n await invalidateAllPaySchedulesGetUnprocessedTerminationPeriods(queryClient)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_CREATED, {\n payrolls: createdPayrolls,\n })\n }\n } catch (payrollError) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_FAILED, {\n error: payrollError,\n employeeId,\n })\n }\n }\n\n const eventType = existingTermination\n ? componentEvents.EMPLOYEE_TERMINATION_UPDATED\n : componentEvents.EMPLOYEE_TERMINATION_CREATED\n\n onEvent(eventType, {\n termination: result.termination,\n payrollOption,\n runTerminationPayroll,\n })\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_DONE, {\n employeeId,\n effectiveDate,\n payrollOption,\n payrollUuid: firstPayrollUuid,\n termination: result.termination,\n ...(payrollOption === 'anotherWay' && { manualHandling: true }),\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const isPending = isCreatingTermination || isUpdatingTermination || isCreatingPayroll\n\n return (\n <TerminateEmployeePresentation\n employeeName={employeeName}\n existingTermination={existingTermination}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isLoading={isPending}\n />\n )\n}\n"],"names":["TerminateEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","componentEvents","createTermination","isCreatingTermination","useEmployeeEmploymentsCreateTerminationMutation","updateTermination","isUpdatingTermination","useEmployeeEmploymentsUpdateTerminationMutation","createOffCyclePayroll","isCreatingPayroll","usePayrollsCreateOffCycleMutation","fetchTerminationPeriods","usePaySchedulesGetUnprocessedTerminationPeriods","employeeName","firstLastName","existingTermination","TerminateEmployeePresentation","formData","lastDayOfWork","payrollOption","effectiveDate","runTerminationPayroll","result","invalidateAllEmployeeEmploymentsGetTerminations","firstPayrollUuid","terminationPeriodsData","employeePeriods","period","createdPayrolls","terminationPeriod","payrollResult","OffCycleReason","RFCDate","invalidateAllPayrollsList","invalidateAllPaySchedulesGetUnprocessedTerminationPeriods","payrollError","eventType"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,SAASA,GAAkBC,GAA+B;AAC/D,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,QAAyC;AAC9E,EAAAC,EAAuB,2CAA2CD,CAAU,GAC5EE,EAAQ,yCAAyC;AAEjD,QAAMC,IAAcC,EAAA,GACd,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAA;AAAA,EAAS,IACfC,EAAwB,EAAE,YAAAX,G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,IACdd,EAAgB,+BAChBA,EAAgB;AAEpB,UAAAP,EAAQ0C,GAAW;AAAA,YACjB,aAAad,EAAO;AAAA,YACpB,eAAAH;AAAA,YACA,uBAAAE;AAAA,UAAA,CACD,GAED3B,EAAQO,EAAgB,2BAA2B;AAAA,YACjD,YAAAd;AAAA,YACA,eAAAiC;AAAA,YACA,eAAAD;AAAA,YACA,aAAaK;AAAA,YACb,aAAaF,EAAO;AAAA,YACpB,GAAIH,MAAkB,gBAAgB,EAAE,gBAAgB,GAAA;AAAA,UAAK,CAC9D;AAAA,QACH,CAAC;AAAA,MACH;AAAA,MAaI,UAXiB,MAAM;AACzB,QAAAzB,EAAQO,EAAgB,MAAM;AAAA,MAChC;AAAA,MAUI,WARcE,KAAyBG,KAAyBG;AAAA,IAQrD;AAAA,EAAA;AAGjB;"}
|
|
1
|
+
{"version":3,"file":"TerminateEmployee.js","sources":["../../../../../src/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.tsx"],"sourcesContent":["import { useQueryClient } from '@tanstack/react-query'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n useEmployeeEmploymentsGetTerminationsSuspense,\n invalidateAllEmployeeEmploymentsGetTerminations,\n} from '@gusto/embedded-api/react-query/employeeEmploymentsGetTerminations'\nimport { useEmployeeEmploymentsCreateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsCreateTermination'\nimport { useEmployeeEmploymentsUpdateTerminationMutation } from '@gusto/embedded-api/react-query/employeeEmploymentsUpdateTermination'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport {\n usePaySchedulesGetUnprocessedTerminationPeriods,\n invalidateAllPaySchedulesGetUnprocessedTerminationPeriods,\n} from '@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods'\nimport { invalidateAllPayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { OffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport type { PayrollOption } from '../types'\nimport { TerminateEmployeePresentation } from './TerminateEmployeePresentation'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\nexport interface TerminateEmployeeProps extends BaseComponentInterface<'Employee.Terminations.TerminateEmployee'> {\n employeeId: string\n companyId: string\n}\n\nexport interface TerminateEmployeeFormData {\n lastDayOfWork: Date\n payrollOption: PayrollOption\n}\n\nexport function TerminateEmployee(props: TerminateEmployeeProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, companyId, dictionary }: TerminateEmployeeProps) => {\n useComponentDictionary('Employee.Terminations.TerminateEmployee', dictionary)\n useI18n('Employee.Terminations.TerminateEmployee')\n\n const queryClient = useQueryClient()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n const { data: terminationsData } = useEmployeeEmploymentsGetTerminationsSuspense({ employeeId })\n\n // If employee is already terminated, redirect to summary with existing termination data\n // Don't pass payrollOption to avoid showing the success alert\n if (employee?.terminated && terminationsData.terminationList?.[0]) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_VIEW_SUMMARY, {\n employeeId,\n effectiveDate: terminationsData.terminationList[0].effectiveDate!,\n termination: terminationsData.terminationList[0],\n })\n return null\n }\n\n const { mutateAsync: createTermination, isPending: isCreatingTermination } =\n useEmployeeEmploymentsCreateTerminationMutation()\n\n const { mutateAsync: updateTermination, isPending: isUpdatingTermination } =\n useEmployeeEmploymentsUpdateTerminationMutation()\n\n const { mutateAsync: createOffCyclePayroll, isPending: isCreatingPayroll } =\n usePayrollsCreateOffCycleMutation()\n\n const { refetch: fetchTerminationPeriods } = usePaySchedulesGetUnprocessedTerminationPeriods(\n { companyId },\n { enabled: false },\n )\n\n const employeeName = firstLastName({\n first_name: employee?.firstName,\n last_name: employee?.lastName,\n })\n\n const existingTermination = terminationsData.terminationList?.[0]\n\n const handleSubmit = async (formData: TerminateEmployeeFormData) => {\n const { lastDayOfWork, payrollOption } = formData\n const effectiveDate = lastDayOfWork.toISOString().split('T')[0]!\n\n await baseSubmitHandler({ effectiveDate, payrollOption }, async () => {\n const runTerminationPayroll = payrollOption === 'dismissalPayroll'\n\n const result = existingTermination\n ? await updateTermination({\n request: {\n employeeId,\n requestBody: {\n version: existingTermination.version!,\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n : await createTermination({\n request: {\n employeeId,\n requestBody: {\n effectiveDate,\n runTerminationPayroll,\n },\n },\n })\n\n await invalidateAllEmployeeEmploymentsGetTerminations(queryClient)\n\n let firstPayrollUuid: string | undefined\n\n if (runTerminationPayroll) {\n try {\n const { data: terminationPeriodsData } = await fetchTerminationPeriods()\n\n const employeePeriods =\n terminationPeriodsData?.unprocessedTerminationPayPeriodList?.filter(\n period => period.employeeUuid === employeeId,\n ) ?? []\n\n const createdPayrolls = []\n\n for (const terminationPeriod of employeePeriods) {\n if (terminationPeriod.startDate && terminationPeriod.endDate) {\n const payrollResult = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: OffCycleReason.DismissedEmployee,\n startDate: new RFCDate(terminationPeriod.startDate),\n endDate: new RFCDate(terminationPeriod.endDate),\n employeeUuids: [employeeId],\n checkDate: terminationPeriod.checkDate\n ? new RFCDate(terminationPeriod.checkDate)\n : undefined,\n },\n },\n })\n\n if (payrollResult.payrollUnprocessed) {\n createdPayrolls.push(payrollResult.payrollUnprocessed)\n }\n }\n }\n\n if (createdPayrolls.length > 0) {\n firstPayrollUuid = createdPayrolls[0]?.payrollUuid ?? createdPayrolls[0]?.uuid\n\n await invalidateAllPayrollsList(queryClient)\n await invalidateAllPaySchedulesGetUnprocessedTerminationPeriods(queryClient)\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_CREATED, {\n payrolls: createdPayrolls,\n })\n }\n } catch (payrollError) {\n onEvent(componentEvents.EMPLOYEE_TERMINATION_PAYROLL_FAILED, {\n error: payrollError,\n employeeId,\n })\n }\n }\n\n const eventType = existingTermination\n ? componentEvents.EMPLOYEE_TERMINATION_UPDATED\n : componentEvents.EMPLOYEE_TERMINATION_CREATED\n\n onEvent(eventType, {\n termination: result.termination,\n payrollOption,\n runTerminationPayroll,\n })\n\n onEvent(componentEvents.EMPLOYEE_TERMINATION_DONE, {\n employeeId,\n effectiveDate,\n payrollOption,\n payrollUuid: firstPayrollUuid,\n termination: result.termination,\n ...(payrollOption === 'anotherWay' && { manualHandling: true }),\n })\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const isPending = isCreatingTermination || isUpdatingTermination || isCreatingPayroll\n\n return (\n <TerminateEmployeePresentation\n employeeName={employeeName}\n existingTermination={existingTermination}\n onSubmit={handleSubmit}\n onCancel={handleCancel}\n isLoading={isPending}\n />\n )\n}\n"],"names":["TerminateEmployee","props","jsx","BaseComponent","Root","employeeId","companyId","dictionary","useComponentDictionary","useI18n","queryClient","useQueryClient","onEvent","baseSubmitHandler","useBase","employee","useEmployeesGetSuspense","terminationsData","useEmployeeEmploymentsGetTerminationsSuspense","componentEvents","createTermination","isCreatingTermination","useEmployeeEmploymentsCreateTerminationMutation","updateTermination","isUpdatingTermination","useEmployeeEmploymentsUpdateTerminationMutation","createOffCyclePayroll","isCreatingPayroll","usePayrollsCreateOffCycleMutation","fetchTerminationPeriods","usePaySchedulesGetUnprocessedTerminationPeriods","employeeName","firstLastName","existingTermination","TerminateEmployeePresentation","formData","lastDayOfWork","payrollOption","effectiveDate","runTerminationPayroll","result","invalidateAllEmployeeEmploymentsGetTerminations","firstPayrollUuid","terminationPeriodsData","employeePeriods","period","createdPayrolls","terminationPeriod","payrollResult","OffCycleReason","RFCDate","invalidateAllPayrollsList","invalidateAllPaySchedulesGetUnprocessedTerminationPeriods","payrollError","eventType"],"mappings":";;;;;;;;;;;;;;;;;AAmCO,SAASA,GAAkBC,GAA+B;AAC/D,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,IAAO,CAAC,EAAE,YAAAC,GAAY,WAAAC,GAAW,YAAAC,QAAyC;AAC9E,EAAAC,EAAuB,2CAA2CD,CAAU,GAC5EE,EAAQ,yCAAyC;AAEjD,QAAMC,IAAcC,EAAA,GACd,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC;AAAA,IACJ,MAAM,EAAE,UAAAC,EAAA;AAAA,EAAS,IACfC,EAAwB,EAAE,YAAAX,GAAY,GAEpC,EAAE,MAAMY,EAAA,IAAqBC,EAA8C,EAAE,YAAAb,GAAY;AAI/F,MAAIU,GAAU,cAAcE,EAAiB,kBAAkB,CAAC;AAC9D,WAAAL,EAAQO,EAAgB,mCAAmC;AAAA,MACzD,YAAAd;AAAA,MACA,eAAeY,EAAiB,gBAAgB,CAAC,EAAE;AAAA,MACnD,aAAaA,EAAiB,gBAAgB,CAAC;AAAA,IAAA,CAChD,GACM;AAGT,QAAM,EAAE,aAAaG,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEI,EAAE,aAAaC,GAAmB,WAAWC,EAAA,IACjDC,EAAA,GAEI,EAAE,aAAaC,GAAuB,WAAWC,EAAA,IACrDC,EAAA,GAEI,EAAE,SAASC,EAAA,IAA4BC;AAAA,IAC3C,EAAE,WAAAxB,EAAA;AAAA,IACF,EAAE,SAAS,GAAA;AAAA,EAAM,GAGbyB,IAAeC,EAAc;AAAA,IACjC,YAAYjB,GAAU;AAAA,IACtB,WAAWA,GAAU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5,11 @@ import { useForm as D, FormProvider as g } from "react-hook-form";
|
|
|
5
5
|
import { zodResolver as E } from "@hookform/resolvers/zod";
|
|
6
6
|
import { Flex as a } from "../../../Common/Flex/Flex.js";
|
|
7
7
|
import { ActionsLayout as R } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import { Form as x } from "../../../Common/Form/Form.js";
|
|
9
|
+
import { useComponentContext as F } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
|
+
import { useI18n as W } from "../../../../i18n/I18n.js";
|
|
11
|
+
import { RadioGroupField as q } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
12
|
+
import { DatePickerField as T } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
13
13
|
const k = t.object({
|
|
14
14
|
lastDayOfWork: t.date({ error: "validation.lastDayRequired" }),
|
|
15
15
|
payrollOption: t.enum(["dismissalPayroll", "regularPayroll", "anotherWay"], {
|
|
@@ -23,8 +23,8 @@ function I({
|
|
|
23
23
|
onCancel: y,
|
|
24
24
|
isLoading: s
|
|
25
25
|
}) {
|
|
26
|
-
const { Alert: u, Heading: f, Text: p, Button: m } =
|
|
27
|
-
|
|
26
|
+
const { Alert: u, Heading: f, Text: p, Button: m } = F();
|
|
27
|
+
W("Employee.Terminations.TerminateEmployee");
|
|
28
28
|
const { t: o } = v("Employee.Terminations.TerminateEmployee"), O = (P) => P.runTerminationPayroll === !0 ? "dismissalPayroll" : "regularPayroll", h = {
|
|
29
29
|
lastDayOfWork: l?.effectiveDate ? new Date(l.effectiveDate) : void 0,
|
|
30
30
|
payrollOption: l ? O(l) : "dismissalPayroll"
|
|
@@ -48,14 +48,14 @@ function I({
|
|
|
48
48
|
description: o("form.payrollOption.options.anotherWay.description")
|
|
49
49
|
}
|
|
50
50
|
];
|
|
51
|
-
return /* @__PURE__ */ r(g, { ...i, children: /* @__PURE__ */ r(
|
|
51
|
+
return /* @__PURE__ */ r(g, { ...i, children: /* @__PURE__ */ r(x, { onSubmit: i.handleSubmit(d), children: /* @__PURE__ */ e(a, { flexDirection: "column", gap: 24, children: [
|
|
52
52
|
/* @__PURE__ */ e(a, { flexDirection: "column", gap: 4, children: [
|
|
53
53
|
/* @__PURE__ */ r(f, { as: "h2", children: o("title", { employeeName: n }) }),
|
|
54
54
|
/* @__PURE__ */ r(p, { variant: "supporting", children: o("subtitle") })
|
|
55
55
|
] }),
|
|
56
56
|
/* @__PURE__ */ e(a, { flexDirection: "column", gap: 24, children: [
|
|
57
57
|
/* @__PURE__ */ r(
|
|
58
|
-
|
|
58
|
+
T,
|
|
59
59
|
{
|
|
60
60
|
name: "lastDayOfWork",
|
|
61
61
|
label: o("form.lastDayOfEmployment.label"),
|
|
@@ -65,7 +65,7 @@ function I({
|
|
|
65
65
|
}
|
|
66
66
|
),
|
|
67
67
|
/* @__PURE__ */ r(
|
|
68
|
-
|
|
68
|
+
q,
|
|
69
69
|
{
|
|
70
70
|
name: "payrollOption",
|
|
71
71
|
label: o("form.payrollOption.label"),
|
package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js
CHANGED
|
@@ -15,11 +15,11 @@ import { useComponentContext as S } from "../../../../contexts/ComponentAdapter/
|
|
|
15
15
|
import { useComponentDictionary as z, useI18n as g } from "../../../../i18n/I18n.js";
|
|
16
16
|
import { Flex as p, FlexItem as f } from "../../../Common/Flex/Flex.js";
|
|
17
17
|
import { payrollWireEvents as N } from "../../../../shared/constants.js";
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
18
|
+
import { TextAreaField as V } from "../../../Common/Fields/TextAreaField/TextAreaField.js";
|
|
19
|
+
import { useDateFormatter as J } from "../../../../hooks/useDateFormatter.js";
|
|
20
|
+
import { NumberInputField as Q } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
21
|
+
import { TextInputField as X } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
22
|
+
import { DatePickerField as Z } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
23
23
|
const $ = r.object({
|
|
24
24
|
amountSent: r.number().positive(),
|
|
25
25
|
dateSent: r.date(),
|
|
@@ -41,7 +41,7 @@ const oe = ({
|
|
|
41
41
|
modalContainerRef: y
|
|
42
42
|
}) => {
|
|
43
43
|
z("Payroll.ConfirmWireDetailsForm", i), g("Payroll.ConfirmWireDetailsForm");
|
|
44
|
-
const { onEvent: a, baseSubmitHandler: I } = Y(), { t } = F("Payroll.ConfirmWireDetailsForm"), { Heading: v, Text: b } = S(), R =
|
|
44
|
+
const { onEvent: a, baseSubmitHandler: I } = Y(), { t } = F("Payroll.ConfirmWireDetailsForm"), { Heading: v, Text: b } = S(), R = J(), { data: P } = U({
|
|
45
45
|
wireInRequestUuid: o
|
|
46
46
|
}), W = P.wireInRequest, { data: q } = G({
|
|
47
47
|
companyId: n,
|
|
@@ -83,7 +83,7 @@ const oe = ({
|
|
|
83
83
|
className: d.form,
|
|
84
84
|
children: /* @__PURE__ */ m(p, { flexDirection: "column", gap: 20, children: [
|
|
85
85
|
/* @__PURE__ */ e(
|
|
86
|
-
|
|
86
|
+
Q,
|
|
87
87
|
{
|
|
88
88
|
name: "amountSent",
|
|
89
89
|
label: t("amountLabel"),
|
|
@@ -93,7 +93,7 @@ const oe = ({
|
|
|
93
93
|
}
|
|
94
94
|
),
|
|
95
95
|
/* @__PURE__ */ e(
|
|
96
|
-
|
|
96
|
+
Z,
|
|
97
97
|
{
|
|
98
98
|
name: "dateSent",
|
|
99
99
|
label: t("dateLabel"),
|
|
@@ -103,7 +103,7 @@ const oe = ({
|
|
|
103
103
|
}
|
|
104
104
|
),
|
|
105
105
|
/* @__PURE__ */ e(
|
|
106
|
-
|
|
106
|
+
X,
|
|
107
107
|
{
|
|
108
108
|
name: "bankName",
|
|
109
109
|
label: t("bankNameLabel"),
|
|
@@ -113,7 +113,7 @@ const oe = ({
|
|
|
113
113
|
errorMessage: t("validations.bankName")
|
|
114
114
|
}
|
|
115
115
|
),
|
|
116
|
-
/* @__PURE__ */ e(
|
|
116
|
+
/* @__PURE__ */ e(V, { name: "additionalNotes", label: t("notesLabel"), rows: 3 })
|
|
117
117
|
] })
|
|
118
118
|
}
|
|
119
119
|
) })
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { usePayrollsGetSuspense as
|
|
4
|
-
import { PayrollExecutionFlow as
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as u } from "react";
|
|
3
|
+
import { usePayrollsGetSuspense as d } from "@gusto/embedded-api/react-query/payrollsGet";
|
|
4
|
+
import { PayrollExecutionFlow as p } from "../PayrollExecutionFlow/PayrollExecutionFlow.js";
|
|
5
5
|
import { DismissalPayPeriodSelection as y } from "./DismissalPayPeriodSelection/DismissalPayPeriodSelection.js";
|
|
6
6
|
import { useFlow as a } from "../../Flow/useFlow.js";
|
|
7
7
|
import { ensureRequired as s } from "../../../helpers/ensureRequired.js";
|
|
8
|
-
import { BaseComponent as
|
|
8
|
+
import { BaseComponent as P } from "../../Base/Base.js";
|
|
9
9
|
function h() {
|
|
10
10
|
const { companyId: o, employeeId: e, onEvent: r } = a();
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ t(
|
|
12
12
|
y,
|
|
13
13
|
{
|
|
14
14
|
companyId: s(o),
|
|
@@ -18,9 +18,9 @@ function h() {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
function w() {
|
|
21
|
-
const { companyId: o, payrollUuid: e, onEvent: r, breadcrumbs: n } = a(),
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
21
|
+
const { companyId: o, payrollUuid: e, onEvent: r, breadcrumbs: n } = a(), i = n?.payPeriodSelection?.[0], m = u(() => i ? [i] : void 0, [i]), l = s(o), c = s(e);
|
|
22
|
+
return /* @__PURE__ */ t(P, { onEvent: r, children: /* @__PURE__ */ t(
|
|
23
|
+
f,
|
|
24
24
|
{
|
|
25
25
|
companyId: l,
|
|
26
26
|
payrollId: c,
|
|
@@ -29,18 +29,19 @@ function w() {
|
|
|
29
29
|
}
|
|
30
30
|
) });
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function f({
|
|
33
33
|
companyId: o,
|
|
34
34
|
payrollId: e,
|
|
35
35
|
...r
|
|
36
36
|
}) {
|
|
37
|
-
const { data: n } =
|
|
38
|
-
return /* @__PURE__ */
|
|
39
|
-
|
|
37
|
+
const { data: n } = d({ companyId: o, payrollId: e }), i = n.payrollShow?.payPeriod;
|
|
38
|
+
return /* @__PURE__ */ t(
|
|
39
|
+
p,
|
|
40
40
|
{
|
|
41
41
|
companyId: o,
|
|
42
42
|
payrollId: e,
|
|
43
|
-
initialPayPeriod:
|
|
43
|
+
initialPayPeriod: i,
|
|
44
|
+
isDismissalPayroll: !0,
|
|
44
45
|
...r
|
|
45
46
|
}
|
|
46
47
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DismissalFlowComponents.js","sources":["../../../../src/components/Payroll/Dismissal/DismissalFlowComponents.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { DismissalPayPeriodSelection } from './DismissalPayPeriodSelection/DismissalPayPeriodSelection'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { BaseComponent } from '@/components/Base/Base'\n\nexport interface DismissalFlowContextInterface extends FlowContextInterface {\n companyId: string\n employeeId?: string\n payrollUuid?: string\n}\n\nexport interface DismissalFlowProps {\n companyId: string\n employeeId?: string\n onEvent: OnEventType<EventType, unknown>\n payrollId?: string\n}\n\nexport function DismissalPayPeriodSelectionContextual() {\n const { companyId, employeeId, onEvent } = useFlow<DismissalFlowContextInterface>()\n return (\n <DismissalPayPeriodSelection\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n />\n )\n}\n\nexport function DismissalExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<DismissalFlowContextInterface>()\n\n const payPeriodSelectionBreadcrumb = breadcrumbs?.['payPeriodSelection']?.[0]\n const prefixBreadcrumbs = useMemo(() => {\n return payPeriodSelectionBreadcrumb ? [payPeriodSelectionBreadcrumb] : undefined\n }, [payPeriodSelectionBreadcrumb])\n\n const resolvedCompanyId = ensureRequired(companyId)\n const resolvedPayrollId = ensureRequired(payrollUuid)\n\n return (\n <BaseComponent onEvent={onEvent}>\n <DismissalExecutionWithData\n companyId={resolvedCompanyId}\n payrollId={resolvedPayrollId}\n onEvent={onEvent}\n prefixBreadcrumbs={prefixBreadcrumbs}\n />\n </BaseComponent>\n )\n}\n\ntype DismissalExecutionWithDataProps = Pick<\n PayrollExecutionFlowProps,\n 'companyId' | 'payrollId' | 'onEvent' | 'prefixBreadcrumbs'\n>\n\nfunction DismissalExecutionWithData({\n companyId,\n payrollId,\n ...rest\n}: DismissalExecutionWithDataProps) {\n const { data } = usePayrollsGetSuspense({ companyId, payrollId })\n const initialPayPeriod = data.payrollShow?.payPeriod\n\n return (\n <PayrollExecutionFlow\n companyId={companyId}\n payrollId={payrollId}\n initialPayPeriod={initialPayPeriod}\n {...rest}\n />\n )\n}\n"],"names":["DismissalPayPeriodSelectionContextual","companyId","employeeId","onEvent","useFlow","jsx","DismissalPayPeriodSelection","ensureRequired","DismissalExecutionContextual","payrollUuid","breadcrumbs","payPeriodSelectionBreadcrumb","prefixBreadcrumbs","useMemo","resolvedCompanyId","resolvedPayrollId","BaseComponent","DismissalExecutionWithData","payrollId","rest","data","usePayrollsGetSuspense","initialPayPeriod","PayrollExecutionFlow"],"mappings":";;;;;;;;AA0BO,SAASA,IAAwC;AACtD,QAAM,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAC3C,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAeN,CAAS;AAAA,MACnC,YAAAC;AAAA,MACA,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,SAASK,IAA+B;AAC7C,QAAM,EAAE,WAAAP,GAAW,aAAAQ,GAAa,SAAAN,GAAS,aAAAO,EAAA,IAAgBN,EAAA,GAEnDO,IAA+BD,GAAc,qBAAwB,CAAC,GACtEE,IAAoBC,EAAQ,MACzBF,IAA+B,CAACA,CAA4B,IAAI,QACtE,CAACA,CAA4B,CAAC,GAE3BG,IAAoBP,EAAeN,CAAS,GAC5Cc,IAAoBR,EAAeE,CAAW;AAEpD,SACE,gBAAAJ,EAACW,KAAc,SAAAb,GACb,UAAA,gBAAAE;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,WAAWH;AAAA,MACX,WAAWC;AAAA,MACX,SAAAZ;AAAA,MACA,mBAAAS;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAOA,SAASK,EAA2B;AAAA,EAClC,WAAAhB;AAAA,EACA,WAAAiB;AAAA,EACA,GAAGC;AACL,GAAoC;AAClC,QAAM,EAAE,MAAAC,EAAA,IAASC,EAAuB,EAAE,WAAApB,GAAW,WAAAiB,GAAW,GAC1DI,IAAmBF,EAAK,aAAa;AAE3C,SACE,gBAAAf;AAAA,IAACkB;AAAA,IAAA;AAAA,MACC,WAAAtB;AAAA,MACA,WAAAiB;AAAA,MACA,kBAAAI;AAAA,
|
|
1
|
+
{"version":3,"file":"DismissalFlowComponents.js","sources":["../../../../src/components/Payroll/Dismissal/DismissalFlowComponents.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { DismissalPayPeriodSelection } from './DismissalPayPeriodSelection/DismissalPayPeriodSelection'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport { BaseComponent } from '@/components/Base/Base'\n\nexport interface DismissalFlowContextInterface extends FlowContextInterface {\n companyId: string\n employeeId?: string\n payrollUuid?: string\n}\n\nexport interface DismissalFlowProps {\n companyId: string\n employeeId?: string\n onEvent: OnEventType<EventType, unknown>\n payrollId?: string\n}\n\nexport function DismissalPayPeriodSelectionContextual() {\n const { companyId, employeeId, onEvent } = useFlow<DismissalFlowContextInterface>()\n return (\n <DismissalPayPeriodSelection\n companyId={ensureRequired(companyId)}\n employeeId={employeeId}\n onEvent={onEvent}\n />\n )\n}\n\nexport function DismissalExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<DismissalFlowContextInterface>()\n\n const payPeriodSelectionBreadcrumb = breadcrumbs?.['payPeriodSelection']?.[0]\n const prefixBreadcrumbs = useMemo(() => {\n return payPeriodSelectionBreadcrumb ? [payPeriodSelectionBreadcrumb] : undefined\n }, [payPeriodSelectionBreadcrumb])\n\n const resolvedCompanyId = ensureRequired(companyId)\n const resolvedPayrollId = ensureRequired(payrollUuid)\n\n return (\n <BaseComponent onEvent={onEvent}>\n <DismissalExecutionWithData\n companyId={resolvedCompanyId}\n payrollId={resolvedPayrollId}\n onEvent={onEvent}\n prefixBreadcrumbs={prefixBreadcrumbs}\n />\n </BaseComponent>\n )\n}\n\ntype DismissalExecutionWithDataProps = Pick<\n PayrollExecutionFlowProps,\n 'companyId' | 'payrollId' | 'onEvent' | 'prefixBreadcrumbs'\n>\n\nfunction DismissalExecutionWithData({\n companyId,\n payrollId,\n ...rest\n}: DismissalExecutionWithDataProps) {\n const { data } = usePayrollsGetSuspense({ companyId, payrollId })\n const initialPayPeriod = data.payrollShow?.payPeriod\n\n return (\n <PayrollExecutionFlow\n companyId={companyId}\n payrollId={payrollId}\n initialPayPeriod={initialPayPeriod}\n isDismissalPayroll\n {...rest}\n />\n )\n}\n"],"names":["DismissalPayPeriodSelectionContextual","companyId","employeeId","onEvent","useFlow","jsx","DismissalPayPeriodSelection","ensureRequired","DismissalExecutionContextual","payrollUuid","breadcrumbs","payPeriodSelectionBreadcrumb","prefixBreadcrumbs","useMemo","resolvedCompanyId","resolvedPayrollId","BaseComponent","DismissalExecutionWithData","payrollId","rest","data","usePayrollsGetSuspense","initialPayPeriod","PayrollExecutionFlow"],"mappings":";;;;;;;;AA0BO,SAASA,IAAwC;AACtD,QAAM,EAAE,WAAAC,GAAW,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAC3C,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAeN,CAAS;AAAA,MACnC,YAAAC;AAAA,MACA,SAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,SAASK,IAA+B;AAC7C,QAAM,EAAE,WAAAP,GAAW,aAAAQ,GAAa,SAAAN,GAAS,aAAAO,EAAA,IAAgBN,EAAA,GAEnDO,IAA+BD,GAAc,qBAAwB,CAAC,GACtEE,IAAoBC,EAAQ,MACzBF,IAA+B,CAACA,CAA4B,IAAI,QACtE,CAACA,CAA4B,CAAC,GAE3BG,IAAoBP,EAAeN,CAAS,GAC5Cc,IAAoBR,EAAeE,CAAW;AAEpD,SACE,gBAAAJ,EAACW,KAAc,SAAAb,GACb,UAAA,gBAAAE;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,WAAWH;AAAA,MACX,WAAWC;AAAA,MACX,SAAAZ;AAAA,MACA,mBAAAS;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAOA,SAASK,EAA2B;AAAA,EAClC,WAAAhB;AAAA,EACA,WAAAiB;AAAA,EACA,GAAGC;AACL,GAAoC;AAClC,QAAM,EAAE,MAAAC,EAAA,IAASC,EAAuB,EAAE,WAAApB,GAAW,WAAAiB,GAAW,GAC1DI,IAAmBF,EAAK,aAAa;AAE3C,SACE,gBAAAf;AAAA,IAACkB;AAAA,IAAA;AAAA,MACC,WAAAtB;AAAA,MACA,WAAAiB;AAAA,MACA,kBAAAI;AAAA,MACA,oBAAkB;AAAA,MACjB,GAAGH;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -18,12 +18,13 @@ import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
|
18
18
|
import { formatNumberAsCurrency as L } from "../../../helpers/formattedStrings.js";
|
|
19
19
|
import "../../../shared/constants.js";
|
|
20
20
|
import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
21
|
+
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
21
22
|
import { useI18n as E } from "../../../i18n/I18n.js";
|
|
22
23
|
import { NumberInputField as T } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
23
24
|
const q = w.object({
|
|
24
25
|
netPay: w.number().positive()
|
|
25
26
|
});
|
|
26
|
-
function
|
|
27
|
+
function fe({ isOpen: n, onCalculateGrossUp: P, onApply: A, onCancel: u }) {
|
|
27
28
|
E("Payroll.GrossUpModal");
|
|
28
29
|
const { t: r } = k("Payroll.GrossUpModal"), { Modal: N, Heading: d, Text: p, Button: i, Alert: f } = V(), { baseSubmitHandler: y } = H(), x = R(null), [l, c] = o(null), [h, m] = o(null), [g, b] = o(!1), [F, C] = o(!1), s = U({
|
|
29
30
|
resolver: z(q),
|
|
@@ -109,6 +110,6 @@ function pe({ isOpen: n, onCalculateGrossUp: P, onApply: A, onCancel: u }) {
|
|
|
109
110
|
);
|
|
110
111
|
}
|
|
111
112
|
export {
|
|
112
|
-
|
|
113
|
+
fe as GrossUpModal
|
|
113
114
|
};
|
|
114
115
|
//# sourceMappingURL=GrossUpModal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GrossUpModal.js","sources":["../../../../src/components/Payroll/GrossUpModal/GrossUpModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { GrossUpModalProps } from './GrossUpModalTypes'\nimport styles from './GrossUpModal.module.scss'\nimport { ActionsLayout, Flex, NumberInputField } from '@/components/Common'\nimport { useBase } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\n\nconst GrossUpFormSchema = z.object({\n netPay: z.number().positive(),\n})\n\ntype GrossUpFormValues = z.infer<typeof GrossUpFormSchema>\n\nexport function GrossUpModal({ isOpen, onCalculateGrossUp, onApply, onCancel }: GrossUpModalProps) {\n useI18n('Payroll.GrossUpModal')\n const { t } = useTranslation('Payroll.GrossUpModal')\n const { Modal, Heading, Text, Button, Alert } = useComponentContext()\n const { baseSubmitHandler } = useBase()\n const modalContainerRef = useRef<HTMLDivElement>(null)\n\n const [calculatedGrossUp, setCalculatedGrossUp] = useState<string | null>(null)\n const [errorMessage, setErrorMessage] = useState<string | null>(null)\n const [isCalculating, setIsCalculating] = useState(false)\n const [isApplying, setIsApplying] = useState(false)\n\n const formHandlers = useForm<GrossUpFormValues>({\n resolver: zodResolver(GrossUpFormSchema),\n defaultValues: { netPay: 0 },\n })\n\n useEffect(() => {\n if (!isOpen) {\n formHandlers.reset({ netPay: 0 })\n setCalculatedGrossUp(null)\n setErrorMessage(null)\n }\n }, [isOpen, formHandlers.reset])\n\n const handleCalculate = async (data: GrossUpFormValues) => {\n setErrorMessage(null)\n setCalculatedGrossUp(null)\n setIsCalculating(true)\n\n await baseSubmitHandler(null, async () => {\n try {\n const result = await onCalculateGrossUp(data.netPay)\n\n if (result) {\n setCalculatedGrossUp(result)\n } else {\n setErrorMessage(t('errorMessage'))\n }\n } finally {\n setIsCalculating(false)\n }\n })\n }\n\n const handleApply = async () => {\n if (calculatedGrossUp) {\n setIsApplying(true)\n await baseSubmitHandler(null, async () => {\n try {\n await onApply(calculatedGrossUp)\n } finally {\n setIsApplying(false)\n }\n })\n }\n }\n\n return (\n <Modal\n isOpen={isOpen}\n onClose={onCancel}\n containerRef={modalContainerRef}\n footer={\n <ActionsLayout>\n <Button\n variant=\"primary\"\n isDisabled={!calculatedGrossUp}\n onClick={handleApply}\n isLoading={isApplying}\n >\n {t('applyCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n </ActionsLayout>\n }\n >\n <FormProvider {...formHandlers}>\n <div className={styles.header}>\n <Heading as=\"h2\" styledAs=\"h3\">\n {t('title')}\n </Heading>\n <Text variant=\"supporting\" as=\"p\">\n {t('description')}\n </Text>\n </div>\n\n <div className={styles.content}>\n {errorMessage && (\n <div className={styles.alert}>\n <Alert label={errorMessage} status=\"error\" disableScrollIntoView />\n </div>\n )}\n\n <div className={styles.alert}>\n <Alert label={t('warning')} status=\"warning\" disableScrollIntoView />\n </div>\n\n <Flex flexDirection=\"row\" gap={8}>\n <NumberInputField\n name=\"netPay\"\n label={t('netPayLabel')}\n format=\"currency\"\n min={0}\n isRequired\n />\n <Button\n variant=\"secondary\"\n className={styles.calculateButton}\n isDisabled={isCalculating}\n onClick={formHandlers.handleSubmit(handleCalculate)}\n >\n {isCalculating ? t('calculatingCta') : t('calculateCta')}\n </Button>\n </Flex>\n\n {calculatedGrossUp && (\n <>\n <div className={styles.result}>\n <Text size=\"sm\" variant=\"supporting\" weight=\"semibold\">\n {t('grossPayResult')}\n </Text>\n <Heading as=\"h3\">{formatNumberAsCurrency(parseFloat(calculatedGrossUp))}</Heading>\n </div>\n </>\n )}\n </div>\n </FormProvider>\n </Modal>\n )\n}\n"],"names":["GrossUpFormSchema","z","GrossUpModal","isOpen","onCalculateGrossUp","onApply","onCancel","useI18n","t","useTranslation","Modal","Heading","Text","Button","Alert","useComponentContext","baseSubmitHandler","useBase","modalContainerRef","useRef","calculatedGrossUp","setCalculatedGrossUp","useState","errorMessage","setErrorMessage","isCalculating","setIsCalculating","isApplying","setIsApplying","formHandlers","useForm","zodResolver","useEffect","handleCalculate","data","result","jsx","ActionsLayout","jsxs","FormProvider","styles","Flex","NumberInputField","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACjC,QAAQA,EAAE,OAAA,EAAS,SAAA;AACrB,CAAC;AAIM,SAASC,GAAa,EAAE,QAAAC,GAAQ,oBAAAC,GAAoB,SAAAC,GAAS,UAAAC,KAA+B;AACjG,EAAAC,EAAQ,sBAAsB;AAC9B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,sBAAsB,GAC7C,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAC1C,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAoBC,EAAuB,IAAI,GAE/C,CAACC,GAAmBC,CAAoB,IAAIC,EAAwB,IAAI,GACxE,CAACC,GAAcC,CAAe,IAAIF,EAAwB,IAAI,GAC9D,CAACG,GAAeC,CAAgB,IAAIJ,EAA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;AAAA,YAAA;AAAA,UACzD,GACF;AAAA,UAECL,KACC,gBAAAgB,EAAAO,GAAA,EACE,UAAA,gBAAAL,EAAC,OAAA,EAAI,WAAWE,EAAO,QACrB,UAAA;AAAA,YAAA,gBAAAJ,EAACxB,GAAA,EAAK,MAAK,MAAK,SAAQ,cAAa,QAAO,YACzC,UAAAJ,EAAE,gBAAgB,EAAA,CACrB;AAAA,YACA,gBAAA4B,EAACzB,KAAQ,IAAG,MAAM,YAAuB,WAAWS,CAAiB,CAAC,EAAA,CAAE;AAAA,UAAA,EAAA,CAC1E,EAAA,CACF;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA,EAAA,CACF;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_content_wjov6_1", e = "_header_wjov6_8", o = "_alert_wjov6_14", c = "_calculateButton_wjov6_18", n = "_result_wjov6_25", _ = {
|
|
2
2
|
content: t,
|
|
3
3
|
header: e,
|
|
4
|
-
alert:
|
|
4
|
+
alert: o,
|
|
5
5
|
calculateButton: c,
|
|
6
6
|
result: n
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
o as alert,
|
|
10
10
|
c as calculateButton,
|
|
11
11
|
t as content,
|
|
12
|
-
|
|
12
|
+
_ as default,
|
|
13
13
|
e as header,
|
|
14
14
|
n as result
|
|
15
15
|
};
|
package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
1
|
+
import { jsxs as i, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as l } from "react-i18next";
|
|
3
|
-
import
|
|
3
|
+
import a from "./OffCyclePayPeriodDateFormPresentation.module.scss.js";
|
|
4
4
|
import { useI18n as o } from "../../../i18n/I18n.js";
|
|
5
|
-
import
|
|
5
|
+
import "../../../shared/constants.js";
|
|
6
6
|
import { CheckboxField as c } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
7
|
-
|
|
7
|
+
import { DatePickerField as t } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
8
|
+
function h() {
|
|
8
9
|
o("Payroll.OffCyclePayPeriodDateForm");
|
|
9
10
|
const { t: e } = l("Payroll.OffCyclePayPeriodDateForm");
|
|
10
|
-
return /* @__PURE__ */ i("div", { className:
|
|
11
|
-
/* @__PURE__ */ i("div", { className:
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ i("div", { className: a.root, children: [
|
|
12
|
+
/* @__PURE__ */ i("div", { className: a.dateFields, children: [
|
|
13
|
+
/* @__PURE__ */ r(t, { name: "startDate", label: e("startDateLabel"), isRequired: !0 }),
|
|
14
|
+
/* @__PURE__ */ r(t, { name: "endDate", label: e("endDateLabel"), isRequired: !0 })
|
|
14
15
|
] }),
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */
|
|
16
|
+
/* @__PURE__ */ r("div", { className: a.checkDateField, children: /* @__PURE__ */ r(t, { name: "checkDate", label: e("checkDateLabel"), isRequired: !0 }) }),
|
|
17
|
+
/* @__PURE__ */ r(
|
|
17
18
|
c,
|
|
18
19
|
{
|
|
19
20
|
name: "isCheckOnly",
|
|
@@ -24,6 +25,6 @@ function D() {
|
|
|
24
25
|
] });
|
|
25
26
|
}
|
|
26
27
|
export {
|
|
27
|
-
|
|
28
|
+
h as OffCyclePayPeriodDateFormPresentation
|
|
28
29
|
};
|
|
29
30
|
//# sourceMappingURL=OffCyclePayPeriodDateFormPresentation.js.map
|