+
+ Descr: {{ itemcat.descr_it }}
+
+
+
+
diff --git a/src/components/categories/SingleCat/index.ts b/src/components/categories/SingleCat/index.ts
new file mode 100644
index 0000000..afa4a14
--- /dev/null
+++ b/src/components/categories/SingleCat/index.ts
@@ -0,0 +1 @@
+export {default as SingleCat} from './SingleCat.vue'
diff --git a/src/components/categories/category/category.ts b/src/components/categories/category/category.ts
index b387e4e..19914b9 100644
--- a/src/components/categories/category/category.ts
+++ b/src/components/categories/category/category.ts
@@ -1,10 +1,15 @@
import Vue from 'vue'
import { Component } from 'vue-property-decorator'
+import { SingleCat } from '@components'
+import { ICategory } from '@src/model'
+
require('./category.scss')
-@Component({})
+@Component({
+ components: { SingleCat }
+})
export default class Category extends Vue {
filter: boolean = false
category: string = ''
@@ -20,21 +25,37 @@ export default class Category extends Vue {
this.updatetable()
}
+ initcat() {
+
+ const objcat: ICategory = {
+ id: 0,
+ descr_it: '',
+ descr_en: '',
+ descr_es: ''
+ }
+ return objcat
+
+ }
+
async insertCategory() {
+ const objcat = this.initcat()
+
let myid = 0
- const mycat = this.category
+ objcat.descr_it = this.category
+
// Add to Indexdb
- await this.$db.categories.add(
- { descr_it: mycat }
+ await this.$db.categories.add(objcat
).then(ris => {
myid = ris
})
// created_at: new Date(),
+ objcat.id = myid
+
// Add into the memory
- this.categories_arr.push({ descr_it: mycat, id: myid })
+ this.categories_arr.push(objcat)
this.updatetable()
}
diff --git a/src/components/categories/category/category.vue b/src/components/categories/category/category.vue
index be70f04..ca3f7a3 100644
--- a/src/components/categories/category/category.vue
+++ b/src/components/categories/category/category.vue
@@ -1,7 +1,7 @@