From 2e62ef19642abc389c4731fde886cd7416e71bfc Mon Sep 17 00:00:00 2001
From: Caitlin Barnard <54268863+CaitBarnard@users.noreply.github.com>
Date: Mon, 9 Dec 2024 10:58:29 +0000
Subject: [PATCH] Refactor: Refactor payroll toggle to use same payroll
permissions as page (#571)
---
forecast/templates/forecast/edit/edit.html | 4 +++-
forecast/views/edit_forecast.py | 1 -
front_end/src/Components/EditForecast/index.jsx | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/forecast/templates/forecast/edit/edit.html b/forecast/templates/forecast/edit/edit.html
index 8b43b699..47342065 100644
--- a/forecast/templates/forecast/edit/edit.html
+++ b/forecast/templates/forecast/edit/edit.html
@@ -1,4 +1,5 @@
{% extends "forecast/edit/forecast_base.html" %}
+{% load payroll_permissions %}
{% load util vite %}
{% load breadcrumbs %}
@@ -41,6 +42,7 @@
{% endblock %}
{% block scripts %}
{{ view.get_payroll_forecast_report|json_script:'payroll_forecast_data' }}
+ {% can_edit_payroll user as can_edit_payroll %}
{% vite_dev_client %}
{% vite_js 'src/index.jsx' %}
diff --git a/forecast/views/edit_forecast.py b/forecast/views/edit_forecast.py
index 2d5663b3..fd2c8d39 100644
--- a/forecast/views/edit_forecast.py
+++ b/forecast/views/edit_forecast.py
@@ -528,7 +528,6 @@ def get_context_data(self, **kwargs):
context["forecast_dump"] = forecast_dump
context["actuals"] = actual_data
context["period_display"] = period_display
- context["can_toggle_payroll"] = self.request.user.is_superuser
return context
diff --git a/front_end/src/Components/EditForecast/index.jsx b/front_end/src/Components/EditForecast/index.jsx
index ca82c1c0..908fb343 100644
--- a/front_end/src/Components/EditForecast/index.jsx
+++ b/front_end/src/Components/EditForecast/index.jsx
@@ -325,7 +325,7 @@ function EditForecast() {
return (
- {window.can_toggle_payroll === "True" && }
+ {window.can_edit_payroll === "True" && }
{errorMessage != null &&