65 lines
2.2 KiB
Vue
65 lines
2.2 KiB
Vue
<template>
|
|
<div>
|
|
<div class="card">
|
|
<div class="card-header">
|
|
Instants gagnants
|
|
<button v-if="cangenerate" class="btn btn-sm btn-success float-right" @click="generate()"><i class="fas fa-cog"></i> Générer</button>
|
|
<button v-else class="btn btn-sm btn-success float-right"><i class="far fa-copy"></i> Exporter</button>
|
|
</div>
|
|
|
|
<!-- TODO : Export des donnnées dans le presse papier avec v-clipboard -->
|
|
<div class="card-body">
|
|
<table class="table table-sm table-striped text-center">
|
|
<thead class="thead-light">
|
|
<tr>
|
|
<th class="w-25" scope="col">Date d'apparition</th>
|
|
<th class="w-50" scope="col">Lot</th>
|
|
<th class="w-25" scope="col">Etat</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr v-for="item in datas" v-bind:key="item.id">
|
|
<td>{{item.appear_date}}</td>
|
|
<td>{{item.prize.label_one}}</td>
|
|
<td></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
mounted() {
|
|
console.log('Instant Win Component mounted.');
|
|
this.datas = JSON.parse(this.instantwin);
|
|
},
|
|
props: {
|
|
cangenerate: Number,
|
|
startdate: String,
|
|
enddate: String,
|
|
instantwin: String
|
|
},
|
|
data() {
|
|
return {
|
|
datas: [],
|
|
response: null
|
|
}
|
|
},
|
|
methods: {
|
|
generate() {
|
|
axios.get('/bo/ajax/instant-win-generate')
|
|
.then(
|
|
response => (this.datas = response.data)
|
|
)
|
|
.catch(function (error) {
|
|
console.log(error);
|
|
this.response = "Erreur lors de la génération.";
|
|
});
|
|
this.cangenerate = 0;
|
|
}
|
|
}
|
|
}
|
|
</script>
|