Skip to content

Commit

Permalink
Add payroll approval field to vacation request serializer; update vac…
Browse files Browse the repository at this point in the history
…ation list test for payroll access; fix avatar image path; enhance vacation columns with cedula field
  • Loading branch information
S-e-b-a-s committed Dec 12, 2024
1 parent 50f323e commit 062a55c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ jobs:
- name: Deploy to server
run: |
rm -rf /var/www/INSIGHTS/frontend/dist/*
cp -r ./frontend/dist/* /var/www/INSIGHTS/frontend/dist
cp -r ./dist/* /var/www/INSIGHTS/frontend/dist
sudo systemctl restart nginx
2 changes: 2 additions & 0 deletions INSIGHTSAPI/vacation/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ def to_representation(self, instance):
data = super().to_representation(instance)
data["username"] = instance.user.get_full_name()
data["user_id"] = instance.user.id
if "request" in self.context and self.context["request"].user.has_perm("vacation.payroll_approval"):
data["cedula"] = instance.user.cedula
data.pop("manager_approved_at")
data.pop("hr_approved_at")
data.pop("payroll_approved_at")
Expand Down
9 changes: 9 additions & 0 deletions INSIGHTSAPI/vacation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,15 @@ def test_vacation_list_manager_multiple_areas(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.data), 2)

def test_vacation_list_payroll(self):
"""Test listing all vacations endpoint for payroll."""
self.user.user_permissions.add(self.permission)
VacationRequest.objects.create(**self.vacation_request_user)
VacationRequest.objects.create(**self.vacation_request_user)
response = self.client.get(reverse("vacation-list"))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(len(response.data), 2)

def test_vacation_list_hr(self):
"""Test listing all vacations endpoint for HR."""
self.user.job_position.name = "GERENTE DE GESTION HUMANA"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { Typography, Box, Container, Card } from '@mui/material';
// Media
const benefit = `${getApiUrl().apiUrl}static/images/benefits/benefit-1.webp`;
const cake = `${getApiUrl().apiUrl}static/images/birthdays/cake.webp`;
const AvatarImage = `${getApiUrl().apiUrl}static/birthdays/avatar.webp`;
const AvatarImage = `${getApiUrl().apiUrl}static/images/birthdays/avatar.webp`;
const fultbolVideo = `${getApiUrl().apiUrl}static/videos/futbol.mp4`;
const pointsVideo = `${getApiUrl().apiUrl}static/videos/points.mp4`;

Expand Down
8 changes: 7 additions & 1 deletion frontend/src/components/pages/vacations/Vacations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ export const Vacations = () => {
};

const columns = [
{
field: 'cedula',
headerName: 'Cedula',
width: 110,
type: 'text',
},
{
field: 'start_date',
headerName: 'Fecha inicio',
Expand Down Expand Up @@ -606,7 +612,7 @@ export const Vacations = () => {
};

const handleCloseDialogPayslip = () => {
setOpenDialogPayslip(false);
setOpenDialogPayslip(false);
setOpenObservationsInput(false);
setButtonType('button');
};
Expand Down

0 comments on commit 062a55c

Please sign in to comment.