My SMM panel
 
 
 
 
 
 

70 lines
1.9 KiB

  1. <template>
  2. <div>
  3. <section class="pending-pane">
  4. <h4>Pending Orders</h4>
  5. <ul>
  6. <template v-bind:key='order.id' v-for="order in orders">
  7. <div class="pending-item" v-if="order.status == 'pending'">
  8. <div class="pending-heading">
  9. <li @click="togglePending($event)">{{order.service.name}} ({{order.updated_at}})</li>
  10. <img class="chevron" src="../../images/chevron-down.svg" alt="">
  11. </div>
  12. <div class="pending-content">
  13. <p>ID: {{order.id}}<br>URL: {{order.url}}<br>Quantity: {{order.quantity}}<br>Note: {{order.note}}</p>
  14. </div>
  15. </div>
  16. </template>
  17. </ul>
  18. </section>
  19. <section class="history-pane">
  20. <h4>Order History</h4>
  21. <table>
  22. <thead><th>Date</th><th>ID</th><th>Name</th><th>Status</th> <th>Quantity</th></thead>
  23. <tbody>
  24. <tr v-bind:key='order.id' v-for='order in orders.slice(historyPage*10-10, historyPage*10)'>
  25. <td>{{order.updated_at}}</td>
  26. <td>{{order.id}}</td>
  27. <td>{{order.service.name}}</td>
  28. <td :class="order.status"
  29. class="status"><span>{{order.status.charAt(0).toUpperCase() +
  30. order.status.slice(1)}}</span></td>
  31. <td>{{order.quantity}}</td>
  32. </tr>
  33. </tbody>
  34. </table>
  35. <img @click="moveHistory(false)" class="nav-btn left" src="../../images/arrow-left-circle-fill.svg" alt=""/>
  36. <p class="nav-legend">{{historyPage}}/{{Math.ceil(orders.length/10)}}</p>
  37. <img @click="moveHistory(true)" class="nav-btn right" src="../../images/arrow-right-circle-fill.svg" alt=""/>
  38. </section>
  39. </div>
  40. </template>
  41. <script>
  42. function togglePending(event) {
  43. event.target.parentNode.parentNode.classList.toggle('selected')
  44. }
  45. function moveHistory(forward) {
  46. if (forward) {
  47. this.historyPage += 1
  48. } else {
  49. this.historyPage -= 1
  50. }
  51. if (this.historyPage < 1) {
  52. this.historyPage = 1
  53. return
  54. } else if (this.historyPage > this.orders.length/10+1) {
  55. this.historyPage -= 1
  56. return
  57. }
  58. }
  59. export default {
  60. data() {return {historyPage: 1}},
  61. methods: {
  62. togglePending, moveHistory
  63. },
  64. props: ['orders']
  65. }
  66. </script>