Skip to main content

Interface: UsePurchaseAuthorizationConfiguratorReturn

Defined in: composables/react/usePurchaseAuthorization.ts:105

State, per-row helpers and handlers returned by usePurchaseAuthorizationConfigurator.

Properties

actionLoading

actionLoading: Record<number, boolean>

Defined in: composables/react/usePurchaseAuthorization.ts:126

Per-contact in-flight flag for save/create/delete, keyed by contact id.


addContactError

addContactError: string

Defined in: composables/react/usePurchaseAuthorization.ts:135

Error message from the add-contact modal, or ''.


addContactForm

addContactForm: AddContactFormState

Defined in: composables/react/usePurchaseAuthorization.ts:131

Working form state of the add-contact modal.


addContactLoading

addContactLoading: boolean

Defined in: composables/react/usePurchaseAuthorization.ts:133

true while a contact is being created.


closeAddContactModal

closeAddContactModal: () => void

Defined in: composables/react/usePurchaseAuthorization.ts:167

Closes the add-contact modal and resets its form.

Returns

void


company

company: Company | null

Defined in: composables/react/usePurchaseAuthorization.ts:108

The loaded company, or null.


contacts

contacts: Contact[]

Defined in: composables/react/usePurchaseAuthorization.ts:112

Contacts on the current company page.


currentPage

currentPage: number

Defined in: composables/react/usePurchaseAuthorization.ts:116

Current contact page (1-based).


getRowLimit

getRowLimit: (contactId) => number | undefined

Defined in: composables/react/usePurchaseAuthorization.ts:146

Current (possibly edited) limit for the row.

Parameters

contactId

number

Returns

number | undefined


getRowRole

getRowRole: (contactId) => string

Defined in: composables/react/usePurchaseAuthorization.ts:144

Current (possibly edited) role for the row.

Parameters

contactId

number

Returns

string


handleAddContactSubmit

handleAddContactSubmit: () => Promise<void>

Defined in: composables/react/usePurchaseAuthorization.ts:171

Submits the add-contact form, registering a new company contact.

Returns

Promise<void>


handleCreate

handleCreate: (contactId) => Promise<void>

Defined in: composables/react/usePurchaseAuthorization.ts:157

Creates a PAC for the contact from the staged row edit.

Parameters

contactId

number

Returns

Promise<void>


handleDelete

handleDelete: (contactId) => Promise<void>

Defined in: composables/react/usePurchaseAuthorization.ts:161

Deletes the contact's PAC.

Parameters

contactId

number

Returns

Promise<void>


handleLimitChange

handleLimitChange: (contactId, value) => void

Defined in: composables/react/usePurchaseAuthorization.ts:155

Stages a limit change for a contact's row.

Parameters

contactId

number

value

string

Returns

void


handlePageChange

handlePageChange: (page) => void

Defined in: composables/react/usePurchaseAuthorization.ts:163

Changes the current contact page.

Parameters

page

number

Returns

void


handleRoleChange

handleRoleChange: (contactId, role) => void

Defined in: composables/react/usePurchaseAuthorization.ts:153

Stages a role change for a contact's row.

Parameters

contactId

number

role

string

Returns

void


handleSave

handleSave: (contactId) => Promise<void>

Defined in: composables/react/usePurchaseAuthorization.ts:159

Saves the staged row edit to the contact's existing PAC.

Parameters

contactId

number

Returns

Promise<void>


hasPac

hasPac: (contactId) => boolean

Defined in: composables/react/usePurchaseAuthorization.ts:138

true when the contact already has a PAC.

Parameters

contactId

number

Returns

boolean


isAuthManager

isAuthManager: boolean

Defined in: composables/react/usePurchaseAuthorization.ts:119

true when the signed-in user is an authorization manager for the company.


isCurrentUser

isCurrentUser: (contactId) => boolean

Defined in: composables/react/usePurchaseAuthorization.ts:140

true when the contact id is the signed-in user.

Parameters

contactId

number

Returns

boolean


isRowDirty

isRowDirty: (contactId) => boolean

Defined in: composables/react/usePurchaseAuthorization.ts:142

true when the row has unsaved changes.

Parameters

contactId

number

Returns

boolean


isRowLoading

isRowLoading: (contactId) => boolean

Defined in: composables/react/usePurchaseAuthorization.ts:148

true while the row has an action in flight.

Parameters

contactId

number

Returns

boolean


loadCompany

loadCompany: (page) => Promise<void>

Defined in: composables/react/usePurchaseAuthorization.ts:151

Loads a page of the company's contacts and their PACs.

Parameters

page

number

Returns

Promise<void>


loading

loading: boolean

Defined in: composables/react/usePurchaseAuthorization.ts:110

true while company data is loading.


openAddContactModal

openAddContactModal: () => void

Defined in: composables/react/usePurchaseAuthorization.ts:165

Opens the add-contact modal.

Returns

void


pacMap

pacMap: Record<number, PurchaseAuthorizationConfig>

Defined in: composables/react/usePurchaseAuthorization.ts:124

Existing PAC per contact, keyed by contact id.


rowEdits

rowEdits: Record<number, RowEdit>

Defined in: composables/react/usePurchaseAuthorization.ts:122

Per-contact unsaved PAC edits, keyed by contact id.


setAddContactForm

setAddContactForm: Dispatch<SetStateAction<AddContactFormState>>

Defined in: composables/react/usePurchaseAuthorization.ts:169

Setter for the add-contact form state.


showAddContactModal

showAddContactModal: boolean

Defined in: composables/react/usePurchaseAuthorization.ts:129

Whether the add-contact modal is open.


totalPages

totalPages: number

Defined in: composables/react/usePurchaseAuthorization.ts:114

Total contact pages.