Advertisement
Guest User

swannnnbis

a guest
Mar 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.55 KB | None | 0 0
  1. <template>
  2. <div>
  3. <h2 is="sui-header">Module {{ $route.params.reference }} - {{name}} </h2>
  4. <sui-grid class="centered">
  5. <sui-grid-column :width="8">
  6. <sui-divider fitted/>
  7. <p>Nombre d'étudiants inscrits au module : <b>{{numetu}}</b></p>
  8. <sui-divider hidden/>
  9. </sui-grid-column>
  10. </sui-grid>
  11.  
  12. <h3 is="sui-header" class="centered">Trophées ( {{numtro}} disponibles )</h3>
  13.  
  14. <sui-container>
  15. <sui-table color="orange" unstackable>
  16. <sui-table-header>
  17. <sui-table-row>
  18. <sui-table-header-cell>Nom</sui-table-header-cell>
  19. <sui-table-header-cell>Valeur</sui-table-header-cell>
  20. <sui-table-header-cell class="vue_small">Vote</sui-table-header-cell>
  21. <sui-table-header-cell>Délivrer</sui-table-header-cell>
  22. <sui-table-header-cell>Informations</sui-table-header-cell>
  23. </sui-table-row>
  24. </sui-table-header>
  25. <sui-table-body>
  26. <sui-table-row v-for="trophy in trophies" :key="trophy.nom">
  27. <sui-table-cell>{{trophy.titre}}</sui-table-cell>
  28. <sui-table-cell><img width=40 height=40 :src="'/static/images/imageTrophee' + trophy.type.charAt(0).toUpperCase() + trophy.type.slice(1) + '.png'" /></sui-table-cell>
  29. <sui-table-cell class="vue_small"><i class="check icon" v-if="!trophy.vote" ></i></sui-table-cell>
  30. <sui-table-cell ><DeliverTrophy :numodule="trophy.numod"/></sui-table-cell>
  31. <sui-table-cell text-align="right"><EditTrophy :id="trophy.nutroph" /></sui-table-cell>
  32. </sui-table-row>
  33. </sui-table-body>
  34. </sui-table>
  35. <CreateTrophy/>
  36. </sui-container>
  37. <div v-if="chargement" class="ui active dimmer">
  38. <div class="ui indeterminate text loader">Chargement ...</div>
  39. </div>
  40. </div>
  41. </template>
  42.  
  43. <script>
  44.  
  45. import DeliverTrophy from '@/components/DeliverTrophy'
  46. import EditTrophy from '@/components/EditTrophy'
  47. import CreateTrophy from '@/components/CreateTrophy'
  48. import axios from 'axios'
  49. import global from '@/globals.json'
  50.  
  51. export default {
  52.  
  53. components: {DeliverTrophy, EditTrophy, CreateTrophy},
  54. data () {
  55. return {
  56. id: this.$route.params.reference,
  57. name: 'loading...',
  58. numetu: '',
  59. numtro: '',
  60. errors: [],
  61. trophies: [],
  62. chargement: true
  63. }
  64. },
  65. mounted () {
  66. let promesse1 = []
  67. let promesse2 = []
  68. let promesse3 = []
  69. promesse1.push(axios.get(global.API + '/module/' + this.$route.params.reference)
  70. .then(res => {
  71. this.name = res.data[0].nom
  72. promesse2.push(axios.get(global.API + '/module/' + this.$route.params.reference)
  73. .then(res => {
  74. this.numetu = res.data.length
  75. })
  76. .catch(e => {
  77. this.errors.push(e)
  78. }))
  79. promesse3.push(axios.get(global.API + '/trophy/module/' + this.$route.params.reference)
  80. .then(res => {
  81. this.numtro = res.data.length
  82. this.trophies = res.data
  83. })
  84. .catch(e => {
  85. this.errors.push(e)
  86. }))
  87. })
  88. .catch(e => {
  89. this.errors.push(e)
  90. }))
  91. Promise.all(promesse1, promesse2, promesse3).then(() => {
  92. this.chargement = false
  93. })
  94. }
  95. }
  96. </script>
  97.  
  98. <style>
  99.  
  100. @media (max-width: 700px) {
  101. .vue_small {
  102. display: none;
  103. }
  104. }
  105. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement