Skip to content

Commit

Permalink
Merge pull request #33034 from allroundexperts/feat-32994
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam authored Dec 20, 2023
2 parents 5d71c93 + 56d4762 commit a141a08
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ const ONYXKEYS = {
POLICY_RECENTLY_USED_CATEGORIES: 'policyRecentlyUsedCategories_',
POLICY_TAGS: 'policyTags_',
POLICY_RECENTLY_USED_TAGS: 'policyRecentlyUsedTags_',
POLICY_REPORT_FIELDS: 'policyReportFields_',
POLICY_RECENTLY_USED_REPORT_FIELDS: 'policyRecentlyUsedReportFields_',
WORKSPACE_INVITE_MEMBERS_DRAFT: 'workspaceInviteMembersDraft_',
WORKSPACE_INVITE_MESSAGE_DRAFT: 'workspaceInviteMessageDraft_',
REPORT: 'report_',
Expand Down Expand Up @@ -443,6 +445,8 @@ type OnyxValues = {
[ONYXKEYS.COLLECTION.POLICY_MEMBERS]: OnyxTypes.PolicyMembers;
[ONYXKEYS.COLLECTION.POLICY_MEMBERS_DRAFTS]: OnyxTypes.PolicyMember;
[ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES]: OnyxTypes.RecentlyUsedCategories;
[ONYXKEYS.COLLECTION.POLICY_REPORT_FIELDS]: OnyxTypes.PolicyReportField;
[ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_REPORT_FIELDS]: OnyxTypes.RecentlyUsedReportFields;
[ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST]: OnyxTypes.PolicyMembers;
[ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT]: Record<string, number>;
[ONYXKEYS.COLLECTION.REPORT]: OnyxTypes.Report;
Expand Down
28 changes: 28 additions & 0 deletions src/types/onyx/PolicyReportField.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
type PolicyReportFieldType = 'text' | 'date' | 'dropdown' | 'formula';

type PolicyReportField = {
/** Name of the field */
name: string;

/** Default value assigned to the field */
defaultValue: string;

/** Unique id of the field */
fieldID: string;

/** Position at which the field should show up relative to the other fields */
orderWeight: number;

/** Type of report field */
type: PolicyReportFieldType;

/** Tells if the field is required or not */
deletable: boolean;

/** Options to select from if field is of type dropdown */
values: string[];
};

type PolicyReportFields = Record<string, PolicyReportField>;
export default PolicyReportField;
export type {PolicyReportFields};
3 changes: 3 additions & 0 deletions src/types/onyx/RecentlyUsedReportFields.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type RecentlyUsedReportFields = Record<string, string[]>;

export default RecentlyUsedReportFields;
3 changes: 3 additions & 0 deletions src/types/onyx/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ type Report = {
text?: string;
privateNotes?: Record<number, Note>;
isLoadingPrivateNotes?: boolean;

/** If the report contains reportFields, save the field id and its value */
reportFields?: Record<string, string>;
};

export default Report;
Expand Down
4 changes: 4 additions & 0 deletions src/types/onyx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ import PlaidData from './PlaidData';
import Policy from './Policy';
import PolicyCategory, {PolicyCategories} from './PolicyCategory';
import PolicyMember, {PolicyMembers} from './PolicyMember';
import PolicyReportField from './PolicyReportField';
import PolicyTag, {PolicyTags} from './PolicyTag';
import PrivatePersonalDetails from './PrivatePersonalDetails';
import RecentlyUsedCategories from './RecentlyUsedCategories';
import RecentlyUsedReportFields from './RecentlyUsedReportFields';
import RecentlyUsedTags from './RecentlyUsedTags';
import RecentWaypoint from './RecentWaypoint';
import ReimbursementAccount from './ReimbursementAccount';
Expand Down Expand Up @@ -126,4 +128,6 @@ export type {
WalletTerms,
WalletTransfer,
ReportUserIsTyping,
PolicyReportField,
RecentlyUsedReportFields,
};

0 comments on commit a141a08

Please sign in to comment.