Commit 9201a8ba authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

add select parent_id

parent 5d98f35a
...@@ -23,13 +23,12 @@ ...@@ -23,13 +23,12 @@
min="1" min="1"
required required
/> />
<label>Parent ID :</label> <label>Parent :</label>
<input <b-form-select v-model="parent_id">
type="text" <option v-for="item in categories" :value="item.id">
class="form-control mb-2" {{item.name}}
placeholder="Parent ID" </option>
v-model="parent_id" </b-form-select>
/>
<label>Ordering :</label> <label>Ordering :</label>
<input <input
type="text" type="text"
...@@ -38,7 +37,6 @@ ...@@ -38,7 +37,6 @@
v-model="ordering" v-model="ordering"
required required
/> />
<b-form-select v-model="selected" :options="options"></b-form-select>
<label>Image :</label> <label>Image :</label>
<b-form-file <b-form-file
@change="fileSelected" @change="fileSelected"
...@@ -205,7 +203,7 @@ export default { ...@@ -205,7 +203,7 @@ export default {
middleware: ["web"], middleware: ["web"],
data: () => { data: () => {
return { return {
parent_id:'', parent_id: null,
name:'', name:'',
ordering:'', ordering:'',
image: null, image: null,
...@@ -320,13 +318,15 @@ export default { ...@@ -320,13 +318,15 @@ export default {
}); });
}, },
createCategory() { createCategory() {
const self = this const set = new Set([this.image]);
const image = Array.from(set);
const self = this;
axios axios
.post('http://127.0.0.1:8000/api/categories/',{ .post('http://127.0.0.1:8000/api/categories/',{
name: this.name, name: this.name,
ordering: this.ordering, ordering: this.ordering,
parent_id: this.parent_id, parent_id: this.parent_id,
image: this.image, image: image,
}, { }, {
headers: { headers: {
"Content-Type": "multipart/form-data", "Content-Type": "multipart/form-data",
......
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