diff --git a/src/ONYXKEYS.ts b/src/ONYXKEYS.ts index 0cc7934ad007..76de820aedd6 100755 --- a/src/ONYXKEYS.ts +++ b/src/ONYXKEYS.ts @@ -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_', @@ -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; [ONYXKEYS.COLLECTION.REPORT]: OnyxTypes.Report; diff --git a/src/types/onyx/PolicyReportField.ts b/src/types/onyx/PolicyReportField.ts new file mode 100644 index 000000000000..6a3be23c0a0b --- /dev/null +++ b/src/types/onyx/PolicyReportField.ts @@ -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; +export default PolicyReportField; +export type {PolicyReportFields}; diff --git a/src/types/onyx/RecentlyUsedReportFields.ts b/src/types/onyx/RecentlyUsedReportFields.ts new file mode 100644 index 000000000000..2b3d046c8316 --- /dev/null +++ b/src/types/onyx/RecentlyUsedReportFields.ts @@ -0,0 +1,3 @@ +type RecentlyUsedReportFields = Record; + +export default RecentlyUsedReportFields; diff --git a/src/types/onyx/Report.ts b/src/types/onyx/Report.ts index 25c544f6f5c3..509f27f9e95d 100644 --- a/src/types/onyx/Report.ts +++ b/src/types/onyx/Report.ts @@ -157,6 +157,9 @@ type Report = { text?: string; privateNotes?: Record; isLoadingPrivateNotes?: boolean; + + /** If the report contains reportFields, save the field id and its value */ + reportFields?: Record; }; export default Report; diff --git a/src/types/onyx/index.ts b/src/types/onyx/index.ts index 110bdb024a8c..c76dbe72192e 100644 --- a/src/types/onyx/index.ts +++ b/src/types/onyx/index.ts @@ -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'; @@ -124,4 +126,6 @@ export type { WalletTerms, WalletTransfer, ReportUserIsTyping, + PolicyReportField, + RecentlyUsedReportFields, };