<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 === 'partner-group') {
    setTimeout(() => {
      showQuickViewContent.value = true
    }, 400)
  }
}
onMounted(handleQuickViewContent)
watch(quickView, handleQuickViewContent)

const viewHandler = () => {
  router.push(`/partners/partner-groups/${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 === 'partner-group'}" :style="{display: quickView === 'partner-group' ? 'block' : 'none'}">
    <div class="offCanvasBackdrop" @click.self="closeQuickView"></div>
    <Transition name="slideRight">
    <div v-if="showQuickViewContent" class="offCanvasContent">
      <div class="offCanvasHeader">
        <h3 class="offCanvasTitle">Partner Group 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>Credit Watch Percent</strong>
          <div class="textAlign-right">{{ quickViewParam.creditWatchPercent }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Price Match Tolerance</strong>
          <div class="textAlign-right">{{ quickViewParam.priceMatchTolerance }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Print Color</strong>
          <div class="textAlign-right">{{ quickViewParam.printColor }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Priority Base</strong>
          <div class="textAlign-right">{{ quickViewParam.priorityBase }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Price List</strong>
          <div class="textAlign-right">{{ quickViewParam.priceList }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>PO Price List</strong>
          <div class="textAlign-right">{{ quickViewParam.poPriceList }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Discount Schema</strong>
          <div class="textAlign-right">{{ quickViewParam.discountSchema }}</div>
        </div>
        <div class="d-flex justify-between gap-10px">
          <strong>PO Discount Schema</strong>
          <div class="textAlign-right">{{ quickViewParam.poDiscountSchema }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Dunning</strong>
          <div class="textAlign-right">{{ quickViewParam.dunning }}</div>
        </div>
        <div class="mb-3">
          <strong class="label d-block mb-2 fw-bold">Status</strong>
          <div class="check">
            <input type="checkbox" v-model="quickViewParam.isActive" class="checkInput" id="isActive" :checked="quickViewParam.isActive" disabled>
            <label class="checkLabel" for="isActive">Active</label>
          </div>
          <div class="check">
            <input type="checkbox" v-model="quickViewParam.isDefault" class="checkInput" id="isDefault" :checked="quickViewParam.isDefault" disabled>
            <label class="checkLabel" for="isDefault">Default</label>
          </div>
          <div class="check">
            <input type="checkbox" v-model="quickViewParam.isConfidentialInfo" class="checkInput" id="isConfidentialInfo" :checked="quickViewParam.isConfidentialInfo" disabled>
            <label class="checkLabel" for="isConfidentialInfo">Confidential Info</label>
          </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>