Commit 5b0c67dc authored by vietanh-0511's avatar vietanh-0511

update categories

parent 9201a8ba
......@@ -64,20 +64,21 @@
v-model="eName"
max="255"
min="1"
value="this?.eName"
/>
<label>Parent ID :</label>
<input
type="text"
class="form-control mb-2"
placeholder="Parent ID"
v-model="eParent_id"
/>
<label>Parent :</label>
<b-form-select v-model="eParentId">
<option v-for="item in categories" :value="item.id" :key="item.id">
{{item.name}}
</option>
</b-form-select>
<label>Ordering :</label>
<input
type="text"
class="form-control mb-2"
placeholder="Ordering"
v-model="eOrdering"
value="this?.eOrdering"
/>
<!-- <b-form-select v-model="selected" :options="options"></b-form-select> -->
<label>Image :</label>
......@@ -178,7 +179,7 @@
</v-toolbar>
</template>
<template v-slot:item.actions="{ item }">
<v-icon small class="mr-2" @click=" editCategory(item.id)" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small class="mr-2" @click="editCategory(item)" :id ="item.id"> mdi-pencil </v-icon>
<v-icon small @click="deleteCategory(item.id,item)" :id ="item.id"> mdi-delete </v-icon>
</template>
<template v-slot:no-data>
......@@ -229,7 +230,7 @@ export default {
eID: '',
eName:'',
eOrdering:'',
eParent_id:'',
eParentId:null,
eImage: null,
message: [],
editedIndex: -1,
......@@ -326,7 +327,7 @@ export default {
name: this.name,
ordering: this.ordering,
parent_id: this.parent_id,
image: image,
images: image,
}, {
headers: {
"Content-Type": "multipart/form-data",
......@@ -377,13 +378,19 @@ export default {
getID(item) {
console.log(this.categories.indexOf(item))
},
editCategory(userID) {
editCategory(item) {
this.$bvModal.show('modal-edit');
this.eID = userID;
this.eID = item.id;
this.eName= item.name,
this.eOrdering= item.ordering,
this.eParentId= item.parent_id,
this.eImage= item.images,
console.log(this?.eID);
console.log(this.eName);
console.log(item);
},
updateCategory(userID) {
const set = new Set([this.eImage]);
const image = Array.from(set);
const self = this
console.log(this.eName);
console.log(this.eOrdering);
......@@ -393,8 +400,8 @@ export default {
.post(`http://127.0.0.1:8000/api/categories/update/${this?.eID}`,{
name: this.eName,
ordering: this.eOrdering,
parent_id: this.eParent_id,
image: this.eImage }, {
parent_id: this.eParentId,
images: image }, {
headers: {
"Content-Type": "multipart/form-data",
"Authorization": this.$auth.$storage.getUniversal("token")
......
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