From 0498efb4ce15f9756c538a53ab2514ca11c7b368 Mon Sep 17 00:00:00 2001 From: Alexandre Monjol Date: Mon, 31 Jul 2023 09:27:13 -0500 Subject: [PATCH] feat: update net payment term and display payment due date --- ditto/base.json | 20 ++ ditto/config.yml | 4 + ditto/de.json | 2 + ditto/fr.json | 2 + ditto/index.js | 8 +- ditto/nb.json | 2 + src/components/customers/CustomerSettings.tsx | 117 ++++++- .../DeleteCustomerNetPaymentTermDialog.tsx | 81 +++++ src/components/designSystem/Dialog.tsx | 2 +- .../invoices/InvoiceCustomerInfos.tsx | 53 ++-- .../settings/EditNetPaymentTermDialog.tsx | 296 ++++++++++++++++++ src/core/constants/paymentTerm.ts | 7 + src/generated/graphql.tsx | 181 ++++++++++- src/pages/settings/InvoiceSettings.tsx | 53 ++++ 14 files changed, 790 insertions(+), 38 deletions(-) create mode 100644 src/components/customers/DeleteCustomerNetPaymentTermDialog.tsx create mode 100644 src/components/settings/EditNetPaymentTermDialog.tsx create mode 100644 src/core/constants/paymentTerm.ts diff --git a/ditto/base.json b/ditto/base.json index f4dd1e004..6a06b6e62 100644 --- a/ditto/base.json +++ b/ditto/base.json @@ -446,6 +446,26 @@ "text_636df520279a9e1b3c68cc67": "API keys & ID", "text_636df520279a9e1b3c68cc75": "Organization ID", "text_636df520279a9e1b3c68cc7d": "Organization ID copied to clipboard", + "text_64c7a89b6c67eb6c98898167": "Net payment term", + "text_64c7a89b6c67eb6c98898182": "The duration within which a customer is expected to remit payment after the invoice is issued.\r\nNeed flexibility by customer? Set it up on a customer that will override the one above.", + "text_64c7a89b6c67eb6c988980eb": "The duration within which a customer is expected to remit payment after the invoice is issued. Note that it may impact all invoices already in draft.", + "text_64c7a89b6c67eb6c98898109": "Net payment term", + "text_64c7a89b6c67eb6c98898125": "0 days (at issuing date)", + "text_64c7a89b6c67eb6c9889815f": "{{days}} day|{{days}} days", + "text_64c7a89b6c67eb6c988981ae": "Custom period", + "text_64c7a89b6c67eb6c988981e0": "Edit net payment term", + "text_64c7a89b6c67eb6c98898181": "Net payment term successfully edited", + "text_64c7a89b6c67eb6c9889822d": "Add a net payment term", + "text_64c7a89b6c67eb6c98898241": "{{days}} day (from organization)|{{days}} days (from organization)", + "text_64c7a89b6c67eb6c9889824d": "This customer inherits this net payment term from the general settings. Add it on this customer to overwrite the general setting.", + "text_64c7a89b6c67eb6c98898073": "Add net payment term", + "text_64c7a89b6c67eb6c9889831d": "Net payment term applied only for this customer.", + "text_64c7a89b6c67eb6c98898350": "Net payment term successfully added", + "text_64c7a89b6c67eb6c988980db": "You’re about to delete the net payment term", + "text_64c7a89b6c67eb6c988980f9": "After deleting this net payment term, {{customerName}}’s draft and upcoming invoices will automatically adopt the one defined at the organization level. Are you sure to delete it?", + "text_64c7a89b6c67eb6c98898133": "Yes, delete", + "text_64c7a89b6c67eb6c98898357": "Net payment term successfully deleted", + "text_64c7b3014f5c4639c4a51ab0": "Search or select a net payment term", "text_64aeb7b998c4322918c84204": "Payment methods", "text_64aeb7b998c4322918c84208": "Card", "text_64aeb7b998c4322918c8420c": "SEPA Direct Debit", diff --git a/ditto/config.yml b/ditto/config.yml index f638c7f72..a9de01273 100644 --- a/ditto/config.yml +++ b/ditto/config.yml @@ -265,7 +265,11 @@ sources: fileName: Add missing keys - name: 👍 [Ready for dev] - Settings / Customers - Lago x Stripe SDD id: 64aeb7b7d5628db33254c4bb + fileName: 👍 [Ready for dev] - Settings / Customers - Lago x Stripe SDD - name: 👍 [Ready for dev] - Plans - Add tax to plans id: 64be91077c9f2900a38f3ad3 + fileName: 👍 [Ready for dev] - Plans - Add tax to plans + - name: 👍 [Ready for dev] - Settings - Net payment term + id: 64c7a896197f1907cbc6371c format: flat variants: true diff --git a/ditto/de.json b/ditto/de.json index aa76972c2..4e7f9038f 100644 --- a/ditto/de.json +++ b/ditto/de.json @@ -1,4 +1,6 @@ { + "__variant-name": "German", + "__variant-description": "", "text_641d6ae1d947c400671e6abb": "Etwas ist schiefgelaufen", "text_641d6aee014c8d00c1425cdd": "Bitte aktualisieren Sie die Seite oder kontaktieren Sie uns, wenn der Fehler weiterhin besteht.", "text_641d6b00ef96c1008754734d": "Seite aktualisieren", diff --git a/ditto/fr.json b/ditto/fr.json index b9221a155..f206627f4 100644 --- a/ditto/fr.json +++ b/ditto/fr.json @@ -1,4 +1,6 @@ { + "__variant-name": "French", + "__variant-description": "", "text_641d6ae1d947c400671e6abb": "Quelque chose n'a pas fonctionné", "text_641d6aee014c8d00c1425cdd": "Veuillez actualiser la page ou nous contacter si l'erreur persiste.", "text_641d6b00ef96c1008754734d": "Actualiser la page", diff --git a/ditto/index.js b/ditto/index.js index 7df21d162..fcaf34446 100644 --- a/ditto/index.js +++ b/ditto/index.js @@ -62,6 +62,9 @@ module.exports = { "project_634ea0e94c99df2bb59820d9": { "base": require('./-ready-for-dev---settings---customers---lago-gocardless-connection__base.json') }, + "project_64c7a896197f1907cbc6371c": { + "base": require('./-ready-for-dev---settings---net-payment-term__base.json') + }, "project_64aeb7b7d5628db33254c4bb": { "base": require('./-ready-for-dev---settings--customers---lago-x-stripe-sdd__base.json') }, @@ -186,7 +189,10 @@ module.exports = { "base": require('./customers---edit--delete-a-customer__base.json') }, "ditto_component_library": { - "base": require('./ditto-component-library__base.json') + "base": require('./ditto-component-library__base.json'), + "de": require('./ditto-component-library__de.json'), + "fr": require('./ditto-component-library__fr.json'), + "nb": require('./ditto-component-library__nb.json') }, "project_623b3ac9459a5d00df324533": { "base": require('./documentation-asset__base.json') diff --git a/ditto/nb.json b/ditto/nb.json index 8665d292d..7fc75c74b 100644 --- a/ditto/nb.json +++ b/ditto/nb.json @@ -1,4 +1,6 @@ { + "__variant-name": "Norwegian", + "__variant-description": "", "text_641d6ae1d947c400671e6abb": "Noe gikk galt", "text_641d6aee014c8d00c1425cdd": "Oppdater siden eller kontakt oss hvis feilen vedvarer.", "text_641d6b00ef96c1008754734d": "Oppdater siden", diff --git a/src/components/customers/CustomerSettings.tsx b/src/components/customers/CustomerSettings.tsx index 1026c7023..01c84fb26 100644 --- a/src/components/customers/CustomerSettings.tsx +++ b/src/components/customers/CustomerSettings.tsx @@ -18,6 +18,7 @@ import { CustomerForDeleteVatRateDialogFragmentDoc, DeleteCustomerDocumentLocaleFragmentDoc, DeleteCustomerGracePeriodFragmentDoc, + DeleteCustomerNetPaymentTermFragmentDoc, EditCustomerDocumentLocaleFragmentDoc, EditCustomerInvoiceGracePeriodFragmentDoc, EditCustomerVatRateFragmentDoc, @@ -33,6 +34,11 @@ import { PremiumWarningDialog, PremiumWarningDialogRef } from '~/components/Prem import ErrorImage from '~/public/images/maneki/error.svg' import { DocumentLocales } from '~/core/translations/documentLocales' import { intlFormatNumber } from '~/core/formats/intlFormatNumber' +import { GenericPlaceholder } from '~/components/GenericPlaceholder' +import { + EditNetPaymentTermDialog, + EditNetPaymentTermDialogRef, +} from '~/components/settings/EditNetPaymentTermDialog' import { EditCustomerInvoiceGracePeriodDialog, @@ -51,8 +57,10 @@ import { EditCustomerDocumentLocaleDialogRef, } from './EditCustomerDocumentLocaleDialog' import { DeleteCustomerDocumentLocaleDialog } from './DeleteCustomerDocumentLocaleDialog' - -import { GenericPlaceholder } from '../GenericPlaceholder' +import { + DeleteOrganizationNetPaymentTermDialog, + DeleteOrganizationNetPaymentTermDialogRef, +} from './DeleteCustomerNetPaymentTermDialog' gql` fragment CustomerAppliedTaxRatesForSettings on Customer { @@ -69,6 +77,7 @@ gql` customer(id: $id) { id invoiceGracePeriod + netPaymentTerm billingConfiguration { id documentLocale @@ -82,10 +91,12 @@ gql` ...DeleteCustomerGracePeriod ...DeleteCustomerDocumentLocale ...CustomerForDeleteVatRateDialog + ...DeleteCustomerNetPaymentTerm } organization { id + netPaymentTerm billingConfiguration { id invoiceGracePeriod @@ -100,6 +111,7 @@ gql` ${DeleteCustomerGracePeriodFragmentDoc} ${DeleteCustomerDocumentLocaleFragmentDoc} ${CustomerForDeleteVatRateDialogFragmentDoc} + ${DeleteCustomerNetPaymentTermFragmentDoc} ` interface CustomerSettingsProps { @@ -122,6 +134,9 @@ export const CustomerSettings = ({ customerId }: CustomerSettingsProps) => { const editCustomerDocumentLocale = useRef(null) const deleteCustomerDocumentLocale = useRef(null) const premiumWarningDialogRef = useRef(null) + const editNetPaymentTermDialogRef = useRef(null) + const deleteOrganizationNetPaymentTermDialogRef = + useRef(null) { !!error && !loading && ( @@ -213,6 +228,95 @@ export const CustomerSettings = ({ customerId }: CustomerSettingsProps) => { )} + + + {translate('text_64c7a89b6c67eb6c98898109')} + + {typeof customer?.netPaymentTerm !== 'number' ? ( + + ) : ( + } + > + {({ closePopper }) => ( + + + + + )} + + )} + + + + {loading ? ( + <> + + + + ) : ( + <> + + {typeof customer?.netPaymentTerm !== 'number' + ? translate( + 'text_64c7a89b6c67eb6c98898241', + { + days: organization?.netPaymentTerm, + }, + organization?.netPaymentTerm + ) + : customer?.netPaymentTerm === 0 + ? translate('text_64c7a89b6c67eb6c98898125') + : translate( + 'text_64c7a89b6c67eb6c9889815f', + { + days: customer?.netPaymentTerm, + }, + customer?.netPaymentTerm + )} + + + + )} + + {translate('text_638dff9779fb99299bee912e')} @@ -410,6 +514,14 @@ export const CustomerSettings = ({ customerId }: CustomerSettingsProps) => { ref={deleteCustomerDocumentLocale} customer={customer} /> + + )} @@ -428,6 +540,7 @@ const InfoBlock = styled.div<{ $loading?: boolean; $hasSeparator?: boolean }>` padding-top: ${({ $loading }) => ($loading ? theme.spacing(1) : 0)}; padding-bottom: ${({ $loading, $hasSeparator }) => $loading ? theme.spacing(9) : $hasSeparator ? theme.spacing(8) : 0}; + margin-bottom: ${theme.spacing(8)}; box-shadow: ${({ $hasSeparator }) => ($hasSeparator ? theme.shadows[7] : 'none')}; > *:not(:last-child) { diff --git a/src/components/customers/DeleteCustomerNetPaymentTermDialog.tsx b/src/components/customers/DeleteCustomerNetPaymentTermDialog.tsx new file mode 100644 index 000000000..bd9d5d000 --- /dev/null +++ b/src/components/customers/DeleteCustomerNetPaymentTermDialog.tsx @@ -0,0 +1,81 @@ +import { gql } from '@apollo/client' +import { forwardRef } from 'react' + +import { Typography, DialogRef } from '~/components/designSystem' +import { + useDeleteCustomerNetPaymentTermMutation, + DeleteCustomerNetPaymentTermFragment, +} from '~/generated/graphql' +import { WarningDialog, WarningDialogRef } from '~/components/WarningDialog' +import { useInternationalization } from '~/hooks/core/useInternationalization' +import { addToast } from '~/core/apolloClient' + +gql` + fragment DeleteCustomerNetPaymentTerm on Customer { + id + externalId + name + netPaymentTerm + } + + mutation deleteCustomerNetPaymentTerm($input: UpdateCustomerInput!) { + updateCustomer(input: $input) { + id + ...DeleteCustomerNetPaymentTerm + } + } +` + +export interface DeleteOrganizationNetPaymentTermDialogRef extends WarningDialogRef {} + +interface DeleteOrganizationNetPaymentTermDialogProps { + customer: DeleteCustomerNetPaymentTermFragment +} + +export const DeleteOrganizationNetPaymentTermDialog = forwardRef< + DialogRef, + DeleteOrganizationNetPaymentTermDialogProps +>(({ customer }: DeleteOrganizationNetPaymentTermDialogProps, ref) => { + const [deleteCustomerNetPaymentTerm] = useDeleteCustomerNetPaymentTermMutation({ + onCompleted(data) { + if (data && data.updateCustomer) { + addToast({ + message: translate('text_64c7a89b6c67eb6c98898357'), + severity: 'success', + }) + } + }, + }) + const { translate } = useInternationalization() + + return ( + ${customer.name}`, + })} + /> + } + onContinue={async () => + await deleteCustomerNetPaymentTerm({ + variables: { + input: { + id: customer.id, + netPaymentTerm: null, + // TODO: API should not require those fields on customer update + // To be tackled as improvement + externalId: customer.externalId, + name: customer.name || '', + }, + }, + }) + } + continueText={translate('text_64c7a89b6c67eb6c98898133')} + /> + ) +}) + +DeleteOrganizationNetPaymentTermDialog.displayName = 'DeleteOrganizationNetPaymentTermDialog' diff --git a/src/components/designSystem/Dialog.tsx b/src/components/designSystem/Dialog.tsx index 3b9ec7f68..a28a1252e 100644 --- a/src/components/designSystem/Dialog.tsx +++ b/src/components/designSystem/Dialog.tsx @@ -89,7 +89,7 @@ export const Dialog = forwardRef( PaperProps={{ className: 'dialogPaper' }} transitionDuration={80} > - + <Title $hasDescription={!!description} variant="headline"> {title} {description && {description}} diff --git a/src/components/invoices/InvoiceCustomerInfos.tsx b/src/components/invoices/InvoiceCustomerInfos.tsx index 5e36ebf67..812644281 100644 --- a/src/components/invoices/InvoiceCustomerInfos.tsx +++ b/src/components/invoices/InvoiceCustomerInfos.tsx @@ -17,6 +17,7 @@ gql` fragment InvoiceForInvoiceInfos on Invoice { number issuingDate + paymentDueDate customer { id name @@ -158,32 +159,32 @@ export const InvoiceCustomerInfos = memo(({ invoice }: InvoiceCustomerInfosProps )} {invoice?.issuingDate && ( - <> - - - {translate('text_634687079be251fdb4383407')} - - - {formatDateToTZ( - invoice?.issuingDate, - customer?.applicableTimezone, - "LLL. dd, yyyy U'T'CZ" - )} - - - - - {translate('text_634687079be251fdb4383413')} - - - {formatDateToTZ( - invoice?.issuingDate, - customer?.applicableTimezone, - "LLL. dd, yyyy U'T'CZ" - )} - - - + + + {translate('text_634687079be251fdb4383407')} + + + {formatDateToTZ( + invoice?.issuingDate, + customer?.applicableTimezone, + "LLL. dd, yyyy U'T'CZ" + )} + + + )} + {invoice?.paymentDueDate && ( + + + {translate('text_634687079be251fdb4383413')} + + + {formatDateToTZ( + invoice?.paymentDueDate, + customer?.applicableTimezone, + "LLL. dd, yyyy U'T'CZ" + )} + + )} diff --git a/src/components/settings/EditNetPaymentTermDialog.tsx b/src/components/settings/EditNetPaymentTermDialog.tsx new file mode 100644 index 000000000..c6c88cef8 --- /dev/null +++ b/src/components/settings/EditNetPaymentTermDialog.tsx @@ -0,0 +1,296 @@ +import { forwardRef, useState, useRef, useImperativeHandle } from 'react' +import { gql } from '@apollo/client' +import styled from 'styled-components' +import { InputAdornment } from '@mui/material' +import { string, object, number } from 'yup' +import { useFormik } from 'formik' + +import { Button, Dialog, DialogRef } from '~/components/designSystem' +import { useInternationalization } from '~/hooks/core/useInternationalization' +import { + EditCustomerNetPaymentTermForDialogFragment, + EditOrganizationNetPaymentTermForDialogFragment, + useUpdateCustomerNetPaymentTermMutation, + useUpdateOrganizationNetPaymentTermMutation, +} from '~/generated/graphql' +import { ComboBoxField, TextInputField } from '~/components/form' +import { addToast } from '~/core/apolloClient' +import { theme } from '~/styles' +import { NetPaymentTermValuesEnum } from '~/core/constants/paymentTerm' + +gql` + fragment EditCustomerNetPaymentTermForDialog on Customer { + id + externalId + name + netPaymentTerm + } + + fragment EditOrganizationNetPaymentTermForDialog on Organization { + id + netPaymentTerm + } + + mutation updateCustomerNetPaymentTerm($input: UpdateCustomerInput!) { + updateCustomer(input: $input) { + id + ...EditCustomerNetPaymentTermForDialog + } + } + + mutation updateOrganizationNetPaymentTerm($input: UpdateOrganizationInput!) { + updateOrganization(input: $input) { + id + ...EditOrganizationNetPaymentTermForDialog + } + } +` + +enum NetPaymentTermModelTypesEnum { + 'Customer' = 'Customer', + 'Organization' = 'Organization', +} + +export interface EditNetPaymentTermDialogRef { + openDialog: ( + model: + | EditCustomerNetPaymentTermForDialogFragment + | EditOrganizationNetPaymentTermForDialogFragment + | null + | undefined + ) => unknown + closeDialog: () => unknown +} + +interface EditNetPaymentTermDialogProps { + description: string +} + +export const EditNetPaymentTermDialog = forwardRef< + EditNetPaymentTermDialogRef, + EditNetPaymentTermDialogProps +>(({ description }: EditNetPaymentTermDialogProps, ref) => { + const { translate } = useInternationalization() + const dialogRef = useRef(null) + const [model, setLocalModel] = useState< + EditCustomerNetPaymentTermForDialogFragment | EditOrganizationNetPaymentTermForDialogFragment + >() + const [isEdit, setIsEdit] = useState(false) + const [updateOrganization] = useUpdateOrganizationNetPaymentTermMutation({ + onCompleted(res) { + if (res?.updateOrganization) { + addToast({ + severity: 'success', + translateKey: isEdit ? 'text_64c7a89b6c67eb6c98898181' : 'text_64c7a89b6c67eb6c98898350', + }) + } + }, + }) + const [updateCustomer] = useUpdateCustomerNetPaymentTermMutation({ + onCompleted(res) { + if (res?.updateCustomer) { + addToast({ + severity: 'success', + translateKey: isEdit ? 'text_64c7a89b6c67eb6c98898181' : 'text_64c7a89b6c67eb6c98898350', + }) + } + }, + }) + + const formikProps = useFormik<{ + netPaymentTerm: string | null + customPeriod: number | null + }>({ + initialValues: { + netPaymentTerm: + typeof model?.netPaymentTerm === 'number' && + !Object.values(NetPaymentTermValuesEnum).includes( + String(model?.netPaymentTerm) as unknown as NetPaymentTermValuesEnum + ) + ? NetPaymentTermValuesEnum.custom + : typeof model?.netPaymentTerm === 'number' + ? String(model?.netPaymentTerm) + : null, + customPeriod: + typeof model?.netPaymentTerm === 'number' && + !Object.values(NetPaymentTermValuesEnum).includes( + String(model?.netPaymentTerm) as unknown as NetPaymentTermValuesEnum + ) + ? model?.netPaymentTerm + : null, + }, + validationSchema: object().shape({ + netPaymentTerm: string().required(''), + customPeriod: number() + .when('netPaymentTerm', { + is: (netPaymentTerm: string) => netPaymentTerm === NetPaymentTermValuesEnum.custom, + then: (schema) => schema.required(''), + }) + .nullable(), + }), + validateOnMount: true, + enableReinitialize: true, + onSubmit: async (values) => { + if (!model) return + + const localInput = { + netPaymentTerm: + values.netPaymentTerm === NetPaymentTermValuesEnum.custom + ? Number(values.customPeriod) + : Number(values.netPaymentTerm), + } + + if (model.__typename === NetPaymentTermModelTypesEnum.Customer) { + await updateCustomer({ + variables: { + input: { + id: model.id, + externalId: model.externalId, + name: model.name || '', + ...localInput, + }, + }, + }) + } else if (model.__typename === NetPaymentTermModelTypesEnum.Organization) { + await updateOrganization({ + variables: { + input: localInput, + }, + }) + } + }, + }) + + useImperativeHandle(ref, () => ({ + openDialog: (data) => { + !!data && setLocalModel(data) + setIsEdit(typeof data?.netPaymentTerm === 'number') + dialogRef.current?.openDialog() + }, + closeDialog: () => { + dialogRef.current?.closeDialog() + }, + })) + + return ( + { + formikProps.resetForm() + formikProps.validateForm() + }} + actions={({ closeDialog }) => ( + <> + + + + )} + > + + + + {formikProps.values.netPaymentTerm === NetPaymentTermValuesEnum.custom && ( + + {translate('text_638dc196fb209d551f3d814d')} + + ), + }} + /> + )} + + + ) +}) + +const ContentWrapper = styled.div` + display: flex; + gap: ${theme.spacing(3)}; + margin-bottom: ${theme.spacing(8)}; + + > * { + flex: 1; + } + + ${theme.breakpoints.down('md')} { + flex-direction: column; + } +` + +EditNetPaymentTermDialog.displayName = 'forwardRef' diff --git a/src/core/constants/paymentTerm.ts b/src/core/constants/paymentTerm.ts new file mode 100644 index 000000000..6a03759bc --- /dev/null +++ b/src/core/constants/paymentTerm.ts @@ -0,0 +1,7 @@ +export enum NetPaymentTermValuesEnum { + zero = '0', + thirty = '30', + sixty = '60', + ninety = '90', + custom = 'custom', +} diff --git a/src/generated/graphql.tsx b/src/generated/graphql.tsx index 70c50cae8..c69053575 100644 --- a/src/generated/graphql.tsx +++ b/src/generated/graphql.tsx @@ -878,6 +878,7 @@ export type CreateCustomerInput = { logoUrl?: InputMaybe; metadata?: InputMaybe>; name: Scalars['String']['input']; + netPaymentTerm?: InputMaybe; paymentProvider?: InputMaybe; phone?: InputMaybe; providerCustomer?: InputMaybe; @@ -1382,6 +1383,7 @@ export type Customer = { logoUrl?: Maybe; metadata?: Maybe>; name?: Maybe; + netPaymentTerm?: Maybe; paymentProvider?: Maybe; phone?: Maybe; providerCustomer?: Maybe; @@ -1794,6 +1796,7 @@ export type Invoice = { issuingDate: Scalars['ISO8601Date']['output']; metadata?: Maybe>; number: Scalars['String']['output']; + paymentDueDate: Scalars['ISO8601Date']['output']; paymentStatus: InvoicePaymentStatusTypeEnum; prepaidCreditAmountCents: Scalars['BigInt']['output']; refundableAmountCents: Scalars['BigInt']['output']; @@ -2395,6 +2398,7 @@ export type Organization = { legalNumber?: Maybe; logoUrl?: Maybe; name: Scalars['String']['output']; + netPaymentTerm: Scalars['Int']['output']; state?: Maybe; stripePaymentProvider?: Maybe; taxIdentificationNumber?: Maybe; @@ -3337,6 +3341,7 @@ export type UpdateCustomerInput = { logoUrl?: InputMaybe; metadata?: InputMaybe>; name: Scalars['String']['input']; + netPaymentTerm?: InputMaybe; paymentProvider?: InputMaybe; phone?: InputMaybe; providerCustomer?: InputMaybe; @@ -3388,6 +3393,7 @@ export type UpdateOrganizationInput = { legalName?: InputMaybe; legalNumber?: InputMaybe; logo?: InputMaybe; + netPaymentTerm?: InputMaybe; state?: InputMaybe; taxIdentificationNumber?: InputMaybe; timezone?: InputMaybe; @@ -3737,7 +3743,7 @@ export type GetCustomerSettingsQueryVariables = Exact<{ }>; -export type GetCustomerSettingsQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, invoiceGracePeriod?: number | null, name?: string | null, externalId: string, billingConfiguration?: { __typename?: 'CustomerBillingConfiguration', id: string, documentLocale?: string | null } | null, taxes?: Array<{ __typename?: 'Tax', id: string, name: string, code: string, rate: number }> | null } | null, organization?: { __typename?: 'Organization', id: string, billingConfiguration?: { __typename?: 'OrganizationBillingConfiguration', id: string, invoiceGracePeriod: number, documentLocale?: string | null } | null } | null }; +export type GetCustomerSettingsQuery = { __typename?: 'Query', customer?: { __typename?: 'Customer', id: string, invoiceGracePeriod?: number | null, netPaymentTerm?: number | null, name?: string | null, externalId: string, billingConfiguration?: { __typename?: 'CustomerBillingConfiguration', id: string, documentLocale?: string | null } | null, taxes?: Array<{ __typename?: 'Tax', id: string, name: string, code: string, rate: number }> | null } | null, organization?: { __typename?: 'Organization', id: string, netPaymentTerm: number, billingConfiguration?: { __typename?: 'OrganizationBillingConfiguration', id: string, invoiceGracePeriod: number, documentLocale?: string | null } | null } | null }; export type DeleteCustomerDialogFragment = { __typename?: 'Customer', id: string, name?: string | null }; @@ -3766,6 +3772,15 @@ export type DeleteCustomerGracePeriodMutationVariables = Exact<{ export type DeleteCustomerGracePeriodMutation = { __typename?: 'Mutation', updateCustomerInvoiceGracePeriod?: { __typename?: 'Customer', id: string, invoiceGracePeriod?: number | null } | null }; +export type DeleteCustomerNetPaymentTermFragment = { __typename?: 'Customer', id: string, externalId: string, name?: string | null, netPaymentTerm?: number | null }; + +export type DeleteCustomerNetPaymentTermMutationVariables = Exact<{ + input: UpdateCustomerInput; +}>; + + +export type DeleteCustomerNetPaymentTermMutation = { __typename?: 'Mutation', updateCustomer?: { __typename?: 'Customer', id: string, externalId: string, name?: string | null, netPaymentTerm?: number | null } | null }; + export type CustomerForDeleteVatRateDialogFragment = { __typename?: 'Customer', id: string, name?: string | null, externalId: string, taxes?: Array<{ __typename?: 'Tax', id: string, code: string }> | null }; export type TaxRateForDeleteCustomerVatRateDialogFragment = { __typename?: 'Tax', id: string, name: string }; @@ -3931,11 +3946,11 @@ export type FinalizeInvoiceMutationVariables = Exact<{ }>; -export type FinalizeInvoiceMutation = { __typename?: 'Mutation', finalizeInvoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; +export type FinalizeInvoiceMutation = { __typename?: 'Mutation', finalizeInvoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, paymentDueDate: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; export type InvoiceForCreditNotesTableFragment = { __typename?: 'Invoice', id: string, customer: { __typename?: 'Customer', id: string }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null }; -export type InvoiceForInvoiceInfosFragment = { __typename?: 'Invoice', number: string, issuingDate: any, customer: { __typename?: 'Customer', id: string, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, applicableTimezone: TimezoneEnum, deletedAt?: any | null } }; +export type InvoiceForInvoiceInfosFragment = { __typename?: 'Invoice', number: string, issuingDate: any, paymentDueDate: any, customer: { __typename?: 'Customer', id: string, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, applicableTimezone: TimezoneEnum, deletedAt?: any | null } }; export type InvoiceForDetailsTableFragment = { __typename?: 'Invoice', invoiceType: InvoiceTypeEnum, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, totalAmountCents: any, currency?: CurrencyEnum | null, issuingDate: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, customer: { __typename?: 'Customer', id: string, currency?: CurrencyEnum | null, applicableTimezone: TimezoneEnum }, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null }; @@ -4055,6 +4070,24 @@ export type UnassignTaxRateToOrganizationMutationVariables = Exact<{ export type UnassignTaxRateToOrganizationMutation = { __typename?: 'Mutation', updateTax?: { __typename?: 'Tax', id: string, name: string, appliedToOrganization: boolean } | null }; +export type EditCustomerNetPaymentTermForDialogFragment = { __typename?: 'Customer', id: string, externalId: string, name?: string | null, netPaymentTerm?: number | null }; + +export type EditOrganizationNetPaymentTermForDialogFragment = { __typename?: 'Organization', id: string, netPaymentTerm: number }; + +export type UpdateCustomerNetPaymentTermMutationVariables = Exact<{ + input: UpdateCustomerInput; +}>; + + +export type UpdateCustomerNetPaymentTermMutation = { __typename?: 'Mutation', updateCustomer?: { __typename?: 'Customer', id: string, externalId: string, name?: string | null, netPaymentTerm?: number | null } | null }; + +export type UpdateOrganizationNetPaymentTermMutationVariables = Exact<{ + input: UpdateOrganizationInput; +}>; + + +export type UpdateOrganizationNetPaymentTermMutation = { __typename?: 'Mutation', updateOrganization?: { __typename?: 'Organization', id: string, netPaymentTerm: number } | null }; + export type UpdateDocumentLocaleOrganizationMutationVariables = Exact<{ input: UpdateOrganizationInput; }>; @@ -4412,14 +4445,14 @@ export type GetOrganizationInfosQueryVariables = Exact<{ [key: string]: never; } export type GetOrganizationInfosQuery = { __typename?: 'Query', organization?: { __typename?: 'Organization', id: string, name: string, logoUrl?: string | null, timezone?: TimezoneEnum | null } | null }; -export type AllInvoiceDetailsForCustomerInvoiceDetailsFragment = { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null }; +export type AllInvoiceDetailsForCustomerInvoiceDetailsFragment = { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, paymentDueDate: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null }; export type GetInvoiceDetailsQueryVariables = Exact<{ id: Scalars['ID']['input']; }>; -export type GetInvoiceDetailsQuery = { __typename?: 'Query', invoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; +export type GetInvoiceDetailsQuery = { __typename?: 'Query', invoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, paymentDueDate: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; export type DownloadInvoiceMutationVariables = Exact<{ input: DownloadInvoiceInput; @@ -4433,7 +4466,7 @@ export type RefreshInvoiceMutationVariables = Exact<{ }>; -export type RefreshInvoiceMutation = { __typename?: 'Mutation', refreshInvoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; +export type RefreshInvoiceMutation = { __typename?: 'Mutation', refreshInvoice?: { __typename?: 'Invoice', id: string, invoiceType: InvoiceTypeEnum, number: string, paymentStatus: InvoicePaymentStatusTypeEnum, status: InvoiceStatusTypeEnum, totalAmountCents: any, currency?: CurrencyEnum | null, refundableAmountCents: any, creditableAmountCents: any, issuingDate: any, subTotalExcludingTaxesAmountCents: any, subTotalIncludingTaxesAmountCents: any, paymentDueDate: any, couponsAmountCents: any, creditNotesAmountCents: any, prepaidCreditAmountCents: any, versionNumber: number, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, currency?: CurrencyEnum | null, name?: string | null, legalNumber?: string | null, legalName?: string | null, taxIdentificationNumber?: string | null, email?: string | null, addressLine1?: string | null, addressLine2?: string | null, state?: string | null, country?: CountryCode | null, city?: string | null, zipcode?: string | null, deletedAt?: any | null, metadata?: Array<{ __typename?: 'CustomerMetadata', id: string, displayInInvoice: boolean, key: string, value: string }> | null }, creditNotes?: Array<{ __typename?: 'CreditNote', id: string, couponsAdjustmentAmountCents: any, number: string, subTotalExcludingTaxesAmountCents: any, currency: CurrencyEnum, totalAmountCents: any, appliedTaxes?: Array<{ __typename?: 'CreditNoteAppliedTax', id: string, amountCents: any, baseAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null, items: Array<{ __typename?: 'CreditNoteItem', amountCents: any, amountCurrency: CurrencyEnum, fee: { __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, itemName: string, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, subscription?: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null } }> }> | null, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, itemName: string, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null }> | null, invoiceSubscriptions?: Array<{ __typename?: 'InvoiceSubscription', fromDatetime?: any | null, toDatetime?: any | null, chargesFromDatetime?: any | null, chargesToDatetime?: any | null, subscription: { __typename?: 'Subscription', id: string, name?: string | null, plan: { __typename?: 'Plan', id: string, name: string, interval: PlanInterval, amountCents: any, amountCurrency: CurrencyEnum } }, fees?: Array<{ __typename?: 'Fee', id: string, amountCents: any, eventsCount?: any | null, units: number, feeType: FeeTypesEnum, appliedTaxes?: Array<{ __typename?: 'FeeAppliedTax', id: string, tax: { __typename?: 'Tax', id: string, rate: number } }> | null, trueUpFee?: { __typename?: 'Fee', id: string } | null, trueUpParentFee?: { __typename?: 'Fee', id: string } | null, charge?: { __typename?: 'Charge', id: string, billableMetric: { __typename?: 'BillableMetric', id: string, name: string, aggregationType: AggregationTypeEnum } } | null, group?: { __typename?: 'Group', id: string, key?: string | null, value: string } | null }> | null }> | null, metadata?: Array<{ __typename?: 'InvoiceMetadata', id: string, key: string, value: string }> | null, appliedTaxes?: Array<{ __typename?: 'InvoiceAppliedTax', id: string, amountCents: any, feesAmountCents: any, tax: { __typename?: 'Tax', id: string, name: string, rate: number } }> | null } | null }; export type SideNavInfosQueryVariables = Exact<{ [key: string]: never; }>; @@ -4719,7 +4752,7 @@ export type GetOrganizationSettingsQueryVariables = Exact<{ }>; -export type GetOrganizationSettingsQuery = { __typename?: 'Query', organization?: { __typename?: 'Organization', id: string, billingConfiguration?: { __typename?: 'OrganizationBillingConfiguration', id: string, invoiceGracePeriod: number, invoiceFooter?: string | null, documentLocale?: string | null } | null } | null, taxes: { __typename?: 'TaxCollection', collection: Array<{ __typename?: 'Tax', id: string, name: string, code: string, rate: number, appliedToOrganization: boolean }> } }; +export type GetOrganizationSettingsQuery = { __typename?: 'Query', organization?: { __typename?: 'Organization', id: string, netPaymentTerm: number, billingConfiguration?: { __typename?: 'OrganizationBillingConfiguration', id: string, invoiceGracePeriod: number, invoiceFooter?: string | null, documentLocale?: string | null } | null } | null, taxes: { __typename?: 'TaxCollection', collection: Array<{ __typename?: 'Tax', id: string, name: string, code: string, rate: number, appliedToOrganization: boolean }> } }; export type GetInvitesQueryVariables = Exact<{ page?: InputMaybe; @@ -5019,6 +5052,14 @@ export const DeleteCustomerGracePeriodFragmentDoc = gql` name } `; +export const DeleteCustomerNetPaymentTermFragmentDoc = gql` + fragment DeleteCustomerNetPaymentTerm on Customer { + id + externalId + name + netPaymentTerm +} + `; export const CustomerForDeleteVatRateDialogFragmentDoc = gql` fragment CustomerForDeleteVatRateDialog on Customer { id @@ -5180,6 +5221,20 @@ export const DeleteOrganizationVatRateFragmentDoc = gql` appliedToOrganization } `; +export const EditCustomerNetPaymentTermForDialogFragmentDoc = gql` + fragment EditCustomerNetPaymentTermForDialog on Customer { + id + externalId + name + netPaymentTerm +} + `; +export const EditOrganizationNetPaymentTermForDialogFragmentDoc = gql` + fragment EditOrganizationNetPaymentTermForDialog on Organization { + id + netPaymentTerm +} + `; export const EditOrganizationInformationsDialogFragmentDoc = gql` fragment EditOrganizationInformationsDialog on Organization { id @@ -5710,6 +5765,7 @@ export const InvoiceForInvoiceInfosFragmentDoc = gql` fragment InvoiceForInvoiceInfos on Invoice { number issuingDate + paymentDueDate customer { id name @@ -6831,6 +6887,7 @@ export const GetCustomerSettingsDocument = gql` customer(id: $id) { id invoiceGracePeriod + netPaymentTerm billingConfiguration { id documentLocale @@ -6842,9 +6899,11 @@ export const GetCustomerSettingsDocument = gql` ...DeleteCustomerGracePeriod ...DeleteCustomerDocumentLocale ...CustomerForDeleteVatRateDialog + ...DeleteCustomerNetPaymentTerm } organization { id + netPaymentTerm billingConfiguration { id invoiceGracePeriod @@ -6858,7 +6917,8 @@ ${EditCustomerDocumentLocaleFragmentDoc} ${EditCustomerInvoiceGracePeriodFragmentDoc} ${DeleteCustomerGracePeriodFragmentDoc} ${DeleteCustomerDocumentLocaleFragmentDoc} -${CustomerForDeleteVatRateDialogFragmentDoc}`; +${CustomerForDeleteVatRateDialogFragmentDoc} +${DeleteCustomerNetPaymentTermFragmentDoc}`; /** * __useGetCustomerSettingsQuery__ @@ -6991,6 +7051,40 @@ export function useDeleteCustomerGracePeriodMutation(baseOptions?: Apollo.Mutati export type DeleteCustomerGracePeriodMutationHookResult = ReturnType; export type DeleteCustomerGracePeriodMutationResult = Apollo.MutationResult; export type DeleteCustomerGracePeriodMutationOptions = Apollo.BaseMutationOptions; +export const DeleteCustomerNetPaymentTermDocument = gql` + mutation deleteCustomerNetPaymentTerm($input: UpdateCustomerInput!) { + updateCustomer(input: $input) { + id + ...DeleteCustomerNetPaymentTerm + } +} + ${DeleteCustomerNetPaymentTermFragmentDoc}`; +export type DeleteCustomerNetPaymentTermMutationFn = Apollo.MutationFunction; + +/** + * __useDeleteCustomerNetPaymentTermMutation__ + * + * To run a mutation, you first call `useDeleteCustomerNetPaymentTermMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useDeleteCustomerNetPaymentTermMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [deleteCustomerNetPaymentTermMutation, { data, loading, error }] = useDeleteCustomerNetPaymentTermMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useDeleteCustomerNetPaymentTermMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(DeleteCustomerNetPaymentTermDocument, options); + } +export type DeleteCustomerNetPaymentTermMutationHookResult = ReturnType; +export type DeleteCustomerNetPaymentTermMutationResult = Apollo.MutationResult; +export type DeleteCustomerNetPaymentTermMutationOptions = Apollo.BaseMutationOptions; export const RemoveAppliedTaxRateOnCustomerDocument = gql` mutation removeAppliedTaxRateOnCustomer($input: UpdateCustomerInput!) { updateCustomer(input: $input) { @@ -8038,6 +8132,74 @@ export function useUnassignTaxRateToOrganizationMutation(baseOptions?: Apollo.Mu export type UnassignTaxRateToOrganizationMutationHookResult = ReturnType; export type UnassignTaxRateToOrganizationMutationResult = Apollo.MutationResult; export type UnassignTaxRateToOrganizationMutationOptions = Apollo.BaseMutationOptions; +export const UpdateCustomerNetPaymentTermDocument = gql` + mutation updateCustomerNetPaymentTerm($input: UpdateCustomerInput!) { + updateCustomer(input: $input) { + id + ...EditCustomerNetPaymentTermForDialog + } +} + ${EditCustomerNetPaymentTermForDialogFragmentDoc}`; +export type UpdateCustomerNetPaymentTermMutationFn = Apollo.MutationFunction; + +/** + * __useUpdateCustomerNetPaymentTermMutation__ + * + * To run a mutation, you first call `useUpdateCustomerNetPaymentTermMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdateCustomerNetPaymentTermMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [updateCustomerNetPaymentTermMutation, { data, loading, error }] = useUpdateCustomerNetPaymentTermMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useUpdateCustomerNetPaymentTermMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(UpdateCustomerNetPaymentTermDocument, options); + } +export type UpdateCustomerNetPaymentTermMutationHookResult = ReturnType; +export type UpdateCustomerNetPaymentTermMutationResult = Apollo.MutationResult; +export type UpdateCustomerNetPaymentTermMutationOptions = Apollo.BaseMutationOptions; +export const UpdateOrganizationNetPaymentTermDocument = gql` + mutation updateOrganizationNetPaymentTerm($input: UpdateOrganizationInput!) { + updateOrganization(input: $input) { + id + ...EditOrganizationNetPaymentTermForDialog + } +} + ${EditOrganizationNetPaymentTermForDialogFragmentDoc}`; +export type UpdateOrganizationNetPaymentTermMutationFn = Apollo.MutationFunction; + +/** + * __useUpdateOrganizationNetPaymentTermMutation__ + * + * To run a mutation, you first call `useUpdateOrganizationNetPaymentTermMutation` within a React component and pass it any options that fit your needs. + * When your component renders, `useUpdateOrganizationNetPaymentTermMutation` returns a tuple that includes: + * - A mutate function that you can call at any time to execute the mutation + * - An object with fields that represent the current status of the mutation's execution + * + * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2; + * + * @example + * const [updateOrganizationNetPaymentTermMutation, { data, loading, error }] = useUpdateOrganizationNetPaymentTermMutation({ + * variables: { + * input: // value for 'input' + * }, + * }); + */ +export function useUpdateOrganizationNetPaymentTermMutation(baseOptions?: Apollo.MutationHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useMutation(UpdateOrganizationNetPaymentTermDocument, options); + } +export type UpdateOrganizationNetPaymentTermMutationHookResult = ReturnType; +export type UpdateOrganizationNetPaymentTermMutationResult = Apollo.MutationResult; +export type UpdateOrganizationNetPaymentTermMutationOptions = Apollo.BaseMutationOptions; export const UpdateDocumentLocaleOrganizationDocument = gql` mutation updateDocumentLocaleOrganization($input: UpdateOrganizationInput!) { updateOrganization(input: $input) { @@ -11239,6 +11401,7 @@ export const GetOrganizationSettingsDocument = gql` query getOrganizationSettings($appliedToOrganization: Boolean = true) { organization { id + netPaymentTerm billingConfiguration { id invoiceGracePeriod @@ -11246,6 +11409,7 @@ export const GetOrganizationSettingsDocument = gql` documentLocale } ...EditOrganizationInvoiceTemplateDialog + ...EditOrganizationNetPaymentTermForDialog } taxes(appliedToOrganization: $appliedToOrganization) { collection { @@ -11258,6 +11422,7 @@ export const GetOrganizationSettingsDocument = gql` } } ${EditOrganizationInvoiceTemplateDialogFragmentDoc} +${EditOrganizationNetPaymentTermForDialogFragmentDoc} ${DeleteOrganizationVatRateFragmentDoc}`; /** diff --git a/src/pages/settings/InvoiceSettings.tsx b/src/pages/settings/InvoiceSettings.tsx index 149937687..61adf8c71 100644 --- a/src/pages/settings/InvoiceSettings.tsx +++ b/src/pages/settings/InvoiceSettings.tsx @@ -18,6 +18,7 @@ import { theme, NAV_HEIGHT } from '~/styles' import { DeleteOrganizationVatRateFragmentDoc, EditOrganizationInvoiceTemplateDialogFragmentDoc, + EditOrganizationNetPaymentTermForDialogFragmentDoc, useGetOrganizationSettingsQuery, } from '~/generated/graphql' import { @@ -41,6 +42,10 @@ import { DeleteOrganizationVatRateDialog, DeleteOrganizationVatRateDialogRef, } from '~/components/settings/DeleteOrganizationVatRateDialog' +import { + EditNetPaymentTermDialog, + EditNetPaymentTermDialogRef, +} from '~/components/settings/EditNetPaymentTermDialog' const MAX_FOOTER_LENGTH_DISPLAY_LIMIT = 200 @@ -48,6 +53,7 @@ gql` query getOrganizationSettings($appliedToOrganization: Boolean = true) { organization { id + netPaymentTerm billingConfiguration { id invoiceGracePeriod @@ -55,6 +61,7 @@ gql` documentLocale } ...EditOrganizationInvoiceTemplateDialog + ...EditOrganizationNetPaymentTermForDialog } taxes(appliedToOrganization: $appliedToOrganization) { @@ -71,6 +78,7 @@ gql` ${DeleteOrganizationVatRateFragmentDoc} ${EditOrganizationInvoiceTemplateDialogFragmentDoc} + ${EditOrganizationNetPaymentTermForDialogFragmentDoc} ` const InvoiceSettings = () => { @@ -81,6 +89,7 @@ const InvoiceSettings = () => { const editInvoiceTemplateDialogRef = useRef(null) const editGracePeriodDialogRef = useRef(null) const editDocumentLanguageDialogRef = useRef(null) + const editNetPaymentTermDialogRef = useRef(null) const premiumWarningDialogRef = useRef(null) const { data, error, loading } = useGetOrganizationSettingsQuery() const organization = data?.organization @@ -182,6 +191,45 @@ const InvoiceSettings = () => { )} + + + {translate('text_64c7a89b6c67eb6c98898167')} + + + + + + {loading ? ( + <> + + + + ) : ( + <> + + {organization?.netPaymentTerm === 0 + ? translate('text_64c7a89b6c67eb6c98898125') + : translate( + 'text_64c7a89b6c67eb6c9889815f', + { + days: organization?.netPaymentTerm, + }, + organization?.netPaymentTerm + )} + + + {translate('text_64c7a89b6c67eb6c98898182')} + + + )} + + {translate('text_638dc196fb209d551f3d8141')} @@ -310,6 +358,10 @@ const InvoiceSettings = () => { ref={editDocumentLanguageDialogRef} documentLocale={documentLocale} /> + ) @@ -338,6 +390,7 @@ const InlineSectionTitle = styled.div` const InfoBlock = styled.div<{ $loading?: boolean }>` padding-top: ${({ $loading }) => ($loading ? theme.spacing(1) : 0)}; padding-bottom: ${({ $loading }) => ($loading ? theme.spacing(9) : theme.spacing(8))}; + margin-bottom: ${theme.spacing(8)}; box-shadow: ${theme.shadows[7]}; > *:not(:last-child) {