Examples of code I've written in PHP, Javascript, SCSS, etc.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

101 lignes
2.6 KiB

  1. <template>
  2. <div>
  3. <section class="pending-pane">
  4. <div class="actions"><a class="new-order" href="#new-order">New</a><a
  5. class="new-order" href="#credits">Add Credits</a></div>
  6. <h4>Pending Orders</h4>
  7. <ul>
  8. <template v-bind:key='order.id' v-for="order in orders">
  9. <div class="pending-item" v-if="order.status == 'pending'">
  10. <div class="pending-heading">
  11. <li @click="togglePending($event)">{{order.service.name}} ({{order.updated_at}})</li>
  12. <img class="chevron" src="../../images/chevron-down.svg" alt="">
  13. </div>
  14. <div class="pending-content">
  15. <p>ID: {{order.id}}<br>URL: {{order.url}}<br>Quantity:
  16. {{order.quantity}}<br>Note: {{order.note}}</p>
  17. </div>
  18. </div>
  19. </template>
  20. </ul>
  21. </section>
  22. <div class="info-grey"><p>Orders are typically completed within 1-5
  23. days.</p><div></div></div>
  24. <section class="history-pane">
  25. <h4>Order History</h4>
  26. <div class="table-scroller">
  27. <table>
  28. <thead><th>Date</th><th>ID</th><th>Name</th><th>Status</th>
  29. <th>Quantity</th></thead>
  30. <tbody>
  31. <tr v-bind:key='order.id' v-for='order in
  32. orders.slice(historyPage*10-10, historyPage*10)'>
  33. <td>{{order.updated_at}}</td>
  34. <td>{{order.id}}</td>
  35. <td>{{order.service.name}}</td>
  36. <td :class="order.status"
  37. class="status"><span>{{order.status.charAt(0).toUpperCase() +
  38. order.status.slice(1)}}</span></td>
  39. <td>{{order.quantity}}</td>
  40. <td> <eye @click="select(order)"></eye> </td>
  41. </tr>
  42. </tbody>
  43. </table>
  44. </div>
  45. <img @click="moveHistory(false)" class="nav-btn left"
  46. src="../../images/arrow-left-circle-fill.svg" alt=""/>
  47. <p class="nav-legend">{{historyPage}}/{{Math.ceil(orders.length/10)}}</p>
  48. <img @click="moveHistory(true)" class="nav-btn right"
  49. src="../../images/arrow-right-circle-fill.svg" alt=""/>
  50. </section>
  51. <order-item v-if="selected" @close="close" :selected="selected"
  52. :token="token" @change-url="(url) => selected.url = url"></order-item>
  53. </div>
  54. </template>
  55. <script>
  56. import Eye from '../icons/eye-fill.vue'
  57. import OrderItem from './order-item.vue'
  58. function togglePending(event) {
  59. event.target.parentNode.parentNode.classList.toggle('selected')
  60. }
  61. function moveHistory(forward) {
  62. if (forward) {
  63. this.historyPage += 1
  64. } else {
  65. this.historyPage -= 1
  66. }
  67. if (this.historyPage < 1) {
  68. this.historyPage = 1
  69. return
  70. } else if (this.historyPage > this.orders.length/10+1) {
  71. this.historyPage -= 1
  72. return
  73. }
  74. }
  75. function close() {
  76. this.selected = null
  77. }
  78. function select(order) {
  79. this.selected = order
  80. }
  81. export default {
  82. components: {Eye, OrderItem},
  83. data() {return {historyPage: 1, selected: null}},
  84. methods: {
  85. togglePending, moveHistory, close, select
  86. },
  87. props: ['orders', 'token'],
  88. }
  89. </script>