jsdoc.transactions_modal

File: biweeklybudget/flaskapp/static/js/transactions_modal.js

budgetSplitBlur()

Triggered when a form element for budget splits loses focus. Calls validateTransModalSplits() and updates the warning div with the result.

getObjectValueKey(obj, val)

Return the first property of obj with val as its value, or null.

Arguments:
  • obj – the object to check
  • val – the value to look for
selectBudget(sel_num, budg_id)

Select a budget in a budget select element. If sel_num is null then select in #trans_frm_budget, else it is expected to be an integer and the selection will be made in trans_frm_budget_<sel_num>.

Arguments:
  • sel_num (number|null) – The trans_frm_budget_ Select element suffix, or else null for the trans_frm_budget select.
  • budg_id (number) – The ID of the budget to select.
transModal(id, dataTableObj)

Show the Transaction modal popup, optionally populated with information for one Transaction. This function calls transModalDivForm() to generate the form HTML, transModalDivFillAndShow() to populate the form for editing, and handleForm() to handle the Submit action (using transModalFormSerialize() as a custom serialization function).

Arguments:
  • id (number) – the ID of the Transaction to show a modal for, or null to show modal to add a new Transaction.
  • dataTableObj (Object|null) – passed on to handleForm()
transModalAddSplitBudget()

Handler for the “Add Budget” link on trans modal when using budget split.

transModalBudgetSplitRowHtml(row_num)

Generate HTML for a budget div inside the split budgets div.

Arguments:
  • row_num (Integer) – the budget split row number
transModalDivFillAndShow(msg)

Ajax callback to fill in the modalDiv with data on a Transaction.

transModalDivForm()

Generate the HTML for the form on the Modal

transModalFormSerialize(form_id)

Custom serialization function passed to handleForm() for Transaction modal forms generated by transModal(). This handles serialization of Transaction forms that may have a budget split, generating data with a budgets Object (hash/mapping/dict) with budget ID keys and amount values, suitable for passing directly to set_budget_amounts().

Arguments:
  • form_id (String) – the ID of the form on the page.
transModalHandleSplit()

Handler for change of the “Budget Split?” (#trans_frm_is_split) checkbox.

transModalSplitBudgetChanged(row_num)

Called when a budget split dropdown is changed. If its amount box is empty, set it to the transaction amount minus the sum of all other budget splits.

Arguments:
  • row_num (Integer) – the budget split row number
validateTransModalSplits()

Function to validate Transaction modal split budgets. Returns null if valid or otherwise a String error message.