<template>
    <div>
        <div class="kit__body">
            <div class="lessons__list">
                <div class="lessons__item" v-for="(lesson, index) in lessons">
                    <div class="lessons__actions lessons__actions__no-hover">
                        <button type="button" class="lessons__action" @click="removeLesson(lesson.fields.id)">
                            <svg class="icon icon-delete">
                                <use xlink:href="/static/img/sprite.svg#icon-delete"></use>
                            </svg>
                        </button>
                        <button type="button" class="lessons__action" @click="editLesson(lesson.fields.id)">
                            <svg class="icon icon-edit">
                                <use xlink:href="/static/img/sprite.svg#icon-edit"></use>
                            </svg>
                        </button>
                    </div>
                    <div class="lessons__subtitle subtitle">{{lesson.fields.date}} // {{ lesson.fields.title }}</div>
                    <div class="lessons__row">
                        <div class="lessons__content">{{ lesson.fields.short_description }}</div>
                    </div>
                </div>
            </div>
            <div class="lessons__foot">
                <button type="button" class="lessons__btn btn btn_md" @click="addLesson">СОЗДАТЬ УРОК</button>
            </div>
        </div>
    </div>
</template>

<script>
    // import { ROLE_ADMIN, ROLE_AUTHOR } from './consts'
    // import LinkInput from './inputs/LinkInput'
    // import DatePicker from 'vuejs-datepicker'
    // import BlockText from './blocks/BlockText'
    // import BlockImage from './blocks/BlockImage'
    // import BlockImages from './blocks/BlockImages'
    // import BlockImageText from './blocks/BlockImageText'
    // import BlockVideo from './blocks/BlockVideo'
    // import LilSelect from "./inputs/LilSelect";
    // import LessonRedactor from "./LessonRedactor";
    // import {api} from "../js/modules/api";
    // import BlockAdd from "./blocks/BlockAdd";
    // import $ from 'jquery';
    // import {required, minValue, numeric, url } from 'vuelidate/lib/validators'
    // import slugify from 'slugify';
    // import Draggable from 'vuedraggable';
    import {showNotification} from "../js/modules/notification";
    // import createHistory from "history/createBrowserHistory";
    // import moment from 'moment'
    // import _ from 'lodash'

    export default {
        name: "leessons-admin",
        props: ["lessons"],
        methods: {
            addLesson() {
                window.location = '/course/create/live';
            },
            editLesson(id) {
                window.location = '/school/lessons/'+id+'/edit';
            },
            removeLesson(id) {
                showNotification('error', '<p>Вжух и удалили!<sup style="vertical-align: super;">(на самом деле нет)</sup></p>');
            }
        }
    }
</script>