My SMM panel
 
 
 
 
 
 

85 líneas
2.5 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" v-else-if="active === '#new-order'" id="main">
  32. </NewOrder>
  33. <div id="main" v-else-if="active === '#exit'">
  34. <section class="logout-pane">
  35. <h3>Are you sure you want to logout?</h3>
  36. <a href="/logout">Logout</a>
  37. </section>
  38. </div>
  39. <settings :token="token" :user="user" class="settings-page" id="main" v-else-if="active === '#settings'"></settings>
  40. </transition>
  41. </template>
  42. </template>
  43. <script>
  44. import Sidebar from './sidebar.vue'
  45. import Settings from './settings.vue'
  46. import PastOrders from './orders.vue'
  47. import NewOrder from './services.vue'
  48. /* function getServices() { */
  49. /* } */
  50. /* function getServices() { */
  51. /* fetch("/panel/services", { */
  52. /* method: 'GET', */
  53. /* headers: {'Content-Type': 'application/json', */
  54. /* 'Accept': 'application/json', */
  55. /* 'X-XSRF-TOKEN': this.token} */
  56. /* }).then(response => { */
  57. /* response.json().then(data => {this.services = data}) */
  58. /* }) */
  59. /* } */
  60. export default {
  61. components: {
  62. Sidebar, Settings, PastOrders, NewOrder
  63. },
  64. data() {
  65. return {active: window.location.hash, user: '',
  66. token: '', orders: '', loading: true}
  67. },
  68. methods: {},
  69. beforeCreate() {
  70. fetch("/panel/services", {
  71. method: 'GET',
  72. headers: {'Content-Type': 'application/json',
  73. 'Accept': 'application/json',
  74. 'X-XSRF-TOKEN': this.token}
  75. }).then(response => {
  76. response.json().then(data => {this.services = data; this.loading = false})
  77. })
  78. }
  79. }
  80. </script>