queue.html 6.5 KB

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