new AccountManager(localStorage) → {Object}
This constructor function about account managment
Parameters:
Name | Type | Description |
---|---|---|
localStorage |
localStorage |
- Source:
Members
(inner) carArray :array
Array that hold the cars.
- Source:
(inner) ls :localStorage
localStorage.
- Source:
(inner) signalArray :array
Array that hold the signals.
- Source:
(inner) teamArray :array
Array that hold the teams.
- Source:
(inner) userArray :array
Array that hold the users.
- Source:
Methods
(inner) assignTeamForSignal(signalId, teamId) → {number}
Function that assign team for a signal
Parameters:
Name | Type | Description |
---|---|---|
signalId |
number | Id of the signal |
teamId |
number | Id of the team |
- Source:
(inner) checkForEnterUser() → {boolean}
Function that check if user is logged.
- Source:
(inner) checkIfLoginUserIsAdmin(email, pass) → {boolean}
Check if login user is admin.
Parameters:
Name | Type | Description |
---|---|---|
email |
string | |
pass |
string | Password |
- Source:
(inner) deleteAccount()
Function that delete a user account
- Source:
(inner) deleteAllAccount()
Function that delete all accounts
- Source:
(inner) deleteSignal(signalId) → {number}
Function that delete a signal.
Parameters:
Name | Type | Description |
---|---|---|
signalId |
number | Id of the signal |
- Source:
(inner) diff(start, end) → {string}
Function that estimate the time between two time
Parameters:
Name | Type | Description |
---|---|---|
start |
string | Start time |
end |
string | End Time |
- Source:
(inner) endWorking(id)
Function that save the time of end of working.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the signal |
- Source:
(inner) escapeHtml(unsafe)
Function that prevent Cross Site Scripting
by replacing (escaping) special HTML characters.
Parameters:
Name | Type | Description |
---|---|---|
unsafe |
string | The unsafe string |
- Source:
(inner) findCarByRP(registrationPlate) → {Object}
Function to find a car by registration plate.
Parameters:
Name | Type | Description |
---|---|---|
registrationPlate |
string | Registration plate of the car |
- Source:
(inner) findUserByEmail(email) → {object}
Function to find a user by email.
Parameters:
Name | Type | Description |
---|---|---|
email |
string | Email of the user |
- Source:
(inner) getAcceptedSignals() → {array}
Function that get signals that are accepted.
- Source:
(inner) getActiveUser() → {Object}
Function that gets the
active user from localeStorage.
- Source:
(inner) getAll() → {array}
Function to save the users in localStorage.
- Source:
(inner) getCars() → {array}
Function that get all cars.
- Source:
(inner) getCarWithId(id) → {Car}
Function that return a car with id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the car |
- Source:
(inner) getClosedSignals() → {array}
Function that get signals that are closed.
- Source:
(inner) getFirefighters() → {array}
Function that get all firefighters.
- Source:
(inner) getNumberOfCars() → {number}
Return the number of cars.
- Source:
(inner) getNumberOfFires() → {number}
Return the number of fires.
- Source:
(inner) getNumberOfFloods() → {number}
Return the number of floods.
- Source:
(inner) getNumberOfFreeCars() → {number}
Return the number of free cars.
- Source:
(inner) getNumberOfRescues() → {number}
Return the number of rescues.
- Source:
(inner) getNumberOfSignals() → {number}
Return the number of signals.
- Source:
(inner) getNumberOfTeam() → {number}
Return the number of teams.
- Source:
(inner) getSignals() → {array}
Function that get all signals.
- Source:
(inner) getSignalsWithId(id) → {Signal}
Function that get signal with a id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the signal |
- Source:
(inner) getSignalsWithoutTeamSelected() → {array}
Function that get signals that don't have teams.
- Source:
(inner) getSignalsWithTeamSelected() → {array}
Function that get signals that have teams.
- Source:
(inner) getTeams() → {array}
Function that get all teams.
- Source:
(inner) getTeamsForSignals() → {array}
Function that get all signal that can accept the signal.
- Source:
(inner) getTeamWithId(id) → {Team}
Function that return a team with id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the team |
- Source:
(inner) getUserWithId(id) → {User}
Function that return a user with id.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the user |
- Source:
(inner) hasDuplicates(array) → {boolean}
Function that checks for duplicates .
Parameters:
Name | Type | Description |
---|---|---|
array |
array |
- Source:
(inner) isArrayEmpty(arr) → {boolean}
Check if array is empty.
Parameters:
Name | Type | Description |
---|---|---|
arr |
array | Array |
- Source:
(inner) load()
Function to load the users.
- Source:
(inner) login(email, pass) → {boolean}
Function that check is user credentials are correct.
Parameters:
Name | Type | Description |
---|---|---|
email |
string | Email of the user |
pass |
string | Password of the user |
- Source:
(inner) logOut()
Function that logout a user
- Source:
(inner) parseDate(input) → {Date}
Function that converts from string to date
Parameters:
Name | Type | Description |
---|---|---|
input |
string | date in DD.MM.YYYY format |
- Source:
(inner) registerCar(model, registrationPlate, numberOfSeats, region) → {number}
Function for registering a car.
Parameters:
Name | Type | Description |
---|---|---|
model |
string | The model of the car |
registrationPlate |
string | The registration plate of the car |
numberOfSeats |
number | Number of seats in the car |
region |
string | The region of the car |
- Source:
(inner) registerTeam(employees, car, starOfWorkingDay, endOfWorkingDay, shifts, holidays, sickLeaves, businessTrips) → {number}
Function for registering a team.
Parameters:
Name | Type | Description |
---|---|---|
employees |
array | Array of employees ids |
car |
number | Id of the car use by the team |
starOfWorkingDay |
string | When the team start working |
endOfWorkingDay |
string | When the team end working |
shifts |
array | Array of numbers, when the team is on shift |
holidays |
string | String with start and end of holidays |
sickLeaves |
string | String with start and end of sick leaves |
businessTrips |
string | String with start and end of business trips |
- Source:
(inner) registerUser(fname, lname, email, pass, role, region) → {number}
Function for registering a user.
Parameters:
Name | Type | Description |
---|---|---|
fname |
string | First name of the user |
lname |
string | Last name of the user |
email |
string | Email of the user |
pass |
string | Password of the user |
role |
number | Role of the user |
region |
string | Region of the user |
- Source:
(inner) save()
Function to save the users in localStorage.
- Source:
(inner) startWorking(id)
Function that save the time of start of working.
Parameters:
Name | Type | Description |
---|---|---|
id |
number | Id of the signal |
- Source:
(inner) submitSignalForm(title, names, type, coordinatesX, coordinatesY, description, team) → {number}
Function that save signal to the localStorage
Parameters:
Name | Type | Default | Description |
---|---|---|---|
title |
string | The title of the signal | |
names |
string | The names of the sender of the signal | |
type |
string | The type of signal | |
coordinatesX |
string | The longitude coordinate of the signal | |
coordinatesY |
string | The latitude coordinate of the signal | |
description |
string | The description of the singal | |
team |
number | null | The id of the team setted to the signal |
- Source:
(inner) validateEmail(email) → {boolean}
Function to validate the input.
Parameters:
Name | Type | Description |
---|---|---|
email |
string |
- Source:
(inner) validateFname(fname) → {boolean}
Function to validate the input.
Parameters:
Name | Type | Description |
---|---|---|
fname |
string | First name |
- Source:
(inner) validateLname(lname) → {boolean}
Function to validate the input.
Parameters:
Name | Type | Description |
---|---|---|
lname |
string | Last name |
- Source:
(inner) validatePass(pass) → {boolean}
Function to validate the input.
Parameters:
Name | Type | Description |
---|---|---|
pass |
string | Password |
- Source: