<commit_before><template>
  <div class="people page fixed-page">
    <div class="flexrow mt2 add-people">
      <span class="flexrow-item people-field-label">
        {{ $t('people.add_member_to_team') }}
      </span>
      <people-field
        ref="people-field"
        class="flexrow-item add-people-field"
        :people="unlistedPeople"
        @enter="addPerson"
        v-model="person"
      />
      <button
        class="button flexrow-item"
        @click="addPerson"
      >
        {{ $t('main.add') }}
      </button>
    </div>

    <production-team-list
      :entries="teamPersons"
      :is-loading="isTeamLoading"
      :is-error="isTeamLoadingError"
      @remove="removePerson"
    />
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'

import { sortPeople } from '../../lib/sorting'

import ProductionTeamList from '../lists/ProductionTeamList'
import PeopleField from '../widgets/PeopleField'

export default {
  name: 'people',
  components: {
    PeopleField,
    ProductionTeamList
  },

  data () {
    return {
      person: null,
      isTeamLoading: false,
      isTeamLoadingError: false
    }
  },

  computed: {
    ...mapGetters([
      'currentProduction',
      'productionMap',
      'openProductions',
      'personMap',
      'people'
    ]),

    teamPersons () {
      return sortPeople(this.currentProduction.team
        .map((personId) => this.personMap[personId]))
    },

    unlistedPeople () {
      return this.people.filter((person) => {
        return !this.currentProduction.team.includes(person.id)
      })
    }
  },

  methods: {
    ...mapActions([
      'addPersonToTeam'
    ]),

    addPerson () {
      this.addPersonToTeam(this.person)
      setTimeout(() => {
        this.$refs['people-field'].clear()
      }, 1)
    },

    removePerson (person) {
      this.removePersonFromTeam(person)<commit_msg>Do not allow to include unactive user into teams<commit_after><template>
  <div class="people page fixed-page">
    <div class="flexrow mt2 add-people">
      <span class="flexrow-item people-field-label">
        {{ $t('people.add_member_to_team') }}
      </span>
      <people-field
        ref="people-field"
        class="flexrow-item add-people-field"
        :people="unlistedPeople"
        @enter="addPerson"
        v-model="person"
      />
      <button
        class="button flexrow-item"
        @click="addPerson"
      >
        {{ $t('main.add') }}
      </button>
    </div>

    <production-team-list
      :entries="teamPersons"
      :is-loading="isTeamLoading"
      :is-error="isTeamLoadingError"
      @remove="removePerson"
    />
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'

import { sortPeople } from '../../lib/sorting'

import ProductionTeamList from '../lists/ProductionTeamList'
import PeopleField from '../widgets/PeopleField'

export default {
  name: 'people',
  components: {
    PeopleField,
    ProductionTeamList
  },

  data () {
    return {
      person: null,
      isTeamLoading: false,
      isTeamLoadingError: false
    }
  },

  computed: {
    ...mapGetters([
      'currentProduction',
      'productionMap',
      'openProductions',
      'personMap',
      'people'
    ]),

    teamPersons () {
      return sortPeople(this.currentProduction.team
        .map((personId) => this.personMap[personId]))
    },

    unlistedPeople () {
      return this.people.filter((person) => {
        return !this.currentProduction.team.includes(person.id) &&
          person.active
      })
    }
  },

  methods: {
    ...mapActions([
      'addPersonToTeam'
    ]),

    addPerson () {
      this.addPersonToTeam(this.person)
      setTimeout(() => {
        this.$refs['people-field'].clear()
      }, 1)
    },

    removePerson (person) {
      this.removePersonFromTeam(person)
{'fraction_non_alphanumeric': 0.14771547248182762, 'fraction_numerical': 0.0010384215991692627, 'mean_word_length': 2.3504347826086955, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3687127', 'n_tokens_mistral': 1206, 'n_tokens_neox': 1178, 'n_words': 200}