<template>
  <div class="text-xs-center">
    <v-dialog
      v-model="dialog"
      width="500"
    >

      <v-card>
        

        <v-card-title
          class="headline grey lighten-2"
          primary-title
        >
            Tolak Pemeriksaan   
        </v-card-title>

        <v-card-text>
            <v-radio-group v-model="selected_reject_action">
                <v-radio 
                    v-for="(unval, n) in reject_actions"
                    v-bind:key="n"
                    :label="unval.label"
                    :value="unval.val"></v-radio>
            </v-radio-group>
        </v-card-text>

        <v-card-actions>
            <v-btn
            color="primary"
            flat
            @click="dialog=!dialog"
          >
            Tutup
          </v-btn>
          <v-spacer></v-spacer>
          <v-btn
            color="primary"
            @click="reject"
            :disabled="!selected_reject_action"
            :dark="!!selected_reject_action"
          >
            Tolak
          </v-btn>
        </v-card-actions>
      </v-card>
    </v-dialog>
  </div>
</template>

<script>
module.exports = {
    data () {
        return {
          
        }
    },

    computed : {
        dialog : {
            get () { return this.$store.state.re_px.dialog_reject },
            set (v) { this.$store.commit("re_px/update_dialog_reject", v) }
        },

        reject_actions () {
            return this.$store.state.re_px.reject_actions
        },

        selected_reject_action : {
            get () { return this.$store.state.re_px.selected_reject_action },
            set (v) { this.$store.commit('re_px/update_selected_reject_action', v) }
        }
    },

    methods : {
        reject () {
            this.$store.dispatch('re_px/reject')
            this.dialog = false
        }
    }
}
</script>
