<script setup>
import { date } from 'alga-js'
const router = useRouter()
const quickView = useQuickView()
const quickViewParam = useQuickViewParam()

const props = defineProps({
  modelName: String 
})

const showQuickViewContent = ref(false)
const handleQuickViewContent = () => {
  if(quickView.value === 'activity') {
    setTimeout(() => {
      showQuickViewContent.value = true
    }, 400)
  }
}
onMounted(handleQuickViewContent)
watch(quickView, handleQuickViewContent)

const viewHandler = () => {
  router.push(`/settings/activities/${quickViewParam.value.id}/view`)
  setTimeout(() => {
    quickView.value = ''
    quickViewParam.value = {}
  }, 400)
}
const closeQuickView = () => {
  showQuickViewContent.value = false
  setTimeout(() => {
    quickView.value = ''
    quickViewParam.value = {}
  }, 400)
}
</script>

<template>
  <div class="offCanvas right" :class="{'active': quickView === 'activity'}" :style="{display: quickView === 'activity' ? 'block' : 'none'}">
    <div class="offCanvasBackdrop" @click.self="closeQuickView"></div>
    <Transition name="slideRight">
    <div v-if="showQuickViewContent" class="offCanvasContent">
      <div class="offCanvasHeader">
        <h3 class="offCanvasTitle">Activity Details</h3>
        <div class="cursor-pointer" @click="closeQuickView">
          <span class="tf-icon ti ti-x ti-sm me-1"></span>
        </div>
      </div>
      <div class="offCanvasBody">
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Tenant</strong>
          <div class="textAlign-right">{{ quickViewParam.client }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Organization</strong>
          <div class="textAlign-right">{{ quickViewParam.organization }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Name</strong>
          <div class="textAlign-right">{{ quickViewParam.name }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Search Key</strong>
          <div class="textAlign-right">{{ quickViewParam.value }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Description</strong>
          <div class="textAlign-right">{{ quickViewParam.description }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Comment/Help</strong>
          <div class="textAlign-right">{{ quickViewParam.help }}</div>
        </div>
      </div>
      <div class="offCanvasFooter">
        <div></div>
        <div class="d-flex justify-flexEnd gap-5px">
          <button type="button" class="button" @click="viewHandler">View More Details</button>
          <button type="button" class="button" @click="closeQuickView">Close</button>
        </div>
      </div>
    </div>
    </Transition>
  </div>
</template>

<style scoped>

</style>