-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1521 from eciis/responsive
Merge Responsive - dev
- Loading branch information
Showing
45 changed files
with
1,060 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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': '[email protected]', | ||
'phone_number': '61 3315-2425', | ||
'state': 'active', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
backend/send_email_hierarchy/request_state_email_sender.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
|
||
<title></title> | ||
</head> | ||
|
||
<body style="margin:0; padding:0;"> | ||
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"> | ||
<tr align="center"> | ||
<td align="center"> | ||
|
||
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="background-color: #004D40;"> | ||
<tr align="center"> | ||
<td> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2FLOGo.png?alt=media&token=fbb74261-4b24-42aa-b67f-be36577c48df" | ||
style="width: 50px; padding-top: 20px; height: 50px;" /> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2Fasset_09_logo_white.png?alt=media&token=5fa33bc3-140a-4f71-90ff-5d1e9203a196" | ||
style="width: 150px; padding-bottom: 10px;" /> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" align="center"> | ||
<tr> | ||
<td> | ||
<div style="height: 410px;"> | ||
<div style="background-color: #009688; height: 65%;" align="center"> | ||
<div style="height: 25%; background-color: #004D40;"> | ||
<div style="width: 275px; height: 470px; margin-top: 10px; border: 1px solid #E1E1E1; background: #fff; | ||
border-radius: 5px; display: inline-block; position: relative;" align="center"> | ||
<div style="height: 35%; background-color: #EEEEEE; border-top-left-radius: 10px; border-top-right-radius: 10px;"> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2FAsset%2012logo.png?alt=media&token=9b5b92e9-c889-4176-b80a-c37afc59af4b" | ||
style="width: 100px; margin-top: 40px;" /> | ||
</div> | ||
<div style="background-color: white; font-size: 20px;"> | ||
<div style="width: 90%; color: #009688; margin-top: 10px; font-family: Arial, Helvetica, sans-serif;"> | ||
<b>AQUI ESTÁ O LINK QUE VOCÊ SOLICITOU</b> | ||
</div> | ||
<hr width="80%;" /> | ||
<div style="color: #757575; width: 90%; font-size: 15px; margin-top: 10px; font-family: Arial, Helvetica, sans-serif; word-wrap: break-word;"> | ||
<b> | ||
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. | ||
</b> | ||
</div> | ||
<div style="margin-top: 10px;"> | ||
<a href="{{ state_link }}" style="text-decoration: none;"> | ||
<button style="background-color: #009688; width: 90%; height: 25px; border: none;"> | ||
<span style="text-align: center; font-size: 8px; color: #FFFFFF">Acessar link</span> | ||
</button> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center" style="margin-bottom: 5px; margin-top: 80px;"> | ||
<tr align="center"> | ||
<td> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2FLOGo.png?alt=media&token=fbb74261-4b24-42aa-b67f-be36577c48df" | ||
style="width: 50px; height: 50px;" /> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2FAsset_09LOGO.png?alt=media&token=a33e8fc2-95d4-4b74-ae95-c6f50514645e" | ||
style="width: 150px; padding-bottom: 10px;"> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<table width="100%" border="0" cellpadding="0" cellspacing="0" align="center"> | ||
<tr align="center"> | ||
<td style="width: 100%;"> | ||
<div style="width: 100%; height: 170px; position: relative; border-top: 1px solid #E0E0E0; border-bottom: 1px solid #E1E1E1; background: #fff; | ||
border-radius: 0px; | ||
display: inline-block; position: relative;" align="center"> | ||
<div style="height: 50%; background-color: white;"> | ||
<div> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2Fufcg.png?alt=media&token=6edbaf3e-3c46-4e8a-8101-80d432d1ab6f" | ||
style="width: 100px; margin-top: 5px;" /> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2Fcis.png?alt=media&token=ccab7007-97b0-462b-a1d0-38b5da58a2ad" | ||
style="width: 100px; margin-top: 5px; margin-left: 20px;" /> | ||
</div> | ||
<div> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2Fopasoms.png?alt=media&token=a71b5c27-a317-417e-aa6e-3c744ed0e602" | ||
style="width: 220px; margin-top: 5px;" /> | ||
</div> | ||
<div> | ||
<img src="https://firebasestorage.googleapis.com/v0/b/eciis-splab.appspot.com/o/admin_email%2Flogo_ms_nova.png?alt=media&token=11b3f998-309e-46aa-bfa6-3f02ad4ec679" | ||
style="width: 150px; margin-top: 10px;" /> | ||
</div> | ||
<div style="margin-top: 23px; font-size: 10px;"> | ||
<span align="center" style="word-break: break-all; color: black;"> | ||
Copyright © 2017 Plataforma CIS - Ministério da Saúde. | ||
</span> | ||
</div> | ||
<div> | ||
<span style="font-size: 10px; color: black;"> | ||
Todos os direitos reservados. | ||
</span> | ||
</div> | ||
</div> | ||
<div style="height: 50%; background-color: white;"> | ||
</div> | ||
</div> | ||
</td> | ||
</tr> | ||
</table> | ||
</td> | ||
</tr> | ||
</table> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
}); | ||
}; | ||
}]); | ||
})(); |
43 changes: 43 additions & 0 deletions
43
frontend/email/stateLinkRequest/StateLinkRequestService.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
}; | ||
} | ||
}]); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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' | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<md-dialog> | ||
<gen-dialog | ||
title="Formulário extenso" | ||
subtitle="Você está prestes a acessar um formulario longo, por isso, é recomendado preenche-lo ou modifica-lo em um computador. Você deseja receber um email com o link desse formulario para preenche-lo mais tarde?" | ||
confirm-action="ctrl.sendStateLink" | ||
cancel-text="Não" | ||
confirm-text="Sim"> | ||
</gen-dialog> | ||
</md-dialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: '<', | ||
} | ||
}); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<span layout="row"> | ||
<md-icon class="event-canceled-icon">highlight_off</md-icon> | ||
<div> | ||
<h5 class="event-canceled-tag">ESTE EVENTO FOI CANCELADO</h5> | ||
<h6 class="event-canceled-subtitle">por {{canceledEventCtrl.getNameOfLastModified()}} • | ||
{{canceledEventCtrl.event.last_modified_date | amUtc | amLocal | amCalendar:referenceTime:formats}} </h6> | ||
</div> | ||
</span> |
Oops, something went wrong.