run the command npm start
The application is composed by 3 modules.
This folder contains the core entities of the application:
This folder contains:
1. *Mock-State* and *Mock-Survey* used to mock the result of the WEB API which eventually will replace them when is ready
2. Suvery. It contains all the interface type which represent the Survey
3. User. It contains the User type interface which represents the user.
This folder contains:
1. *SurveyService*. It contains the functions which mock the WEB API backed calls
2. *AppSurveyStoreService*. It contains those functions needed to create and update the state of the application
This module is the main one, it is provided by the ng
tool scaffolder and is the entry point of the application.
It works with the module AppRouting to provide the routing support for the application. It acts as container for any other module of the application
PageNotFound. It is a minimal UI page used to redirect the user in case tries to make a request to a route which doesn't exist.
AppRoutingModule. It contains all the routes of the application, it lasys load the module Survey.
This module contains:
Login. which used to access to the application and will be the where the user is redirected if try to access to restricted pages. Once the login is performed the application will save the credential on the local storage to avoid to required the password everytime the user refresh the page.
auth.service. This service is in charge to perform Login, Logout and to check is a user is currently logged in.
The first page loaded is the login. To access to the list of surveys you can use any user name and password for this demo. It is important to login otherwise you won't access to the the other pages.
This module is lazy loaded, it contains all the page and services related the survey which the user will interact with. It's composed by:
-
Pages
- SurveyForm
- SuveyList
- SurveySummary
-
Page Components and nested components
- SurveyQuestion. This is the main component which represents the Question block and is composed alternatively by the following components:
- FreeTextQuestion
- MultiChoiceQuestion
- SingleChoiceQuestion
- YesNoQuestion
- SurveyQuestion. This is the main component which represents the Question block and is composed alternatively by the following components:
-
Service Guards
- AuthGuard. This guard check if the user is logged in, if so allows the user to access to the survey module.
- SurveyGuard. Check if the the user has completed the form, if so allows the user to access to the Summary.
The Log In
button will redirect the user to the dashboard page which shows the list of surveys.
To access a survey click on any of the displayed cards.
The survey form displays a dynamic set of questions with their definition coming from a list of JSON files which mock the backend API. Each survey have different questions and the questions can be of the following types:
- Free text.
- Yes/No.
- Single selection.
- Multiple selection.
-
A user is required to answer all question by typing or by click of the option buttons such Radio button or Checkbox.
-
Once the user provides an answer the
Save
button gets activated -
A user is required to click on the
Save
button to store the answer provided
- Once the answer is saved the question frame border will turn to a green colour to confirm that the answer has been stored
Once all questions get an answer and once all of them are saved by clicking on the Save
button, then the button Complete
gets actvated and finally the user can submit the survey.
Once the user click to the button Complete
will get redirect to the summary page which shows all the questions the user answers