Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Little improvements to vacations also front refactors #145

Merged
merged 14 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion INSIGHTSAPI/vacation/templates/vacation_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
}

.content p {
margin-bottom: 35px;
font-size: 20px;
}
</style>
Expand Down
1 change: 0 additions & 1 deletion INSIGHTSAPI/vacation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def setUp(self):

def test_vacation_create(self):
"""Test creating a vacation endpoint."""

self.vacation_request["hr_is_approved"] = True # This is just a check
self.vacation_request["sat_is_working"] = False
response = self.client.post(
Expand Down
52 changes: 7 additions & 45 deletions INSIGHTSAPI/vacation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@


class VacationRequestViewSet(viewsets.ModelViewSet):
queryset = (
VacationRequest.objects.all().select_related("user").order_by("-created_at")
)
queryset = VacationRequest.objects.all().select_related("user").order_by("-pk")
serializer_class = VacationRequestSerializer
permission_classes = [IsAuthenticated]

Expand Down Expand Up @@ -163,44 +161,6 @@ def create(self, request, *args, **kwargs):
)
return response

# def list(self, request, *args, **kwargs):
# if request.user.job_position.name == "GERENTE DE GESTION HUMANA":
# queryset = self.queryset.all()
# # Check if the user is in payroll
# elif request.user.has_perm("vacation.payroll_approval"):
# queryset = self.queryset.all()
# # Check if the user has employee management permissions
# elif request.user.job_position.rank >= 2:
# children = self.request.user.area.get_children()
# # Check if the user is a manager
# if children and request.user.area.manager == request.user:
# queryset = self.queryset.filter(
# # Check if the user is the owner
# (Q(user=request.user))
# # Check if the user is a manager of the area
# | (Q(user__area__manager=request.user))
# # Check if the user is a manager of a child area
# | (Q(user__area__in=children))
# | (
# Q(user__job_position__rank__lt=request.user.job_position.rank)
# & Q(user__area=request.user.area)
# )
# )
# else:
# queryset = self.queryset.filter(
# Q(user=request.user)
# | (Q(user__area__manager=request.user))
# | (
# Q(user__job_position__rank__lt=request.user.job_position.rank)
# & Q(user__area=request.user.area)
# )
# )
# # The user is a regular employee
# else:
# queryset = self.queryset.filter(Q(user=request.user))
# serializer = self.serializer_class(queryset, many=True)
# return Response(serializer.data)

def partial_update(self, request, *args, **kwargs):

if isinstance(request.user, AnonymousUser):
Expand Down Expand Up @@ -287,12 +247,12 @@ def partial_update(self, request, *args, **kwargs):
[str(hr_user.company_email)],
)
payroll_user = User.objects.filter(
user_permissions__codename="payroll_is_approved"
user_permissions__codename="payroll_approval"
).first()
if not payroll_user:
mail_admins(
"No hay usuarios con el permiso de payroll_is_approved",
"No hay usuarios con el permiso de payroll_is_approved",
"No hay usuarios con el permiso de payroll_approval",
"No hay usuarios con el permiso de payroll_approval",
)
return response
create_notification(
Expand Down Expand Up @@ -443,7 +403,9 @@ def generate_response(self, request, pk=None):
open(str(settings.STATIC_ROOT) + "/images/just_logo.png", "rb").read()
).decode("utf-8"),
"company_logo_vertical": base64.b64encode(
open(str(settings.STATIC_ROOT) + "/images/vertical_logo.png", "rb").read()
open(
str(settings.STATIC_ROOT) + "/images/vertical_logo.png", "rb"
).read()
).decode("utf-8"),
}
# Import the html template
Expand Down
65 changes: 32 additions & 33 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
<!doctype html>
<html lang="es">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Dancing+Script&display=swap"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta
name="description"
content="INSIGHTS es la intranet de C&C Services S.A.S, con inicio de sesión seguro con Active Directory, un blog dinámico, gestión de documentos, 'Sobre Nosotros' y una visualización única de la foto de perfil de cumpleaños de los empleados. La plataforma también incluye módulos de utilidad para mejorar la productividad y la colaboración."
/>
<title>Intranet</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.png" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="preload" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" as="style"
onload="this.rel='stylesheet'">
<noscript>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
</noscript>

<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet" />
<link
href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet" />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap"
rel="stylesheet" />
<link href="https://fonts.googleapis.com/css2?family=Dancing+Script&display=swap" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description"
content="INSIGHTS es la intranet de C&C Services S.A.S, con inicio de sesión seguro con Active Directory, un blog dinámico, gestión de documentos, 'Sobre Nosotros' y una visualización única de la foto de perfil de cumpleaños de los empleados. La plataforma también incluye módulos de utilidad para mejorar la productividad y la colaboración." />
<title>Intranet</title>
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>

</html>
42 changes: 21 additions & 21 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,23 @@
"format": "prettier --write ."
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^6.1.6",
"@mui/lab": "6.0.0-beta.14",
"@mui/material": "^6.1.6",
"@mui/x-data-grid": "^7.22.2",
"@sentry/react": "^8.38.0",
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@mui/icons-material": "^6.1.9",
"@mui/lab": "6.0.0-beta.17",
"@mui/material": "^6.1.9",
"@mui/x-data-grid": "^7.22.3",
"@sentry/react": "^8.41.0",
"@sentry/vite-plugin": "^2.22.6",
"@tanstack/react-query": "^5.61.5",
"cally": "^0.7.2",
"clsx": "^2.1.1",
"depcheck": "^1.4.7",
"embla-carousel-autoplay": "^8.3.1",
"embla-carousel-class-names": "^8.3.1",
"embla-carousel-fade": "^8.3.1",
"embla-carousel-react": "^8.3.1",
"filepond": "^4.32.1",
"embla-carousel-autoplay": "^8.5.1",
"embla-carousel-class-names": "^8.5.1",
"embla-carousel-fade": "^8.5.1",
"embla-carousel-react": "^8.5.1",
"filepond": "^4.32.4",
"filepond-plugin-file-validate-type": "^1.2.9",
"filepond-plugin-image-exif-orientation": "^1.0.11",
"filepond-plugin-image-preview": "^4.6.12",
Expand All @@ -39,26 +40,25 @@
"react-dropzone": "^14.3.5",
"react-filepond": "^7.1.2",
"react-material-ui-carousel": "^3.4.2",
"react-router-dom": "^6.28.0",
"react-router": "^7.0.1",
"rollup-plugin-visualizer": "^5.12.0",
"sonner": "^1.7.0",
"swiper": "^11.1.14",
"swiper": "^11.1.15",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
"yup": "^1.4.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.25.9",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/react": "^18.3.12",
"@vitejs/plugin-react": "^4.3.3",
"@vitest/ui": "^2.1.4",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/ui": "^2.1.6",
"jsdom": "^25.0.1",
"oxlint": "^0.11.1",
"prettier": "^3.3.3",
"oxlint": "^0.13.2",
"prettier": "^3.4.1",
"rollup-plugin-visualizer": "^5.12.0",
"vite": "^5.4.11",
"vitest": "^2.1.4"
"vite": "^6.0.1",
"vitest": "^2.1.6"
}
}
Loading
Loading