<template>
<div>

    <!-- dialog delete -->
    <v-dialog v-model="dialog_reject" persistent width="500">
        <v-card>
            <v-card-title class="headline grey lighten-2" primary-title>
                KONFIRMASI REJECT 
            </v-card-title>
            <v-card-text>
                <p>
                  Isi alasan reject
                  <span class="font-weight-bold"> {{ selected_list_data.MutasiRequestNumber }} </span>
                  ?
                </p>
                <v-layout row wrap>
                    <v-flex xs12>
                        <v-textarea
                            v-model="note_reject" hide-details 
                            auto-grow rows="1" label="Catatan" outline
                        ></v-textarea>
                    </v-flex>
                </v-layout>
            </v-card-text>
            <v-divider></v-divider>
            <v-card-actions>
                <v-spacer></v-spacer>
                <v-btn color="red" flat outline @click="dialog_reject = false">
                    TIDAK
                </v-btn>
                <v-btn color="green" flat outline @click="btnDoReject()">
                    YA
                </v-btn>
            </v-card-actions>
        </v-card>
    </v-dialog>
</div>
</template>

<script>
module.exports = {
    data() {
        return {
            
        }
    },
    computed: {
        dialog_reject: {
            get() {
                return this.$store.state.mutasi.dialog_reject;
            },
            set(val) {
                this.$store.commit("mutasi/update_dialog_reject", val);
            }
        },
        note_reject: {
            get() {
                return this.$store.state.mutasi.note_reject;
            },
            set(val) {
                this.$store.commit("mutasi/update_note_reject", val);
            }
        },
        selected_list_data() {
            return this.$store.state.mutasi.selected_list_data;
        }
    },
    methods: {
        btnDoReject() {
            let selected = this.$store.state.mutasi.selected_list_data
            this.$store.dispatch("mutasi/rejectMutasiRequest", {
                mutasiRequestID: selected.MutasiRequestID,
                reject_note: this.note_reject
            });
        }
    },
}
</script>