Payment Terms Selector Element
Introduction
The payment terms selector is an element that consists of a drop-down select populated with the available payment
terms for a given organization. When payment terms are selected, a preview of the payment plan generated by the
selected terms is shown. When applicable, you can also apply an upfront payment amount and set custom installment
dates.
Inputs and Outputs
Required Inputs
-
organizationId: this is the organization whose payment terms you
want listed in the selector
-
saleType: invoice or order (should we add a default?)
Optional Inputs
-
addPaymentTerms: set to "true" to display the link to launch the add payment terms modal
-
preSelectedCustomDates: the payment due dates that should be selected when the element is loaded or changed
-
preSelectedTermId: the id of the payment terms that should be selected when the element is loaded or changed
-
saleGroupItems: an array of the sale items and quantities associated with this sale. Currently used
for itemized invoices only.
-
totalAmount: the total amount of the sale. Currently used for non-itemized invoices only.
-
triggerPaymentTermError:
boolean, triggers validation checks and applicable errors in the element when the user performs an action (e.g. button click) located in the host application.
The validation checks happen on all applicable form controls in the element (paymentTermSelect, customDates, upfrontAmount).
The 'valid' attribute emitted with the `outputPaymentTermForm` can be used to set and update the 'triggerPaymentTermError' attribute in the host application.
See a code example in sn_frontend:
https://github.com/sportngin/sn_frontend/blob/master/client-apps/org/send-invoices/send-invoices.directive.js#L46-L48
and
Output
-
outputPaymentTermForm: when payment terms are selected from the drop down or the element itself changes, the form data is emitted.
-
openPaymentTermsModal: If the input 'addPaymentTerms' is passed to the element, event is emitted when a click on the link 'Add Payment Terms' happens. Host app needs to then trigger the payment terms modal to open.
Examples