<template>
   <v-layout class="fill-height" column>
      <v-card class="grow">
         <v-subheader>
            <h3 class="title">DAFTAR PENERIMAAN SPECIMEN HANDLING</h3>
         </v-subheader>
            <hr style="border-top:0px solid #c8c8c8;"></hr>
         <v-data-table
            :headers="headers" :items="patients"
            :loading="isLoading"
            hide-actions class="xelevation-1">
            <template slot="items" slot-scope="props">
               <td class="text-xs-left pl-2 pr-2" 
                   @click="select(props.item)">
                  {{ oneMoment(props.item.date) }}
               </td>
               <td class="text-xs-left pl-2 pr-2" 
                   @click="select(props.item)">
                  {{ props.item.lab }}
               </td>
               <td class=" pl-2 pr-2" 
                   @click="select(props.item)">
                  {{ props.item.sid}}
               </td>
               <td class="text-xs-left pl-2 pr-2" 
                   @click="select(props.item)">
                  {{ props.item.name }}
               </td>
               <td class="text-xs-left pl-2 pr-2" 
                   @click="select(props.item)">
                   <v-btn v-show="props.item.status == 'SAMPLING.Handling.From.Verification'" block flat>Diterima</v-btn>
                   <v-btn v-show="props.item.status == 'SAMPLING.Handling.Process'" block flat color="green">Diproses</v-btn>
                   <v-btn v-show="props.item.status == 'SAMPLING.Handling.Reject'" block flat color="red">Ditolak</v-btn>
               </td>
               <td class="text-xs-left pl-2 pr-2 text-xs-center">
                   <v-btn flat icon color="red"
                   @click="remove(props.item)"
                   v-show="props.item.status == 'SAMPLING.Handling.From.Verification'">
                        <v-icon>delete</v-icon>
                  </v-btn>
                  
               </td>
            </template>

         </v-data-table>

      </v-card>
   </v-layout>
</template>

<style scoped>
.searchbox .v-input.v-text-field .v-input__slot{
   min-height:60px;
}
.searchbox .v-btn {
   min-height:60px;
}
table.v-table tbody td,table.v-table tbody th {
   height: 40px;
}

table.v-table thead tr {
   height: 40px;
}

</style>

<script>
module.exports = {
   data() {
      return {
         query: "",
         items: [],
         headers: [
            {
               text: "KIRIM",
               align: "left",
               sortable: false,
               value: "mr",
               width: "20%",
               class: "pa-2 blue lighten-3 white--text"
            },
            {
               text: "NO LAB",
               align: "left",
               sortable: false,
               value: "mr",
               width: "15%",
               class: "pa-2 blue lighten-3 white--text"
            },
            {
               text: "SAMPLE ID",
               align: "left",
               sortable: false,
               value: "lab",
               width: "15%",
               class: "pa-2 blue lighten-3 white--text"
            },
            {
               text: "NAMA",
               align: "left",
               sortable: false,
               value: "name",
               width: "25%",
               class: "pa-2 blue lighten-3 white--text"
            },

            {
               text: "STATUS",
               align: "center",
               sortable: false,
               value: "status",
               width: "15%",
               class: "pa-2 blue lighten-3 white--text"
            },

            {
               text: "ACTION",
               align: "center",
               sortable: false,
               value: "status",
               width: "10%",
               class: "pa-2 blue lighten-3 white--text"
            }
         ],


         isLoading: false
         
      };
   },

   methods : {
      oneMoment : function(d) {
         return window.oneMoment(d)
      },

      select (item) {
         // this.$store.commit('ver_verification/update_selected_sent_sample', item)
      },

      remove (item) {
         this.$store.commit('receive_patient/update_selected_sent_sample', item)
         this.$store.dispatch('receive_patient/remove')
      }
   },

   computed : {
      patients () {
         return this.$store.state.receive_patient.sent_patients
      }
   }
}
</script>
