<template>
    <v-layout column fill-height>


            <v-toolbar  class="pa-1 mb-2" color="blue lighten-3" dark height="60px">
              <v-toolbar-title>STATUS ANTRIAN</v-toolbar-title>
              <v-spacer></v-spacer>

            </v-toolbar>


            <v-card class="pa-1 p-left-side grow" grow>
                <v-card-text class="pa-0">
                    <v-layout row wrap>

                        <v-flex >
                        <v-data-table :headers="headers" :items="xsummaries"   :loading="isLoading" hide-actions class="elevation-1">
                           <template slot="items" slot-scope="props">
                              <td  v-bind:class="{'amber lighten-4':props.item.selected}" @click="selectMe(props.item)">{{ props.item.serviceName }}</td>
                               <td style="text-align:center"  v-bind:class="{'amber lighten-4':props.item.selected}" @click="selectMe(props.item)">{{ props.item.total_queue }}</td>
                                <td  style="text-align:center" v-bind:class="{'amber lighten-4':props.item.selected}" @click="selectMe(props.item)">{{ props.item.total_queue - props.item.total_served  }}</td>
                             </template>

                        </v-data-table>
                        </v-flex>

                    </v-layout>
                    <v-divider></v-divider>
                    <v-layout row>
                       <v-flex xs12>
                          <v-progress-circular
                           v-if="false"
                           :rotate="360"
                           :size="100"
                           :width="15"
                           :value="persentase"
                           color="teal"
                        >
                           {{ value }}
                        </v-progress-circular>
                       </v-flex>
                    </v-layout>
                </v-card-text>



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

</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 = {
   components : {
      'one-dialog-info':httpVueLoader('../../common/oneDialogInfo.vue'),
      'one-dialog-alert':httpVueLoader('../../common/oneDialogAlert.vue')
   },
   mounted() {
   
   },
   methods : {
      getTime(val){
         return moment(val).format("HH:mm")
      }
   },
   computed: {
      persentase(){
         var total = 0
         var sisa = 0
         var alldata = this.$store.state.summary.summaries
         /*
         _.forEach(alldata, function(value) {
            total += total + value.total_queue
            sisa += sisa + value.total_served
         })
         return (sisa/total) * 100
         */
      },
      xsummaries(){
         return this.$store.state.summary.summaries
      },
      isLoading() {
         return this.$store.state.summary.load_summary == 1
      }
   },
   data() {
      return {
         headers: [
            {
               text: "Layanan",
               align: "left",
               sortable: false,
               value: "mr",
               width: "25%",
               class: " blue lighten-4"
            },
            {
               text: "Total Antrian",
               align: "center",
               sortable: false,
               value: "lab",
               width: "10%",
               class: "blue lighten-4"
            },
            {
               text: "Sisa Antrian",
               align: "center",
               sortable: false,
               value: "name",
               width: "10%",
               class: "blue lighten-4"
            }
         ]
      };
   }
}
</script>
