<%if manual_payment_approval%>
<%Links::Payment::admin_approve_payment($payment_id)%>
  <%if manual_payment_success%>
    <%set success_message = "This payment has been manually approved."%>
  <%else%>
    <%set error_message = "This payment has already been approved."%>
  <%endif%>
<%endif%>

<html>

<head>
  <title>Gossamer Links - Payments - Payment Details</title>
<base target="_self">
</head>

<%Links::Payment::view_details($payment_id)%>
<body bgcolor="white">
<%set header_title = "Payment Details"%>
<%set header_description = "This page displays details for a given payment transaction."%>
<%include payment_header.html%>
<br>
<%set font_tag = '<font face="Tahoma,Arial,Helvetica" size="2">'%>

<%unless payments_id%>
<br>
<table border="1" cellpadding="0" cellspacing="0">
  <tr>
    <td>
      <table bgcolor="white" border="0" cellpadding="3" cellspacing="3" width="500" valign="top">
        <tr>
          <td width="100" valign="top">
            <%font_tag%><b>Payment not found!</b></font>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
<%else%>

<br>
<table border="1" cellpadding="0" cellspacing="0" width="500">
  <tr>
    <td>
      <table bgcolor="white" border="0" cellpadding="3" cellspacing="3" width="500" valign="top">
        <tr>
          <td width="100" valign="top"><%font_tag%><b>ID:</b></font></td>
          <td><%font_tag%><%payments_id%></font></td>
        </tr>
        <tr>
          <td valign="top" width="30%"><%font_tag%><b>Link:</b></font></td>
          <td width="70%"><%font_tag%><a href="<%escape_html URL%>"><%escape_html Title%></a> <small>(<a href="admin.cgi?do=search_results;db=Links;ID=<%ID%>;ID-opt=%3D">details</a>, <a href="admin.cgi?do=modify_search_results;db=Links;ID=<%ID%>;ID-opt=%3D">modify</a>)</small></font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Type:</b></font></td>
          <td><%font_tag%>
            <%if payments_type eq 0%>Signup payment<%elsif payments_type eq 1%>Renewal payment<%elsif payments_type eq 2%>Recurring payment<%endif%>
          </font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Status:</b></font></td>
          <td><%font_tag%>
            <%if payments_status eq 0%>Pending
            <%elsif payments_status eq 1%>Completed
            <%elsif payments_status eq 2%>Declined
            <%elsif payments_status eq 3%>Error
            <%endif%>
          </td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Amount:</b></font></td>
          <td><%font_tag%>
            <%if payments_amount = 0%>Trial - <%endif%>
            $<%payments_amount%>
          </font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Term:</b></font></td>
          <td><%font_tag%>
            <%if payments_term_num%><%payments_term_num%> <%payments_term_unit%><%else%>Unlimited<%endif%>
          </font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Method:</b></font></td>
          <td><%font_tag%>
            <%if payments_method eq 'trial'%>Trial
            <%else%><%payments_method%> <%if payments_direct%>(Direct)<%elsif payments_remote%>(Remote)<%endif%>
            <%endif%>
          </font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Intiated:</b></font></td>
          <td><%font_tag%>
            <%GT::Date::date_get($payments_start, '%ddd% %mmm% %d% %h%:%MM% %tt% %yyyy%')%>
          </font></td>
        </tr>
        <tr>
          <td valign="top"><%font_tag%><b>Last&nbsp;Activity:</b></font></td>
          <td><%font_tag%>
            <%if payments_last == $payments_start%><i>No activity since payment was initiated.</i>
            <%else%><%GT::Date::date_get($payments_last, '%ddd% %mmm% %d% %h%:%MM% %tt% %yyyy%')%>
            <%endif%>
          </font></td>
        </tr>
<%unless payments_status eq 1%>
        <tr>
          <td valign="top"><%font_tag%><b>Manual&nbsp;Approval:</b></font></td>
          <td><%font_tag%>
            <a href="admin.cgi?do=page;page=payment_details.html;payment_id=<%payments_id%>;manual_payment_approval=1">
              Manually approve payment
            </a>
          </font></td>
        </tr>
<%endunless%>
      </table>
    </td>
  </tr>
</table>
<br>
<%font_tag%><b><big>Payment Logs:</big></b></font>
<br>
<table border="1" cellpadding="2" cellspacing="0" width="500">
  <tr>
    <th width="15%"><%font_tag%>Type</font></th>
    <th width="32%"><%font_tag%>Date</font></th>
    <th width="53%"><%font_tag%>Message</font></th>
  </tr>
<%loop logs%>
  <tr>
    <td valign="top"><%font_tag%><%if paylogs_type eq 0%>Info<%elsif paylogs_type eq 1%>Accepted<%elsif paylogs_type eq 2%>Declined<%elsif paylogs_type eq 3%>Error<%elsif paylogs_type eq 4%>Manual<%endif%></font></td>
    <td valign="top"><%font_tag%><%GT::Date::date_get($paylogs_time, '%ddd% %mmm% %d% %h%:%MM% %tt% %yyyy%')%></font></td>
    <td valign="top"><%font_tag%><%unescape_html paylogs_text%></font></td>
  </tr>
<%endloop%>
</table>

<%endunless%>
</body>
</html>
