Skip to content

Commit

Permalink
used default categories const
Browse files Browse the repository at this point in the history
  • Loading branch information
FitseTLT committed Feb 6, 2025
1 parent 2af94ab commit 907f61b
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 36 deletions.
42 changes: 21 additions & 21 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2640,27 +2640,27 @@ const CONST = {
ARE_RULES_ENABLED: 'areRulesEnabled',
ARE_PER_DIEM_RATES_ENABLED: 'arePerDiemRatesEnabled',
},
DEFAULT_CATEGORIES: [
'Advertising',
'Benefits',
'Car',
'Equipment',
'Fees',
'Home Office',
'Insurance',
'Interest',
'Labor',
'Maintenance',
'Materials',
'Meals and Entertainment',
'Office Supplies',
'Other',
'Professional Services',
'Rent',
'Taxes',
'Travel',
'Utilities',
],
DEFAULT_CATEGORIES: {
ADVERTISING: 'Advertising',
BENEFITS: 'Benefits',
CAR: 'Car',
EQUIPMENT: 'Equipment',
FEES: 'Fees',
HOME_OFFICE: 'Home Office',
INSURANCE: 'Insurance',
INTEREST: 'Interest',
LABOR: 'Labor',
MAINTENANCE: 'Maintenance',
MATERIALS: 'Materials',
MEALS_AND_ENTERTAINMENT: 'Meals and Entertainment',
OFFICE_SUPPLIES: 'Office Supplies',
OTHER: 'Other',
PROFESSIONAL_SERVICES: 'Professional Services',
RENT: 'Rent',
TAXES: 'Taxes',
TRAVEL: 'Travel',
UTILITIES: 'Utilities',
},
OWNERSHIP_ERRORS: {
NO_BILLING_CARD: 'noBillingCard',
AMOUNT_OWED: 'amountOwed',
Expand Down
26 changes: 13 additions & 13 deletions src/libs/actions/Policy/Category.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,67 +147,67 @@ function buildOptimisticMccGroup() {
const optimisticMccGroup: Record<'mccGroup', Record<string, MccGroup>> = {
mccGroup: {
airlines: {
category: 'Travel',
category: CONST.POLICY.DEFAULT_CATEGORIES.TRAVEL,
groupID: 'airlines',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
commuter: {
category: 'Car',
category: CONST.POLICY.DEFAULT_CATEGORIES.CAR,
groupID: 'commuter',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
gas: {
category: 'Car',
category: CONST.POLICY.DEFAULT_CATEGORIES.CAR,
groupID: 'gas',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
goods: {
category: 'Materials',
category: CONST.POLICY.DEFAULT_CATEGORIES.MATERIALS,
groupID: 'goods',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
groceries: {
category: 'Meals and Entertainment',
category: CONST.POLICY.DEFAULT_CATEGORIES.MEALS_AND_ENTERTAINMENT,
groupID: 'groceries',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
hotel: {
category: 'Travel',
category: CONST.POLICY.DEFAULT_CATEGORIES.TRAVEL,
groupID: 'hotel',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
mail: {
category: 'Office Supplies',
category: CONST.POLICY.DEFAULT_CATEGORIES.OFFICE_SUPPLIES,
groupID: 'mail',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
meals: {
category: 'Meals and Entertainment',
category: CONST.POLICY.DEFAULT_CATEGORIES.MEALS_AND_ENTERTAINMENT,
groupID: 'meals',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
rental: {
category: 'Travel',
category: CONST.POLICY.DEFAULT_CATEGORIES.TRAVEL,
groupID: 'rental',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
services: {
category: 'Professional Services',
category: CONST.POLICY.DEFAULT_CATEGORIES.PROFESSIONAL_SERVICES,
groupID: 'services',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
taxi: {
category: 'Travel',
category: CONST.POLICY.DEFAULT_CATEGORIES.TRAVEL,
groupID: 'taxi',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
uncategorized: {
category: 'Other',
category: CONST.POLICY.DEFAULT_CATEGORIES.OTHER,
groupID: 'uncategorized',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
utilities: {
category: 'Utilities',
category: CONST.POLICY.DEFAULT_CATEGORIES.UTILITIES,
groupID: 'utilities',
pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
},
Expand Down
4 changes: 2 additions & 2 deletions src/libs/actions/Policy/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ function buildPolicyData(
pendingChatMembers,
} = ReportUtils.buildOptimisticWorkspaceChats(policyID, workspaceName, expenseReportId);

const optimisticCategoriesData = buildOptimisticPolicyCategories(policyID, CONST.POLICY.DEFAULT_CATEGORIES);
const optimisticCategoriesData = buildOptimisticPolicyCategories(policyID, Object.values(CONST.POLICY.DEFAULT_CATEGORIES));
const optimisticMccGroupData = buildOptimisticMccGroup();

const shouldSetCreatedWorkspaceAsActivePolicy = !!activePolicyID && allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`]?.type === CONST.POLICY.TYPE.PERSONAL;
Expand Down Expand Up @@ -2136,7 +2136,7 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy
{
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES_DRAFT}${policyID}`,
value: CONST.POLICY.DEFAULT_CATEGORIES.reduce<Record<string, PolicyCategory>>((acc, category) => {
value: Object.values(CONST.POLICY.DEFAULT_CATEGORIES).reduce<Record<string, PolicyCategory>>((acc, category) => {
acc[category] = {
name: category,
enabled: true,
Expand Down

0 comments on commit 907f61b

Please sign in to comment.