adapt store actions

This commit is contained in:
2020-06-23 17:20:34 +02:00
parent 7dacf0441c
commit e75e22316e
5 changed files with 19 additions and 43 deletions
+7 -4
View File
@@ -4,9 +4,12 @@
<h3>{{@produkt.titel}}</h3>
<ul class="details">
<li class="detail"><h4>Menge:</h4> {{@produkt.menge}}{{@produkt.einheit}}</li>
<!--<li class="detail"><h4>this.ex:</h4> {{this.ex}}</li>
<li class="detail"><h4>this.prodn:</h4> {{this.prodn}}</li>
<li class="detail"><h4>produkt count:</h4> {{this.count}}</li>-->
</ul>
</div>
</button>
</button>
<!--<li class="detail"><h4>this.ex:</h4> {{this.ex}}</li>
<li class="detail"><h4>this.prodn:</h4> {{this.prodn}}</li>
<li class="detail"><h4>produkt count:</h4> {{this.count}}</li>-->
+8 -30
View File
@@ -6,10 +6,6 @@ import { inject as service } from '@ember/service';
export default class ProduktController extends Component {
@tracked isLarge = false;
@tracked isSelected = false;
@tracked ex = false;
@tracked isSet = false;
@tracked prodn = "test";
@tracked count = 0;
@service store;
@@ -26,18 +22,13 @@ export default class ProduktController extends Component {
@action getStatus(produktname)
{
this.prodn = produktname;
this.store.findAll('produkt')
.then(function(suchergebnis)
{
suchergebnis.forEach(element => {
if(element.titel==produktname)
{
this.exists = true;
this.isSelected = element.getStatus().isSelected;
this.ex = true;
this.isSelected = element.getStatus().isSelected;
}
});
@@ -52,26 +43,13 @@ export default class ProduktController extends Component {
{
//schreibt den aktuellen Zustand in den store
let suchergebnis = this.get('store').query('produkt', {
filter: {
titel: produktname
}});
this.prodn = suchergebnis.titel;
count = suchergebnisse.titel;
this.prodn = element.titel;
suchergebnisse.forEach(element => {
this.prodn = element.titel;
count++;
if(element.titel === produktname)
let suchergebnis = this.store.query('produkt', {
filter:
{
this.prodn = produktname;
element.isSelected = this.isSelected;
this.isSet = !this.isSet;
}
});
titel: produktname
}}).then(function(element)
{
element.isSelected = this.isSelected;
});;
}
}