-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1037 from ministryofjustice/CAS-270-fe-users-can-…
…filter-referrals-by-name-as-well-as-crn-part-2 Add SearchByCrnOrNameForm and SearchByCrnOrNameResult component
- Loading branch information
Showing
4 changed files
with
137 additions
and
95 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
server/views/components/search-by-crn-or-name-form/macro.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{% from "govuk/components/input/macro.njk" import govukInput %} | ||
{% from "govuk/components/button/macro.njk" import govukButton %} | ||
|
||
|
||
{# params - Type of Object - Description #} | ||
{# uiStatus - String - Specific status the record would be in #} | ||
{# type - String - Either "bookings" or "referrals" #} | ||
{# basePath - String - URL used to define where form should be submitted to and the link the "Clear" should take the user too #} | ||
{# crnOrName - String - Either a CRN or Name which the user would like to search for#} | ||
|
||
|
||
{% macro searchByCrnOrNameForm(params) %} | ||
{% set searchLabel = 'Search ' + params.uiStatus + ' ' + params.type + ' by CRN (case reference number)' %} | ||
|
||
<form action="{{ params.basePath }}" method="get"> | ||
|
||
{{ govukInput( | ||
{ | ||
label: { | ||
classes: 'govuk-label--m', | ||
text: searchLabel | ||
}, | ||
hint: { | ||
text: 'For example, XD7364CD' | ||
}, | ||
name: 'crn', | ||
id: 'crn', | ||
value: params.crnOrName | ||
} | ||
) }} | ||
|
||
<div class="govuk-button-group"> | ||
{{ govukButton({ text: "Search", attributes: { id: 'search-button' }, preventDoubleClick: true}) }} | ||
|
||
<a class="govuk-link" href="{{ params.basePath }}">Clear</a> | ||
</div> | ||
</form> | ||
{% endmacro %} |
37 changes: 37 additions & 0 deletions
37
server/views/components/search-by-crn-or-name-results/macro.njk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{%- from "moj/components/pagination/macro.njk" import mojPagination -%} | ||
|
||
|
||
{# params - Type of Object - Description #} | ||
{# errors - Object - Errors object from the view, soon to be removed #} | ||
{# resultsHtml - String - HTML string containing the pagination and results. Currently parent view is responsible for this. We will look to moving that logic into this component #} | ||
{# crnOrName - String - Either a CRN or Name which the user would like to search for #} | ||
{# uiStatus - String - Specific status the record would be in #} | ||
{# type - String - Either "bookings" or "referrals". #} | ||
|
||
|
||
{% macro searchByCrnOrNameResults(params) %} | ||
{% if params.errors.crn %} | ||
<h2>You have not entered any search terms</h2> | ||
|
||
<p>Enter a CRN. This can be found in nDelius.</p> | ||
|
||
{% elif (params.resultsHtml| trim |length > 0) or (not params.crnOrName) %} | ||
{{ params.resultsHtml | safe | trim | indent(8)}} | ||
|
||
{% else %} | ||
<h2>There are no results for ‘{{ params.crnOrName }}’ in {{ params.uiStatus }} {{ params.type }}.</h2> | ||
|
||
<p>Check the other lists.</p> | ||
|
||
{% if params.type === 'bookings' %} | ||
{% set type_name = 'booking' %} | ||
{% elif params.type ==='referrals' %} | ||
{% set type_name = 'referral' %} | ||
{% endif %} | ||
|
||
<p> | ||
If the {{ type_name }} is missing from every list, <a href="mailto:{{ PhaseBannerUtils.supportEmail }}">contact | ||
support</a> for help. | ||
</p> | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters