My SMM panel
 
 
 
 
 
 

107 lines
3.1 KiB

  1. <template>
  2. <template v-if="!loading">
  3. <sidebar :active="active"></sidebar>
  4. <transition name="fade" mode="out-in">
  5. <div v-if="active === ''" id="main">
  6. <section class="welcome-pane"><h3>Welcome, {{user.name}}!</h3></section>
  7. <section class="credits-pane"><img src="../../images/wallet2.svg" alt="wallet" class="icon"/><p>Credits: ${{user.credits}}</p></section>
  8. <section class="alerts-pane"><h4>News and Announcements</h4>
  9. <p>We've just launched. Thanks for joining us.</p>
  10. </section>
  11. <section class="recent-pane"><h4>Recent Activity</h4>
  12. <table>
  13. <thead><th>Date</th><th>Name</th><th>Status</th> <th>Quantity</th></thead>
  14. <tbody>
  15. <tr v-bind:key='order.id' v-for='order in orders.slice(0, 10)'>
  16. <template v-if="order.status != 'pending'">
  17. <td>{{order.updated_at}}</td>
  18. <td>{{order.service.name}}</td>
  19. <td :class="order.status"
  20. class="status"><span>{{order.status.charAt(0).toUpperCase() +
  21. order.status.slice(1)}}</span></td>
  22. <td>{{order.quantity}}</td>
  23. </template>
  24. </tr>
  25. </tbody>
  26. </table>
  27. </section>
  28. </div>
  29. <PastOrders :orders="orders" v-else-if="active === '#orders'" id="main">
  30. </PastOrders>
  31. <NewOrder :token="token" :credits="user.credits" v-else-if="active ===
  32. '#new-order'" id="main" @updateUser='updateUser'>
  33. </NewOrder>
  34. <div id="main" v-else-if="active === '#exit'">
  35. <section class="logout-pane">
  36. <h3>Are you sure you want to logout?</h3>
  37. <a href="/logout">Logout</a>
  38. </section>
  39. </div>
  40. <settings :token="token" :user="user" class="settings-page" id="main" v-else-if="active === '#settings'"></settings>
  41. </transition>
  42. </template>
  43. </template>
  44. <script>
  45. import Sidebar from './sidebar.vue'
  46. import Settings from './settings.vue'
  47. import PastOrders from './orders.vue'
  48. import NewOrder from './services.vue'
  49. /* function getServices() { */
  50. /* } */
  51. /* function getServices() { */
  52. /* fetch("/panel/services", { */
  53. /* method: 'GET', */
  54. /* headers: {'Content-Type': 'application/json', */
  55. /* 'Accept': 'application/json', */
  56. /* 'X-XSRF-TOKEN': this.token} */
  57. /* }).then(response => { */
  58. /* response.json().then(data => {this.services = data}) */
  59. /* }) */
  60. /* } */
  61. function updateUser() {
  62. fetch("/panel/user", {
  63. method: 'GET',
  64. headers: {'Content-Type': 'application/json',
  65. 'Accept': 'application/json',
  66. 'X-XSRF-TOKEN': this.token},
  67. }).then(response => {
  68. return response.json()
  69. }).then(data => {
  70. this.user = data
  71. })
  72. }
  73. export default {
  74. components: {
  75. Sidebar, Settings, PastOrders, NewOrder
  76. },
  77. data() {
  78. return {active: window.location.hash, user: null,
  79. token: null, orders: null, loading: true}
  80. },
  81. methods: {updateUser},
  82. created() {
  83. fetch("/panel/services", {
  84. method: 'GET',
  85. headers: {'Content-Type': 'application/json',
  86. 'Accept': 'application/json',
  87. 'X-XSRF-TOKEN': this.token}
  88. }).then(response => {
  89. response.json().then(data => {this.services = data; this.loading = false})
  90. }).then(
  91. fetch("/panel/services", {
  92. method: 'GET',
  93. headers: {'Content-Type': 'application/json',
  94. 'Accept': 'application/json',
  95. 'X-XSRF-TOKEN': this.token}
  96. }).then(response => {
  97. response.json().then(data => {this.services = data; this.loading = false})
  98. }))
  99. }
  100. }
  101. </script>