My SMM panel
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

108 satır
3.0 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/coin-stack.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" :active="active" :credits="user.credits" v-else-if="active ===
  32. '#new-order' || active === '#credits'" id="main" @update-user='getUser' @update-orders='getOrders'>
  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. return fetch("/panel/services", {
  51. method: 'GET',
  52. headers: {'Content-Type': 'application/json',
  53. 'Accept': 'application/json',
  54. 'X-XSRF-TOKEN': this.token}
  55. }).then(response => {
  56. response.json().then(data => {this.services = data})
  57. })
  58. }
  59. function getUser() {
  60. return fetch("/panel/user", {
  61. method: 'GET',
  62. headers: {'Content-Type': 'application/json',
  63. 'Accept': 'application/json',
  64. 'X-XSRF-TOKEN': this.token},
  65. }).then(response => {
  66. return response.json()
  67. }).then(data => {
  68. this.user = data
  69. })
  70. }
  71. function getOrders() {
  72. return fetch("/panel/orders", {
  73. method: 'GET',
  74. headers: {'Content-Type': 'application/json',
  75. 'Accept': 'application/json',
  76. 'X-XSRF-TOKEN': this.token},
  77. }).then(response => {
  78. return response.json()
  79. }).then(data => {
  80. this.orders = data
  81. })
  82. }
  83. export default {
  84. components: {
  85. Sidebar, Settings, PastOrders, NewOrder
  86. },
  87. data() {
  88. return {active: window.location.hash, user: null,
  89. token: null, orders: null, loading: true,}
  90. },
  91. methods: {getUser, getServices, getOrders},
  92. created() {
  93. let loaders = []
  94. loaders.push(this.getUser())
  95. loaders.push(this.getServices())
  96. loaders.push(this.getOrders())
  97. Promise.all(loaders).then(() => {
  98. this.loading = false
  99. })
  100. }
  101. }
  102. </script>