diff --git a/inicial/models.py b/inicial/models.py index 9bd8d848..59c49b15 100644 --- a/inicial/models.py +++ b/inicial/models.py @@ -104,10 +104,14 @@ class Meta: verbose_name = "dados" verbose_name_plural = "Dados" - SEXO = [ - ("femininino", "Feminino"), - ("masculino", "Masculino"), - ("na","Não informado") + GENERO = [ + ("na","Não informado"), + ("homem-cis", "Homem cis"), + ("homem-trans", "Homem trans"), + ("mulher-cis", "Mulher cis"), + ("mulher-trans", "Mulher trans"), + ("nao-binario", "Não-binário"), + ("outro", "Outro") ] TIPO_SANGUINIO = [ @@ -131,9 +135,8 @@ class Meta: ] usuario = models.OneToOneField(User,on_delete=models.CASCADE, primary_key=True) - nome = models.CharField(max_length=200, null=False, blank=False, default="Não informado") - idade = models.IntegerField(null=False, blank=False, default=0) - sexo = models.CharField(max_length=20, null=False, blank=False, default="na", choices=SEXO) + data_nascimento = models.DateField(null=False, blank=False, default=timezone.now) + genero = models.CharField(max_length=20, null=False, blank=False, default="na", choices=GENERO) profissao = models.CharField(max_length=200, null=False, blank=False, default="Não informada") endereco = models.CharField(max_length=200, null=False, blank=False, default="Não informado") telefone = models.CharField(max_length=20, null=False, blank=False, default="Não informado") diff --git a/inicial/signals.py b/inicial/signals.py index 557cbff2..08e4ce08 100644 --- a/inicial/signals.py +++ b/inicial/signals.py @@ -13,7 +13,7 @@ def update_time(sender, instance, created, **kwargs): risco = instance.risco duracao = Avaliacao.objects.filter(hospital=hospital).filter(risco=risco).aggregate(Avg("duracao", default=timedelta(minutes=0))) minutos = round(duracao["duracao__avg"].seconds / 60) - + avaliacao = Avaliacao.objects.filter(hospital=hospital).aggregate(Avg("avaliacao", default=0)) nota = avaliacao["avaliacao__avg"] hospital.nota = nota @@ -33,11 +33,5 @@ def update_time(sender, instance, created, **kwargs): if risco == "NAO_URGENTE": hospital.tempo_nao_urgente = minutos - hospital.atualizacao = timezone.now + hospital.atualizacao = timezone.now() hospital.save() - -@receiver(post_save, sender=User) -def create_data(sender, instance, created, **kwargs): - if created: - dados = Dados(usuario=instance) - dados.save() \ No newline at end of file diff --git a/inicial/static/styles/css_criarconta.css b/inicial/static/styles/css_criarconta.css deleted file mode 100644 index 3dc64485..00000000 --- a/inicial/static/styles/css_criarconta.css +++ /dev/null @@ -1,319 +0,0 @@ -@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&family=Oleo+Script:wght@400;700&family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap'); - -:root{ - --clr:#1D7FF1; - --clr2: #002653; - --fonte-titulo: 'Oleo script', sans-serif; - --fonte-padrao: 'Inter', sans-serif; - --fonte-destaque: 'Open sans', sans-serif; - --fonte-titulo: 'Oleo script', sans-serif; -} -*{ - margin:0; -} - -body{ - background-image:url('bg_criarconta.jpg'); - background-size:cover; - font-family: var(--fonte-padrao); -} - -/*main{*/ -/*#regForm{*/ -.multi-step-form-container{ - background-color:white; - width:700px; - position:relative; - /* right:30px; - margin-top:0px; */ - padding:30px; - text-align:center; - border-bottom-left-radius: 20px; - border-bottom-right-radius: 20px; - /* margin: auto; */ - z-index: 99; - top: 1%; - left: 49%; - transform: translateX(-50%); - /* top: 0px; - bottom: 0px; */ - /* height: 420px; */ -} - -input[type=text], input[type=password]{ - font-family: var(--fonte-destaque); - width:100%; - display:inline-block; - border-width: 0px 0px 1px 0px; - /*border-color*/ - margin-top: 12px; - margin-bottom: 30px; -} - -input[type=text]:focus, input[type=password]:focus{ - background-color:#ededed; - outline:none; -} - -/*#continuar{*/ -#nextBtn{ - background-color:#28c47e; - outline:none; - border-width:0; - color:white; - padding:14px 20px; - border-radius:10px; - text-transform:uppercase; - margin:8px; - cursor:pointer; - /*width:100%;*/ - opacity:0.9; - box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); -} - -/*#continuar:hover{*/ -#nextBtn:hover{ - opacity:1; -} - -input-invalid{ - background-color:#ffdddd; -} - -.tab{ - display:none; -} - -/* Make circles that indicate the steps of the form: */ -.step { - height: 15px; - width: 15px; - margin: 0 2px; - background-color: #bbbbbb; - border: none; - border-radius: 50%; - display: inline-block; - opacity: 0.5; - } - - /* Mark the active step: */ - .step.active { - opacity: 1; - } - - /* Mark the steps that are finished and valid: */ - .step.finish { - background-color: #04AA6D; - } - - h2 { - margin: 0; -} - -/*#multi-step-form-container { - /*margin-top: 5rem; - margin-top:0; - padding:30px; - background-color:pink; - width:600px; - left:500px; - position:relative; -}*/ - -.text-center { - text-align: center; -} -.mx-auto { - margin-left: auto; - margin-right: auto; -} -.pl-0 { - padding-left: 0; -} -.button { - padding: 0.7rem 1.5rem; - border: 1px solid #4361ee; - background-color: #4361ee; - color: #fff; - border-radius: 5px; - cursor: pointer; - text-transform:uppercase; - /*float:right; - margin-left:10px;*/ -} -.submit-btn { - border: 1px solid #0e9594; - background-color: #0e9594; - /*float:right;*/ -} -.mt-3 { - /* margin-top: 2rem; */ - position: relative; - top: 0px; - left: 50%; - transform: translateX(-50%); -} -.mt-3 > button{ - font-family: var(--fonte-padrao); - margin: 20px 0; -} -.d-none { - display: none; -} -.form-step { - position: absolute; - border: /*1px solid rgba(0, 0, 0, 0.1)*/0; - /*border-radius: 20px; - padding: 3rem;*/ - top: 50%; - left: 50%; - transform: translateX(-50%); -} -.font-normal { - font-weight: normal; -} -ul.form-stepper { - counter-reset: section; - margin-bottom: 3rem; -} -ul.form-stepper .form-stepper-circle { - position: relative; -} -ul.form-stepper .form-stepper-circle span { - position: absolute; - top: 50%; - left: 50%; - transform: translateY(-50%) translateX(-50%); -} -.form-stepper-horizontal { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; -} -ul.form-stepper > li:not(:last-of-type) { - margin-bottom: 0.625rem; - -webkit-transition: margin-bottom 0.4s; - -o-transition: margin-bottom 0.4s; - transition: margin-bottom 0.4s; -} -.form-stepper-horizontal > li:not(:last-of-type) { - margin-bottom: 0 !important; -} -.form-stepper-horizontal li { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - -webkit-box-align: start; - -ms-flex-align: start; - align-items: start; - -webkit-transition: 0.5s; - transition: 0.5s; -} -.form-stepper-horizontal li:not(:last-child):after { - position: relative; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - height: 1px; - content: ""; - top: 32%; -} -.form-stepper-horizontal li:after { - background-color: #dee2e6; -} -.form-stepper-horizontal li.form-stepper-completed:after { - background-color: #4da3ff; -} -.form-stepper-horizontal li:last-child { - flex: unset; -} -ul.form-stepper li a .form-stepper-circle { - display: inline-block; - width: 40px; - height: 40px; - margin-right: 0; - line-height: 1.7rem; - text-align: center; - background: rgba(0, 0, 0, 0.38); - border-radius: 50%; -} -.form-stepper .form-stepper-active .form-stepper-circle { - background-color: #4361ee !important; - color: #fff; -} -.form-stepper .form-stepper-active .label { - color: #4361ee !important; -} -.form-stepper .form-stepper-active .form-stepper-circle:hover { - background-color: #4361ee !important; - color: #fff !important; -} -.form-stepper .form-stepper-unfinished .form-stepper-circle { - background-color: #f8f7ff; -} -.form-stepper .form-stepper-completed .form-stepper-circle { - background-color: #0e9594 !important; - color: #fff; -} -.form-stepper .form-stepper-completed .label { - color: #0e9594 !important; -} -.form-stepper .form-stepper-completed .form-stepper-circle:hover { - background-color: #0e9594 !important; - color: #fff !important; -} -.form-stepper .form-stepper-active span.text-muted { - color: #fff !important; -} -.form-stepper .form-stepper-completed span.text-muted { - color: #fff !important; -} -.form-stepper .label { - font-size: 1rem; - margin-top: 0.5rem; -} -.form-stepper a { - cursor: default; -} -.login_google{ - margin: 10px; - padding: 10px; - color: #F14336; - border-color: #F14336; - border-radius: 5px; - width: 370px; - height: 40px; - /* font-family: Josefin Sans; */ - box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); -} -.login_google:hover{ - box-shadow: none; - color: #822b25; - border-color:#822b25; -} -.login_facebook{ - display: block; - padding: 10px; - color: var(--clr); - border-color: var(--clr); - margin-left: 10px; - border-radius: 5px; - width: 370px; - height: 40px; - /* font-family: Josefin Sans; */ - box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); -} -.login_facebook:hover{ - color: #002653; - border-color: #002653; - background-color: #ededed; - box-shadow: none; -} \ No newline at end of file diff --git a/inicial/static/styles/css_criarconta_2.css b/inicial/static/styles/css_criarconta_2.css deleted file mode 100644 index 4da385ab..00000000 --- a/inicial/static/styles/css_criarconta_2.css +++ /dev/null @@ -1,251 +0,0 @@ -*{ - margin:0; -} - -body{ - background-image:url('../img/bg_criarconta.jpg'); - background-size:cover; -} - -/*main{*/ -/*#regForm{*/ -.multi-step-form-container{ - background-color:white; - width:700px; - position:absolute; - right:30px; - margin-top:0px; - padding:30px; - text-align:center; - border-bottom-left-radius: 20px; - border-bottom-right-radius: 20px; -} - -input[type=text], input[type=password]{ - width:100%; - display:inline-block; - border-width: 0px 0px 1px 0px; - /*border-color*/ -} - -input[type=text]:focus, input[type=password]:focus{ - background-color:#ededed; - outline:none; -} - -/*#continuar{*/ -#nextBtn{ - background-color:#28c47e; - outline:none; - border-width:0; - color:white; - padding:14px 20px; - border-radius:10px; - text-transform:uppercase; - margin:8px; - cursor:pointer; - /*width:100%;*/ - opacity:0.9; - box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25); -} - -/*#continuar:hover{*/ -#nextBtn:hover{ - opacity:1; -} - -input-invalid{ - background-color:#ffdddd; -} - -.tab{ - display:none; -} - -/* Make circles that indicate the steps of the form: */ -.step { - height: 15px; - width: 15px; - margin: 0 2px; - background-color: #bbbbbb; - border: none; - border-radius: 50%; - display: inline-block; - opacity: 0.5; - } - - /* Mark the active step: */ - .step.active { - opacity: 1; - } - - /* Mark the steps that are finished and valid: */ - .step.finish { - background-color: #04AA6D; - } - - h2 { - margin: 0; -} - -/*#multi-step-form-container { - /*margin-top: 5rem; - margin-top:0; - padding:30px; - background-color:pink; - width:600px; - left:500px; - position:relative; -}*/ - -.text-center { - text-align: center; -} -.mx-auto { - margin-left: auto; - margin-right: auto; -} -.pl-0 { - padding-left: 0; -} -.button { - padding: 0.7rem 1.5rem; - border: 1px solid #4361ee; - background-color: #4361ee; - color: #fff; - border-radius: 5px; - cursor: pointer; - text-transform:uppercase; - /*float:right; - margin-left:10px;*/ -} -.submit-btn { - border: 1px solid #0e9594; - background-color: #0e9594; - /*float:right;*/ -} -.mt-3 { - margin-top: 2rem; -} -.d-none { - display: none; -} -.form-step { - border: /*1px solid rgba(0, 0, 0, 0.1)*/0; - /*border-radius: 20px; - padding: 3rem;*/ -} -.font-normal { - font-weight: normal; -} -ul.form-stepper { - counter-reset: section; - margin-bottom: 3rem; -} -ul.form-stepper .form-stepper-circle { - position: relative; -} -ul.form-stepper .form-stepper-circle span { - position: absolute; - top: 50%; - left: 50%; - transform: translateY(-50%) translateX(-50%); -} -.form-stepper-horizontal { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-pack: justify; - -ms-flex-pack: justify; - justify-content: space-between; -} -ul.form-stepper > li:not(:last-of-type) { - margin-bottom: 0.625rem; - -webkit-transition: margin-bottom 0.4s; - -o-transition: margin-bottom 0.4s; - transition: margin-bottom 0.4s; -} -.form-stepper-horizontal > li:not(:last-of-type) { - margin-bottom: 0 !important; -} -.form-stepper-horizontal li { - position: relative; - display: -webkit-box; - display: -ms-flexbox; - display: flex; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - -webkit-box-align: start; - -ms-flex-align: start; - align-items: start; - -webkit-transition: 0.5s; - transition: 0.5s; -} -.form-stepper-horizontal li:not(:last-child):after { - position: relative; - -webkit-box-flex: 1; - -ms-flex: 1; - flex: 1; - height: 1px; - content: ""; - top: 32%; -} -.form-stepper-horizontal li:after { - background-color: #dee2e6; -} -.form-stepper-horizontal li.form-stepper-completed:after { - background-color: #4da3ff; -} -.form-stepper-horizontal li:last-child { - flex: unset; -} -ul.form-stepper li a .form-stepper-circle { - display: inline-block; - width: 40px; - height: 40px; - margin-right: 0; - line-height: 1.7rem; - text-align: center; - background: rgba(0, 0, 0, 0.38); - border-radius: 50%; -} -.form-stepper .form-stepper-active .form-stepper-circle { - background-color: #4361ee !important; - color: #fff; -} -.form-stepper .form-stepper-active .label { - color: #4361ee !important; -} -.form-stepper .form-stepper-active .form-stepper-circle:hover { - background-color: #4361ee !important; - color: #fff !important; -} -.form-stepper .form-stepper-unfinished .form-stepper-circle { - background-color: #f8f7ff; -} -.form-stepper .form-stepper-completed .form-stepper-circle { - background-color: #0e9594 !important; - color: #fff; -} -.form-stepper .form-stepper-completed .label { - color: #0e9594 !important; -} -.form-stepper .form-stepper-completed .form-stepper-circle:hover { - background-color: #0e9594 !important; - color: #fff !important; -} -.form-stepper .form-stepper-active span.text-muted { - color: #fff !important; -} -.form-stepper .form-stepper-completed span.text-muted { - color: #fff !important; -} -.form-stepper .label { - font-size: 1rem; - margin-top: 0.5rem; -} -.form-stepper a { - cursor: default; -} \ No newline at end of file diff --git a/inicial/static/styles/css_criarconta_3.css b/inicial/static/styles/css_criarconta_3.css index 53bf1789..23692027 100644 --- a/inicial/static/styles/css_criarconta_3.css +++ b/inicial/static/styles/css_criarconta_3.css @@ -6,7 +6,7 @@ } body{ - background-image:url('bg_criarconta.jpg'); + background-image:url('../img/bg_criarconta.jpg'); background-size:cover; /*background-color: darkolivegreen;*/ } diff --git a/inicial/views.py b/inicial/views.py index dedfe905..f28e5884 100644 --- a/inicial/views.py +++ b/inicial/views.py @@ -117,38 +117,43 @@ def duvidas_frequentes(request): def cadastro(request): - cadastro = CadastroForms() - if request.method == "POST": - cadastro = CadastroForms(request.POST) - - if cadastro.is_valid(): - if cadastro["senha_1"].value() != cadastro["senha_2"].value(): - messages.error(request, "Digite senhas iguais para concluir o cadastro") - return redirect('cadastro') - nome = cadastro["nome_cadastro"].value() - email = cadastro["email"].value() - senha = cadastro["senha_1"].value() + email = request.POST["email"] + senha_1 = request.POST["senha_1"] + senha_2 = request.POST["senha_2"] + nome = request.POST["nome"] + sobrenome = request.POST["sobrenome"] + data_nascimento = datetime.strptime(request.POST["data_nascimento"],"%Y-%m-%d") + genero = request.POST["genero"] + + if User.objects.filter(email=email).exists(): + messages.error(request, "Email já cadastrado") + return redirect('cadastro') + + if senha_1 != senha_2: + messages.error(request, "Digite senhas iguais para concluir o cadastro") + return redirect('cadastro') + + usuario = User.objects.create_user( + username=email, + email=email, + password=senha_1, + first_name=nome, + last_name=sobrenome + ) - if User.objects.filter(username=nome).exists() or User.objects.filter(email=email).exists(): - messages.error(request, "Usuário já existente") - return redirect('cadastro') + usuario.save() - usuario = User.objects.create_user( - username=nome, - email=email, - password=senha - ) + Dados.objects.create(usuario=usuario, data_nascimento=data_nascimento, genero=genero) - usuario.save() - login(request, usuario) - messages.success(request, "Usuário cadastrado com sucesso!") - return redirect('index') + login(request, usuario) + messages.success(request, "Usuário cadastrado com sucesso!") + return redirect('index') context = {"cadastro":cadastro} - return render(request, 'inicial/criar_conta.html', context) + return render(request, 'inicial/criar_conta_2.html', context) def login_site(request, view_name): if request.method == "POST": @@ -383,11 +388,11 @@ def editar_dados(request): if dados["nome"] != "": novos_dados.nome = dados["nome"] - if dados["idade"] != "": - novos_dados.idade = dados["idade"] + if dados["data_nascimento"] != "": + novos_dados.idade = datetime.strptime(request.POST["data_nascimento"],"%Y-%m-%d") - if "sexo" in dados: - novos_dados.sexo = dados["sexo"] + if "genero" in dados: + novos_dados.sexo = dados["genero"] if dados["profissao"] != "": novos_dados.profissao = dados["profissao"] diff --git a/templates/inicial/criar_conta.html b/templates/inicial/criar_conta.html deleted file mode 100644 index 06c1fc2f..00000000 --- a/templates/inicial/criar_conta.html +++ /dev/null @@ -1,169 +0,0 @@ -{% load static %} - - - - - - - Cadastro | MedConnect - - - -
- - - - - -
- {% csrf_token %} - - -
-

Informações Básicas

- - {% for message in messages %} -
-

{{message}}

-
- {% endfor %} -
- - - {% for field in cadastro.visible_fields %} - - {{ field }} - {% endfor %} -
-
- -
-
- - -
-

Social profiles

- -
- Vão aqui os campos de imput.. -
-
- - -
-
- - -
-
- - - \ No newline at end of file diff --git a/templates/inicial/criar_conta_2.html b/templates/inicial/criar_conta_2.html index 7a0bb40d..5b506305 100644 --- a/templates/inicial/criar_conta_2.html +++ b/templates/inicial/criar_conta_2.html @@ -1,30 +1,35 @@ +{% load static %} + Criar Conta | MedConnect - +
- -
+ + {% csrf_token %}

Criar conta -
etapa 1 de 2

- - + + {% for message in messages %} +

{{ message }}

+ {% endfor %}
EMAIL:

- +

Senha:

- +

Confirmar senha:

- +

a. Mínimo de 8 caracteres
b. Mínimo de 1 número
c. Mínimo de 1 caractere especial
d. Mínimo de 1 letra maiúscula
e. Mínimo de 1 letra minúscula

@@ -36,14 +41,14 @@

Criar conta -
etapa 2 de 2

Nome:

- +

Sobrenome:

- +

@@ -52,7 +57,7 @@

Criar conta -
etapa 2 de 2

Data de nascimento: (DD/MM/AA)

- +

@@ -71,8 +76,8 @@

Criar conta -
etapa 2 de 2

- - + + diff --git a/templates/inicial/editardados.html b/templates/inicial/editardados.html index 5480be6a..2a91ae6f 100644 --- a/templates/inicial/editardados.html +++ b/templates/inicial/editardados.html @@ -53,19 +53,20 @@

MEUS DADOS

- Idade: - + Data de nascimento: +
- Sexo: -
- - -
-
- - -
+ Genero: +
diff --git a/templates/inicial/locaisdeatendimento.html b/templates/inicial/locaisdeatendimento.html index b2e511eb..d90f7443 100644 --- a/templates/inicial/locaisdeatendimento.html +++ b/templates/inicial/locaisdeatendimento.html @@ -45,7 +45,7 @@ {% for hospital in hospitais %}
  • -

    {{ hospital.nome }}

    +

    {{ hospital.nome }}

    {{ hospital.endereco }}. CEP: {{ hospital.cep }}
    diff --git a/templates/inicial/maisinformacoes.html b/templates/inicial/maisinformacoes.html index 611a46e1..b40a7300 100644 --- a/templates/inicial/maisinformacoes.html +++ b/templates/inicial/maisinformacoes.html @@ -148,7 +148,6 @@

    INFORMAÇÕES ADICIONAIS

  • PEDIÁTRICO:{{ hospital.uti_pediatrico }}
  • NEONATAL:{{ hospital.uti_neonatal }}
  • QUEIMADO:{{ hospital.uti_queimado }}
  • -

    ESCALA DE SERVIÇOS E MEDICAMENTOS DISPONÍVEIS


    @@ -168,7 +167,6 @@

    ESCALA DE SERVIÇOS E MEDICAMENTOS DISPONÍVEIS

    🞄 Portal "Transparência e Prestação de Contas" - SES-DF. -