My SMM panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

127 line
3.7 KiB

  1. <template>
  2. <template v-if="!loading">
  3. <sidebar :role="user.role" :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/coin-stack.svg" alt="wallet" class="icon"/><p>Credits: {{(user.credits/100).toLocaleString('en')}}</p></section>
  8. <section class="alerts-pane"><h4>News and Announcements</h4>
  9. <p>We've just launched. Thanks for joining us! Some features are still
  10. being tested. If you experience a delay in credits being added to your
  11. account, please wait 24 hours before contacting support@trendplays.com.</p>
  12. </section>
  13. <section class="recent-pane"><h4>Recent Activity</h4>
  14. <table>
  15. <thead><th>Date</th><th>Name</th><th>Status</th> <th>Quantity</th></thead>
  16. <tbody>
  17. <tr v-bind:key='order.id' v-for='order in orders.slice(0, 10)'>
  18. <template v-if="order.status != 'pending'">
  19. <td>{{order.updated_at}}</td>
  20. <td>{{order.service.name}}</td>
  21. <td :class="order.status"
  22. class="status"><span>{{order.status.charAt(0).toUpperCase() +
  23. order.status.slice(1)}}</span></td>
  24. <td>{{order.quantity}}</td>
  25. </template>
  26. </tr>
  27. </tbody>
  28. </table>
  29. </section>
  30. </div>
  31. <past-orders :orders="orders" v-else-if="active === '#orders'" id="main">
  32. </past-orders>
  33. <new-order :preferred="user.payment_method" :token="token" :active="active" :credits="user.credits" v-else-if="active ===
  34. '#new-order' || active === '#credits'" id="main" @update-user='getUser' @update-orders='getOrders'>
  35. </new-order>
  36. <div id="main" v-else-if="active === '#exit'">
  37. <section class="logout-pane">
  38. <h3>Are you sure you want to logout?</h3>
  39. <a href="/logout">Logout</a>
  40. </section>
  41. </div>
  42. <settings :token="token" :user="user" class="settings-page" id="main"
  43. v-else-if="active === '#settings'">
  44. </settings>
  45. <transaction-end @purchase-complete="getUser" :token="token" :user="user"
  46. :active="active" v-else-if="active ==
  47. '#transaction-complete' || active == '#transaction-failed'">
  48. </transaction-end>
  49. <support v-else-if="active == '#support'" :user="user" :token="token"></support>
  50. </transition>
  51. </template>
  52. </template>
  53. <script>
  54. import Sidebar from './sidebar.vue'
  55. import Settings from './settings.vue'
  56. import PastOrders from './orders.vue'
  57. import NewOrder from './services.vue'
  58. import TransactionEnd from './transaction-endpoint.vue'
  59. import Support from './support.vue'
  60. function getServices() {
  61. return fetch("/panel/services", {
  62. method: 'GET',
  63. headers: {'Content-Type': 'application/json',
  64. 'Accept': 'application/json',
  65. 'X-XSRF-TOKEN': this.token}
  66. }).then(response => {
  67. response.json().then(data => {this.services = data})
  68. })
  69. }
  70. function getUser() {
  71. return fetch("/panel/user", {
  72. method: 'GET',
  73. headers: {'Content-Type': 'application/json',
  74. 'Accept': 'application/json',
  75. 'X-XSRF-TOKEN': this.token},
  76. }).then(response => {
  77. return response.json()
  78. }).then(data => {
  79. this.user = data
  80. })
  81. }
  82. function getOrders() {
  83. return fetch("/panel/orders", {
  84. method: 'GET',
  85. headers: {'Content-Type': 'application/json',
  86. 'Accept': 'application/json',
  87. 'X-XSRF-TOKEN': this.token},
  88. }).then(response => {
  89. return response.json()
  90. }).then(data => {
  91. this.orders = data
  92. })
  93. }
  94. export default {
  95. components: {
  96. Sidebar, Settings, PastOrders, NewOrder,
  97. TransactionEnd, Support
  98. },
  99. data() {
  100. return {active: window.location.hash, user: null,
  101. token: null, orders: null, loading: true,}
  102. },
  103. methods: {getUser, getServices, getOrders, },
  104. created() {
  105. let loaders = []
  106. loaders.push(this.getUser())
  107. loaders.push(this.getServices())
  108. loaders.push(this.getOrders())
  109. Promise.all(loaders).then(() => {
  110. this.loading = false
  111. })
  112. }
  113. }
  114. </script>