import ModalBase from 'ember-cli-dunlop/mixins/modal-base'
import lookupValidator from 'ember-changeset-validations'
import Changeset from 'ember-changeset'
import ModelValidations from 'ember-panda/validations/project'
validator = lookupValidator(ModelValidations)
export default ModalBase.extend
  selected_organizations: []
  possible_organizations: []
  willOpenModal: ->
    @set 'possible_organizations', @store.peekAll('panda/organization')
    @get("model.organizations").then (organizations)=>
      @set "selected_organizations", organizations.toArray()

  actions:
    saveRecord: ->
      @set("model.organizations", @get('selected_organizations'))
      @_super()
