diff --git a/app/adapters/application.js b/app/adapters/application.js index bb87e0f..aaa0d95 100644 --- a/app/adapters/application.js +++ b/app/adapters/application.js @@ -7,13 +7,6 @@ export default class ApplicationAdapter extends JSONAPIAdapter { urlForUpdateRecord(id, modelName, snapshot) { return `api/${modelName}s`; - } - - createRecord(store, type, snapshot) { - let data = this.serialize(snapshot, { includeId: true }); - //let url = `/${type.modelName}`; - - // ... - } + } } diff --git a/app/components/hinzufuegen.hbs b/app/components/hinzufuegen.hbs new file mode 100644 index 0000000..5d3a2ad --- /dev/null +++ b/app/components/hinzufuegen.hbs @@ -0,0 +1,23 @@ +
+ + + + + +
\ No newline at end of file diff --git a/app/components/hinzufuegen.js b/app/components/hinzufuegen.js new file mode 100644 index 0000000..5fbac50 --- /dev/null +++ b/app/components/hinzufuegen.js @@ -0,0 +1,42 @@ +import Component from '@glimmer/component'; +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; + +export default class HinzufuegenController extends Component { + + @tracked titel; + @tracked kategorie; + @tracked menge; + @tracked einheit; + @tracked bild; + @tracked id; + @tracked isselected; + + @service store; + + + + @action speichern() + { + this.store.createRecord('produkt', { + type: 'produkt', + id: this.titel.split(' ').join(''), + attributes: { + titel: this.titel, + kategorie: this.kategorie, + menge: this.menge, + einheit: this.einheit, + bild: this.bild, + isselected: false + } + }).save(); + + this.titel = null; + this.kategorie = null; + this.menge = null; + this.einheit = null; + this.bild = null; + this.id = null; + } +} \ No newline at end of file diff --git a/app/components/produkt.hbs b/app/components/produkt.hbs index c50ee42..aa706e7 100644 --- a/app/components/produkt.hbs +++ b/app/components/produkt.hbs @@ -1,4 +1,4 @@ -