Produkte der Rezepte auf Zettel anzeigen
This commit is contained in:
@@ -15,22 +15,32 @@ export default class HinzufuegenController extends Component {
|
||||
|
||||
@service store;
|
||||
|
||||
|
||||
|
||||
@action speichern()
|
||||
{
|
||||
this.store.createRecord('produkt', {
|
||||
let produkt = 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();
|
||||
//attributes: {
|
||||
titel: this.titel,
|
||||
kategorie: this.kategorie,
|
||||
menge: this.menge,
|
||||
einheit: this.einheit,
|
||||
bild: this.bild,
|
||||
isselected: false
|
||||
//}
|
||||
})
|
||||
|
||||
//produkt._promiseProxy = true;
|
||||
produkt.save();
|
||||
|
||||
this.store.findAll('produkt').then(function (suchergebnis) {
|
||||
suchergebnis.forEach(element => {
|
||||
if (element.titel != undefined) {
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
this.titel = null;
|
||||
this.kategorie = null;
|
||||
@@ -38,5 +48,8 @@ export default class HinzufuegenController extends Component {
|
||||
this.einheit = null;
|
||||
this.bild = null;
|
||||
this.id = null;
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -54,6 +54,7 @@ export default class ProduktController extends Component {
|
||||
if(element.titel==produktname)
|
||||
{
|
||||
element.isselected = selection;
|
||||
element._promiseProxy = true;
|
||||
element.save().catch(failure);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -30,6 +30,7 @@ export default class RezeptController extends Component {
|
||||
if(element.titel==rezeptname)
|
||||
{
|
||||
element.isselected = selection;
|
||||
element._promiseProxy = true;
|
||||
element.save().catch(failure);
|
||||
|
||||
function failure(reason)
|
||||
|
||||
@@ -7,9 +7,4 @@ export default class ProduktModel extends Model {
|
||||
@attr ('number') menge;
|
||||
@attr ('string') einheit;
|
||||
@attr ('string') bild;
|
||||
|
||||
get status()
|
||||
{
|
||||
return `${this.titel} ${this.isselected}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,5 @@ export default class RezeptModel extends Model {
|
||||
@attr ('number') personen;
|
||||
@attr ('string') bild;
|
||||
@attr gewuerze;
|
||||
|
||||
|
||||
get status()
|
||||
{
|
||||
return `${this.titel} ${this.IsSelected}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ export default class ProduktRoute extends Route {
|
||||
@service store;
|
||||
|
||||
async model() {
|
||||
return this.store.findAll('produkt');
|
||||
let produkte = this.store.findAll('produkt');
|
||||
let rezepte = this.store.findAll('rezept');
|
||||
|
||||
return {produkte, rezepte};
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,18 @@
|
||||
<Kategorie @titel={{"mein Zettel"}}>
|
||||
<div class="rentals">
|
||||
<ul class="resultsProdukt">
|
||||
{{#each @model as |produkt|}}
|
||||
{{#if produkt.isSelected}}
|
||||
{{#each @model.produkte as |produkt|}}
|
||||
{{#if produkt.isselected}}
|
||||
<Produkt @produkt={{produkt}}/>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{#each @model.rezepte as |rezept|}}
|
||||
{{#if rezept.isselected}}
|
||||
{{#each rezept.produkte as |produkt|}}
|
||||
<Produkt @produkt={{produkt.attributes}}/>
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</div>
|
||||
</Kategorie>
|
||||
Reference in New Issue
Block a user