Commit 41585dec authored by TTS Kieu Tuan Anh's avatar TTS Kieu Tuan Anh

rs category

parent 189df397
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-container> <v-container>
<v-form ref="formEdit">
<v-row> <v-row>
<v-col cols="12"> <v-col cols="12">
<v-text-field <v-text-field
...@@ -70,6 +71,8 @@ ...@@ -70,6 +71,8 @@
item-value="id" item-value="id"
selected-color="primary" selected-color="primary"
selection-type="independent" selection-type="independent"
@update:open="onOpen"
@input="selectCategory"
/> />
</v-card-text> </v-card-text>
</v-card> </v-card>
...@@ -99,6 +102,7 @@ ...@@ -99,6 +102,7 @@
/> />
</v-col> </v-col>
</v-row> </v-row>
</v-form>
</v-container> </v-container>
<small>*indicates required field</small> <small>*indicates required field</small>
</v-card-text> </v-card-text>
...@@ -212,7 +216,7 @@ ...@@ -212,7 +216,7 @@
item-value="id" item-value="id"
selected-color="primary" selected-color="primary"
selection-type="independent" selection-type="independent"
:rule="singleRules" :rules="singleRules"
/> />
</v-card-text> </v-card-text>
</v-card> </v-card>
...@@ -448,8 +452,7 @@ export default { ...@@ -448,8 +452,7 @@ export default {
], ],
nameRules: [ nameRules: [
v => !!v || 'Name is required', v => !!v || 'Name is required',
v => v => (v && v.length <= 255) || 'Name must be less than 255 characters'
(v && v.length <= 255) || 'Name must be less than 255 characters'
], ],
requiredRules: [v => !!v || 'This field is required'], requiredRules: [v => !!v || 'This field is required'],
numberRules: [ numberRules: [
...@@ -478,6 +481,20 @@ export default { ...@@ -478,6 +481,20 @@ export default {
}, },
dialogDelete (val) { dialogDelete (val) {
val || this.closeDelete() val || this.closeDelete()
},
eParentId: function () {
if (this.eParentId.length > 1) {
this.$toast.error('please chose 1 -___-!', {
duration: 3000
})
}
},
parent_id: function () {
if (this.parent_id.length > 1) {
this.$toast.error('please chose 1 -___-!', {
duration: 3000
})
}
} }
}, },
created () { created () {
...@@ -573,9 +590,7 @@ export default { ...@@ -573,9 +590,7 @@ export default {
this.$axios this.$axios
.post('/categories/', fd, { .post('/categories/', fd, {
headers: { headers: {
Authorization: `Bearer ${this.$auth.$storage.getUniversal( Authorization: `Bearer ${this.$auth.$storage.getUniversal('token')}`
'token'
)}`
} }
}) })
.then((response) => { .then((response) => {
...@@ -691,6 +706,21 @@ export default { ...@@ -691,6 +706,21 @@ export default {
}, },
clearFile () { clearFile () {
this.file = null this.file = null
},
onOpen (e) {
if (!this.__initial) {
this.__initial = true
return
}
// this.eParentId.length = 0
console.log('toggle arrow clicked', e)
},
selectCategory (e) {
console.log(e[0])
console.log(this.eParentId)
// this.eParentId.length = 0
// this.eParentId.push(e[0])
} }
} }
} }
......
...@@ -128,8 +128,6 @@ ...@@ -128,8 +128,6 @@
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
sm="6"
md="4"
> >
<v-text-field <v-text-field
v-model="eName" v-model="eName"
...@@ -178,10 +176,17 @@ ...@@ -178,10 +176,17 @@
</v-col> </v-col>
<v-col v-if="files" cols="12"> <v-col v-if="files" cols="12">
<v-col v-for="(image, index) in files" :key="index" cols="12"> <v-col v-for="(image, index) in files" :key="index" cols="12">
<v-img :src="image" contain /> <v-img :src="image" contain height="100px" width="150px" display:flex/>
</v-col>
</v-col> </v-col>
<v-col v-for="(imageEdit, index) in eImages" :key="index" cols="12" text-align=" left" style="display:flex" >
<v-img
contain
height="100px"
width="150px"
:src="imageEdit"
/>
</v-col> </v-col>
<!-- <v-img v-if="typeof eImages === 'string'" :src="eImages" /> -->
<v-col cols="12"> <v-col cols="12">
<v-btn <v-btn
class="mx-2" class="mx-2"
...@@ -345,8 +350,6 @@ ...@@ -345,8 +350,6 @@
<v-row> <v-row>
<v-col <v-col
cols="12" cols="12"
sm="6"
md="4"
> >
<v-text-field <v-text-field
v-model="name" v-model="name"
...@@ -835,6 +838,7 @@ export default { ...@@ -835,6 +838,7 @@ export default {
this.eStock = item.stock this.eStock = item.stock
this.eDescription = item.description this.eDescription = item.description
this.eVariants = item.variants this.eVariants = item.variants
this.eImages = item.images
this.editedIndex = this.products.indexOf(item) this.editedIndex = this.products.indexOf(item)
console.log(item.variants) console.log(item.variants)
this.dialog3 = true this.dialog3 = true
...@@ -955,3 +959,9 @@ export default { ...@@ -955,3 +959,9 @@ export default {
} }
} }
</script> </script>
<style>
img {
width: 100px;
height: 150px;
}
</style>
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