<template>
  <div v-if="rooms.length>0" class="row q-pa-sm rounded-borders">
    <div class="price-item q-ma-none text-white" :class="{'q-ml-md':i>0}" v-for="(x,i) in rooms">
      <div class="label">{{ x.name }}</div>
      <div class="f12">{{ x.price }}</div>
    </div>
  </div>
  <div v-if="rooms.length==0">{{$t('hotel.col.noMore')}}</div>
</template>

<script lang="ts">
import { X } from 'app/dist/spa/assets/index.89636ad9'
import { defineComponent, toRefs, reactive, inject } from 'vue'
import { useI18n } from 'vue-i18n'
import { moneyFormat } from '../../../utils/tools'
export default defineComponent({
  props: {
    price: {
      type: Object,
      default: {},
      require: true
    }
  },
  setup(props) {
    const { t } = useI18n()
    const data = reactive({
      rooms:[] as Array<any>
    })
    const methods = {
      setCurrentHotel() {
        let temp = props.price.PriceList?props.price.PriceList[0]:null
        if(!temp) return
        let roomTyps = ['BidroomPrice', 'SingleroomPrice', 'AddBedPrice', 'GuideRoomPrice']
        let roomLangs = [t('hotel.rooms.big'), t('hotel.rooms.sing'), t('hotel.rooms.three'), t('hotel.rooms.driver')]
        roomTyps.forEach((x: any, i: number) => {
          if (temp[x] > 0) {
            data.rooms.push({
              price:moneyFormat(temp[x]),
              name:roomLangs[i]
            })
          }
        })
      }
    }

    methods.setCurrentHotel()

    return { ...toRefs(data) }
  }
})
</script>

<style scoped>
.price-item {
  margin-top: 8px;
}
.price-item .label {
  opacity: 0.5;
  font-size: 12px;
  font-weight: 400;
}
</style>
