Skip to content
5 changes: 5 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3188,6 +3188,7 @@ const CONST = {
ARE_DISTANCE_RATES_ENABLED: 'areDistanceRatesEnabled',
ARE_WORKFLOWS_ENABLED: 'areWorkflowsEnabled',
ARE_REPORT_FIELDS_ENABLED: 'areReportFieldsEnabled',
ARE_INVOICE_FIELDS_ENABLED: 'areInvoiceFieldsEnabled',
ARE_CONNECTIONS_ENABLED: 'areConnectionsEnabled',
ARE_RECEIPT_PARTNERS_ENABLED: 'receiptPartners',
ARE_COMPANY_CARDS_ENABLED: 'areCompanyCardsEnabled',
Expand Down Expand Up @@ -7680,6 +7681,10 @@ const CONST = {
LIST: 'dropdown',
FORMULA: 'formula',
},
REPORT_FIELD_TARGETS: {
EXPENSE: 'expense',
INVOICE: 'invoice',
},

NAVIGATION_ACTIONS: {
RESET: 'RESET',
Expand Down
29 changes: 29 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1922,6 +1922,35 @@ const ROUTES = {
route: 'workspaces/:policyID/invoices/company-website',
getRoute: (policyID: string) => `workspaces/${policyID}/invoices/company-website` as const,
},
WORKSPACE_INVOICE_FIELDS_CREATE: {
route: 'workspaces/:policyID/invoices/newInvoiceField',
getRoute: (policyID: string) => `workspaces/${policyID}/invoices/newInvoiceField` as const,
},
WORKSPACE_INVOICE_FIELDS_SETTINGS: {
route: 'workspaces/:policyID/invoices/:reportFieldID/edit',
getRoute: (policyID: string, reportFieldID: string) => `workspaces/${policyID}/invoices/${encodeURIComponent(reportFieldID)}/edit` as const,
},
WORKSPACE_INVOICE_FIELDS_LIST_VALUES: {
route: 'workspaces/:policyID/invoices/listValues/:reportFieldID?',
getRoute: (policyID: string, reportFieldID?: string) => `workspaces/${policyID}/invoices/listValues/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_INVOICE_FIELDS_ADD_VALUE: {
route: 'workspaces/:policyID/invoices/addValue/:reportFieldID?',
getRoute: (policyID: string, reportFieldID?: string) => `workspaces/${policyID}/invoices/addValue/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_INVOICE_FIELDS_VALUE_SETTINGS: {
route: 'workspaces/:policyID/invoices/:valueIndex/:reportFieldID?',
getRoute: (policyID: string, valueIndex: number, reportFieldID?: string) =>
`workspaces/${policyID}/invoices/${valueIndex}/${reportFieldID ? encodeURIComponent(reportFieldID) : ''}` as const,
},
WORKSPACE_INVOICE_FIELDS_EDIT_VALUE: {
route: 'workspaces/:policyID/invoices/newInvoiceField/:valueIndex/edit',
getRoute: (policyID: string, valueIndex: number) => `workspaces/${policyID}/invoices/newInvoiceField/${valueIndex}/edit` as const,
},
WORKSPACE_INVOICE_FIELDS_EDIT_INITIAL_VALUE: {
route: 'workspaces/:policyID/invoices/:reportFieldID/edit/initialValue',
getRoute: (policyID: string, reportFieldID: string) => `workspaces/${policyID}/invoices/${encodeURIComponent(reportFieldID)}/edit/initialValue` as const,
},
WORKSPACE_MEMBERS: {
route: 'workspaces/:policyID/members',
getRoute: (policyID: string | undefined) => {
Expand Down
7 changes: 7 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ const SCREENS = {
INVOICES_VERIFY_ACCOUNT: 'Workspace_Invoices_Verify_Account',
INVOICES_COMPANY_NAME: 'Workspace_Invoices_Company_Name',
INVOICES_COMPANY_WEBSITE: 'Workspace_Invoices_Company_Website',
INVOICE_FIELDS_CREATE: 'Workspace_InvoiceFields_Create',
INVOICE_FIELDS_SETTINGS: 'Workspace_InvoiceFields_Settings',
INVOICE_FIELDS_LIST_VALUES: 'Workspace_InvoiceFields_ListValues',
INVOICE_FIELDS_ADD_VALUE: 'Workspace_InvoiceFields_AddValue',
INVOICE_FIELDS_VALUE_SETTINGS: 'Workspace_InvoiceFields_ValueSettings',
INVOICE_FIELDS_EDIT_VALUE: 'Workspace_InvoiceFields_EditValue',
INVOICE_FIELDS_EDIT_INITIAL_VALUE: 'Workspace_InvoiceFields_EditInitialValue',
MEMBERS: 'Workspace_Members',
MEMBERS_IMPORT: 'Members_Import',
MEMBERS_IMPORTED: 'Members_Imported',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ function MoneyRequestViewReportFields({report, policy, isCombinedReport = false,
const isOnlyTitleFieldEnabled = enabledReportFields.length === 1 && isReportFieldOfTypeTitle(enabledReportFields.at(0));
const isPaidGroupPolicyExpenseReport = isPaidGroupPolicyExpenseReportUtils(report);
const isInvoiceReport = isInvoiceReportUtils(report);
const areFieldsEnabledForReport = isInvoiceReport ? policy?.areInvoiceFieldsEnabled : policy?.areReportFieldsEnabled;

const shouldDisplayReportFields = (isPaidGroupPolicyExpenseReport || isInvoiceReport) && !!policy?.areReportFieldsEnabled && (!isOnlyTitleFieldEnabled || !isCombinedReport);
const shouldDisplayReportFields = (isPaidGroupPolicyExpenseReport || isInvoiceReport) && !!areFieldsEnabledForReport && (!isOnlyTitleFieldEnabled || !isCombinedReport);

return (
shouldDisplayReportFields &&
Expand Down
3 changes: 2 additions & 1 deletion src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import type {OnyxEntry} from 'react-native-onyx';
import ActivityIndicator from '@components/ActivityIndicator';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';

Check warning on line 8 in src/components/ReportActionItem/MoneyReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used by a pattern. Direct imports from Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details

Check warning on line 8 in src/components/ReportActionItem/MoneyReportView.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'@components/Icon/Expensicons' import is restricted from being used. Direct imports from @components/Icon/Expensicons are deprecated. Please use lazy loading hooks instead. Use `useMemoizedLazyExpensifyIcons` from @hooks/useLazyAsset. See docs/LAZY_ICONS_AND_ILLUSTRATIONS.md for details
import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription';
import OfflineWithFeedback from '@components/OfflineWithFeedback';
import SpacerView from '@components/SpacerView';
Expand Down Expand Up @@ -106,6 +106,7 @@
const isPaidGroupPolicyExpenseReport = isPaidGroupPolicyExpenseReportUtils(report);
const isInvoiceReport = isInvoiceReportUtils(report);

const areFieldsEnabledForReport = isInvoiceReport ? policy?.areInvoiceFieldsEnabled : policy?.areReportFieldsEnabled;
const shouldShowReportField =
!isClosedExpenseReportWithNoExpenses &&
(isPaidGroupPolicyExpenseReport || isInvoiceReport) &&
Expand Down Expand Up @@ -135,7 +136,7 @@
{!isClosedExpenseReportWithNoExpenses && (
<>
{(isPaidGroupPolicyExpenseReport || isInvoiceReport) &&
policy?.areReportFieldsEnabled &&
areFieldsEnabledForReport &&
(!isCombinedReport || !isOnlyTitleFieldEnabled) &&
sortedPolicyReportFields.map((reportField) => {
if (shouldHideSingleReportField(reportField)) {
Expand Down
7 changes: 7 additions & 0 deletions src/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3882,6 +3882,7 @@ ${
customFieldHint: 'Fügen Sie benutzerdefinierte Kodierung hinzu, die auf alle Ausgaben dieses Mitglieds angewendet wird.',
reports: 'Berichte',
reportFields: 'Berichtsfelder',
invoiceFields: 'Rechnungsfelder',
reportTitle: 'Berichtstitel',
reportField: 'Berichtsfeld',
taxes: 'Steuern',
Expand Down Expand Up @@ -5396,6 +5397,12 @@ _Für ausführlichere Anweisungen [besuchen Sie unsere Hilfeseite](${CONST.NETSU
reportFieldInitialValueRequiredError: 'Bitte wählen Sie einen Anfangswert für das Berichtsfeld',
genericFailureMessage: 'Beim Aktualisieren des Berichtsfelds ist ein Fehler aufgetreten. Bitte versuche es erneut.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Tag-Name',
requiresTag: 'Mitglieder müssen alle Ausgaben taggen',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3914,6 +3914,7 @@ const translations = {
customFieldHint: 'Add custom coding that applies to all spend from this member.',
reports: 'Reports',
reportFields: 'Report fields',
invoiceFields: 'Invoice fields',
reportTitle: 'Report title',
reportField: 'Report field',
taxes: 'Taxes',
Expand Down Expand Up @@ -5351,6 +5352,12 @@ const translations = {
reportFieldInitialValueRequiredError: 'Please choose a report field initial value',
genericFailureMessage: 'An error occurred while updating the report field. Please try again.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Tag name',
requiresTag: 'Members must tag all expenses',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3646,6 +3646,7 @@ ${amount} para ${merchant} - ${date}`,
customFieldHint: 'Añade una codificación personalizada que se aplique a todos los gastos de este miembro.',
reports: 'Informes',
reportFields: 'Campos de informe',
invoiceFields: 'Campos de factura',
reportTitle: 'El título del informe.',
taxes: 'Impuestos',
bills: 'Pagar facturas',
Expand Down Expand Up @@ -5105,6 +5106,12 @@ ${amount} para ${merchant} - ${date}`,
reportFieldInitialValueRequiredError: 'Elige un valor inicial de campo de informe',
genericFailureMessage: 'Se ha producido un error al actualizar el campo de informe. Por favor, inténtalo de nuevo.',
},
invoiceFields: {
subtitle: 'Los campos de factura pueden ayudarte cuando quieras incluir información adicional.',
importedFromAccountingSoftware: 'Campos de factura importados desde',
disableInvoiceFields: 'Desactivar campos de factura',
disableInvoiceFieldsConfirmation: '¿Estás seguro? Los campos de factura se desactivarán en las facturas.',
},
tags: {
tagName: 'Nombre de etiqueta',
requiresTag: 'Los miembros deben etiquetar todos los gastos',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3890,6 +3890,7 @@ ${
customFieldHint: 'Ajouter un codage personnalisé qui s’applique à toutes les dépenses de ce membre.',
reports: 'Rapports',
reportFields: 'Champs du rapport',
invoiceFields: 'Champs de facture',
reportTitle: 'Titre du rapport',
reportField: 'Champ de rapport',
taxes: 'Taxes',
Expand Down Expand Up @@ -5405,6 +5406,12 @@ _Pour des instructions plus détaillées, [visitez notre site d’aide](${CONST.
reportFieldInitialValueRequiredError: 'Veuillez choisir une valeur initiale pour le champ de rapport',
genericFailureMessage: 'Une erreur s’est produite lors de la mise à jour du champ de rapport. Veuillez réessayer.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Nom de balise',
requiresTag: 'Les membres doivent étiqueter toutes les dépenses',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3871,6 +3871,7 @@ ${
customFieldHint: 'Aggiungi una codifica personalizzata che si applica a tutte le spese di questo membro.',
reports: 'Report',
reportFields: 'Campi del report',
invoiceFields: 'Campi fattura',
reportTitle: 'Titolo del report',
reportField: 'Campo del report',
taxes: 'Imposte',
Expand Down Expand Up @@ -5382,6 +5383,12 @@ _Per istruzioni più dettagliate, [visita il nostro sito di assistenza](${CONST.
reportFieldInitialValueRequiredError: 'Scegli un valore iniziale per il campo del rendiconto',
genericFailureMessage: 'Si è verificato un errore durante l’aggiornamento del campo del report. Riprova.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Nome tag',
requiresTag: 'I membri devono taggare tutte le spese',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3858,6 +3858,7 @@ ${
customFieldHint: 'このメンバーからのすべての支出に適用されるカスタムコーディングを追加します。',
reports: 'レポート',
reportFields: 'レポート項目',
invoiceFields: '請求書項目',
reportTitle: 'レポートタイトル',
reportField: 'レポートフィールド',
taxes: '税金',
Expand Down Expand Up @@ -5346,6 +5347,12 @@ _より詳しい手順については、[ヘルプサイトをご覧ください
reportFieldInitialValueRequiredError: 'レポート項目の初期値を選択してください',
genericFailureMessage: 'レポートフィールドの更新中にエラーが発生しました。もう一度お試しください。',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'タグ名',
requiresTag: 'メンバーはすべての経費にタグを付ける必要があります',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3871,6 +3871,7 @@ ${
customFieldHint: 'Aangepaste codering toevoegen die van toepassing is op alle uitgaven van dit lid.',
reports: 'Rapporten',
reportFields: 'Rapportvelden',
invoiceFields: 'Factuurvelden',
reportTitle: 'Rapporttitel',
reportField: 'Rapportveld',
taxes: 'Belastingen',
Expand Down Expand Up @@ -5372,6 +5373,12 @@ _Voor gedetailleerdere instructies, [bezoek onze helpsite](${CONST.NETSUITE_IMPO
reportFieldInitialValueRequiredError: 'Kies een beginwaarde voor het rapportveld',
genericFailureMessage: 'Er is een fout opgetreden bij het bijwerken van het rapportveld. Probeer het opnieuw.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Tagnaam',
requiresTag: 'Leden moeten alle uitgaven taggen',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3864,6 +3864,7 @@ ${
customFieldHint: 'Dodaj niestandardowe kodowanie, które ma zastosowanie do wszystkich wydatków tego członka.',
reports: 'Raporty',
reportFields: 'Pola raportu',
invoiceFields: 'Pola faktury',
reportTitle: 'Tytuł raportu',
reportField: 'Pole raportu',
taxes: 'Podatki',
Expand Down Expand Up @@ -5363,6 +5364,12 @@ _Aby uzyskać bardziej szczegółowe instrukcje, [odwiedź naszą stronę pomocy
reportFieldInitialValueRequiredError: 'Wybierz początkową wartość pola raportu',
genericFailureMessage: 'Wystąpił błąd podczas aktualizowania pola raportu. Spróbuj ponownie.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Nazwa tagu',
requiresTag: 'Członkowie muszą oznaczyć wszystkie wydatki',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3863,6 +3863,7 @@ ${
customFieldHint: 'Adicionar codificação personalizada que se aplique a todos os gastos deste membro.',
reports: 'Relatórios',
reportFields: 'Campos de relatório',
invoiceFields: 'Campos de fatura',
reportTitle: 'Título do relatório',
reportField: 'Campo de relatório',
taxes: 'Impostos',
Expand Down Expand Up @@ -5363,6 +5364,12 @@ _Para instruções mais detalhadas, [visite nosso site de ajuda](${CONST.NETSUIT
reportFieldInitialValueRequiredError: 'Por favor, escolha um valor inicial para o campo de relatório',
genericFailureMessage: 'Ocorreu um erro ao atualizar o campo do relatório. Tente novamente.',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: 'Nome da tag',
requiresTag: 'Membros devem etiquetar todas as despesas',
Expand Down
7 changes: 7 additions & 0 deletions src/languages/zh-hans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3798,6 +3798,7 @@ ${
customFieldHint: '为该成员的所有支出添加适用的自定义编码。',
reports: '报表',
reportFields: '报表字段',
invoiceFields: '发票字段',
reportTitle: '报表标题',
reportField: '报表字段',
taxes: '税费',
Expand Down Expand Up @@ -5254,6 +5255,12 @@ _如需更详细的说明,请[访问我们的帮助网站](${CONST.NETSUITE_IM
reportFieldInitialValueRequiredError: '请选择报表字段的初始值',
genericFailureMessage: '更新报表字段时出错。请重试。',
},
invoiceFields: {
subtitle: "Invoice fields can be helpful when you'd like to include extra information.",
importedFromAccountingSoftware: 'The invoice fields below are imported from your',
disableInvoiceFields: 'Disable invoice fields',
disableInvoiceFieldsConfirmation: 'Are you sure? Invoice fields will be disabled on invoices.',
},
tags: {
tagName: '标签名称',
requiresTag: '成员必须为所有报销添加标签',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type CreateWorkspaceInvoiceFieldListValueParams = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<string>
*/
invoiceFields: string;
};

export default CreateWorkspaceInvoiceFieldListValueParams;
10 changes: 10 additions & 0 deletions src/libs/API/parameters/CreateWorkspaceInvoiceFieldParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type CreateWorkspaceInvoiceFieldParams = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<string>
*/
invoiceFields: string;
};

export default CreateWorkspaceInvoiceFieldParams;
10 changes: 10 additions & 0 deletions src/libs/API/parameters/DeletePolicyInvoiceField.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type DeletePolicyInvoiceField = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<string>
*/
invoiceFields: string;
};

export default DeletePolicyInvoiceField;
6 changes: 6 additions & 0 deletions src/libs/API/parameters/EnablePolicyInvoiceFieldsParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type EnablePolicyInvoiceFieldsParams = {
policyID: string;
enabled: boolean;
};

export default EnablePolicyInvoiceFieldsParams;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type EnableWorkspaceInvoiceFieldListValueParams = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<string>
*/
invoiceFields: string;
};

export default EnableWorkspaceInvoiceFieldListValueParams;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
type RemoveWorkspaceInvoiceFieldListValueParams = {
policyID: string;
/**
* Stringified JSON object with type of following structure:
* Array<string>
*/
invoiceFields: string;
};

export default RemoveWorkspaceInvoiceFieldListValueParams;
Loading
Loading