<%doc>$Id: letter.mhtml,v 1.29 2004/02/07 14:03:47 anoncvs Exp $</%doc>
<%args>
$data
@people
$user
$format => 'html'
$state
$volunteerState => ''
$err => ''
</%args>
<h1>Your Letter-Writing eBlock</h1>

%if ($err) {
<p><b>Error:</b> <font color="red"><%$err%></font></p>
%}

<p><b>Making phone calls:</b> If you want to make phone calls instead
of sending letters, <a href="/eblock/index.mhtml?mode=call">click
here</a>.

<p><b>Quick instructions:</b> Write a letter to an address on your
eBlock. Once you've mailed the letter (or put it in a stack of letters
to be mailed), click the "Mark as Complete" button so we know you're
done with it. Once you complete your block, you'll get another one to
work on.</p>


<p><a href="/eblocks/resources/letters/#tips">Letter-writing tips</a>| <a href="/eblocks/resources/letters/#samples">See sample letters, postcards, and fliers</a> 
</p>

<hr>

% my $formAction = "/eblocks/index.mhtml";
%if ($user->hasPermission('eblocks_unlimited') && $format eq 'csv') {
<pre>
SALUTATION,FIRST,MIDDLE,LAST,JR,ADDRESS,CITY,STATE,ZIP,GENDER,PARTY,VOTERID
%foreach my $p (@people) {
<% $p->prefix() %>,<% $p->firstName() %>,<% $p->middleName() %>,<% $p->lastName() %>,<% $p->suffix() %>,<% $p->address() %>,<% $p->city() %>,<% $p->mstate() %>,<% $p->zip() %>,<% $p->genderName() %>,<% $p->partyName() %>,<%$p->statevoterkey()%>
%}
</pre>
%if ($data->userCanCompleteInBulk($user, 'mail')) {
 <form name="mail-all" action="<%$formAction%>" method="post">
 <input type="hidden" name="action" value="setall">
%$m->comp('mantainState.mhtml', mode => 'mail', format => $format, state => $state, volunteerState => $volunteerState);
 <input type="submit" name="setall" value="Mark this block as Complete">
 </form>
%}
%} else {

<table width="100%">
<tr><th></th><th>Voter name</th><th>Address</th>
%if($format ne 'simple') {
<th>Gender</th><th>Party</th>
%}
<th></th></tr>
% foreach my $p (@people) {
<form name="mail-<% $p->voterkey %>" action="<%$formAction%>" method="post">
<input type="hidden" name="action" value="set">
%$m->comp('mantainState.mhtml', mode => 'mail', format => $format, state => $state, volunteerState => $volunteerState);
<tr>
 <td valign="top"><% $counter %>.  <!--Score <% $p->address_score() %>--></td>
 <td valign="top"><% $p->prefix() %> <% $p->firstName() %> <% $p->middleName() %> <% $p->lastName() %> <% $p->suffix() %></td>
 <td valign="top"><% $p->address() %><br /><% $p->city() %>, <% $p->mstate() %> <% $p->zip() %></td>
%if ($format ne 'simple') {
 <td valign="top"><% $p->genderName() %></td>
 <td valign="top"><% $p->partyName() %></td>
%}
 <td valign="top"><input type="hidden" name="voterkey" value="<% $p->voterkey() %>" /> <input type="hidden" name="notes" value=""/>
     <input type="submit" name="resolve" value="Mark as Complete"></td>
</tr>
</form>
% $counter++;
% }
% if ($data->userCanCompleteInBulk($user, 'mail') && $counter > 2) {
 <tr><td colspan="5"></td><td>
  <form name="mail-all" action="<%$formAction%>" method="post">
  <input type="hidden" name="action" value="setall">
% $m->comp('mantainState.mhtml', mode => 'mail', format => $format, state => $state, volunteerState => $volunteerState);
  <input type="submit" name="setall" value="Mark all <%$counter-1%> as Complete">
  </form>
 </td></tr>
%}
</table>
%}
<p>This block is reserved for you until <%$data->expiryTime($user,
'call')%>. If you don't mark these voters complete by then, they'll
be returned to the pool and you'll get another block.
%if ($user->hasPermission('eblocks_unlimited')) {
  <p><font size="-1">
%if ($format eq 'html') {
<a href="/eblocks/index.mhtml?<%$data->queryString('mail', $state, $volunteerState, 'csv')%>">Show your eBlock in comma-separated value form</a> (for input into Excel)
%} else {
<a href="/eblocks/index.mhtml?<%$data->queryString('mail', $state, $volunteerState, 'html')%>">Show your eBlock as HTML</a>
%}
</font></p>

%}

<%init>
our $counter = 1;
</%init>
