<cut_modus> 
  <select id="{opts.f_id}" class='form-control short-4' data-table-id='6' onchange='{change}' disabled="{opts.field_disabled}">
    <option each="{ item in select_items }" value="{ item.modus }">{ item.modus }</option>
  </select>
  <script>
    'use strict';
    this.on('mount', () => {
      this.select = this.root.firstChild
    })

    this.on('modus', (species_id) => {
      fetch(`./php_scripts/get_cut_modus.php?species_id=${species_id}`)
      .then(res => res.json())
      .then(res => {
        if (res) {
          this.select_items = res
          //console.log('aaa', this.parent.header.card_id )
          //if (this.parent.header.card_id !== undefined) {
            //this.parent.trigger('modus', this.parent.header.card_id, res[0].modus, false)
            //this.parent.trigger('modus', this.parent.header.card_id, res[0].modus, true)
          //}
        }
      })
      .then(() => {
        fetch('./php_scripts/get_goodness_header.php?card_id=' +  this.parent.header.card_id )
        .then(res => res.json())
        .then(res => {
          //console.log(res)
          if (res) {
            if (opts.f_id == 'f_222_1') {
              this.select.value = res[0].f_222
            }
            else if (res.length == 2) {
              this.select.value = res[1].f_222
            }
          }
        })
        .catch(err => console.log(err))
      })
      .then(() => this.update())
      .catch(err => console.log(err))
    })

    this.on('init_modus', () => {
      console.log(this)
    })

    change (e) {
        let date = false
     if (opts.f_id == 'f_222_1') {
        this.parent.trigger('modus', this.parent.header.card_id, e.target.value, false)
      }
      else {
        this.parent.trigger('modus', this.parent.header.card_id, e.target.value, true)
      }

      //console.log(e.target)
    }
  </script>
</cut_modus>
