Commit 85eca19f authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

add show products

parent bf0dc658
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
<label>Image :</label> <label>Image :</label>
<b-form-file <b-form-file
v-model="images" v-model="images"
multiple accept="image/*" multiple
:state="Boolean(images)" :state="Boolean(images)"
placeholder="Choose a image or drop it here..." placeholder="Choose a image or drop it here..."
drop-placeholder="Drop file here..." drop-placeholder="Drop file here..."
...@@ -125,9 +125,9 @@ ...@@ -125,9 +125,9 @@
</v-toolbar> </v-toolbar>
</template> </template>
<template v-slot:item.actions="{ item }"> <template v-slot:item.actions="{ item }">
<v-icon small @click=" editCategory(item.id)" :id ="item.id"> mdi-pencil </v-icon> <v-icon small @click="editCategory(item.id)" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-delete </v-icon> <v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-delete </v-icon>
<v-icon small @click="deleteProduct(item.id,item)" :id ="item.id"> mdi-account-details </v-icon> <v-icon small @click="showProduct(item.id)" :id ="item.id"> mdi-account-details </v-icon>
</template> </template>
<template v-slot:no-data> <template v-slot:no-data>
<v-btn color="primary" @click="initialize"> Reset </v-btn> <v-btn color="primary" @click="initialize"> Reset </v-btn>
...@@ -192,6 +192,7 @@ export default { ...@@ -192,6 +192,7 @@ export default {
{ text: 'Actions', value: 'actions', sortable: false }, { text: 'Actions', value: 'actions', sortable: false },
], ],
products: [], products: [],
product: [],
eID: '', eID: '',
eName:'', eName:'',
eOrdering:'', eOrdering:'',
...@@ -237,6 +238,7 @@ export default { ...@@ -237,6 +238,7 @@ export default {
methods: { methods: {
initialize() { initialize() {
this.products= []; this.products= [];
this.product= [];
}, },
editItem(item) { editItem(item) {
this.editedIndex = this.products.indexOf(item); this.editedIndex = this.products.indexOf(item);
...@@ -341,6 +343,22 @@ export default { ...@@ -341,6 +343,22 @@ export default {
} }
} }
}, },
showProduct(ID) {
const self = this;
try{
axios
.get(`http://127.0.0.1:8000/api/products/${ID}`,{
headers: {
"Content-Type": "multipart/form-data",
"Authorization": this.$auth.$storage.getUniversal("token")
}
} )
.then((response) => (this.product = response.data.data))
} catch(error){
console.log(error)
}
console.log(this.product)
},
// getID(item) { // getID(item) {
// console.log(this.products.indexOf(item)) // console.log(this.products.indexOf(item))
// }, // },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment