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

Feat/global reimbursements #3

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8636802
feat: GR
MrMuzyk Aug 1, 2024
136c6d9
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Aug 1, 2024
8bcc723
feat: UI
MrMuzyk Aug 13, 2024
b1e228b
feat: draft
MrMuzyk Aug 20, 2024
615505c
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Aug 20, 2024
3be3481
feat: draft values
MrMuzyk Aug 26, 2024
2ff61c2
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Aug 26, 2024
41092bf
feat: global reimbursements more
MrMuzyk Sep 2, 2024
7eb4d71
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 2, 2024
a0315c5
feat: some corrections and ownership percentage validation
MrMuzyk Sep 4, 2024
a5ff4b9
fix: prop removal
MrMuzyk Sep 4, 2024
bdc036e
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 4, 2024
45484f1
feat: mobile styles
MrMuzyk Sep 4, 2024
52674c3
fix: ts
MrMuzyk Sep 9, 2024
d8de0fd
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 9, 2024
9569fa0
fix: ts and lint
MrMuzyk Sep 9, 2024
9bcbd09
fix: revert ios changes
MrMuzyk Sep 9, 2024
d3042af
fix: revert ios changes
MrMuzyk Sep 9, 2024
a8a76ee
region selector
MrMuzyk Sep 12, 2024
4c48daf
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 12, 2024
6c679e9
fix naming
MrMuzyk Sep 12, 2024
e713b1e
ts fix
MrMuzyk Sep 12, 2024
1ce1107
feat: fixes
MrMuzyk Sep 19, 2024
309fcc8
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 19, 2024
fe2f2d0
fix: ts and lint
MrMuzyk Sep 19, 2024
bff1300
feat: before form type change
MrMuzyk Sep 20, 2024
b983e1f
feat: interactive step wrapper
MrMuzyk Sep 24, 2024
3a5402b
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Sep 24, 2024
bdc3f85
feat: more or less working step 1-2
MrMuzyk Sep 26, 2024
a61f086
feat: reworking
MrMuzyk Oct 3, 2024
7f11174
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Oct 3, 2024
7ece302
feat: updating
MrMuzyk Oct 10, 2024
dc98c23
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Oct 10, 2024
a4608b5
fix: linter/ts
MrMuzyk Oct 11, 2024
1ccb470
fix: few smaller fixes
MrMuzyk Oct 11, 2024
e97b24d
fix: loosen types on getfields
MrMuzyk Oct 11, 2024
257c22b
feat: move everything under existing form key
MrMuzyk Oct 15, 2024
662078f
Merge branch 'main' of https://github.com/Expensify/App into feat/glo…
MrMuzyk Oct 16, 2024
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
Prev Previous commit
Next Next commit
feat: draft values
  • Loading branch information
MrMuzyk committed Aug 26, 2024
commit 3be34813edd0bd7702e2458b54a7274bc3765632
28 changes: 28 additions & 0 deletions assets/images/simple-illustrations/simple-illustration__pillow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ const CONST = {
OWNERSHIP_CHART: 5,
OWNERS_LIST: 6,
},
BENEFICIAL_OWNER_DATA: {
BENEFICIAL_OWNER_KEYS: 'ownerKeys',
OWNER_DATA: {
OWNER_KEYS: 'ownerKeys',
PREFIX: 'owner',
FIRST_NAME: 'firstName',
LAST_NAME: 'lastName',
Expand All @@ -407,6 +407,8 @@ const CONST = {
HANG_TIGHT: 4,
},
},
ALLOWED_FILE_TYPES: ['pdf', 'jpg', 'jpeg', 'png'],
MAX_FILE_SIZE_MB: 5,
},
INCORPORATION_TYPES: {
LLC: 'LLC',
Expand Down
4 changes: 3 additions & 1 deletion src/components/Form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type CurrencySelector from '@components/CurrencySelector';
import type DatePicker from '@components/DatePicker';
import type EmojiPickerButtonDropdown from '@components/EmojiPicker/EmojiPickerButtonDropdown';
import type Picker from '@components/Picker';
import type PushRowWithModal from '@components/PushRowWithModal';
import type RadioButtons from '@components/RadioButtons';
import type RoomNameInput from '@components/RoomNameInput';
import type SingleChoiceQuestion from '@components/SingleChoiceQuestion';
Expand Down Expand Up @@ -55,7 +56,8 @@ type ValidInputs =
| typeof EmojiPickerButtonDropdown
| typeof NetSuiteCustomListPicker
| typeof NetSuiteCustomFieldMappingPicker
| typeof NetSuiteMenuWithTopDescriptionForm;
| typeof NetSuiteMenuWithTopDescriptionForm
| typeof PushRowWithModal;

type ValueTypeKey = 'string' | 'boolean' | 'date' | 'country' | 'reportFields' | 'disabledListValues';
type ValueTypeMap = {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Icon/Illustrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ import OpenSafe from '@assets/images/simple-illustrations/simple-illustration__o
import PalmTree from '@assets/images/simple-illustrations/simple-illustration__palmtree.svg';
import Pencil from '@assets/images/simple-illustrations/simple-illustration__pencil.svg';
import PiggyBank from '@assets/images/simple-illustrations/simple-illustration__piggybank.svg';
import Pillow from '@assets/images/simple-illustrations/simple-illustration__pillow.svg';
import Profile from '@assets/images/simple-illustrations/simple-illustration__profile.svg';
import QRCode from '@assets/images/simple-illustrations/simple-illustration__qr-code.svg';
import ReceiptEnvelope from '@assets/images/simple-illustrations/simple-illustration__receipt-envelope.svg';
Expand Down Expand Up @@ -199,6 +200,7 @@ export {
Car,
Coins,
Pencil,
Pillow,
Tag,
CarIce,
ReceiptLocationMarker,
Expand Down
31 changes: 28 additions & 3 deletions src/components/PushRowWithModal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, {useState} from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import CONST from '@src/CONST';
import PushRowModal from './PushRowModal';

type PushRowWithModalProps = {
Expand All @@ -27,9 +28,26 @@ type PushRowWithModalProps = {

/** Whether the selected option is editable */
shouldAllowChange?: boolean;

/** Text to display on error message */
errorText?: string;

/** Function called whenever option changes */
onInputChange?: (value: string) => void;
};

function PushRowWithModal({selectedOption, onOptionChange, optionsList, wrapperStyles, description, modalHeaderTitle, searchInputTitle, shouldAllowChange = true}: PushRowWithModalProps) {
function PushRowWithModal({
selectedOption,
onOptionChange,
optionsList,
wrapperStyles,
description,
modalHeaderTitle,
searchInputTitle,
shouldAllowChange = true,
errorText,
onInputChange = () => {},
}: PushRowWithModalProps) {
const [isModalVisible, setIsModalVisible] = useState(false);

const handleModalClose = () => {
Expand All @@ -40,20 +58,27 @@ function PushRowWithModal({selectedOption, onOptionChange, optionsList, wrapperS
setIsModalVisible(true);
};

const handleOptionChange = (value: string) => {
onOptionChange(value);
onInputChange(value);
};

return (
<>
<MenuItemWithTopDescription
description={description}
title={optionsList[selectedOption]}
shouldShowRightIcon
shouldShowRightIcon={shouldAllowChange}
onPress={handleModalOpen}
wrapperStyle={wrapperStyles}
interactive={shouldAllowChange}
brickRoadIndicator={errorText ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
errorText={errorText}
/>
<PushRowModal
isVisible={isModalVisible}
selectedOption={selectedOption}
onOptionChange={onOptionChange}
onOptionChange={handleOptionChange}
onClose={handleModalClose}
optionsList={optionsList}
headerTitle={modalHeaderTitle}
Expand Down
96 changes: 96 additions & 0 deletions src/components/UploadFile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import React from 'react';
import type {StyleProp, ViewStyle} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
import useLocalize from '@hooks/useLocalize';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import CONST from '@src/CONST';
import type {FileObject} from './AttachmentModal';
import AttachmentPicker from './AttachmentPicker';
import Button from './Button';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import {PressableWithFeedback} from './Pressable';
import Text from './Text';

type UploadFileProps = {
/** Text displayed on button when no file is uploaded */
buttonText: string;

/** Name of currently uploaded file */
uploadedFileName: string;

/** Handler that fires when file is selected for upload */
onUpload: (fileURL: string) => void;

/** Handler that fires when file is removed */
onRemove: () => void;

/** Array containing accepted file types */
acceptedFileTypes: Array<ValueOf<typeof CONST.API_ATTACHMENT_VALIDATIONS.ALLOWED_RECEIPT_EXTENSIONS>>;

/** Max file size in MB */
maxFileSize: number;

/** Styles to be assigned to Container */
style?: StyleProp<ViewStyle>;
};

function UploadFile({buttonText, uploadedFileName, onUpload, onRemove, acceptedFileTypes, maxFileSize, style}: UploadFileProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const theme = useTheme();

const handleFileUpload = (file: FileObject) => {
onUpload(file?.name ?? '');
};

return (
<View style={[styles.alignItemsStart, style]}>
{uploadedFileName !== '' ? (
<View style={[styles.flexRow, styles.alignItemsCenter, styles.justifyContentCenter, styles.border, styles.p4]}>
<Icon
height={20}
MrMuzyk marked this conversation as resolved.
Show resolved Hide resolved
width={14}
MrMuzyk marked this conversation as resolved.
Show resolved Hide resolved
src={Expensicons.Paperclip}
fill={theme.textSupporting}
/>
<Text style={[styles.ml4, styles.mr3, styles.textBold]}>{uploadedFileName}</Text>
<PressableWithFeedback
onPress={onRemove}
role={CONST.ROLE.BUTTON}
accessibilityLabel={translate('common.remove')}
>
<Icon
height={16}
MrMuzyk marked this conversation as resolved.
Show resolved Hide resolved
width={16}
MrMuzyk marked this conversation as resolved.
Show resolved Hide resolved
src={Expensicons.Close}
fill={theme.textSupporting}
MrMuzyk marked this conversation as resolved.
Show resolved Hide resolved
/>
</PressableWithFeedback>
</View>
) : (
<AttachmentPicker acceptedFileTypes={acceptedFileTypes}>
{({openPicker}) => (
<Button
medium
style={[styles.mb6]}
text={buttonText}
accessibilityLabel={buttonText}
onPress={() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declare this callback function above

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you have in mind here. Could you elaborate?

openPicker({
onPicked: handleFileUpload,
});
}}
/>
)}
</AttachmentPicker>
)}
</View>
);
}

UploadFile.displayName = 'UploadFile';

export default UploadFile;
2 changes: 1 addition & 1 deletion src/hooks/useNonUSDReimbursementAccountStepFormSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type UseNonUSDReimbursementAccountStepFormSubmitParams = Pick<SubStepProps, 'onN
};

/**
* Hook for handling submit method in ReimbursementAccount substeps.
* Hook for handling submit method in NonUSDReimbursementAccount sub steps.
* When user is in editing mode, we should save values only when user confirms the change
* @param onNext - callback
* @param fieldIds - field IDs for particular step
Expand Down
1 change: 0 additions & 1 deletion src/hooks/useStepFormSubmit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export default function useStepFormSubmit<T extends keyof OnyxFormValuesMapping>
return acc;
}, {} as Record<TupleToUnion<typeof fieldIds>, OnyxValues[T][Exclude<keyof OnyxValues[T], keyof BaseForm>]>);

console.log(stepValues);
FormActions.setDraftValues(formId, stepValues);
}

Expand Down
7 changes: 4 additions & 3 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2116,8 +2116,8 @@ export default {
ownerInfo: 'Owner info',
businessOwner: 'Business owner',
signerInfo: 'Signer info',
doYouOwn: 'Do you own 25% or more of ',
doesAnyoneOwn: 'Does any individuals own 25% or more of ',
doYouOwn: ({companyName}) => `Do you own 25% or more of ${companyName}`,
doesAnyoneOwn: ({companyName}) => `Does any individuals own 25% or more of ${companyName}`,
regulationsRequire: 'Regulations require us to verify the identity of any individual who owns more than 25% of the business.',
legalFirstName: 'Legal first name',
legalLastName: 'Legal last name',
Expand All @@ -2138,7 +2138,7 @@ export default {
letsDoubleCheck: 'Let’s double check that everything looks right.',
legalName: 'Legal name',
ownershipPercentage: 'Ownership percentage',
areThereOther: 'Are there other individuals who own 25% or more of ',
areThereOther: ({companyName}) => `Are there other individuals who own 25% or more of ${companyName}`,
owners: 'Owners',
addCertified: 'Add a certified org chart that shows the beneficial owners',
regulationRequiresChart: 'Regulation requires us to collect a certified copy of the ownership chart that shows every individual or entity who owns 25% or more of the business.',
Expand Down Expand Up @@ -2171,6 +2171,7 @@ export default {
enterTwoEmails: 'Enter the emails of two directors or senior officers at',
sendReminder: 'Send a reminder',
chooseFile: 'Choose file',
weAreWaiting: "We're waiting for others to verify their identities as directors or senior officers of the business.",
},
agreementsStep: {
pleaseConfirm: 'Please confirm the agreements below',
Expand Down
Loading