<template>
    <v-card class="xs12 md12 mt-2" flat>
        <!-- <v-card-title primary-title class="pt-1 pb-1 pl-2 pr-2">
          <div>
            <h3 class="headline mb-0">Histori Pasien</h3>
          </div>
        </v-card-title> -->

        <v-card-text class="pt-1 pb-1 pl-2 pr-2">
            <v-data-table :headers="headers" :items="histories" 
                hide-actions class="elevation-1">
                <template slot="items" slot-scope="props">
                    <td class="text-xs-left pa-2" >{{ format_date(props.item.T_OrderHeaderDate) }}</td>
                    <td class="text-xs-left pa-2" >{{ props.item.T_OrderHeaderLabNumber}}</td>
                    <td class="pa-2" >{{ props.item.T_TestName }}</td>
                </template>
            
            </v-data-table>
        </v-card-text>

        
    </v-card>
</template>

<style scoped>
    table.v-table tbody td,table.v-table tbody th {
        height: 40px;
    }

    table.v-table thead tr {
        height: 40px;
    }
</style>

<script>
module.exports = {
    computed : {
       histories(){
          return this.$store.state.history.histories
       }
    },

    data() {
        return {
            headers: [
                {
                    text: "TANGGAL",
                    align: "left",
                    sortable: false,
                    width: "20%",
                    class: "pa-2 blue lighten-3 white--text"
                },
                {
                    text: "NO. LAB",
                    align: "left",
                    sortable: false,
                    width: "20%",
                    class: "pa-2 blue lighten-3 white--text"
                },
                {
                    text: "PEMERIKSAAN",
                    align: "left",
                    sortable: false,
                    width: "60%",
                    class: "pa-2 blue lighten-3 white--text"
                }
            ]
        };
    },

    methods : {
        format_date(d) {
            return d.substr(0, 10).split('-').reverse().join('-')
        }
    }
}
</script>
