diff --git a/.gitmessage b/.github/.gitmessage
similarity index 100%
rename from .gitmessage
rename to .github/.gitmessage
diff --git a/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md
similarity index 100%
rename from CODE_OF_CONDUCT.md
rename to .github/CODE_OF_CONDUCT.md
diff --git a/CONTRIBUTING.md b/.github/CONTRIBUTING.md
similarity index 100%
rename from CONTRIBUTING.md
rename to .github/CONTRIBUTING.md
diff --git a/README.md b/README.md
index b8f9e593..523c0753 100644
--- a/README.md
+++ b/README.md
@@ -11,7 +11,7 @@
-
+
diff --git a/backend/backend/api.py b/backend/backend/api.py
index 49257c4b..e3b9d08c 100644
--- a/backend/backend/api.py
+++ b/backend/backend/api.py
@@ -1,5 +1,5 @@
from rest_framework import routers
-
+from models.geracaoPdf.views import GeracaoPdfView
'''
Função que retorna um objeto que contém as urls do backend.
Para incluir uma nova url utilize router.register
@@ -11,5 +11,5 @@
def create_api():
router = routers.DefaultRouter()
-
+ router.register(r'geracao', GeracaoPdfView, 'geracaoPdf')
return router
diff --git a/backend/backend/settings.py b/backend/backend/settings.py
index b76087d4..7f116648 100644
--- a/backend/backend/settings.py
+++ b/backend/backend/settings.py
@@ -45,7 +45,8 @@
'django.contrib.messages',
'django.contrib.staticfiles',
'corsheaders',
- 'rest_framework'
+ 'rest_framework',
+ 'models.geracaoPdf',
]
MIDDLEWARE = [
@@ -86,7 +87,7 @@
DATABASES = {
'default': {
'ENGINE': 'djongo',
- 'NAME': 'projeto-hospitalar'
+ 'NAME': 'projeto-hospitalar',
}
}
diff --git a/backend/models/geracaoPdf/__init__.py b/backend/models/geracaoPdf/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/backend/models/geracaoPdf/admin.py b/backend/models/geracaoPdf/admin.py
new file mode 100644
index 00000000..3f6cf4e6
--- /dev/null
+++ b/backend/models/geracaoPdf/admin.py
@@ -0,0 +1,12 @@
+from django.contrib import admin
+
+# Register your models here.
+from django.contrib import admin
+from .models import GeracaoPdf
+
+
+class GeracaoPdfAdmin(admin.ModelAdmin):
+ list_display = ()
+
+
+admin.site.register(GeracaoPdf, GeracaoPdfAdmin)
diff --git a/backend/models/geracaoPdf/apps.py b/backend/models/geracaoPdf/apps.py
new file mode 100644
index 00000000..4cdc4f9d
--- /dev/null
+++ b/backend/models/geracaoPdf/apps.py
@@ -0,0 +1,6 @@
+from django.apps import AppConfig
+
+
+class GeracaoPdfConfig(AppConfig):
+ default_auto_field = 'django.db.models.BigAutoField'
+ name = 'models.geracaoPdf'
diff --git a/backend/models/geracaoPdf/migrations/0001_initial.py b/backend/models/geracaoPdf/migrations/0001_initial.py
new file mode 100644
index 00000000..b951d992
--- /dev/null
+++ b/backend/models/geracaoPdf/migrations/0001_initial.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.2.6 on 2021-09-13 23:11
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='GeracaoPdf',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('infosPdf', models.CharField(max_length=1000)),
+ ('cabecalhoPdf', models.CharField(max_length=100)),
+ ('textoEntradaPdf', models.TextField()),
+ ],
+ ),
+ ]
diff --git a/backend/models/geracaoPdf/migrations/0002_auto_20210914_0138.py b/backend/models/geracaoPdf/migrations/0002_auto_20210914_0138.py
new file mode 100644
index 00000000..05196cf6
--- /dev/null
+++ b/backend/models/geracaoPdf/migrations/0002_auto_20210914_0138.py
@@ -0,0 +1,25 @@
+# Generated by Django 3.2.6 on 2021-09-14 04:38
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('geracaoPdf', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='geracaopdf',
+ name='cabecalhoPdf',
+ ),
+ migrations.RemoveField(
+ model_name='geracaopdf',
+ name='infosPdf',
+ ),
+ migrations.RemoveField(
+ model_name='geracaopdf',
+ name='textoEntradaPdf',
+ ),
+ ]
diff --git a/backend/models/geracaoPdf/migrations/__init__.py b/backend/models/geracaoPdf/migrations/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/backend/models/geracaoPdf/models.py b/backend/models/geracaoPdf/models.py
new file mode 100644
index 00000000..a1fd5002
--- /dev/null
+++ b/backend/models/geracaoPdf/models.py
@@ -0,0 +1,7 @@
+from django.db import models
+
+
+class GeracaoPdf(models.Model):
+
+ def _str_(self):
+ return 'No fields'
diff --git a/backend/models/geracaoPdf/serializers.py b/backend/models/geracaoPdf/serializers.py
new file mode 100644
index 00000000..097c5e92
--- /dev/null
+++ b/backend/models/geracaoPdf/serializers.py
@@ -0,0 +1,8 @@
+from rest_framework import serializers
+from .models import GeracaoPdf
+
+
+class GeracaoPdfSerializer(serializers.ModelSerializer):
+ class Meta:
+ model = GeracaoPdf
+ fields = ()
diff --git a/backend/models/geracaoPdf/tests.py b/backend/models/geracaoPdf/tests.py
new file mode 100644
index 00000000..7ce503c2
--- /dev/null
+++ b/backend/models/geracaoPdf/tests.py
@@ -0,0 +1,3 @@
+from django.test import TestCase
+
+# Create your tests here.
diff --git a/backend/models/geracaoPdf/views.py b/backend/models/geracaoPdf/views.py
new file mode 100644
index 00000000..eb58e51e
--- /dev/null
+++ b/backend/models/geracaoPdf/views.py
@@ -0,0 +1,32 @@
+from reportlab.pdfgen import canvas
+from rest_framework import viewsets
+from django.http import HttpResponse
+from .models import GeracaoPdf
+from .serializers import GeracaoPdfSerializer
+from rest_framework.decorators import action
+
+# Create your views here.
+
+
+class GeracaoPdfView(viewsets.ModelViewSet):
+
+ serializer_class = GeracaoPdfSerializer
+ queryset = GeracaoPdf.objects.all()
+
+ @action(methods=['get'], detail=False)
+ def generatePDF(self, request):
+ # Create the HttpResponse object with the appropriate PDF headers.
+ response = HttpResponse(content_type='application/pdf')
+ response['Content-Disposition'] = 'attachment; filename="somefilename.pdf"'
+
+ # Create the PDF object, using the response object as its "file."
+ p = canvas.Canvas(response)
+
+ # Draw things on the PDF. Here's where the PDF generation happens.
+ # See the ReportLab documentation for the full list of functionality.
+ p.drawString(100, 100, "Hello world.")
+
+ # Close the PDF object cleanly, and we're done.
+ p.showPage()
+ p.save()
+ return response
diff --git a/backend/requirements.txt b/backend/requirements.txt
index f11cd3fc..83531582 100644
--- a/backend/requirements.txt
+++ b/backend/requirements.txt
@@ -4,4 +4,5 @@ django-cors-headers==3.8.0
djongo==1.3.6
psycopg2-binary>=2.8
gunicorn==20.1.0
-pymongo==3.12.0
\ No newline at end of file
+pymongo==3.12.0
+reportlab==3.6.1
\ No newline at end of file
diff --git a/docs/README.md b/docs/README.md
index 92b6a61c..b24f4e2c 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -10,7 +10,7 @@
-
+
diff --git a/docs/_sidebar.md b/docs/_sidebar.md
index 8eada59a..e4333644 100644
--- a/docs/_sidebar.md
+++ b/docs/_sidebar.md
@@ -152,43 +152,43 @@
Sprint 00
Sprint 01
Sprint 02
Sprint 03
Sprint 04
Sprint 05
diff --git a/assets/logo-2021.jpg b/docs/assets/logo-2021.jpg
similarity index 100%
rename from assets/logo-2021.jpg
rename to docs/assets/logo-2021.jpg
diff --git a/assets/military-rank.png b/docs/assets/military-rank.png
similarity index 100%
rename from assets/military-rank.png
rename to docs/assets/military-rank.png
diff --git a/docs/produto/Docker/Dockerfile b/docs/produto/Docker/Dockerfile
index 0ee89522..84ca3b06 100644
--- a/docs/produto/Docker/Dockerfile
+++ b/docs/produto/Docker/Dockerfile
@@ -1,8 +1,6 @@
-<<<<<<< Updated upstream
+
FROM python:3
-=======
FROM python:3.8
->>>>>>> Stashed changes
ADD . /code
RUN mkdir -p /code
@@ -11,17 +9,12 @@ WORKDIR /code
COPY requirements.txt ./
RUN pip install -r requirements.txt
-<<<<<<< Updated upstream
+
ENV PYTHONUNBUFFERED=1
-=======
->>>>>>> Stashed changes
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
COPY . .
EXPOSE 8000
-<<<<<<< Updated upstream
-=======
EXPOSE 27017
->>>>>>> Stashed changes
diff --git a/docs/produto/Docker/docker-compose.yml b/docs/produto/Docker/docker-compose.yml
index bd0d8f62..df15436b 100644
--- a/docs/produto/Docker/docker-compose.yml
+++ b/docs/produto/Docker/docker-compose.yml
@@ -1,7 +1,7 @@
version: '3'
services:
-<<<<<<< Updated upstream
+
client:
build:
context: ./frontend
@@ -14,8 +14,7 @@ services:
- /app/node_modules
networks:
- frontend
-=======
->>>>>>> Stashed changes
+
web:
build: .
volumes:
@@ -29,7 +28,7 @@ services:
mongo:
image: mongo
-<<<<<<< Updated upstream
+
container_name: mongo
restart: always
environment:
@@ -59,7 +58,7 @@ services:
-=======
+
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: root
@@ -69,4 +68,4 @@ services:
ports:
- "27017:27017"
->>>>>>> Stashed changes
+
diff --git a/docs/produto/Docker/requirements.txt b/docs/produto/Docker/requirements.txt
index eee0b863..7d624dc5 100644
--- a/docs/produto/Docker/requirements.txt
+++ b/docs/produto/Docker/requirements.txt
@@ -1,15 +1,9 @@
Django==3.2.6
-<<<<<<< Updated upstream
psycopg2-binary>=2.8
-=======
->>>>>>> Stashed changes
gunicorn==20.1.0
pymongo==3.12.0
djongo==1.3.6
django-cors-headers==3.8.0
djangorestframework==3.12.4
-<<<<<<< Updated upstream
-
-=======
docker==5.0.0
->>>>>>> Stashed changes
+
diff --git a/docs/produto/Identidade_Visual/IdentidadeVisual.md b/docs/produto/Identidade_Visual/IdentidadeVisual.md
index e084b52f..2b43931d 100644
--- a/docs/produto/Identidade_Visual/IdentidadeVisual.md
+++ b/docs/produto/Identidade_Visual/IdentidadeVisual.md
@@ -15,7 +15,7 @@
No início do projeto a equipe veio tentando formular alguma ideia de logotipo que pudesse indicar um ambiente hospitalar dentro do sistema militar. Pesquisando mais afundo, conseguimos concluir que as patentes das posições hierárquicas eram uma boa forma de mostrar que o produto iria ser referente ao sistema militar, visto que muitas pessoas já as viram em algum momento, sendo assim de fácil reconhecimento. Logo após isso, precisávamos referenciar também o ambiente hospitalar, já que o produto iria atender aos profissionais que estão constantemente nesse meio também. Decidimos então formatar a patente para que no topo, ao invés de ter uma estrela, fosse colocada uma caixa de seleção com uma marcação de "Ok", para indicar uma das principais atividades exercidas, o checklist. Essas foram as decisões do time para que então chegasse no resultado apresentado abaixo.
-![Logotipo](https://raw.githubusercontent.com/fga-eps-mds/2021-1-hospitalar/main/assets/logo-2021.jpg)
+![Logotipo](https://raw.githubusercontent.com/fga-eps-mds/2021-1-hospitalar/main/docs/assets/logo-2021.jpg)
# Nome do Projeto
diff --git a/docs/sprints/Time_A/sprint3/fechamento_sprint3_A.md b/docs/sprints/Time_A/sprint3/fechamento_sprint3_A.md
index 2f5ff8a0..da488e6e 100644
--- a/docs/sprints/Time_A/sprint3/fechamento_sprint3_A.md
+++ b/docs/sprints/Time_A/sprint3/fechamento_sprint3_A.md
@@ -84,7 +84,7 @@
## Práticas ágeis
-| ID | Nome de prática ágil | Sprint nº |
+| ID | Nome de prática ágil | Sprint 03 |
| :-: | :----------------------------------------------------------------: | :-------: |
| 1 | Priorização do Backlog pelo PO | ✔ |
| 2 | Desenvolvimento de processos e práticas facilitadas pelo SM | ✔ |
diff --git a/docs/sprints/Time_A/sprint4/fechamento_sprint4_A.md b/docs/sprints/Time_A/sprint4/fechamento_sprint4_A.md
index b1f31615..90ee687e 100644
--- a/docs/sprints/Time_A/sprint4/fechamento_sprint4_A.md
+++ b/docs/sprints/Time_A/sprint4/fechamento_sprint4_A.md
@@ -93,7 +93,7 @@
## Práticas ágeis
-| ID | Nome de prática ágil | Sprint nº |
+| ID | Nome de prática ágil | Sprint 04 |
| :-: | :----------------------------------------------------------------: | :-------: |
| 1 | Priorização do Backlog pelo PO | ✔ |
| 2 | Desenvolvimento de processos e práticas facilitadas pelo SM | ✔ |
diff --git a/docs/sprints/Time_A/sprint5/fechamento_sprint5_A.md b/docs/sprints/Time_A/sprint5/fechamento_sprint5_A.md
index 47adb110..ec01d3ee 100644
--- a/docs/sprints/Time_A/sprint5/fechamento_sprint5_A.md
+++ b/docs/sprints/Time_A/sprint5/fechamento_sprint5_A.md
@@ -100,7 +100,7 @@
## Práticas ágeis
-| ID | Nome de prática ágil | Sprint nº |
+| ID | Nome de prática ágil | Sprint 05 |
| :-: | :----------------------------------------------------------------: | :-------: |
| 1 | Priorização do Backlog pelo PO | ✔ |
| 2 | Desenvolvimento de processos e práticas facilitadas pelo SM | ✔ |
diff --git a/docs/sprints/Time_C/sprint0/abertura_sprint0.md b/docs/sprints/Time_C/sprint0/abertura_sprint0.md
index f3962951..9f1ee33c 100644
--- a/docs/sprints/Time_C/sprint0/abertura_sprint0.md
+++ b/docs/sprints/Time_C/sprint0/abertura_sprint0.md
@@ -1,4 +1,4 @@
-# Abertura da Sprint (nº)
+# Abertura da Sprint 0
## Histórico de revisão
diff --git a/docs/sprints/Time_C/sprint0/fechamento_sprint0.md b/docs/sprints/Time_C/sprint0/fechamento_sprint0.md
index d7303408..2a9e6303 100644
--- a/docs/sprints/Time_C/sprint0/fechamento_sprint0.md
+++ b/docs/sprints/Time_C/sprint0/fechamento_sprint0.md
@@ -1,4 +1,4 @@
-# Fechamento da Sprint (nº)
+# Fechamento da Sprint 0
## Backlog da Sprint
diff --git a/frontend/src/pages/GenerateReport/index.tsx b/frontend/src/pages/GenerateReport/index.tsx
index fd259306..b301797f 100644
--- a/frontend/src/pages/GenerateReport/index.tsx
+++ b/frontend/src/pages/GenerateReport/index.tsx
@@ -4,6 +4,7 @@ import React, { useState } from 'react'
import { Button } from '../../components/GlobalComponents/Inputs/Button'
import { Header } from '../../components/GlobalComponents/Header'
import { TextField } from '../../components/GlobalComponents/Inputs/TextField'
+import axios from 'axios'
import { useStyles } from './styles'
export function GenerateReport(): React.ReactElement {
@@ -33,9 +34,22 @@ export function GenerateReport(): React.ReactElement {
}
const handleSubmit = () => {
- if (code !== '' && code.charAt(0) === '#') {
- getHospitalName(code)
- }
+ // eslint-disable-next-line no-console
+ axios({
+ url: 'http://localhost:8000/api/geracao/generatePDF/',
+ method: 'GET',
+ responseType: 'blob', // important
+ })
+ .then((response) => {
+ const url = window.URL.createObjectURL(new Blob([response.data]))
+ const link = document.createElement('a')
+ link.href = url
+ link.setAttribute('download', 'file.pdf')
+ document.body.appendChild(link)
+ link.click()
+ })
+ // eslint-disable-next-line no-console
+ .catch(console.log)
}
const generateForm = () => (
diff --git a/frontend/src/pages/Home/index.tsx b/frontend/src/pages/Home/index.tsx
index 930255c9..92a1a206 100644
--- a/frontend/src/pages/Home/index.tsx
+++ b/frontend/src/pages/Home/index.tsx
@@ -25,6 +25,11 @@ export function Home(): React.ReactElement {
+
+
+
)
}