<template>
  
    <v-dialog
      v-model="dialog"
      width="500px"
    >
      

      <v-card>
        <v-card-title
          class="headline grey lighten-2 pt-2 pb-2"
          primary-title
        >
          Selesai
        </v-card-title>
        <v-card-text class="pt-2 pb-2">
          <v-layout column>
            <v-flex xs12 pt-3 pb-3 class="text-md-center">
              <h6 class="display-1 text-center">PROSES SELESAI</h6>
            </v-flex>
            <v-flex xs12 pt-3 pb-3 class="text-md-center">
              

              <v-btn
                color="orange"
                dark
                @click="print_receipt"
              >
                Cetak Resep
              </v-btn>

              <v-btn
                color="green"
                dark
                @click="print_resume"
              >
                Cetak Resume
              </v-btn>
            </v-flex>
            <v-flex xs12 pt-3 pb-3 class="text-md-center" v-show="queue_number != '' && queue_number != '-'">
              <h6 class="headline text-center">ANTRIAN LAB :</h6>
            </v-flex>
            <v-flex xs12 class="text-md-center" v-show="queue_number != '' && queue_number != '-'">
              <h6 class="display-3 text-center"><span class="red white--text pl-3 pr-3">{{ queue_number }}</span></h6>
            </v-flex>
            <v-flex xs12 b-3 class="text-md-center" v-show="queue_number != '' && queue_number != '-'">
              <v-btn
                color="blue"
                dark
                @click="print_queue"
              >
                Cetak Antrian Lab
              </v-btn>
            </v-flex>
          </v-layout>
          
        </v-card-text>
        <v-divider></v-divider>

        <v-card-actions>
          

          <v-spacer></v-spacer>
          <v-btn
            color="primary"
            flat
            @click="dialog=false"
          >
            Tutup
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  
</template>

<style scoped>
</style>

<script>
module.exports = {
    components : {
    },
    methods : {
        print_receipt () {
         let id = this.$store.state.order.last_order_id
         this.$store.dispatch('order/print_receipt', id)
       },

       print_resume () {
         let id = this.$store.state.order.last_order_id
         this.$store.dispatch('order/print_resume', id)
       },

       print_queue () {
         let id = this.$store.state.order.last_order_id
         this.$store.dispatch('order/print_queue', id)
       }
    },
    computed : {
       dialog: {
          get() {
             return this.$store.state.order.finish_dialog_is_active;
          },
          set(val) {
             this.$store.commit('order/update_finish_dialog_is_active', val);
          }
       },

       queue_number () {
         return this.$store.state.order.queue_number
       }
    }
}
</script>
