diff --git a/hypha/apply/determinations/views.py b/hypha/apply/determinations/views.py index 0d2628f06a..6c7c4ea2a0 100644 --- a/hypha/apply/determinations/views.py +++ b/hypha/apply/determinations/views.py @@ -359,6 +359,10 @@ def get_form_class(self): form_fields[field_block.id].initial = TRANSITION_DETERMINATION[ action ] + # Make capitalization consistent + form_fields[field_block.id].label = form_fields[ + field_block.id + ].label.title() form_fields = self.add_proposal_form_field(form_fields, action) return type("WagtailStreamForm", (self.submission_form_class,), form_fields) @@ -389,7 +393,11 @@ def add_proposal_form_field(self, fields, action): help_text=proposal_form_help_text, required=True if action == "invited_to_proposal" else False, ) + # Move proposal form the be the second field as it's disabled until the first (determination) is input fields.move_to_end("proposal_form", last=False) + fields.move_to_end( + list(fields.keys())[1], last=False + ) # `last=False` moves the item to the start return fields def get_success_url(self): diff --git a/hypha/apply/funds/models/utils.py b/hypha/apply/funds/models/utils.py index 423a20a82a..8a17c45a5a 100644 --- a/hypha/apply/funds/models/utils.py +++ b/hypha/apply/funds/models/utils.py @@ -115,7 +115,7 @@ def get_defined_fields(self, stage=None, form_index=0): stage_num = 1 else: stage_num = self.workflow.stages.index(stage) + 1 - return self.forms.filter(stage=stage_num)[form_index].fields + return list(self.forms.filter(stage=stage_num))[form_index].fields def render_landing_page(self, request, form_submission=None, *args, **kwargs): # We only reach this page after creation of a new submission diff --git a/hypha/static_src/javascript/determination-template.js b/hypha/static_src/javascript/determination-template.js index f42ec90aa0..079405fc49 100644 --- a/hypha/static_src/javascript/determination-template.js +++ b/hypha/static_src/javascript/determination-template.js @@ -25,23 +25,23 @@ getMatchingCopy(value) { const proposal_form = document.querySelector("#id_proposal_form"); - if (value === "0") { - this.text = document.querySelector( - 'div[data-type="rejected"]' - ).textContent; + if (["", "0", "1"].includes(value)) { if (proposal_form) { proposal_form.disabled = true; proposal_form.required = false; } - } else if (value === "1") { - this.text = document.querySelector( - 'div[data-type="more_info"]' - ).textContent; - if (proposal_form) { - proposal_form.disabled = true; - proposal_form.required = false; + if (value === "") { + this.text = ""; + } else if (value === "0") { + this.text = document.querySelector( + 'div[data-type="rejected"]' + ).textContent; + } else if (value === "1") { + this.text = document.querySelector( + 'div[data-type="more_info"]' + ).textContent; } - } else { + } else if (value === "2") { this.text = document.querySelector( 'div[data-type="accepted"]' ).textContent;