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

Upgrade advanced approvals #46808

Merged
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5404,6 +5404,14 @@ const CONST = {
description: `workspace.upgrade.${this.POLICY.CONNECTIONS.NAME.SAGE_INTACCT}.description` as const,
icon: 'IntacctSquare',
},
approvals: {
id: 'approvals' as const,
alias: 'approvals' as const,
name: 'Advanced Approvals' as const,
title: `workspace.upgrade.approvals.title` as const,
description: `workspace.upgrade.approvals.description` as const,
icon: 'AdvancedApprovalsSquare',
},
glCodes: {
id: 'glCodes' as const,
alias: 'gl-codes',
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Expensicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import Send from '@assets/images/send.svg';
import Shield from '@assets/images/shield.svg';
import AppleLogo from '@assets/images/signIn/apple-logo.svg';
import GoogleLogo from '@assets/images/signIn/google-logo.svg';
import AdvancedApprovalsSquare from '@assets/images/simple-illustrations/advanced-approvals-icon-square.svg';
import Facebook from '@assets/images/social-facebook.svg';
import Instagram from '@assets/images/social-instagram.svg';
import Linkedin from '@assets/images/social-linkedin.svg';
Expand Down Expand Up @@ -360,6 +361,7 @@ export {
Workspace,
XeroSquare,
SageIntacctSquare as IntacctSquare,
AdvancedApprovalsSquare,
Zoom,
Twitter,
Youtube,
Expand Down
5 changes: 5 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3454,6 +3454,11 @@ export default {
description: `Enjoy automated syncing and reduce manual entries with the Expensify + Sage Intacct integration. Gain in-depth, real-time financial insights with user-defined dimensions, as well as expense coding by department, class, location, customer, and project (job).`,
onlyAvailableOnPlan: 'Our Sage Intacct integration is only available on the Control plan, starting at ',
},
[CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id]: {
title: 'Advanced Approvals',
description: `If you want to add more layers of approval to the mix – or just make sure the largest expenses get another set of eyes – we’ve got you covered. Advanced approvals help you put the right checks in place at every level so you keep your team’s spend under control.`,
onlyAvailableOnPlan: 'Advanced approvals are only available on the Control plan, which starts at ',
},
glCodes: {
title: 'GL codes',
description: `Add GL codes to your categories and tags for easy export of expenses to your accounting and payroll systems.`,
Expand Down
5 changes: 5 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3507,6 +3507,11 @@ export default {
description: `Disfruta de una sincronización automatizada y reduce las entradas manuales con la integración Expensify + Sage Intacct. Obtén información financiera en profundidad y en tiempo real con dimensiones definidas por el usuario, así como codificación de gastos por departamento, clase, ubicación, cliente y proyecto (trabajo).`,
onlyAvailableOnPlan: 'Nuestra integración Sage Intacct sólo está disponible en el plan Control, a partir de ',
},
[CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id]: {
title: 'Aprobaciones anticipadas',
description: `Si quieres añadir más niveles de aprobación, o simplemente asegurarte de que los gastos más importantes reciben otro vistazo, no hay problema. Las aprobaciones avanzadas ayudan a realizar las comprobaciones adecuadas a cada nivel para mantener los gastos de tu equipo bajo control.`,
onlyAvailableOnPlan: 'Las aprobaciones avanzadas sólo están disponibles en el plan Control, con precios desde ',
},
glCodes: {
title: 'Códigos de libro mayor',
description: `Añada códigos de libro mayor a sus categorías para exportar fácilmente los gastos a sus sistemas de contabilidad y nómina.`,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/workspace/upgrade/UpgradeIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading}: Props) {
const {isExtraSmallScreenWidth, isSmallScreenWidth} = useResponsiveLayout();
const {translate} = useLocalize();
const iconSrc = feature.icon in Illustrations ? Illustrations[feature.icon as keyof typeof Illustrations] : Expensicon[feature.icon as keyof typeof Expensicon];
const iconAdditionalStyles = feature === CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals ? styles.br0 : undefined;
Guccio163 marked this conversation as resolved.
Show resolved Hide resolved

return (
<View style={styles.p5}>
Expand All @@ -35,6 +36,7 @@ function UpgradeIntro({feature, onUpgrade, buttonDisabled, loading}: Props) {
<Avatar
Guccio163 marked this conversation as resolved.
Show resolved Hide resolved
type={CONST.ICON_TYPE_AVATAR}
source={iconSrc}
iconAdditionalStyles={iconAdditionalStyles}
/>
<Badge
icon={Expensicon.Unlock}
Expand Down
25 changes: 15 additions & 10 deletions src/pages/workspace/workflows/WorkspaceWorkflowsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,19 @@ function WorkspaceWorkflowsPage({policy, betas, route}: WorkspaceWorkflowsPagePr
}, [fetchData]),
);

const createNewApprovalWorkflow = useCallback(() => {
Workflow.setApprovalWorkflow({
...EMPTY_APPROVAL_WORKFLOW,
availableMembers: approvalWorkflows.at(0)?.members ?? [],
});

Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS_APPROVALS_EXPENSES_FROM.getRoute(route.params.policyID));
}, [approvalWorkflows, route.params.policyID]);
const addApprovalAction = useCallback(() => {
if (!PolicyUtils.isControlPolicy(policy)) {
Guccio163 marked this conversation as resolved.
Show resolved Hide resolved
Navigation.navigate(
ROUTES.WORKSPACE_UPGRADE.getRoute(route.params.policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.alias, ROUTES.WORKSPACE_WORKFLOWS.getRoute(route.params.policyID)),
);
} else {
Guccio163 marked this conversation as resolved.
Show resolved Hide resolved
Workflow.setApprovalWorkflow({
...EMPTY_APPROVAL_WORKFLOW,
availableMembers: approvalWorkflows.at(0)?.members ?? [],
});
Navigation.navigate(ROUTES.WORKSPACE_WORKFLOWS_APPROVALS_EXPENSES_FROM.getRoute(route.params.policyID));
}
}, [approvalWorkflows, policy, route.params.policyID]);

const optionItems: ToggleSettingOptionRowProps[] = useMemo(() => {
const {accountNumber, addressName, bankName, bankAccountID} = policy?.achAccount ?? {};
Expand Down Expand Up @@ -173,7 +178,7 @@ function WorkspaceWorkflowsPage({policy, betas, route}: WorkspaceWorkflowsPagePr
iconWidth={20}
iconFill={theme.success}
style={[styles.sectionMenuItemTopDescription, styles.mt6, styles.mbn3]}
onPress={createNewApprovalWorkflow}
onPress={addApprovalAction}
/>
</>
) : (
Expand Down Expand Up @@ -285,8 +290,8 @@ function WorkspaceWorkflowsPage({policy, betas, route}: WorkspaceWorkflowsPagePr
approvalWorkflows,
theme.success,
theme.spinner,
addApprovalAction,
policyApproverName,
createNewApprovalWorkflow,
isOffline,
isPolicyAdmin,
displayNameForAuthorizedPayer,
Expand Down
Loading