history.phtml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /**
  3. * @version 7.10 [rev.7.10.01]
  4. */
  5. ?>
  6. <nav class="navbar navbar-filter">
  7. <div class="navbar-left">
  8. <?php
  9. $container = $this->navigation()->getContainer();
  10. echo $this->navigation()
  11. ->setContainer($container->findOneBy('label', $this->_('Account History Filter')))
  12. ->setPartial('navigation/browse-filter.phtml', array('key' => 'show'))
  13. ->menu();
  14. $this->navigation()->setContainer($container);
  15. ?>
  16. </div>
  17. <form class="navbar-form navbar-right" action="" method="get">
  18. <div class="form-group">
  19. <?php
  20. /** @var \Ppb\Form\Element\DateTime $dateTimeFrom */
  21. $dateTimeFrom = $this->formElement('\Ppb\Form\Element\DateTime', 'date_from', $this->dateFrom)
  22. ->setAttributes(array(
  23. 'placeholder' => $this->_('From..'),
  24. 'class' => 'form-control input-default'
  25. ))
  26. ->setCustomData(array(
  27. 'formData' => array(
  28. 'format' => '"YYYY-MM-DD HH:mm"',
  29. 'maxDate' => 'new Date()',
  30. 'useCurrent' => 'false',
  31. 'stepping' => '5',
  32. 'showClear' => 'true',
  33. ),
  34. ));
  35. /** @var \Ppb\Form\Element\DateTime $dateTimeTo */
  36. $dateTimeTo = $this->formElement('\Ppb\Form\Element\DateTime', 'date_to', $this->dateTo)
  37. ->setAttributes(array(
  38. 'placeholder' => $this->_('To..'),
  39. 'class' => 'form-control input-default'
  40. ))
  41. ->setCustomData(array(
  42. 'formData' => array(
  43. 'format' => '"YYYY-MM-DD HH:mm"',
  44. 'maxDate' => 'new Date()',
  45. 'useCurrent' => 'false',
  46. 'stepping' => '5',
  47. 'showClear' => 'true',
  48. ),
  49. ));
  50. $this->script()->addBodyCode(
  51. $dateTimeFrom->getBodyCode());
  52. $this->script()->addBodyCode(
  53. $dateTimeTo->getBodyCode());
  54. echo $dateTimeFrom->render();
  55. echo $dateTimeTo->render();
  56. ?>
  57. </div>
  58. <?php echo $this->formElement('submit', 'submit', $this->_('Show'))
  59. ->setAttributes(array('class' => 'btn btn-default'))
  60. ->render();
  61. ?>
  62. </form>
  63. </nav>
  64. <?php if ($inAdmin && $userId) { ?>
  65. <h4><?php echo $this->_(sprintf('Account History for user ID #%s', $userId)); ?></h4>
  66. <?php } ?>
  67. <p class="text-right">
  68. <span class="label label-default">
  69. <?php echo $this->_('Debit:'); ?>
  70. <?php echo $this->amount($totals['debit'], null, null, true); ?>
  71. </span>
  72. <span class="label label-info">
  73. <?php echo $this->_('Credit:'); ?>
  74. <?php echo $this->amount($totals['credit'], null, null, true); ?>
  75. </span>
  76. <span class="label label-success">
  77. <?php echo $this->_('Payments:'); ?>
  78. <?php echo $this->amount($totals['payments'], null, null, true); ?>
  79. </span>
  80. </p>
  81. <div class="table-responsive">
  82. <table class="table table-striped table-hover">
  83. <caption>
  84. <strong><?php echo $this->paginator->getPages()->totalItemCount; ?></strong> <?php echo $this->_('results found.'); ?>
  85. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  86. <?php echo $this->_('Showing results'); ?>
  87. <strong><?php echo $this->paginator->getPages()->firstItemNumber; ?></strong>
  88. <?php echo $this->_('to'); ?>
  89. <strong><?php echo $this->paginator->getPages()->lastItemNumber; ?></strong>
  90. <?php } ?>
  91. </caption>
  92. <?php if ($this->paginator->getPages()->totalItemCount) { ?>
  93. <thead>
  94. <tr>
  95. <th><?php echo $this->_('Name'); ?></th>
  96. <th class="size-mini"><?php echo $this->_('Type'); ?></th>
  97. <th class="size-mini"><?php echo $this->_('Amount'); ?></th>
  98. <th class="size-small"><?php echo $this->_('Date'); ?></th>
  99. </tr>
  100. </thead>
  101. <?php } ?>
  102. <tbody>
  103. <?php
  104. /** @var \Ppb\Db\Table\Row\Accounting $accounting */
  105. foreach ($this->paginator as $accounting) {
  106. $name = ($accounting['listing_id']) ?
  107. sprintf($this->_('Listing Setup Fees - Listing ID: #%s'),
  108. $accounting['listing_id']) : $accounting->displayName();
  109. ?>
  110. <tr>
  111. <td>
  112. <a href="<?php echo $this->url($accounting->link()); ?>" target="_blank">
  113. <?php echo $name; ?>
  114. </a>
  115. <?php if ($accounting->canRequestRefund()) { ?>
  116. <div>
  117. <a class="btn btn-sm btn-default confirm-box"
  118. href="<?php echo $this->url(array('option' => 'refund_request', 'id' => $accounting['id']),
  119. null, true); ?>"
  120. data-message="<?php echo $this->_('Are you sure that you wish to request a refund for this transaction?'); ?>">
  121. <?php echo $this->_('Request Refund'); ?>
  122. </a>
  123. </div>
  124. <?php
  125. }
  126. else if ($accounting->canProcessRefund()) {
  127. ?>
  128. <div>
  129. <a class="btn btn-sm btn-success confirm-box"
  130. href="<?php echo $this->url(array('option' => 'refund_accept', 'id' => $accounting['id']),
  131. null, true); ?>"
  132. data-message="<?php echo $this->_('Are you sure you wish to refund this transaction?'); ?>">
  133. <?php echo $this->_('Accept Refund Request'); ?>
  134. </a>
  135. <a class="btn btn-sm btn-danger confirm-box"
  136. href="<?php echo $this->url(array('option' => 'refund_decline', 'id' => $accounting['id']),
  137. null, true); ?>"
  138. data-message="<?php echo $this->_('Are you sure you wish to decline this refund request?'); ?>">
  139. <?php echo $this->_('Decline Refund Request'); ?>
  140. </a>
  141. </div>
  142. <?php } ?>
  143. </td>
  144. <td>
  145. <?php echo $this->_($accounting['transaction_filter']); ?>
  146. </td>
  147. <td>
  148. <span class="<?php echo ($accounting['total_amount'] < 0) ? 'text-success' : ''; ?>">
  149. <?php echo $this->amount(abs($accounting['total_amount']), $accounting['currency']); ?>
  150. </span>
  151. </td>
  152. <td>
  153. <small><?php echo $this->date($accounting['created_at']); ?></small>
  154. </td>
  155. </tr>
  156. <?php } ?>
  157. </tbody>
  158. </table>
  159. </div>
  160. <?php echo $this->pagination($this->paginator, 'sliding', 'partials/pagination.phtml'); ?>