diff --git a/backend/admin.py b/backend/admin.py
index ed235961c..f4492b833 100644
--- a/backend/admin.py
+++ b/backend/admin.py
@@ -330,7 +330,7 @@ def get(self):
'address': address_key,
'actuation_area': 'GOVERNMENT_AGENCIES',
'description': 'Ministério da Saúde',
- 'photo_url': 'https://i1.wp.com/notta.news/wp-content/uploads/2017/08/tbg_20170713080909_62787.jpg?w=1024',
+ 'photo_url': 'https://firebasestorage.googleapis.com/v0/b/development-cis.appspot.com/o/images%2Fministerio_da_saude_logo-1551970633722?alt=media&token=a658e366-a3b6-4699-aa98-95dc79eff3b5',
'email': 'deciis@saude.gov.br',
'phone_number': '61 3315-2425',
'state': 'active',
diff --git a/backend/handlers/__init__.py b/backend/handlers/__init__.py
index 34e4f1810..4269bdbf1 100644
--- a/backend/handlers/__init__.py
+++ b/backend/handlers/__init__.py
@@ -44,6 +44,7 @@
from .institution_children_handler import *
from .event_followers_handler import *
from .feature_toggle_handler import *
+from .current_state_email_request_handler import *
handlers = [
base_handler, erro_handler, event_collection_handler, event_handler,
@@ -63,7 +64,8 @@
user_request_collection_handler, user_timeline_handler, vote_handler,
invite_hierarchy_collection_handler, invite_user_collection_handler,
invite_institution_handler, invite_user_handler, institution_parent_handler,
- institution_children_handler, event_followers_handler, feature_toggle_handler
+ institution_children_handler, event_followers_handler, feature_toggle_handler,
+ current_state_email_request_handler
]
__all__ = [prop for handler in handlers for prop in handler.__all__]
diff --git a/backend/handlers/current_state_email_request_handler.py b/backend/handlers/current_state_email_request_handler.py
new file mode 100644
index 000000000..ce27e18fb
--- /dev/null
+++ b/backend/handlers/current_state_email_request_handler.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+"""Current state link request email handler."""
+
+import json
+
+from util import login_required
+from utils import json_response
+from . import BaseHandler
+from send_email_hierarchy import RequestStateEmailSender
+
+__all__ = ['CurrentStateEmailRequestHandler']
+
+
+class CurrentStateEmailRequestHandler(BaseHandler):
+ """Current state email request handler."""
+
+ @login_required
+ @json_response
+ def post(self, user):
+ body = json.loads(self.request.body)
+
+ subject = "Link para preenchimento de formulario"
+
+ email_sender = RequestStateEmailSender(**{
+ 'receiver': user.email,
+ 'subject': subject,
+ 'body': body
+ })
+ email_sender.send_email()
diff --git a/backend/handlers/event_collection_handler.py b/backend/handlers/event_collection_handler.py
index 125ee8da4..491483b3b 100644
--- a/backend/handlers/event_collection_handler.py
+++ b/backend/handlers/event_collection_handler.py
@@ -56,8 +56,8 @@ def get_filtered_events(filters, user):
december = month == 12
begin_selected_month_utc = datetime(year, month, 1, 3)
end_selected_month_utc = datetime(year if not december else year+1, month+1 if not december else 1, 1, 3)
- query = ndb.gql("SELECT __key__ FROM Event WHERE institution_key IN :1 AND state =:2 AND start_time < DATETIME(:3)",
- user.follows, 'published', end_selected_month_utc.strftime("%Y-%m-%d %H:%M:%S"))
+ query = ndb.gql("SELECT __key__ FROM Event WHERE institution_key IN :1 AND start_time < DATETIME(:2)",
+ user.follows, end_selected_month_utc.strftime("%Y-%m-%d %H:%M:%S"))
if query.count() > 0:
return ndb.gql("SELECT * FROM Event WHERE __key__ IN :1 AND end_time >= DATETIME(:2)",
query.fetch(), begin_selected_month_utc.strftime("%Y-%m-%d %H:%M:%S")).order(Event.end_time, Event.key)
diff --git a/backend/main.py b/backend/main.py
index d135f30d8..aad167f7a 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -47,6 +47,7 @@
from handlers import InstitutionChildrenHandler
from handlers import EventFollowersHandler
from handlers import FeatureToggleHandler
+from handlers import CurrentStateEmailRequestHandler
methods = set(webapp2.WSGIApplication.allowed_methods)
methods.add('PATCH')
@@ -100,6 +101,7 @@
("/api/user/timeline.*", UserTimelineHandler),
("/api/search/institution", SearchHandler),
("/api/feature-toggle.*", FeatureToggleHandler),
+ ("/api/email/current-state", CurrentStateEmailRequestHandler),
("/login", LoginHandler),
("/logout", LogoutHandler),
("/api/.*", ErroHandler)
diff --git a/backend/send_email_hierarchy/__init__.py b/backend/send_email_hierarchy/__init__.py
index 910a0cd11..3a2a4db30 100644
--- a/backend/send_email_hierarchy/__init__.py
+++ b/backend/send_email_hierarchy/__init__.py
@@ -10,13 +10,14 @@
from .request_link_email_sender import *
from .request_user_email_sender import *
from .transfer_admin_email_sender import *
-
+from .request_state_email_sender import *
email_modules = [
email_sender, request_institution_email_sender, invite_institution_email_sender,
invite_user_email_sender, leave_institution_email_sender,
remove_institution_email_sender, remove_member_email_sender,
- request_link_email_sender, request_user_email_sender, transfer_admin_email_sender
+ request_link_email_sender, request_user_email_sender, transfer_admin_email_sender,
+ request_state_email_sender
]
__all__ = [prop for email_module in email_modules for prop in email_module.__all__]
\ No newline at end of file
diff --git a/backend/send_email_hierarchy/request_state_email_sender.py b/backend/send_email_hierarchy/request_state_email_sender.py
new file mode 100644
index 000000000..e2cd6f858
--- /dev/null
+++ b/backend/send_email_hierarchy/request_state_email_sender.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""Request state email sender."""
+
+from . import EmailSender
+
+__all__ = ['RequestStateEmailSender']
+
+
+class RequestStateEmailSender(EmailSender):
+ """Entity responsible to send state link email."""
+
+ def __init__(self, **kwargs):
+ """The class constructor.
+
+ It initializes the object with its html and its specific properties.
+ """
+ super(RequestStateEmailSender, self).__init__(**kwargs)
+ self.subject = "Link para preenchimento de formulario"
+ self.html = "request_state_email.html"
+
+ def send_email(self):
+ """It enqueue a sending email task with the json that will fill the entity's html.
+
+ For that, it call its super with email_json property.
+ """
+ email_json = {
+ 'state_link': self.__get_state_link()
+ }
+ super(RequestStateEmailSender, self).send_email(email_json)
+
+ def __get_state_link(self):
+ return self.__get_data()['state-link']
+
+ def __get_data(self):
+ return self.body['data']
diff --git a/backend/templates/request_state_email.html b/backend/templates/request_state_email.html
new file mode 100644
index 000000000..a580a362b
--- /dev/null
+++ b/backend/templates/request_state_email.html
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AQUI ESTÁ O LINK QUE VOCÊ SOLICITOU
+
+
+
+
+ VOCÊ SOLICITOU O LINK DE UM FORMULARIO DA PLATAFORMA PARA PREENCHE-LO DEPOIS E AQUI ESTÁ ELE. CLIQUE NO BOTÃO ABAIXO PARA ACESSA-LO.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Copyright © 2017 Plataforma CIS - Ministério da Saúde.
+
+
+
+
+ Todos os direitos reservados.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/email/EmailService.js b/frontend/email/EmailService.js
new file mode 100644
index 000000000..e6d677733
--- /dev/null
+++ b/frontend/email/EmailService.js
@@ -0,0 +1,24 @@
+(function () {
+ 'use strict';
+
+ angular.module("app").service('EmailService', ["HttpService", function emailService(HttpService) {
+ const emailService = this;
+
+ emailService.STATE_LINK_EMAIL_API_URI = "/api/email/current-state";
+
+ /**
+ * Make a post request to the backend to send a state link by email.
+ * It receives the state link that will be sent.
+ *
+ * @param stateLink the state link that will be sent.
+ * @returns The post request to the backend.
+ */
+ emailService.sendStateLink = (stateLink) => {
+ return HttpService.post(emailService.STATE_LINK_EMAIL_API_URI, {
+ "data": {
+ "state-link": Config.FRONTEND_URL + stateLink
+ }
+ });
+ };
+ }]);
+})();
\ No newline at end of file
diff --git a/frontend/email/stateLinkRequest/StateLinkRequestService.js b/frontend/email/stateLinkRequest/StateLinkRequestService.js
new file mode 100644
index 000000000..0e97f8682
--- /dev/null
+++ b/frontend/email/stateLinkRequest/StateLinkRequestService.js
@@ -0,0 +1,43 @@
+(function () {
+ 'use strict';
+
+ angular.module("app").service('StateLinkRequestService', ['$mdDialog', function StateLinkRequestService($mdDialog) {
+ const StateLinkRequestService = this;
+
+ /**
+ * It shows a dialog that will ask the user if it wants to receive the link of the state
+ * by email. It is used in pages that has big forms to be filled.
+ *
+ * @param stateLink the state link that will be sent by email.
+ * @param previousState the state that the user will comeback if it accepts to receive
+ * the email.
+ */
+ StateLinkRequestService.showLinkRequestDialog = (stateLink, previousState) => {
+ $mdDialog.show({
+ templateUrl: "app/email/stateLinkRequest/stateLinkRequestDialog.html",
+ clickOutsideToClose:true,
+ locals: {
+ stateLink: stateLink,
+ previousState: previousState,
+ },
+ controller: [
+ 'EmailService',
+ '$state',
+ 'stateLink',
+ 'previousState',
+ StateLinkRequestController,
+ ],
+ controllerAs: 'ctrl'
+ });
+ };
+
+ function StateLinkRequestController(EmailService, $state, stateLink, previousState) {
+ const ctrl = this;
+
+ ctrl.sendStateLink = () => {
+ EmailService.sendStateLink(stateLink);
+ $state.go(previousState);
+ };
+ }
+ }]);
+})();
\ No newline at end of file
diff --git a/frontend/email/stateLinkRequest/stateLinkConstants.js b/frontend/email/stateLinkRequest/stateLinkConstants.js
new file mode 100644
index 000000000..0a0cf085b
--- /dev/null
+++ b/frontend/email/stateLinkRequest/stateLinkConstants.js
@@ -0,0 +1,9 @@
+(function () {
+ 'use strict';
+
+ angular.module("app").constant('STATE_LINKS', {
+ 'CREATE_EVENT': '/events',
+ 'MANAGE_INSTITUTION': '/institution/INSTITUTION_KEY/edit',
+ 'INVITE_INSTITUTION': '/inviteInstitution'
+ });
+})();
\ No newline at end of file
diff --git a/frontend/email/stateLinkRequest/stateLinkRequestDialog.html b/frontend/email/stateLinkRequest/stateLinkRequestDialog.html
new file mode 100644
index 000000000..b87ae0cde
--- /dev/null
+++ b/frontend/email/stateLinkRequest/stateLinkRequestDialog.html
@@ -0,0 +1,9 @@
+
+
+
+
\ No newline at end of file
diff --git a/frontend/event/canceledEventHeader.component.js b/frontend/event/canceledEventHeader.component.js
new file mode 100644
index 000000000..8ae316bc6
--- /dev/null
+++ b/frontend/event/canceledEventHeader.component.js
@@ -0,0 +1,27 @@
+"use strict";
+
+(function() {
+
+ function CanceledEventController() {
+ const canceledEventCtrl = this;
+
+ /**
+ * Get the first name of who modified the event by last
+ */
+ canceledEventCtrl.getNameOfLastModified = () => {
+ return _.first(canceledEventCtrl.event.last_modified_by.split(" "));
+ };
+
+ };
+
+ angular
+ .module("app")
+ .component("canceledEventHeader", {
+ templateUrl: 'app/event/canceled_event_header.html',
+ controller: [CanceledEventController],
+ controllerAs: 'canceledEventCtrl',
+ bindings: {
+ event: '<',
+ }
+ });
+})();
\ No newline at end of file
diff --git a/frontend/event/canceled_event_header.html b/frontend/event/canceled_event_header.html
new file mode 100644
index 000000000..3dbb824cc
--- /dev/null
+++ b/frontend/event/canceled_event_header.html
@@ -0,0 +1,8 @@
+
+ highlight_off
+
+
ESTE EVENTO FOI CANCELADO
+ por {{canceledEventCtrl.getNameOfLastModified()}} •
+ {{canceledEventCtrl.event.last_modified_date | amUtc | amLocal | amCalendar:referenceTime:formats}}
+
+
\ No newline at end of file
diff --git a/frontend/event/event.css b/frontend/event/event.css
index 3b4d2fb18..1da876404 100644
--- a/frontend/event/event.css
+++ b/frontend/event/event.css
@@ -210,7 +210,7 @@
.events-grid {
display: grid;
grid-template-columns: 20% 78% auto;
- grid-template-rows: 9em auto;
+ grid-template-rows: auto;
align-items: initial;
margin: 0;
}
@@ -250,7 +250,7 @@
grid-column-end: 3;
}
- .event-preview-image {
+ .event-preview-image, .event-preview-without-image {
max-height: 8em;
height: 8em;
max-width: 100%;
@@ -260,6 +260,10 @@
background-color: #009688;
}
+ .event-preview-without-image {
+ max-height: 3.5em;
+ }
+
.event-preview-border {
border-left: 0.55em solid;
}
@@ -519,6 +523,60 @@
color:#009688;
}
+ .event-canceled-tag, .event-canceled-icon {
+ color: white;
+ }
+
+ .event-canceled-icon {
+ width: 1.5em;
+ height: 2em;
+ font-size: 2.5em;
+ margin-top: 0.4em;
+ margin-left: 0.3em;
+ }
+
+ .event-canceled-tag {
+ margin-right: 2em;
+ margin-left: -1em;
+ margin-top: 1.4em;
+ font-size: 0.9em;
+ }
+
+ .event-canceled-subtitle {
+ font-size: 0.65em;
+ margin-top: -1.9em;
+ margin-left: -1.25em;
+ }
+
+ @media screen and (max-width: 400px) {
+ .event-canceled-tag {
+ font-size: 0.8em;
+ }
+ }
+
+ @media screen and (max-width: 360px) {
+ .event-canceled-tag {
+ margin-top: 1.7em;
+ font-size: 0.75em;
+ }
+ }
+
+ @media screen and (max-width: 330px) {
+ .event-canceled-tag {
+ margin-right: 1em;
+ margin-top: 2.1em;
+ font-size: 0.69em;
+ }
+
+ .event-canceled-subtitle {
+ font-size: 0.55em;
+ }
+
+ .event-canceled-icon {
+ margin-left: 0.2em;
+ }
+ }
+
@media screen and (min-height: 600px) {
.event-links-fields {
max-height: 13em;
diff --git a/frontend/event/eventCard.component.js b/frontend/event/eventCard.component.js
new file mode 100644
index 000000000..a7f5669c5
--- /dev/null
+++ b/frontend/event/eventCard.component.js
@@ -0,0 +1,31 @@
+"use strict";
+
+(function() {
+
+ function EventCardController(AuthService) {
+ const eventCardCtrl = this;
+
+ eventCardCtrl.user = AuthService.getCurrentUser();
+
+ /**
+ * Get the color of institutional profile of the user
+ */
+ eventCardCtrl.getProfileColor = () => {
+ const profile = _.filter(eventCardCtrl.user.institution_profiles, function(prof) {
+ return prof.institution_key === eventCardCtrl.event.institution_key;
+ });
+ return _.get(_.first(profile), 'color', 'teal');
+ };
+ };
+
+ angular
+ .module("app")
+ .component("eventCard", {
+ templateUrl: 'app/event/event_card.html',
+ controller: ['AuthService', EventCardController],
+ controllerAs: 'eventCardCtrl',
+ bindings: {
+ event: '<',
+ }
+ });
+})();
\ No newline at end of file
diff --git a/frontend/event/eventController.js b/frontend/event/eventController.js
index 5665516d7..2c81fd45d 100644
--- a/frontend/event/eventController.js
+++ b/frontend/event/eventController.js
@@ -17,6 +17,8 @@
eventCtrl.selectedYear = null;
eventCtrl.user = AuthService.getCurrentUser();
eventCtrl.isLoadingEvents = true;
+ eventCtrl.isFiltering = false;
+ eventCtrl.institutionsFilter = [];
eventCtrl.loadMoreEvents = function loadMoreEvents() {
@@ -53,14 +55,22 @@
eventCtrl.events.push(event);
});
}
+
+ if (Utils.isMobileScreen(SCREEN_SIZES.SMARTPHONE) && !eventCtrl.institutionKey) {
+ eventCtrl.events = eventCtrl.events.filter(event => {
+ const institution = _.find(eventCtrl.institutionsFilter, institution => institution.name === event.institution_name);
+ return institution && institution.enable;
+ });
+ } else {
+ eventCtrl.events = $filter('filter')(eventCtrl.events, eventCtrl.institutionKey);
+ }
- eventCtrl.events = $filter('filter')(eventCtrl.events, eventCtrl.institutionKey);
eventCtrl.isLoadingEvents = false;
eventCtrl._getEventsByDay();
}, function error() {
$state.go(STATES.HOME);
});
- }
+ };
eventCtrl.newEvent = function newEvent(event) {
if(Utils.isMobileScreen(SCREEN_SIZES.SMARTPHONE)) {
@@ -107,18 +117,7 @@
* @param {object} event - The current event
*/
eventCtrl.goToEvent = (event) => {
- $state.go(STATES.EVENT_DETAILS, { eventKey: event.key });
- };
-
- /**
- * Get the color of institutional profile of the user
- * @param {object} event - The current event
- */
- eventCtrl.getProfileColor = (event) => {
- const profile = _.filter(eventCtrl.user.institution_profiles, function(prof) {
- return prof.institution_key === event.institution_key;
- });
- return _.get(_.first(profile), 'color', 'teal');
+ event.state !== 'deleted' && $state.go(STATES.EVENT_DETAILS, { eventKey: event.key });
};
/**
@@ -172,8 +171,8 @@
* @private
*/
eventCtrl._getEventsByDay = () => {
+ eventCtrl.eventsByDay = [];
if(eventCtrl.events.length > 0 && eventCtrl.selectedMonth) {
- eventCtrl.eventsByDay = [];
let eventsByDay = {};
_.forEach(eventCtrl.events, function(event) {
eventCtrl._distributeEvents(event, eventsByDay);
@@ -214,7 +213,7 @@
eventCtrl.loadMoreEvents();
});
};
-
+
/**
* Generate the menuItems that will live in the middle of the toolbar.
*/
@@ -252,10 +251,13 @@
title: 'Atualizar', action: () => { eventCtrl._moreEvents = true;
eventCtrl._actualPage = 0; eventCtrl.events = []; eventCtrl.loadMoreEvents()}
},
- {
- title: 'Filtrar por instituição', action: () => {}
- }
- ]
+ ];
+
+ if (!eventCtrl.institutionKey) {
+ toolbarMenuGeneralOptions.options.push({
+ title: 'Filtrar por instituição', action: () => {eventCtrl.isFiltering = true;}
+ });
+ }
return toolbarMenuGeneralOptions;
};
@@ -268,6 +270,27 @@
eventCtrl.toolbarItems = eventCtrl._getToolbarMobileMenuItems();
};
+ /**
+ * This function applies the modifications made
+ * to the event filter by institution,
+ * reloading events and filtering.
+ */
+ eventCtrl.confirmFilter = function confirmFilter() {
+ eventCtrl.events = [];
+ eventCtrl._actualPage = 0;
+ eventCtrl._moreEvents = true;
+ eventCtrl.isLoadingEvents = true;
+ eventCtrl.cancelFilter();
+ return eventCtrl.loadMoreEvents();
+ };
+
+ /**
+ * This function cancels the filter run.
+ */
+ eventCtrl.cancelFilter = function cancelFilter() {
+ eventCtrl.isFiltering = false;
+ };
+
eventCtrl.$onInit = () => {
eventCtrl.institutionKey = $state.params.institutionKey;
getCurrentInstitution();
@@ -276,6 +299,13 @@
eventCtrl._getMonths().then(() => {
eventCtrl.setupToolbarFields();
});
+
+ eventCtrl.institutionsFilter = eventCtrl.user.follows.map(institution => {
+ return {
+ name: institution.name,
+ enable: true
+ };
+ });
} else {
eventCtrl.loadMoreEvents();
}
diff --git a/frontend/event/eventDialogController.js b/frontend/event/eventDialogController.js
index 50c8e6f51..0d63e015d 100644
--- a/frontend/event/eventDialogController.js
+++ b/frontend/event/eventDialogController.js
@@ -4,7 +4,7 @@
const app = angular.module("app");
app.controller('EventDialogController', function EventDialogController(MessageService, brCidadesEstados,
- ImageService, AuthService, EventService, $mdMenu, $state, $rootScope, $mdDialog, $http, STATES, SCREEN_SIZES, ObserverRecorderService) {
+ ImageService, AuthService, EventService, $mdMenu, $state, $rootScope, $mdDialog, $http, STATES, SCREEN_SIZES, ObserverRecorderService, StateLinkRequestService, STATE_LINKS) {
var dialogCtrl = this;
dialogCtrl.loading = false;
@@ -365,7 +365,8 @@
dialogCtrl.startHour = new Date(dialogCtrl.event.start_time);
dialogCtrl.startHour.setHours(8, 0, 0);
dialogCtrl.addStartHour();
- dialogCtrl.event.end_time = new Date(dialogCtrl.event.start_time);
+ dialogCtrl.event.end_time = _.isNil(dialogCtrl.event.end_time) ?
+ new Date(dialogCtrl.event.start_time) : dialogCtrl.event.end_time;
dialogCtrl.endHour = new Date(dialogCtrl.event.start_time);
dialogCtrl.endHour.setHours(18, 0, 0);
dialogCtrl.addEndHour();
@@ -518,6 +519,9 @@
} else {
dialogCtrl.event = { address: address };
}
+ if (Utils.isMobileScreen()) {
+ StateLinkRequestService.showLinkRequestDialog(STATE_LINKS.CREATE_EVENT, STATES.EVENTS);
+ }
};
});
})();
\ No newline at end of file
diff --git a/frontend/event/event_card.html b/frontend/event/event_card.html
new file mode 100644
index 000000000..21b1bbe7e
--- /dev/null
+++ b/frontend/event/event_card.html
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+ {{ eventCardCtrl.event.title | uppercase}}
+
+
+ {{ eventCardCtrl.event.start_time | amUtc | amLocal | amDateFormat:'HH:mm' }}
+ {{ eventCardCtrl.event.address.city ? ' | ' + eventCardCtrl.event.address.city : ''}}
+
+ {{eventCardCtrl.event.institution_name || uppercase}}
+
+
+
+
+
\ No newline at end of file
diff --git a/frontend/event/events_mobile.html b/frontend/event/events_mobile.html
index 349519ec8..550add828 100644
--- a/frontend/event/events_mobile.html
+++ b/frontend/event/events_mobile.html
@@ -1,6 +1,6 @@
-
-
add
-
\ No newline at end of file
+
+
+
+
diff --git a/frontend/event/filterEvents/filterEventByInstitution.component.js b/frontend/event/filterEvents/filterEventByInstitution.component.js
new file mode 100644
index 000000000..c208702b5
--- /dev/null
+++ b/frontend/event/filterEvents/filterEventByInstitution.component.js
@@ -0,0 +1,62 @@
+(function() {
+ 'use strict';
+
+ const app = angular.module('app');
+
+ app.controller('FilterEventsByInstitutionController', function() {
+ const filterCtrl = this;
+ filterCtrl.originalList = [];
+ filterCtrl.enableAll = true;
+
+
+ /**
+ * This function checks if all filters are enabled
+ * and changes the enableAll variable to true,
+ * if there is at least one disabled, switch to false.
+ */
+ filterCtrl.checkChange = function checkChange() {
+ filterCtrl.enableAll = (_.find(filterCtrl.filterList, institution => !institution.enable)) ? false : true;
+ };
+
+ /**
+ * This function enables or disables all filters,
+ * according to the enableAll variable
+ */
+ filterCtrl.enableOrDisableAll = function enableOrDisableAll() {
+ filterCtrl.filterList.map(institution => institution.enable = filterCtrl.enableAll);
+ };
+
+ /**
+ * This function cancels the filter modification
+ * and returns it to the original state.
+ */
+ filterCtrl.cancel = function cancel() {
+ filterCtrl.filterList.map((institution, index) => {
+ institution.enable = filterCtrl.originalList[index].enable;
+ });
+ filterCtrl.cancelAction();
+ };
+
+ filterCtrl.$onInit = function() {
+ filterCtrl.originalList = _.cloneDeep(filterCtrl.filterList);
+ filterCtrl.checkChange();
+ };
+ });
+
+ /**
+ * Filter events by institution component
+ * @example
+ *
+ *
+ */
+ app.component("filterEventsByInstitution", {
+ templateUrl: 'app/event/filterEvents/filter_events_by_institution.html',
+ controller: 'FilterEventsByInstitutionController',
+ controllerAs: 'filterCtrl',
+ bindings: {
+ filterList: '<',
+ confirmAction: '<',
+ cancelAction: '<'
+ }
+ });
+})();
\ No newline at end of file
diff --git a/frontend/event/filterEvents/filter_events_by_institution.css b/frontend/event/filterEvents/filter_events_by_institution.css
new file mode 100644
index 000000000..dfb062a6f
--- /dev/null
+++ b/frontend/event/filterEvents/filter_events_by_institution.css
@@ -0,0 +1,46 @@
+.filter-container {
+ display: grid;
+ grid-template-rows: 1fr min-content;
+ height: 100%;
+ max-height: 100%;
+}
+
+.filter-items-container {
+ max-height: 100%;
+ overflow-y: scroll;
+}
+
+.filter-items-container > h3 {
+ text-align: center;
+}
+
+.filter-items-container > div {
+ display: grid;
+ grid-auto-rows: 1fr;
+}
+
+.filter-item {
+ display: grid;
+ grid-template-columns: 20px auto;
+ grid-column-gap: 10px;
+ padding: 0 16px;
+ margin: 8px 0;
+ align-items: center;
+}
+
+.filter-item > md-checkbox {
+ margin: 0;
+ text-align: center;
+}
+
+.filter-buttons-container {
+ display: grid;
+ grid-template-columns: auto auto;
+ justify-content: end;
+ margin-bottom: 10px;
+}
+
+.filter-cancel-button {
+ color: white;
+ background-color: #7F7F7F;
+}
\ No newline at end of file
diff --git a/frontend/event/filterEvents/filter_events_by_institution.html b/frontend/event/filterEvents/filter_events_by_institution.html
new file mode 100644
index 000000000..8a5986c49
--- /dev/null
+++ b/frontend/event/filterEvents/filter_events_by_institution.html
@@ -0,0 +1,20 @@
+
+
+
+
+ CANCELAR
+ FILTRAR
+
+
\ No newline at end of file
diff --git a/frontend/index.html b/frontend/index.html
index 5c31459a4..b3f9bdb3b 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -73,6 +73,7 @@
+
@@ -81,6 +82,7 @@
+
@@ -233,6 +235,9 @@
+
+
+
@@ -317,6 +322,13 @@
+
+
+
+
+
+
+