Skip to content

Commit

Permalink
WIP remove old Vacancies table and WIP add vacancy button
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitBarnard committed Nov 21, 2024
1 parent c55b258 commit 0d7f407
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 37 deletions.
9 changes: 8 additions & 1 deletion front_end/src/Apps/Payroll.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useReducer, useState, useMemo } from "react";
import { useParams } from "react-router-dom";

import EditPayroll from "../Components/EditPayroll";
import * as api from "../Components/EditPayroll/api";
Expand All @@ -19,10 +20,13 @@ export default function Payroll() {
);
const [vacancies, dispatchVacancies] = useReducer(
vacanciesReducer,
initialPayrollState
initialVacanciesState
);
const [saveSuccess, setSaveSuccess] = useState(false);

const { cost_centre_code, financial_year } = useParams();
const addVacancyUrl = `edit/${cost_centre_code}/${financial_year}/vacancies/create`;

useEffect(() => {
const savedSuccessFlag = localStorage.getItem("saveSuccess");
if (savedSuccessFlag === "true") {
Expand Down Expand Up @@ -98,6 +102,9 @@ export default function Payroll() {
RowComponent={EmployeeRow}
/>
<h2 className="govuk-heading-m">Vacancies</h2>
<a class="govuk-button" href={addVacancyUrl}>
Add Vacancy
</a>
<EditPayroll
payroll={vacancies}
headers={vacancyHeaders}
Expand Down
33 changes: 0 additions & 33 deletions payroll/templates/payroll/page/edit_payroll.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,39 +48,6 @@ <h2 class="govuk-heading-m">Payroll forecast</h2>
{% endfor %}
</tbody>
</table>

<h2 class="govuk-heading-m">Vacancies</h2>
<table class="govuk-table">
<thead class="govuk-table__head">
<tr class="govuk-table__row">
<th scope="col" class="govuk-table__header">Recruitment Type</th>
<th scope="col" class="govuk-table__header">Grade</th>
<th scope="col" class="govuk-table__header">Programme</th>
<th scope="col" class="govuk-table__header">Budget Type</th>
<th scope="col" class="govuk-table__header">Appointee Name</th>
<th scope="col" class="govuk-table__header">Hiring Manager</th>
<th scope="col" class="govuk-table__header">HR Ref</th>
<th scope="col" class="govuk-table__header">Recruitment Stage</th>
</tr>
</thead>
<tbody class="govuk-table__body">
{% for vacancy in vacancies %}
<tr class="govuk-table__row">
<td class="govuk-table__cell">{{ vacancy.get_recruitment_type_display }}</td>
<td class="govuk-table__cell">{{ vacancy.grade }}</td>
<td class="govuk-table__cell">{{ vacancy.programme_code.programme_code }}</td>
<td class="govuk-table__cell">{{ vacancy.programme_code.budget_type }}</td>
<td class="govuk-table__cell">{{ vacancy.appointee_name|default:"" }}</td>
<td class="govuk-table__cell">{{ vacancy.hiring_manager|default:"" }}</td>
<td class="govuk-table__cell">{{ vacancy.hr_ref|default:"" }}</td>
<td class="govuk-table__cell">{{ vacancy.get_recruitment_stage_display }}</td>

</tr>
{% endfor %}
</tbody>
</table>

<a class="govuk-button" href="{% url 'payroll:add_vacancy' cost_centre_code financial_year %}">Add Vacancy</a>
{% endblock content %}

{% block scripts %}
Expand Down
3 changes: 0 additions & 3 deletions payroll/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from core.models import FinancialYear
from costcentre.models import CostCentre
from payroll.forms import VacancyForm
from payroll.models import Vacancy

from .services import payroll as payroll_service

Expand Down Expand Up @@ -97,7 +96,6 @@ def edit_payroll_page(
payroll_forecast_report_data = payroll_service.payroll_forecast_report(
cost_centre_obj, financial_year_obj
)
vacancies = Vacancy.objects.filter(cost_centre=cost_centre_code)

context = {
"cost_centre_code": cost_centre_obj.cost_centre_code,
Expand All @@ -117,7 +115,6 @@ def edit_payroll_page(
"Feb",
"Mar",
],
"vacancies": vacancies,
}

return TemplateResponse(request, "payroll/page/edit_payroll.html", context)
Expand Down

0 comments on commit 0d7f407

Please sign in to comment.