<template>
   <v-layout fil-height column>
      <v-card class="mb-2">
         <v-layout row wrap>
            <v-flex xs12>

               <v-layout>
                  <v-flex xs3 pa-2>
                     <v-layout row wrap>
                        <v-flex xs12>
                           <v-img
                              src="https://www.sgm-inc.com/wp-content/uploads/2014/06/no-profile-male-img.gif"
                              aspect-ratio="1"
                              class="grey lighten-2 elevation-2"
                              >
                        </v-flex>



                  </v-flex>

                  <v-flex xs9>
                     <v-flex xs12>
                        <v-layout>
                           <v-flex xs7 pa-1>
                              <v-text-field
                                 label="Nama"
                                 placeholder=""
                                 :value="getField(patient.M_PatientName)"
                                 readonly
                                 ></v-text-field>
                           </v-flex>
                           <v-flex xs5 pa-1>
                              <v-text-field
                                 label="RM"
                                 placeholder=""
                                 :value="getField(patient.M_PatientNoReg)"
                                 readonly
                                 ></v-text-field>
                           </v-flex>
                        </v-layout>

                     </v-flex>

                     <v-flex xs12 pa-1>
                        <v-textarea
                           auto-grow
                           label="Alamat"
                           rows="2"
                           :value="getAddress(patient)"
                           readonly
                           ></v-textarea>

                     </v-flex>

                     <v-flex xs12>
                        <v-layout>
                           <v-flex xs7 pa-1>
                              <v-text-field
                                 label="Telephon / HP"
                                 placeholder=""
                                 :value="getField(patient.M_PatientHP)"
                                 readonly
                                 ></v-text-field>
                           </v-flex>

                           <v-flex xs5 pa-1>
                              <v-text-field
                                 label="Jenis Kelamin"
                                 placeholder=""
                                 :value="getField(patient.M_SexName)"
                                 readonly
                                 ></v-text-field>
                           </v-flex>
                        </v-layout>
                     </v-flex>

                     <v-flex xs12>
                        <v-layout>
                           <v-flex xs7 pa-1>
                              <v-text-field
                                 label="Tanggal Lahir"
                                 placeholder=""
                                 :value="getField(patient.M_PatientDOB)"
                                 readonly
                                 ></v-text-field>
                           </v-flex>

                           <v-flex xs5 pa-1>
                              <v-text-field
                                 label="Umur"
                                 placeholder=""
                                 :value="patient_age"
                                 readonly
                                 ></v-text-field>
                           </v-flex>
                        </v-layout>
                     </v-flex>
                  </v-flex>
                     </v-layout>

            </v-flex>

            <v-flex xs12 >
               <v-layout>
                  <v-flex xs6 pa-2>
                     <one-field-verification
                        :is_error="vpatientname.check"
                        :label="vpatientname.label"
                        :value="vpatientname.check"
                        :note="vpatientname.note"
                        
                        ></one-field-verification>
                  </v-flex>

               <v-flex xs6 pa-2>
                  <one-field-verification
                     :is_error="true"
                     label="No RM sudah sesuai  "
                     value=false
                     ></one-field-verification>
               </v-flex>
               </v-layout>
            </v-flex>


            <v-flex xs12 >
               <v-layout>
                  <v-flex xs6 pa-2>
                     <one-field-verification
                        :is_error="true"
                        label="Alamat sudah sesuai"
                        value=false
                        ></one-field-verification>
                  </v-flex>

               <v-flex xs6 pa-2>
                  <one-field-verification
                     :is_error="true"
                     label="No HP sudah sesuai  "
                     value=false
                     ></one-field-verification>
               </v-flex>
               </v-layout>
            </v-flex>


            <v-flex xs12 >
               <v-layout>
                  <v-flex xs6 pa-2>
                     <one-field-verification
                        :is_error="true"
                        label="DOB sudah sesuai"
                        value=false
                        ></one-field-verification>
                  </v-flex>

               <v-flex xs6 pa-2>
                  <one-field-verification
                     :is_error="true"
                     label="Umur sudah sesuai  "
                     value=false
                     ></one-field-verification>
               </v-flex>
               </v-layout>
            </v-flex>

      </v-card>

      <v-card >
         <v-subheader>
            DATA DOKTER
         </v-subheader>
<!--
         <v-divider></v-divider>
         <v-flex xs12 pa-3>
            <v-text-field
               label="Nama"
               placeholder=""
               readonly
               ></v-text-field>
         </v-flex>

         <v-flex xs12 pa-3>
            <v-text-field
               label="Alamat Dokter"
               placeholder=""
               readonly
               ></v-text-field>
         </v-flex>

-->
         <v-flex xs12 >
            <v-layout>
               <v-flex xs6 pa-2>
                  <one-field-verification
                     :is_error="true"
                     label="Nama DOkter sudah sesuai"
                     value=false
                     ></one-field-verification>
               </v-flex>

            <v-flex xs6 pa-2>
               <one-field-verification
                  :is_error="true"
                  label="Alamat Dokter sudah sesuai  "
                  value=false
                  ></one-field-verification>
            </v-flex>
            </v-layout>
         </v-flex>

         <v-flex xs6 pa-2>
            <one-testing-component-2
               :xdatalabel="xtestingObj.label"
               :xdatacbx="xtestingObj.check"
               :xdatatxt="xtestingObj.note"
               @update-data-txt="updateDataTxt"
               @update-data-cbx="updateDataCbx"
               ></one-testing-component-2>
         </v-flex>

      </v-card>
      
         
      </v-layout>

</template>

<style scoped>
</style>

<script>
module.exports = {
   components : {
      'one-field-verification' : httpVueLoader('../../common/oneFieldVerification.1.vue'),
      'one-testing-component':httpVueLoader('../../common/oneTestingComponent.vue'),
      'one-testing-component-2':httpVueLoader('../../common/oneTestingComponent2.vue')
  
   },
   computed: {
      patient_age() {
         if ( this.patient == undefined) {
            return ''
         }
         return window.calculate_age(this.patient.M_PatientDOB)
      },
      patient() {
         return this.$store.state.patient.selected_patient
      },
      vpatientname() {
         return this.$store.state.verification.verification_patient_name
      },
      updateparent(val) {
            this.$store.commit("verification/update_patient_name",val)   
      },
      xtesting(){
         return this.$store.state.verification.testing
      },
      xtestinginput(){
         return this.$store.state.verification.testing
      },
       xtestingObj(){
         return this.$store.state.verification.testingObj
      }
   },
   methods : {
      getAddress(patient) {
         if ( patient == undefined) {
            return ''
         }
         if (patient.address == undefined  ) return ''
         if (patient.address.length == 0) return ''
         return patient.address[0]
      },
      getField(inp) {
         if ( this.patient != undefined) {
            return inp
         }
         return ''
      },
      getError(inp) {
         if ( this.patient != undefined) {
            return inp
         }
         return ''
      },
       updateDataX(e) {
         this.$store.commit("verification/update_testing",e)  
      },
      updateDataObj(e) {
         this.$store.commit("verification/update_testing_obj",e)  
      },
      updateDataTxt(val) {
         this.$store.commit("verification/update_testing_txt",val)  
      },
      updateDataCbx(val) {
         this.$store.commit("verification/update_testing_cbx",val)  
      }
   }
}
</script>
