Skip to content

Commit

Permalink
removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Tllew committed Dec 9, 2024
1 parent 1509ff6 commit fec9881
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 101 deletions.
8 changes: 0 additions & 8 deletions caseworker/advice/conditionals.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,3 @@ def _get_form_field_boolean(wizard):

def is_desnz_team(wizard):
return wizard.caseworker["team"]["alias"] in services.DESNZ_TEAMS


def is_fcdo_team(wizard):
return wizard.caseworker["team"]["alias"] == services.FCDO_TEAM


def default_form(wizard):
return not (is_fcdo_team(wizard) or is_desnz_team(wizard))
59 changes: 0 additions & 59 deletions caseworker/advice/forms/approval.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
ConditionalCheckboxesQuestion,
RadioTextArea,
)
from core.forms.widgets import GridmultipleSelect


class SelectAdviceForm(forms.Form):
Expand Down Expand Up @@ -88,64 +87,6 @@ def get_layout_fields(self):
)


class FCDOApprovalAdviceForm(RecommendAnApprovalForm):
class Layout:
TITLE = "Recommend an approval"

def __init__(self, countries, *args, **kwargs):
countries = kwargs.pop("countries")
super().__init__(*args, **kwargs)
self.fields["countries"] = forms.MultipleChoiceField(
choices=countries.items(),
widget=GridmultipleSelect(),
label="Select countries for which you want to give advice",
error_messages={"required": "Select the destinations you want to make recommendations for"},
)

def get_layout_fields(self):
return (
RadioTextArea("approval_radios", "approval_reasons", self.approval_text),
"countries",
"add_licence_conditions",
)


class DESNZApprovalForm(PicklistAdviceForm, BaseForm):
class Layout:
TITLE = "Recommend an approval"

approval_reasons = forms.CharField(
widget=forms.Textarea(attrs={"rows": 7, "class": "govuk-!-margin-top-4"}),
label="",
error_messages={"required": "Enter a reason for approving"},
)
approval_radios = forms.ChoiceField(
label="What is your reason for approving?",
required=False,
widget=forms.RadioSelect,
choices=(),
)
add_licence_conditions = forms.BooleanField(
label="Add licence conditions, instructions to exporter or footnotes (optional)",
required=False,
)

def __init__(self, *args, **kwargs):
approval_reason = kwargs.pop("approval_reason")
# this follows the same pattern as denial_reasons.
approval_choices, approval_text = self._picklist_to_choices(approval_reason)
self.approval_text = approval_text
super().__init__(*args, **kwargs)

self.fields["approval_radios"].choices = approval_choices

def get_layout_fields(self):
return (
RadioTextArea("approval_radios", "approval_reasons", self.approval_text),
"add_licence_conditions",
)


class LicenceConditionsForm(PicklistAdviceForm, BaseForm):
class Layout:
TITLE = "Add licence conditions, instructions to exporter or footnotes (optional)"
Expand Down
8 changes: 0 additions & 8 deletions caseworker/advice/picklist_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ def approval_picklist(self):
}


def fcdo_picklist(self):
return {
"approval_reason": get_picklists_list(
self.request, type="standard_advice", disable_pagination=True, show_deactivated=False
)
}


def proviso_picklist(self):
return {
"proviso": get_picklists_list(self.request, type="proviso", disable_pagination=True, show_deactivated=False)
Expand Down
16 changes: 7 additions & 9 deletions caseworker/advice/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.urls import path

from caseworker.advice.views import views, consolidate_advice
from caseworker.advice.views.add_advice import GiveApprovalAdviceView
from caseworker.advice.views.edit_advice import EditAdviceView
from caseworker.advice.views import consolidate, views
from caseworker.advice.views.approval import GiveApprovalAdviceView
from caseworker.advice.views.edit import EditAdviceView

urlpatterns = [
path("", views.AdviceView.as_view(), name="advice_view"),
Expand Down Expand Up @@ -30,14 +30,12 @@
name="countersign_decision_edit",
),
path("consolidate/", views.ConsolidateAdviceView.as_view(), name="consolidate_advice_view"),
path("consolidate/review/", consolidate_advice.ConsolidateSelectDecisionView.as_view(), name="consolidate_review"),
path(
"consolidate/review/approve/", consolidate_advice.ConsolidateApproveView.as_view(), name="consolidate_approve"
),
path("consolidate/review/refuse/", consolidate_advice.ConsolidateRefuseView.as_view(), name="consolidate_refuse"),
path("consolidate/review/", consolidate.ConsolidateSelectDecisionView.as_view(), name="consolidate_review"),
path("consolidate/review/approve/", consolidate.ConsolidateApproveView.as_view(), name="consolidate_approve"),
path("consolidate/review/refuse/", consolidate.ConsolidateRefuseView.as_view(), name="consolidate_refuse"),
path(
"consolidate/review/lu-refuse/",
consolidate_advice.LUConsolidateRefuseView.as_view(),
consolidate.LUConsolidateRefuseView.as_view(),
name="consolidate_refuse_lu",
),
path("consolidate/edit/", views.ConsolidateEditView.as_view(), name="consolidate_edit"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,6 @@
from core.decorators import expect_status


# class SelectAdviceView(LoginRequiredMixin, CaseContextMixin, FormView):
# template_name = "advice/select_advice.html"
# form_class = SelectAdviceForm

# def get_success_url(self):
# recommendation = self.request.POST.get("recommendation")
# if recommendation == "approve_all":
# return reverse("cases:approve_all", kwargs=self.kwargs)
# else:
# return reverse("cases:refuse_all", kwargs=self.kwargs)

# def get_context_data(self, **kwargs):
# context = super().get_context_data(**kwargs)
# return {**context, "security_approvals_classified_display": self.security_approvals_classified_display}


class GiveApprovalAdviceView(LoginRequiredMixin, CaseContextMixin, BaseSessionWizardView):

form_list = [
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from caseworker.advice.forms.approval import FootnotesApprovalAdviceForm, RecommendAnApprovalForm
from caseworker.advice.forms.edit import PicklistApprovalAdviceEditForm
from caseworker.advice.views.add_advice import GiveApprovalAdviceView
from caseworker.advice.views.approval import GiveApprovalAdviceView
from caseworker.advice import services
from caseworker.advice.constants import AdviceSteps
from caseworker.advice.picklist_helpers import approval_picklist, footnote_picklist
Expand Down

0 comments on commit fec9881

Please sign in to comment.