-
Notifications
You must be signed in to change notification settings - Fork 10
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 #279 from fga-gpp-mds/devel
TS37-EditProfile
- Loading branch information
Showing
9 changed files
with
136 additions
and
95 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
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
142 changes: 80 additions & 62 deletions
142
medical_prescription/user/templates/edit_health_professional.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 |
---|---|---|
@@ -1,74 +1,92 @@ | ||
{% extends "editHealthProfessionalLanding/template.html" %} {% block content %} {% load staticfiles %} {% load static %}{% load i18n %} | ||
<!-- Register Form --> | ||
<div class="g-position--relative g-bg-color--primary"> | ||
<div class="g-container--md g-padding-y-125--xs"> | ||
<div class="g-text-center--xs g-margin-t-50--xs g-margin-b-80--xs"> | ||
<p class="text-uppercase g-font-size-14--xs g-font-weight--700 g-color--white-opacity g-letter-spacing--2 g-margin-b-25--xs">Editar Profissional de Saúde</p> | ||
<h2 class="g-font-size-32--xs g-font-size-36--sm g-color--white">Dados Cadastrais</h2> | ||
</div> | ||
|
||
<form class="center-block g-width-500--sm g-width-550--md" method='POST' action=''> | ||
{% csrf_token %} | ||
|
||
<div class="row g-row-col-5 g-margin-b-50--xs"> | ||
<div class="col-sm-10 g-margin-b-30--xs g-margin-b-0--md"> | ||
{% for error in form.name.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{% extends template %} {% block content %} {% load staticfiles %} {% load static %}{% load i18n %} | ||
|
||
<h4 class="g-font-size-14--xs g-font-size-14--sm g-color--white">Nome</h4> | ||
{{ form.name }} | ||
</div> | ||
|
||
<div class="col-sm-2"> | ||
{% for error in form.sex.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{% csrf_token %} | ||
<form class="post-form" action='' method="POST" enctype="multipart/form-data"> | ||
<div class="form-group"> | ||
{% csrf_token %} | ||
<div class="row"> | ||
<div class = "col-md-12"> | ||
<font size="5"> | ||
<span class="label label-primary">{% trans "Nome" %}</span> | ||
</font> | ||
</div> | ||
<div class = "col-md-12"> | ||
{% for error in form.name.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{{ form.name }} | ||
</div> | ||
</div> | ||
<br> | ||
|
||
<h4 class="g-font-size-14--xs g-font-size-14--sm g-color--white">Sexo</h4> | ||
{{ form.sex }} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class = "col-md-12"> | ||
<font size="5"> | ||
<span class="label label-primary">{% trans "Data de Nascimento" %}</span> | ||
</font> | ||
</div> | ||
<div class = "col-md-12"> | ||
{% for error in form.date_of_birth.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{{ form.date_of_birth }} | ||
</div> | ||
</div> | ||
|
||
<br> | ||
|
||
<div class="row g-row-col-5 g-margin-b-50--xs"> | ||
<div class="col-sm-6 g-margin-b-30--xs g-margin-b-0--md"> | ||
{% for error in form.date_of_birth.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
<div class="row"> | ||
<div class = "col-md-12"> | ||
<font size="5"> | ||
<span class="label label-primary">{% trans "Telefone" %}</span> | ||
</font> | ||
</div> | ||
<div class = "col-md-12"> | ||
{% for error in form.phone.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{{ form.phone }} | ||
</div> | ||
</div> | ||
|
||
<h4 class="g-font-size-14--xs g-font-size-14--sm g-color--white">Data de Nascimento</h4> | ||
{{ form.date_of_birth }} | ||
</div> | ||
<br> | ||
|
||
<div class="col-sm-6"> | ||
{% for error in form.phone.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
<div class="row"> | ||
<div class = "col-md-12"> | ||
<font size="5"> | ||
<span class="label label-primary">{% trans "Sexo" %}</span> | ||
</font> | ||
</div> | ||
<div class = "col-md-12"> | ||
{% for error in form.sex.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{{ form.sex }} | ||
</div> | ||
</div> | ||
|
||
<h4 class="g-font-size-14--xs g-font-size-14--sm g-color--white">Telefone:</h4> | ||
{{ form.phone }} | ||
</div> | ||
</div> | ||
<br> | ||
|
||
<div class="row g-row-col-5 g-margin-b-50--xs"> | ||
<div class="col-sm-6 g-margin-b-30--xs g-margin-b-0--md"> | ||
{% for error in form.password.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
<font size="5"> | ||
<span class="label label-primary">{% trans "Imagem de Perfil" %}</span> | ||
</font> | ||
{% for error in form.image_profile.errors %} | ||
<div class="alert alert-danger" role="alert">{{ error }}</div> | ||
{% endfor %} | ||
{% if user.image_profile.name %} | ||
<br><br> | ||
<img src="/public/{{user.image_profile}}" width="100px" height="100px"></img> | ||
<br> | ||
{% endif %} | ||
<br> | ||
|
||
<h4 class="g-font-size-14--xs g-font-size-14--sm g-color--white">Senha</h4> | ||
{{ form.password }} | ||
</div> | ||
</div> | ||
{{ form.image_profile }} | ||
|
||
<div class="g-text-center--xs"> | ||
<button value='Update' type="submit" class="text-uppercase s-btn s-btn--md s-btn--white-bg g-radius--50 g-padding-x-70--xs g-margin-b-20--xs">Editar</button> | ||
</div> | ||
|
||
</form> | ||
</div> | ||
</div> | ||
<!-- End Form --> | ||
|
||
{% endblock %} | ||
<div class="col-sm-2 col-sm-push-5"> | ||
<button type="submit" class="btn btn-success">{% trans "Salvar" %}</button> | ||
</div> | ||
</div> | ||
</form> | ||
{% endblock %} |
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
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,34 @@ | ||
from django.views.generic.edit import UpdateView | ||
from django.urls import reverse_lazy | ||
from django.utils.decorators import method_decorator | ||
from django.contrib.auth.decorators import login_required | ||
|
||
from user.models import User | ||
from user.forms import UpdateUserForm | ||
|
||
|
||
class EditProfileView(UpdateView): | ||
model = User | ||
form_class = UpdateUserForm | ||
template_name = 'edit_health_professional.html' | ||
|
||
@method_decorator(login_required) | ||
def dispatch(self, *args, **kwargs): | ||
return super(EditProfileView, self).dispatch(*args, **kwargs) | ||
|
||
def get_object(self): | ||
return self.request.user | ||
|
||
def get_context_data(self, **kwargs): | ||
context = super(EditProfileView, self).get_context_data(**kwargs) | ||
is_health_professional = hasattr(self.request.user, 'healthprofessional') | ||
if is_health_professional: | ||
template = "dashboardHealthProfessional/template.html" | ||
else: | ||
template = "dashboardPatient/template.html" | ||
|
||
context['template'] = template | ||
return context | ||
|
||
def get_success_url(self): | ||
return reverse_lazy('edit_profile') |