Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Policy category - Add Payroll Code #43151

Merged
merged 41 commits into from
Jul 12, 2024
Merged
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
fda657c
add payroll screen
rushatgabhane Jun 5, 2024
bdf8070
add payroll route
rushatgabhane Jun 5, 2024
b29331a
add navigation links for payroll
rushatgabhane Jun 5, 2024
78cb661
add nav type
rushatgabhane Jun 5, 2024
4ad00ea
add menu item for payroll code to category settings page
rushatgabhane Jun 5, 2024
2cec124
add payroll code to category type
rushatgabhane Jun 5, 2024
bf7b779
add payroll code to form type
rushatgabhane Jun 5, 2024
6d1e603
add payroll code to form type
rushatgabhane Jun 5, 2024
4e6c965
add payroll code
rushatgabhane Jun 5, 2024
2e60d83
add payroll code err msg
rushatgabhane Jun 5, 2024
f20f10c
add payroll code page
rushatgabhane Jun 5, 2024
bf3dd2f
add api command impl for set payroll code
rushatgabhane Jun 5, 2024
ed69bd0
add api params
rushatgabhane Jun 6, 2024
d150bdc
link api params
rushatgabhane Jun 6, 2024
05be40c
add payroll code api typing
rushatgabhane Jun 6, 2024
9a15098
api call to payroll code
rushatgabhane Jun 6, 2024
47d4566
fix typo
rushatgabhane Jun 6, 2024
b8aa3b2
use correct pending fields
rushatgabhane Jun 6, 2024
ff2c261
run prettier
rushatgabhane Jun 6, 2024
1529597
merge main
rushatgabhane Jun 26, 2024
e5c6ca0
add max length
rushatgabhane Jun 26, 2024
2a4637b
fix merge
rushatgabhane Jun 26, 2024
3e7bb90
use translation key
rushatgabhane Jun 26, 2024
fb3c493
merge main
rushatgabhane Jul 6, 2024
cc0423b
set pending fields as none
rushatgabhane Jul 6, 2024
d7f3aa4
use useonyx
rushatgabhane Jul 6, 2024
3bb29bc
add fallback navigation
rushatgabhane Jul 6, 2024
d75e74a
fix merge
rushatgabhane Jul 9, 2024
2bc06c9
add control policy access variant
rushatgabhane Jul 9, 2024
89fec2f
add control policy access variant
rushatgabhane Jul 9, 2024
d884e04
add control policy access variant
rushatgabhane Jul 9, 2024
39f60d5
add control policy access variant
rushatgabhane Jul 9, 2024
e2ac2e0
spanish translation
rushatgabhane Jul 9, 2024
1fc92a8
rename to payroll
rushatgabhane Jul 10, 2024
d62c5bd
rename to payroll code
rushatgabhane Jul 10, 2024
57a31f3
merge main
rushatgabhane Jul 10, 2024
7d8abfb
disable for non control policy
rushatgabhane Jul 10, 2024
529061a
Merge branch 'main' into payroll
rushatgabhane Jul 11, 2024
22df8b4
run prettier
rushatgabhane Jul 11, 2024
6a340ff
fix merge conflicts
rushatgabhane Jul 11, 2024
06265b2
fix merge
rushatgabhane Jul 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add api command impl for set payroll code
  • Loading branch information
rushatgabhane committed Jun 5, 2024
commit bf3dd2f538581edb5152eda2c72a0d1dbab07492
61 changes: 61 additions & 0 deletions src/libs/actions/Policy/Category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,66 @@ function renamePolicyCategory(policyID: string, policyCategory: {oldName: string
API.write(WRITE_COMMANDS.RENAME_WORKSPACE_CATEGORY, parameters, onyxData);
}

function setPolicyCategoryPayrollCode(policyID: string, categoryName: string, payrollCode: string) {
const policyCategoryToUpdate = allPolicyCategories?.[`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`]?.[categoryName] ?? {};

const onyxData: OnyxData = {
optimisticData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,
value: {
[categoryName]: {
...policyCategoryToUpdate,
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
pendingFields: {
name: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE,
},
payrollCode,
},
},
},
],
successData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,
value: {
[categoryName]: {
...policyCategoryToUpdate,
pendingAction: null,
pendingFields: {
name: null,
},
payrollCode,
},
},
},
],
failureData: [
{
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${policyID}`,
value: {
[categoryName]: {
...policyCategoryToUpdate,
errors: ErrorUtils.getMicroSecondOnyxError('workspace.categories.updatePayrollCodeFailureMessage'),
pendingAction: null,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to reset pendingFields as well.

},
},
},
],
};

const parameters = {
policyID,
categoryName,
payrollCode,
};

API.write(WRITE_COMMANDS.UPDATE_POLICY_CATEGORY_GL_CODE, parameters, onyxData);
}

function setWorkspaceRequiresCategory(policyID: string, requiresCategory: boolean) {
const onyxData: OnyxData = {
optimisticData: [
Expand Down Expand Up @@ -591,6 +651,7 @@ export {
buildOptimisticPolicyRecentlyUsedCategories,
setWorkspaceCategoryEnabled,
setWorkspaceRequiresCategory,
setPolicyCategoryPayrollCode,
createPolicyCategory,
renamePolicyCategory,
clearCategoryErrors,
Expand Down