<template>
  <v-layout row justify-center>
    <v-dialog v-model="dialog_cytologi" persistent max-width="40%">
      <v-card>
        <v-card-title>
          <span class="headline">CYTOLOGI</span>
        </v-card-title>
        <v-card-text>
            <v-layout mb-2 row>
              <v-flex xs12>
                  <v-select
                      class="mini-select"
                      item-text="name"
                      return-object
                      outline
                      :items="doctors"
                      v-model="selected_doctor"
                      hide-details
                      label="Dokter"
                      disabled
                  ></v-select>
                  <p v-if="error_doctor" class="error pl-2 pr-2" style="color:#fff">Dokternya siapa ? jangan lupa ya ...</p>
              </v-flex>
            </v-layout>
            <v-layout wrap>
              <v-flex xs12>
                <v-layout v-for="result in results"  mb-2 row>
                    <v-flex xs12>
                        <v-textarea
                            auto-grow
                            :label="result.label"
                            outline
                            rows="2"
                            disabled
                            v-model="result.result"
                            hide-details
                        ></v-textarea>
                    </v-flex>
                </v-layout>
              </v-flex>
            </v-layout>
        </v-card-text>
        <v-card-actions>
          <v-spacer></v-spacer>
          <v-btn color="blue darken-1" flat @click="dialog_cytologi = false">Tutup</v-btn>

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

 <script>
 module.exports = {
   mounted() {
      //this.$store.dispatch("re_cytologi/get_doctors",{token:''})
   },
   data() {
      return {
        error_doctor:false
        
      };
   },
    computed: {
        dialog_cytologi: {
            get() {
                return this.$store.state.re_cytologi.dialog_cytologi
            },
            set(val) {
                this.$store.commit("re_cytologi/update_dialog_cytologi", val)
            }
        },
        results: {
            get() {
                return this.$store.state.re_cytologi.results
            },
            set(val) {
                this.$store.commit("re_cytologi/update_results", val)
            }
        },
        doctors(){
          return this.$store.state.re_cytologi.doctors
        },
        selected_doctor: {
            get() {
                return this.$store.state.re_cytologi.selected_doctor
            },
            set(val) {
                this.$store.commit("re_cytologi/update_selected_doctor", val)
            }
        }
    },
    methods: {
        saveResult_Cytologi(){
          this.$store.dispatch("re_cytologi/saveresult_cytologi",{results:this.results})
        }
    }
    
 }
</script>
