Commit 30845731 authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

Merge branch 'dev' of...

Merge branch 'dev' of https://gitlab.kiaisoft.com/kiaisoft.anh.tran2/kiaisoft_tuananh_nuxt into feature/manage-products
parents 85eca19f c2d2891c
......@@ -23,13 +23,12 @@
min="1"
required
/>
<label>Parent ID :</label>
<input
type="text"
class="form-control mb-2"
placeholder="Parent ID"
v-model="parent_id"
/>
<label>Parent :</label>
<b-form-select v-model="parent_id">
<option v-for="item in categories" :value="item.id">
{{item.name}}
</option>
</b-form-select>
<label>Ordering :</label>
<input
type="text"
......@@ -65,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>
......@@ -179,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>
......@@ -204,7 +204,7 @@ export default {
middleware: ["web"],
data: () => {
return {
parent_id:'',
parent_id: null,
name:'',
ordering:'',
image: null,
......@@ -230,7 +230,7 @@ export default {
eID: '',
eName:'',
eOrdering:'',
eParent_id:'',
eParentId:null,
eImage: null,
message: [],
editedIndex: -1,
......@@ -319,13 +319,15 @@ export default {
});
},
createCategory() {
const self = this
const set = new Set([this.image]);
const image = Array.from(set);
const self = this;
axios
.post('http://127.0.0.1:8000/api/categories/',{
name: this.name,
ordering: this.ordering,
parent_id: this.parent_id,
image: this.image,
images: image,
}, {
headers: {
"Content-Type": "multipart/form-data",
......@@ -375,13 +377,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);
......@@ -391,8 +399,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