queue.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Rewards Queue Management</title>
  5. <link rel="icon" type="image/x-icon" href="/static/img/favicon.ico">
  6. <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
  7. <script>
  8. function refreshPage() {
  9. window.location.reload();
  10. }
  11. </script>
  12. </head>
  13. <script src="/static/userpanel.js"></script>
  14. <div class="panel">
  15. <div class="navbar">
  16. <p>Rewards Queue Management</p>
  17. <img src="/static/img/ownchatbotwide.png">
  18. </div>
  19. <body>
  20. {% if votes %}
  21. <table>
  22. <thead>
  23. <tr>
  24. <th style="width: 20%;">Active Votes</th>
  25. <th style="width: 40%;">Description</th>
  26. <th style="width: 20%;">Price</th>
  27. <th style="width: 20%;">Current Tally</th>
  28. <th></th>
  29. </tr>
  30. </thead>
  31. <tbody>
  32. {% for vote in votes %}
  33. <tr>
  34. <td> {{ prefix }}{{ vote[0] }} </td>
  35. <td> {{ vote[2] }} </td>
  36. {% set points_label = 'point' if rewards[vote[0]]["price"] == 1 else 'points' %}
  37. <td> {{ rewards[vote[0]]["price"] }} {{ points_label }}</td>
  38. {% set votes_label = 'vote' if vote[1] == 1 else 'votes' %}
  39. <td> {{ vote[1] }} {{ votes_label }}</td>
  40. <td></td>
  41. </tr>
  42. {% endfor %}
  43. </tbody>
  44. </table>
  45. {% else %}
  46. <h3> You currently have no active votes. </h3>
  47. {% endif %}
  48. <hr>
  49. {% if goals %}
  50. <table>
  51. <thead>
  52. <tr>
  53. <th style="width: 20%;">Active Goals</th>
  54. <th style="width: 40%;">Description</th>
  55. <th style="width: 25%;">Progress</th>
  56. <th></th>
  57. </tr>
  58. </thead>
  59. <tbody>
  60. {% for goal in goals %}
  61. <tr>
  62. <td> {{ prefix }}{{ goal[0] }} </td>
  63. <td> {{ goal[3] }} </td>
  64. {% set progress = goal[1] / goal[2] * 100 %}
  65. <td>
  66. <div class="bar-light-grey bar-tiny bar-round" style="position: relative;">
  67. <div class="bar-round bar-blue" style="text-align: center; width:{{ progress }}%;">{{ '%0.0f'| format(progress| float) }}%
  68. </div>
  69. {% set milestones = rewards[goal[0]]["milestones"] %}
  70. {% for milestone_key, milestone in milestones.items() %}
  71. {% if milestones[milestone_key][0] and milestones[milestone_key][1] %}
  72. {% if milestones[milestone_key][1] < goal[2] %}
  73. {% set milestone_progress = milestones[milestone_key][1] / goal[2] * 100 %}
  74. <div class="milestone-marker" style="position: absolute; left: {{ milestone_progress }}%; transform: translateX(-50%);">
  75. <img src="/static/img/milestone.png" style="width: 16px; height: 16px;" title="{{ milestones[milestone_key][1] }} points. {{ milestones[milestone_key][0] }}">
  76. </div>
  77. {% endif %}
  78. {% endif %}
  79. {% endfor %}
  80. </div>
  81. </td>
  82. {% if goal[1] == goal[2] %}
  83. <td> {{ goal[1] }} / {{ goal[2] }} <img src=/static/img/tada.png style="width: 24px; height: 24px;"></td>
  84. {% else %}
  85. <td> {{ goal[1] }} / {{ goal[2] }} </td>
  86. {% endif %}
  87. </tr>
  88. {% endfor %}
  89. <tr style="border-bottom: none;">
  90. <td>
  91. </td>
  92. <td>
  93. </td>
  94. <td style="font-size: small;">
  95. (Mouse over flags for milestone details)
  96. </td>
  97. </tr>
  98. </tbody>
  99. </table>
  100. {% else %}
  101. <h3> You currently have no active goals. </h3>
  102. {% endif %}
  103. <hr>
  104. <h3>Redeems Queue</h3>
  105. {% if queue %}
  106. <a href="/mgmt/clearfulfilled"><button class="button button2">Clear Fullfilled Rewards</button></a>&nbsp;&nbsp;<a href="/mgmt/clearqueue"><button class="button button2">Clear All Rewards</button></a>
  107. <table>
  108. <thead>
  109. <tr>
  110. <th>Time</th>
  111. <th>Reward</th>
  112. <th>Description</th>
  113. <th>User</th>
  114. <th></th>
  115. </tr>
  116. </thead>
  117. <tbody>
  118. {% for row in queue %}
  119. <tr>
  120. <td>{{ row[1].replace(tzinfo=utc_timezone).astimezone().strftime("%H:%M") }}</td>
  121. {% if row[4] %}
  122. <td><s>{{ row[2] }}</s></td>
  123. {% else %}
  124. <td>{{ row[2] }}</td>
  125. {% endif %}
  126. <td>{{ rewards[row[2]]["info"] }}</td>
  127. <td>{{ row[6] }}</td>
  128. {% if row[4] %}
  129. {% if row[5] %}
  130. <td>Refunded</td>
  131. {% else %}
  132. <td><a href="/mgmt/refund?reward={{ row[2] }}&username={{ row[6] }}&rewarder_id={{ row[3] }}&reward_id={{ row[0] }} "><button class="button button2">Refund</button></a></td>
  133. {% endif %}
  134. {% else %}
  135. <td><a href="/mgmt/fulfill?reward_id={{ row[0] }}&username={{ row[6] }}"><button class="button button2">Fulfill</button></a></td>
  136. {% endif %}
  137. </tr>
  138. {% endfor %}
  139. </tbody>
  140. </table>
  141. {% else %}
  142. <p>There are currently no rewards waiting in the queue.</p>
  143. {% endif %}
  144. </body>
  145. </div>
  146. <script>
  147. setTimeout(refreshPage, 30 * 1000);
  148. </script>
  149. </html>