Sfoglia il codice sorgente

Updated rewards management panel to separate votes and goals into their own sections

deadtom 1 mese fa
parent
commit
2ff5224ca4
1 ha cambiato i file con 68 aggiunte e 14 eliminazioni
  1. 68 14
      ownchatbot/templates/mgmt.html

+ 68 - 14
ownchatbot/templates/mgmt.html

@@ -25,7 +25,7 @@
     </div>
 
     <div id='managerewards' class="tabcontent">
-        <h3>Manage Rewards</h3>
+        <h2>Manage Rewards</h3>
         <body>
         <div>
         <h4>Reward Types:</h4>
@@ -76,7 +76,6 @@
                 <thead>
                     <tr>
                         <th style="width:15%">Name</th>
-                        <th>Target</th>
                         <th>Price</th>
                         <th>Info</th>
                         <th>Cool down</th>
@@ -86,22 +85,14 @@
                 </thead>
                 <tbody>
                 {% for reward, reward_info in rewards.items() %}
+                    {% if reward in redeems %}
                     {% if reward in active_rewards %}
                     <tr>
                     {% else %}
                     <tr style="color: red;">
                     {% endif %}
                         <td>{{ prefix }}{{ reward }}</td>
-                        {% if reward_info["type"] == "goal" %}
-                        <td>{{ reward_info["target"] }}</td>
-                        {% else %}
-                        <td>N/A</td>
-                        {% endif %}
-                        {% if reward_info["type"] == "goal" %}
-                        <td>N/A</td>
-                        {% else %}
                         <td>{{ reward_info["price"] }}</td>
-                        {% endif %}
                         <td>{{ reward_info["info"] }}</td>
                         {% if reward_info["cooldown"] > 0 %}
                         {% set minutes_label = 'minute' if reward_info["cooldown"] == 1 else 'minutes' %}
@@ -110,13 +101,76 @@
                         <td>None</td>
                         {% endif %}
                         <td>{{ reward_info["categories"] | join(', ') }}</td>
+                        <td>
+                            <a href="{{ url_for('web_panels.edit', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: green;">Edit</span></button></a>&nbsp
+                            <a href="{{ url_for('web_panels.delete', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: red;">Delete</span></button></a>
+                    {% endif %}
+                    </tr>
+                {% endfor %}
+                </tbody>
+            </table>
+
+            <h3><u>Goals</u></h3>
+            <table>
+                <thead>
+                    <tr>
+                        <th style="width:15%">Name</th>
+                        <th>Target</th>
+                        <th>Info</th>
+                        <th>Category</th>
+                        <th style="width:15%">Actions</th>
+                    </tr>
+                </thead>
+                <tbody>
+                {% for reward, reward_info in rewards.items() %}
+                    {% if reward_info["type"] == "goal" %}
+                    {% if reward in active_rewards %}
+                    <tr>
+                    {% else %}
+                    <tr style="color: red;">
+                    {% endif %}
+                        <td>{{ prefix }}{{ reward }}</td>
+                        <td>{{ reward_info["target"] }}</td>
+                        <td>{{ reward_info["info"] }}</td>
+                        <td>{{ reward_info["categories"] | join(', ') }}</td>
                         <td>
                             <a href="{{ url_for('web_panels.edit', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: green;">Edit</span></button></a>&nbsp
                             <a href="{{ url_for('web_panels.delete', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: red;">Delete</span></button></a>&nbsp
-                            {% if reward_info["type"] == "goal" or reward_info["type"] == "vote"  %}
                             <a href="{{ url_for('web_panels.reset', reward_name=reward, reward_type=reward_info["type"]) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: orange;">Reset</span></button></a>
-                            {% endif %}
-                        </td>
+                    {% endif %}
+                    </tr>
+                {% endfor %}
+                </tbody>
+            </table>
+
+            <h3><u>Votes</u></h3>
+            <table>
+                <thead>
+                    <tr>
+                        <th style="width:15%">Name</th>
+                        <th>Price</th>
+                        <th>Info</th>
+                        <th>Category</th>
+                        <th style="width:15%">Actions</th>
+                    </tr>
+                </thead>
+                <tbody>
+                {% for reward, reward_info in rewards.items() %}
+                    {% if reward_info["type"] == "vote" %}
+                    {% if reward in active_rewards %}
+                    <tr>
+                    {% else %}
+                    <tr style="color: red;">
+                    {% endif %}
+                        <td>{{ prefix }}{{ reward }}</td>
+                        <td>{{ reward_info["price"] }}</td>
+                        <td>{{ reward_info["info"] }}</td>
+                        <td>{{ reward_info["categories"] | join(', ') }}</td>
+                        <td>
+                            <a href="{{ url_for('web_panels.edit', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: green;">Edit</span></button></a>&nbsp
+                            <a href="{{ url_for('web_panels.delete', reward_name=reward) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: red;">Delete</span></button></a>&nbsp
+                            <a href="{{ url_for('web_panels.reset', reward_name=reward, reward_type=reward_info["type"]) }}"><button class="button button2" onclick="openTab(event, 'managerewards')"><span style="color: orange;">Reset</span></button></a>
+                    {% endif %}
                     </tr>
                 {% endfor %}
                 </tbody>