Skip to content

Commit

Permalink
Merge pull request Expensify#46808 from software-mansion-labs/Guccio1…
Browse files Browse the repository at this point in the history
…63/upgradeAdvancedApprovals

Upgrade advanced approvals
  • Loading branch information
tgolen authored Aug 7, 2024
2 parents 33f9e00 + 1cbe015 commit 8193c37
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 5 deletions.
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 @@ -5409,6 +5409,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 @@ -3471,6 +3471,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 @@ -3524,6 +3524,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.id === CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.id ? styles.br0 : undefined;

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

const createNewApprovalWorkflow = useCallback(() => {
// User should be allowed to add new Approval Workflow only if he's upgraded to Control Plan, otherwise redirected to the Upgrade Page
const addApprovalAction = useCallback(() => {
if (!PolicyUtils.isControlPolicy(policy)) {
Navigation.navigate(
ROUTES.WORKSPACE_UPGRADE.getRoute(route.params.policyID, CONST.UPGRADE_FEATURE_INTRO_MAPPING.approvals.alias, ROUTES.WORKSPACE_WORKFLOWS.getRoute(route.params.policyID)),
);
return;
}
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]);
}, [approvalWorkflows, policy, route.params.policyID]);

const optionItems: ToggleSettingOptionRowProps[] = useMemo(() => {
const {accountNumber, addressName, bankName, bankAccountID} = policy?.achAccount ?? {};
Expand Down Expand Up @@ -173,7 +179,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 +291,8 @@ function WorkspaceWorkflowsPage({policy, betas, route}: WorkspaceWorkflowsPagePr
approvalWorkflows,
theme.success,
theme.spinner,
addApprovalAction,
policyApproverName,
createNewApprovalWorkflow,
isOffline,
isPolicyAdmin,
displayNameForAuthorizedPayer,
Expand Down

0 comments on commit 8193c37

Please sign in to comment.