<template>
    <div>
       <v-layout align-center row>
          <v-flex xs12>
             <v-card tile flat color=" pa-2 teal lighten-4">
                <h5 class=" subtitle-1 font-weight-bold">DATA PASIEN</h5>
             </v-card>
          </v-flex>
       </v-layout>
       <v-layout row wrap>
 
          <v-flex xs12>
 
             <v-layout>
                <v-flex xs3 pa-2>
                   <v-layout row wrap>
                      <v-flex v-if="patient.info" xs12>
                         <v-btn class="mt-0 mb-0" deppressed small @click="getHistories()"
                            color="teal lighten-3 white--text" block>
                            kunjungan ke 1
                         </v-btn>
                      </v-flex>
                      <v-flex xs12>
                         <v-card tile>
                            <v-img :src="patient_photo" aspect-ratio="1" class="teal lighten-2 pt-2" contain>
                               <template v-slot:placeholder>
                                  <v-layout fill-height align-center justify-center ma-0>
                                     <v-progress-circular indeterminate color="grey lighten-5"></v-progress-circular>
                                  </v-layout>
                               </template>
                            </v-img>
                         </v-card>
                      </v-flex>
                      <v-flex xs12>
                         <v-btn class="mt-0 mb-0" deppressed small color="teal lighten-3 white--text">
                            Update Foto
                         </v-btn>
                         <!--  </v-flex>
                         <v-flex xs12>
                            <v-btn
                               small
                               color="teal lighten-3 white--text"
                               :dark="patient.M_PatientID ? true : false"
                               block
                               @click="edit_patient"
                               :disabled="!patient.M_PatientID"
                               class="mt-1"
                               >
                               Ubah Data
                            </v-btn>
                         </v-flex>
                         <v-flex xs12>
                            <v-btn
                               small
                               color="teal lighten-3 white--text"
                               :dark="patient.M_PatientID ? true : false"
                               block
                               @click="generate_card"
                               :disabled="!patient.M_PatientID"
                               class="mt-1"
                               >
                               Cetak Kartu
                            </v-btn>
                         </v-flex>  -->
                         <v-divider></v-divider>
                         <v-flex mt-0 xs12>
                         </v-flex>
 
                         <!--<v-flex xs12 v-if="patient.info">
                         <div v-show="patient.info.birthday == 'Y'">Happy Birthday !</div>
                   </v-flex>-->
                   </v-layout>
 
 
 
                </v-flex>
 
                
 
 
 
             </v-layout>
 
          </v-flex>
 
 
 
          <patient-photo-dialog></patient-photo-dialog>
       </v-layout>
 
    </div>
 </template>
 
 <style scoped>
 .v-messages {
    display: none;
 }
 
 .v-input__slot {
    margin-bottom: 0px;
 }
 </style>
 
 <script>
 
 module.exports = {
    components: {
       'patient-search-dialog': httpVueLoader('./patientSearchDialog.vue'),
       'patient-history-dialog': httpVueLoader('./patientHistoryDialog.vue'),
       'patient-photo-dialog': httpVueLoader('./oneDialogPhoto.vue')
    },
    data() {
       return {
          showinfo: false,
          dialog_card: false,
          rpt_card: ''
       };
    },
    computed: {
    },
    methods: {
       update_photo() {
          this.$store.commit('photo/update_dialog_photo', true)
       },
       edit_patient() {
          this.$store.commit('patient/update_edit', true)
          this.$store.commit('patient/update_patient_new_dialog_is_active', true)
       },
       getHistories(visit) {
          console.log(visit)
          if (parseInt(visit) > 1) {
             this.$store.dispatch('history/search')
          }
       },
       generate_card() {
          var xid = this.$store.state.patient.selected_patient.M_PatientID
          this.rpt_card = "/birt/run?__report=report/one/fo/rpt_card.rptdesign&__format=pdf&username=admin%20&PID=" + xid
          this.dialog_card = true
       }
    }
 }
 </script>
 