	[% META title="Phone Log" %]
	
<!-- BEGIN phonelog/default.tt -->	
	[% # PROCESS dumper.tt dump = data %]
   
    [% # PROCESS site/js/jquery.tt # already loaded in html_wrapper %]
	<script type="text/javascript" src="/js/jquery.textarea-expander.js"></script>

    [% INCLUDE record/patient_summary.tt %]

    <h3 class="header">Phone Log</h3>

    [% IF dfv_errors %]
    <dl>
        <dt class="error">[% c.cfg('msg').dfv_errors %]</dt>
        [% IF error_status %]
            <dd>Call [% error_status %]</dd>[% END %]
        [% IF error_text %]
            <dd>Details [% error_text %]</dd>[% END %]
    </dl>
    [% END %]
	
	[% phonelog_dfv_js %]

	[% IF data.size %]
        <table class="indent">
            <tr>
                <th>Day</th>
                <th>Date</th>
                <th>Time</th>
                <th>UserID</th>
                <th>I/O</th>
                <th>Identity</th>
                <th>Summary</th>
            </tr>
            [% FOREACH entry IN data %]
            <tr>
                <td>[% entry.time.strftime('%a') %]</td>
                <td>[% entry.time.strftime('%d.%b.%Y') %]</td>
                <td>[% entry.time.strftime('%T') %]</td>
				<td>[% entry.user.username | upper %]</td>
                <td>[% entry.status %]</td>
                <td>[% entry.contact %]</td>
                <td>[% entry.details %]</td>
            </tr>
            [% END %]
        </table>
		
		<p class="title">New:</p>
    [% END %]

    <form action="[% app_url %]/phone-log/update/[% request.id %]" method="post"
        [% phonelog_onsubmit %] name="phone_log" id="phone_log">

	<table class="indent">
		<tr>
			<td class="label">Call:</td>
			<td class="content">
				<div id="id">
					<label><input type="radio" name="status" value="inbound" />incoming</label>					
				</div>
				<div id="id">
					<label><input type="radio" name="status" value="outbound" />outgoing</label>
				</div>
			</td>
		</tr>
		<tr>
			<td class="label">Contact:</td> 
			[% meta_data = c.get_meta_data('RequestPhoneLog');
                max_length = meta_data.column('contact').length; %]
			<td class="content">
				<input type="text" name="contact" size="50" maxlength="[% max_length %]"
					[% site.html.on_focus %] />
				[% error_contact %]
			</td>
		</tr>
		<tr>
			<td class="label" style="vertical-align: top">Details:</td> 
			<td class="content">
				[% FOREACH option IN options %]
				<div>
				<label><input type="radio" name="summary" value="[% option.description %]" />
					[% option.description %]</label>					
				</div>
				[% END %]
				<p>
					Other/additional comments:<br />
					<span class="indent">
						<textarea name="comments" rows="1" cols="40" class="expand20-200"
							[% # PROCESS site/limit_text.tt input_name = 'comments' # 'text' col now %]
							[% site.html.on_focus %]></textarea>
                        [% IF using_countdown # moved varchar -> text now so don't need %]
						  <br />
						  <span class="indent">[% PROCESS site/countdown.tt %]</span>
                        [% END %]
					</span>
				</p>
				 
			</td>
		</tr>
		<tr>
			<td class="label">UserID:</td>
			<td class="content">
				<select name="user_id" id="user_id" [% site.html.on_focus %]>
					<option value="">&nbsp;</option>
					[% FOREACH user IN users %]
                        <option value="[% user.id %]"
							[% 'selected' IF user.username == c.authen.username %]>
						[% user.username | upper %]
                        </option>
					[% END %]
				</select>
				[% IF error_user_id %]
					[% error_user_id %]
				[% ELSE %]
					<span class="info">&#171; change this if necessary</span>
				[% END %]
			</td>
		</tr>
	</table>
 
    <p class="indent">
		[% site.html.back_button %] [% site.html.submit %] [% site.html.reset %]
	</p>                
	
	</form>
	
	</div>
<!-- END phonelog/default.tt -->	

