<template>
    <el-table :data="revisions" stripe>
        <el-table-column prop="revision_number" label="#" width="30px"></el-table-column>
        <el-table-column prop="created_at" label="Date" width="150px">
            <template slot-scope="scope">
                {{scope.row.created_at | readableDateTime}}
            </template>
        </el-table-column>
        <el-table-column prop="comment" label="Comment"></el-table-column>
        <el-table-column prop="user" label="User" width="100px"></el-table-column>
        <el-table-column prop="" label="File" align="center" width="50px">
            <template slot-scope="scope">
                <a :href="base_url + '/contractRevision/viewFile/' + scope.row.id" target="_blank">
                    <i class="el-icon-document"></i>
                </a>
            </template>
        </el-table-column>
    </el-table>
</template>

<script>
export default {
    props: ['data'],
    computed: {
        revisions() {
            return this.$store.state.revisions
        }
    },
    data: function() {
        return { base_url: BASE_URL }
    },
    filters: {
        readableDateTime: function(v) {
            return v ? moment(v).format('DD-MMM-YYYY HH:mm') : '';
        }
    }
}
</script>

<style lang="css">
</style>
