<template>
    <v-layout row wrap>
        <v-flex xs12>
            <v-container fluid grid-list-md>
                <v-layout row wrap>
                    <v-flex xs12 sm6 md4 lg4 v-for="(polozka, zIndex) in zoznam" :key="zIndex">
                        <polozka :atributy="polozka" @otvoritKategoriu="otvoritKategoriu" @otvoritUcebnicu="otvoritUcebnicu"></polozka>
                    </v-flex>
                </v-layout>
            </v-container>
        </v-flex>
    </v-layout>
</template>

<script>
  import Polozka from './Polozka'

  export default {
    name: 'ZoznamKategorii',
    components: {
      Polozka
    },
    props: {
      zoznam: {
        type: Array,
        required: true
      },
      loading: {
        type: Boolean,
        default: false
      }
    },
    data() {
      return {}
    },
    computed: {},
    methods: {
      otvoritKategoriu (data) {
        this.$router.push({
          name: 'Učebné materiály',
          params: {
            kategoria_id: data.id
          }
        })
      },
      otvoritUcebnicu (data) {
        this.$router.push({
          name: 'Učebný materiál',
          params: {
            kategoria_id: data.kategoria_id,
            ucebnica_id: data.id
          }
        })
      }
    },
    watch: {},
  }
</script>

<style scoped></style>
