ManageSubcategoriesAndIndicators class

Constructors

  • constructor of the class ManageSubcategoriesAndIndicators

    Parameters

    • tab: string

      tab from which the class is instantiated

    • user_role: string

      the role when logged in: 'mdg', 'mus', 'com', 'syc'

    Returns ManageSubcategoriesAndIndicators

Properties

btn_save_new_indicator: HTMLButtonElement
btn_save_new_subcategory: HTMLButtonElement
btn_save_toc_order: HTMLButtonElement
btn_save_toc_order_subcategories: HTMLButtonElement
config_indicators: Record<string, any>
container_indicators: HTMLDivElement
container_regex_errors: HTMLDivElement
container_subcategories: HTMLDivElement
dropdown_category: HTMLSelectElement
dropdown_subcategory: HTMLSelectElement
dropdown_unit: HTMLSelectElement
edit_mode: string
input_indicator_data_source: HTMLInputElement
input_indicator_infotext_en: HTMLTextAreaElement
input_indicator_infotext_fr: HTMLTextAreaElement
input_indicator_name: HTMLInputElement
input_indicator_toc_en: HTMLInputElement
input_indicator_toc_fr: HTMLInputElement
input_indicator_unit: HTMLInputElement
input_subcategory_info_title: HTMLParagraphElement
input_subcategory_name: HTMLInputElement
input_subcategory_toc_en: HTMLInputElement
input_subcategory_toc_fr: HTMLInputElement
lang: string
tab: string
user_country_code: string

Methods

  • checks whether all input elements have been populated can be used for creation and edits of subcategories and indicators

    Parameters

    • shortcut: string

      'subcategory' or 'indicator'

    Returns "input-errors-detected" | "no-input-errors-detected"

    input-errors-detected or no-input-errors-detected

  • checks a string against a regex for subcategories AND indicators:

    • only lowercase letters from a-z or underscores are included (this also rejects spaces)
    • cannot start with an underscore
    • cannot end with an underscore
    • an underscore is never followed by another underscore for indicators ONLY:
    • can contain a number at the end

    Parameters

    • string_to_test: string

      the string to be tested against the regex

    • subcategory_or_indicator: string

      whether testing for a subcategory or indicator name

    Returns boolean

    isValid

  • disables or enables all user inputs

    Parameters

    • disable_true_false: boolean

      true = disable, false = enable

    Returns void

  • when the category dropdown in the Manage Indicators tab is changed:

    • populate subcategory dopdown with all subcategories of that category

    Returns void

  • when the category dropdown in the Manage Subcategories tab is changed:

    • show list of all available subcategories for that category
    • show input fields: subcategory name code, TOC text FR, TOC text EN
    • show save button

    Returns void

  • when the subcategory dropdown in the Manage Indicators tab is changed:

    • show list of all available indicators for that subcategory
    • show input fields: indicator name code, TOC text FR, TOC text EN
    • show save button

    Returns void

  • logic to be executed when the config has finished loading

    Parameters

    • config: any

      the config

    Returns void

  • when a unit is selected in the units dropdown, copy the unit into the unit text input

    Returns void

  • triggers when a new character is added to unit input

    Parameters

    • event: any

      input change event

    Returns void

  • used for both tabs Manage Subcategories and Manage Indicators

    Returns void

  • populates the units dropdown with available units

    Returns void

  • creates or edits a subcategory creates or edits an indicator

    Parameters

    • dataObject: any

      the data to be sent to the server

    Returns void

  • saves the indicators TOC order

    Returns void

  • saves the subcategories TOC order

    Returns void

  • moves an item down in the indicators list

    Parameters

    • event: any

      the click event

    Returns void

  • moves an item down in the subcategories list

    Parameters

    • event: any

      the click event

    Returns void

  • moves an item up the subcategories list

    Parameters

    • event: any

      the click event

    Returns void

  • moves an item up in the indicators list

    Parameters

    • event: any

      the click event

    Returns void

  • triggered on click of Edit button (pen icon) copies the indicator name code, TOC text FR, TOC text EN into the input fields

    Parameters

    • event: any

      click event, used to know which indicator was clicked

    Returns void

  • triggered on click of Edit button (pen icon) copies the subcategory code, TOC text FR, TOC text EN into the input fields

    Parameters

    • event: any

      click event, used to know which subcategory was clicked

    Returns void

  • reads the inputs checks for indicator name validity builds dataObject calls server request function

    Returns void

  • reads the inputs checks for subcategory name validity builds dataObject calls server request function

    Returns void