[% META title = 'Patient &raquo; Edit Unit Number' -%]

  <h2 class="header">Edit patient unit number</h2>

	[% # PROCESS dumper.tt dump = count %]

    [% patient_case_dfv_js %]

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
        [% IF error_patient_id %]
            <ul><li>[% c.cfg('msg').require_one %]</li></ul>
        [% END %]
    [% END %]

    <p>
        <strong>Patient demographic data:</strong>
        [ <a href="[% app_url %]/patient/register_edit_patient/[% case.patient.id %]">Edit</a> ]
    </p>

    <div class="indent" style="text-align: center">
    <table>
	    <tr>
	        <th>Last Name</th>
	        <th>First Name(s)</th>
	        <th>Gender</th>
	        <th>D.o.B</th>
	        <th>NHS Number</th>
	        <th>Location</th>
	    </tr>
	    <tr>
	        <td>[% case.patient.last_name | upper %]</td>
	        <td>
                <span>[% case.patient.first_name  | ucfirst %]</span>
                <span>[% case.patient.middle_name | ucfirst %]</span>
            </td>
	        <td>[% case.patient.gender || 'U' %]</td>
	        <td>[% case.patient.dob.strftime('%d.%b.%Y') || site.html.grey_null %]</td>
	        <td>[% case.patient.nhs_number || site.html.grey_null %]</td>
	        <td>[% PROCESS site/display_name.tt location = case.referral_source.display_name %]</td>
	    </tr>
	</table>
    </div>

	<form action="[% app_url %]/patient/update_case/[% case.id %]" method="post" name="edit_case"
		id="edit_case" [% patient_case_onsubmit %]>

		<p class="indent">Unit/case number:
		  <input type="text" name="unit_number" size="12" value="[% case.unit_number %]" />
		  [% IF c.user_can('delete_record') AND ! count %]
		  [ <a href="[% app_url %]/patient/delete_case/[% case.id %]">DELETE CASE</a> ]
		  [% END %]
		</p>

		[% IF count %]
			<p class="bold">
				Number of existing records affected by this change =
					<span class="highlight">[% count %]</span>
			</p>
		[% END %]

		<p class="center">
			[% site.html.submit %]
			[% site.html.reset %]
		</p>

	</form>
