1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import Component from '@glimmer/component';
- import { action } from '@ember/object';
- import { tracked } from '@glimmer/tracking';
- 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;
-
- @action toggleSize()
- {
- this.isLarge = !this.isLarge;
- }
-
- @action toggleSelection(produktname)
- {
- this.isSelected = !this.isSelected;
- this.setStatus(produktname);
- }
-
- @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;
- }
- });
-
- if(!this.exists)
- {
- this.isSelected = false;
- }
- });
- }
-
- setStatus(produktname)
- {
-
- //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)
- {
- this.prodn = produktname;
- element.isSelected = this.isSelected;
- this.isSet = !this.isSet;
- }
- });
- }
- }
|