Skip to content

Commit

Permalink
Merge pull request #39652 from teneeto/feat/37706/implement-accountin…
Browse files Browse the repository at this point in the history
…g-page

Feat: implement accounting page
  • Loading branch information
Hayata Suenaga authored Apr 9, 2024
2 parents 8e7575a + b1ade8e commit efa7d16
Show file tree
Hide file tree
Showing 24 changed files with 627 additions and 44 deletions.
14 changes: 14 additions & 0 deletions assets/images/integrationicons/qbo-icon-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions assets/images/integrationicons/xero-icon-square.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,28 @@ const CONST = {
AUTOREPORTING_OFFSET: 'autoReportingOffset',
GENERAL_SETTINGS: 'generalSettings',
},
CONNECTIONS: {
SYNC_STATUS: {
STARTING: 'starting',
FINISHED: 'finished',
PROGRESS: 'progress',
},
NAME: {
// Here we will add other connections names when we add support for them
QBO: 'quickbooksOnline',
},
SYNC_STAGE_NAME: {
STARTING_IMPORT: 'startingImport',
QBO_CUSTOMERS: 'quickbooksOnlineImportCustomers',
QBO_EMPLOYEES: 'quickbooksOnlineImportEmployees',
QBO_ACCOUNTS: 'quickbooksOnlineImportAccounts',
QBO_CLASSES: 'quickbooksOnlineImportClasses',
QBO_LOCATIONS: 'quickbooksOnlineImportLocations',
QBO_PROCESSING: 'quickbooksOnlineImportProcessing',
QBO_PAYMENTS: 'quickbooksOnlineSyncBillPayments',
QBO_TAX_CODES: 'quickbooksOnlineSyncTaxCodes',
},
},
},

CUSTOM_UNITS: {
Expand Down
3 changes: 3 additions & 0 deletions src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,8 @@ const ONYXKEYS = {

/** This is deprecated, but needed for a migration, so we still need to include it here so that it will be initialized in Onyx.init */
DEPRECATED_POLICY_MEMBER_LIST: 'policyMemberList_',

POLICY_CONNECTION_SYNC_PROGRESS: 'policyConnectionSyncProgress_',
},

/** List of Form ids */
Expand Down Expand Up @@ -545,6 +547,7 @@ type OnyxCollectionValuesMapping = {
[ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT]: string;
[ONYXKEYS.COLLECTION.NEXT_STEP]: OnyxTypes.ReportNextStep;
[ONYXKEYS.COLLECTION.POLICY_JOIN_MEMBER]: OnyxTypes.PolicyJoinMember;
[ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS]: OnyxTypes.PolicyConnectionSyncProgress;
};

type OnyxValuesMapping = {
Expand Down
4 changes: 4 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ const ROUTES = {
route: 'settings/workspaces/:policyID/members',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/members` as const,
},
WORKSPACE_ACCOUNTING: {
route: 'settings/workspaces/:policyID/accounting',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/accounting` as const,
},
WORKSPACE_CATEGORIES: {
route: 'settings/workspaces/:policyID/categories',
getRoute: (policyID: string) => `settings/workspaces/${policyID}/categories` as const,
Expand Down
1 change: 1 addition & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ const SCREENS = {
INVOICES: 'Workspace_Invoices',
TRAVEL: 'Workspace_Travel',
MEMBERS: 'Workspace_Members',
ACCOUNTING: 'Workspace_Accounting',
INVITE: 'Workspace_Invite',
INVITE_MESSAGE: 'Workspace_Invite_Message',
CATEGORIES: 'Workspace_Categories',
Expand Down
3 changes: 2 additions & 1 deletion src/components/HeaderWithBackButton/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type {ReactNode} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import type {Action} from '@hooks/useSingleExecution';
import type {StepCounterParams} from '@src/languages/types';
import type {AnchorPosition} from '@src/styles';
Expand Down Expand Up @@ -74,7 +75,7 @@ type HeaderWithBackButtonProps = Partial<ChildrenProps> & {
shouldSetModalVisibility?: boolean;

/** List of menu items for more(three dots) menu */
threeDotsMenuItems?: ThreeDotsMenuItem[];
threeDotsMenuItems?: PopoverMenuItem[];

/** The anchor position of the menu */
threeDotsAnchorPosition?: AnchorPosition;
Expand Down
4 changes: 4 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ import Hourglass from '@assets/images/hourglass.svg';
import ImageCropCircleMask from '@assets/images/image-crop-circle-mask.svg';
import ImageCropSquareMask from '@assets/images/image-crop-square-mask.svg';
import Info from '@assets/images/info.svg';
import QBOSquare from '@assets/images/integrationicons/qbo-icon-square.svg';
import XeroSquare from '@assets/images/integrationicons/xero-icon-square.svg';
import Invoice from '@assets/images/invoice.svg';
import Key from '@assets/images/key.svg';
import Keyboard from '@assets/images/keyboard.svg';
Expand Down Expand Up @@ -280,6 +282,7 @@ export {
Plus,
Printer,
Profile,
QBOSquare,
QrCode,
QuestionMark,
Receipt,
Expand Down Expand Up @@ -308,6 +311,7 @@ export {
Wallet,
Workflows,
Workspace,
XeroSquare,
Zoom,
Twitter,
Youtube,
Expand Down
1 change: 1 addition & 0 deletions src/components/PopoverMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ function PopoverMenu({
focused={focusedIndex === menuIndex}
displayInDefaultIconColor={item.displayInDefaultIconColor}
shouldShowRightIcon={item.shouldShowRightIcon}
iconRight={item.iconRight}
shouldPutLeftPaddingWhenNoIcon={item.shouldPutLeftPaddingWhenNoIcon}
label={item.label}
isLabelHoverable={item.isLabelHoverable}
Expand Down
42 changes: 1 addition & 41 deletions src/components/ThreeDotsMenu/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, {useEffect, useRef, useState} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import PopoverMenu from '@components/PopoverMenu';
import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback';
import Tooltip from '@components/Tooltip/PopoverAnchorTooltip';
Expand All @@ -14,53 +12,15 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as Browser from '@libs/Browser';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import type {AnchorPosition} from '@src/styles';
import type {Modal} from '@src/types/onyx';
import type AnchorAlignment from '@src/types/utils/AnchorAlignment';
import type IconAsset from '@src/types/utils/IconAsset';
import type ThreeDotsMenuProps from './types';

type ThreeDotsMenuOnyxProps = {
/** Details about any modals being used */
modal: OnyxEntry<Modal>;
};

type ThreeDotsMenuProps = ThreeDotsMenuOnyxProps & {
/** Tooltip for the popup icon */
iconTooltip?: TranslationPaths;

/** icon for the popup trigger */
icon?: IconAsset;

/** Any additional styles to pass to the icon container. */
iconStyles?: StyleProp<ViewStyle>;

/** The fill color to pass into the icon. */
iconFill?: string;

/** Function to call on icon press */
onIconPress?: () => void;

/** menuItems that'll show up on toggle of the popup menu */
menuItems: PopoverMenuItem[];

/** The anchor position of the menu */
anchorPosition: AnchorPosition;

/** The anchor alignment of the menu */
anchorAlignment?: AnchorAlignment;

/** Whether the popover menu should overlay the current view */
shouldOverlay?: boolean;

/** Whether the menu is disabled */
disabled?: boolean;

/** Should we announce the Modal visibility changes? */
shouldSetModalVisibility?: boolean;
};

function ThreeDotsMenu({
iconTooltip = 'common.more',
icon = Expensicons.ThreeDots,
Expand Down
50 changes: 50 additions & 0 deletions src/components/ThreeDotsMenu/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type {StyleProp, ViewStyle} from 'react-native';
import type {OnyxEntry} from 'react-native-onyx';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import type {TranslationPaths} from '@src/languages/types';
import type {AnchorPosition} from '@src/styles';
import type {Modal} from '@src/types/onyx';
import type AnchorAlignment from '@src/types/utils/AnchorAlignment';
import type IconAsset from '@src/types/utils/IconAsset';

type ThreeDotsMenuOnyxProps = {
/** Details about any modals being used */
modal: OnyxEntry<Modal>;
};

type ThreeDotsMenuProps = ThreeDotsMenuOnyxProps & {
/** Tooltip for the popup icon */
iconTooltip?: TranslationPaths;

/** icon for the popup trigger */
icon?: IconAsset;

/** Any additional styles to pass to the icon container. */
iconStyles?: StyleProp<ViewStyle>;

/** The fill color to pass into the icon. */
iconFill?: string;

/** Function to call on icon press */
onIconPress?: () => void;

/** menuItems that'll show up on toggle of the popup menu */
menuItems: PopoverMenuItem[];

/** The anchor position of the menu */
anchorPosition: AnchorPosition;

/** The anchor alignment of the menu */
anchorAlignment?: AnchorAlignment;

/** Whether the popover menu should overlay the current view */
shouldOverlay?: boolean;

/** Whether the menu is disabled */
disabled?: boolean;

/** Should we announce the Modal visibility changes? */
shouldSetModalVisibility?: boolean;
};

export default ThreeDotsMenuProps;
37 changes: 37 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST';
import Str from 'expensify-common/lib/str';
import CONST from '@src/CONST';
import type {Country} from '@src/CONST';
import type {PolicyConnectionSyncStage} from '@src/types/onyx/Policy';
import type {
AddressLineParams,
AdminCanceledRequestParams,
Expand Down Expand Up @@ -1822,6 +1823,7 @@ export default {
invoices: 'Invoices',
travel: 'Travel',
members: 'Members',
accounting: 'Accounting',
plan: 'Plan',
profile: 'Profile',
bankAccount: 'Bank account',
Expand Down Expand Up @@ -2046,6 +2048,41 @@ export default {
invalidRateError: 'Please enter a valid rate',
lowRateError: 'Rate must be greater than 0',
},
accounting: {
title: 'Connections',
subtitle: 'Connect to your accounting system to code transactions with your chart of accounts, auto-match payments and keep your finances in sync.',
qbo: 'Quickbooks Online',
xero: 'Xero',
setup: 'Set up',
lastSync: 'Last synced just now',
import: 'Import',
export: 'Export',
advanced: 'Advanced',
other: 'Other integrations',
syncNow: 'Sync now',
disconnect: 'Disconnect',
disconnectTitle: 'Disconnect integration',
disconnectPrompt: 'Are you sure you want to disconnect this integration?',
enterCredentials: 'Enter your credentials',
connections: {
syncStageName: (stage: PolicyConnectionSyncStage) => {
switch (stage) {
case 'quickbooksOnlineImportCustomers':
return 'Importing customers';
case 'quickbooksOnlineImportEmployees':
return 'Importing employees';
case 'quickbooksOnlineImportAccounts':
return 'Importing accounts';
case 'quickbooksOnlineImportClasses':
return 'Importing classes';

default: {
return `Translation missing for stage: ${stage}`;
}
}
},
},
},
bills: {
manageYourBills: 'Manage your bills',
askYourVendorsBeforeEmail: 'Ask your vendors to forward their invoices to ',
Expand Down
37 changes: 37 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Str from 'expensify-common/lib/str';
import CONST from '@src/CONST';
import type {PolicyConnectionSyncStage} from '@src/types/onyx/Policy';
import type {
AddressLineParams,
AdminCanceledRequestParams,
Expand Down Expand Up @@ -1849,6 +1850,7 @@ export default {
invoices: 'Enviar facturas',
travel: 'Viajes',
members: 'Miembros',
accounting: 'Contabilidad',
plan: 'Plan',
profile: 'Perfil',
bankAccount: 'Cuenta bancaria',
Expand Down Expand Up @@ -2041,6 +2043,41 @@ export default {
invitedBySecondaryLogin: ({secondaryLogin}) => `Agregado por nombre de usuario secundario ${secondaryLogin}.`,
membersListTitle: 'Directorio de todos los miembros del espacio de trabajo.',
},
accounting: {
title: 'Conexiones',
subtitle: 'Conecta a tu sistema de contabilidad para codificar transacciones con tu plan de cuentas, auto-cotejar pagos y mantener tus finanzas sincronizadas.',
qbo: 'Quickbooks Online',
xero: 'Xero',
setup: 'Configurar',
lastSync: 'Recién sincronizado',
import: 'Importar',
export: 'Exportar',
advanced: 'Avanzado',
other: 'Otras integraciones',
syncNow: 'Sincronizar ahora',
disconnect: 'Desconectar',
disconnectTitle: 'Desconectar integración',
disconnectPrompt: '¿Estás seguro de que deseas desconectar esta intregración?',
enterCredentials: 'Ingresa tus credenciales',
connections: {
syncStageName: (stage: PolicyConnectionSyncStage) => {
switch (stage) {
case 'quickbooksOnlineImportCustomers':
return 'Importando clientes';
case 'quickbooksOnlineImportEmployees':
return 'Importing employees';
case 'quickbooksOnlineImportAccounts':
return 'Importing accounts';
case 'quickbooksOnlineImportClasses':
return 'Importing classes';

default: {
return `Translation missing for stage: ${stage}`;
}
}
},
},
},
card: {
header: 'Desbloquea Tarjetas Expensify gratis',
headerWithEcard: '¡Tus tarjetas están listas!',
Expand Down
Loading

0 comments on commit efa7d16

Please sign in to comment.