Module: unit_groups

Contains the functionalities related to the unit groups page.
Author:
  • Joonas Konki
  • Anu Koskela
  • Mikko Kuhno
  • Henrik Paananen
  • Atte Räty
License:
  • BSD 3-clause, see LICENSE for more details.
Source:

Methods

(static) addUnitToUnitGroupInfo(unit)

Creates a label and an input field for the wanted unit and adds the created fields to shown units.
Parameters:
Name Type Description
unit object The unit for which information is shown.
Source:

(static) doc_ready()

This is executed after the HTML page has been loaded. This is a common procedure of all of the client-side modules to initialise the page content.
Source:

(static) fillEditFields()

Displays the information of the current unit group in the corresponding fields.
Source:

(static) hideUnit()

Sets hidden to true for the current selected unit in a local copy of the units variable.
Source:

(static) initModal()

Sets the current unit null and empties the search field of the modal. Displays all units, that are not yet related to the unit group, and their information in the modal.
Source:

(static) makeUpdateUnit(unit)

Sets the qualifier to the selected unit.
Parameters:
Name Type Description
unit object The selected unit.
Source:
Returns:
A function that sets the qualifier to the selected unit.

(static) resetView()

Empties the edit fields and reloads the unit group list.
Source:

(static) setCurrentSelection()

Sets the information of the current unit group to the corresponding fields.
Source:

(static) setNewUnitGroup()

Makes a new object by cloning the empty unit group received from the database.
Source:

(static) setUnitCopy()

Copies all of the units in units list and sets the hidden attribute to true for the units that are already related to the current unit group.
Source:

(static) setUnitGroupType()

Adds all the unit type options (basic studies, advanced studies etc.) to the current unit group type and adds a listener which updates the type of the current unit group when the option is changed.
Source:

(static) updateUnitGroupList(inputText)

Fill the unit groupt list with only the units that match the given string.
Parameters:
Name Type Description
inputText string The string that has to be found in the name of every displayed unit group.
Source:

(static) updateUnitInfo()

Displays the information of the current unit and empties the unit qualifier edit field.
Source:

(static) updateUnitList(inputText)

Checks units to see if their names include the given string. If the string is found, adds the unit to the list of units. If the string is empty, displays all units.
Parameters:
Name Type Description
inputText string The string that is searched from the unit name.
Source:

(static) updateUnits(unitGroup)

Gets all units associated to the wanted unit group and displays them in the edit fields. If no units are found, shows a notification.
Parameters:
Name Type Description
unitGroup object The unit group for which information is to be shown.
Source:

(inner) btnAddNewUnitGroup click()

Sets the current unit group to null and updates the contents of the edit fields.
Source:

(inner) btnDeleteUnitGroup click()

If the current unit group id is not null, removes it from the database.
Source:

(inner) btnSaveChanges click()

If current unit group id is null, makes a call to create a new unit group with the given parameters. Otherwise makes a call to save changes to the current unit group. If important fields are empty, shows a notification without making a call. Updates the view after the call has been completed.
Source:

(inner) modalButtonAdd click()

Adds the selected unit to the current unit group's unit list and updates the view.
Source:

(inner) modalButtonYes click()

Makes a call to remove the current unit group from the database.
Source:

(inner) unitGroupList change()

Makes a clone of the selected unit group and sets its information to the edit fields.
Source:

(inner) unitList change()

Displays the information of the selected unit.
Source: