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

const viewHandler = () => {
  router.push(`/sales/payments/${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 === 'payment'}" :style="{display: quickView === 'payment' ? 'block' : 'none'}">
    <div class="offCanvasBackdrop" @click.self="closeQuickView"></div>
    <Transition name="slideRight">
    <div v-if="showQuickViewContent" class="offCanvasContent">
      <div class="offCanvasHeader">
        <h3 class="offCanvasTitle">Payment 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>Bank Account</strong>
          <div class="textAlign-right">{{ quickViewParam.bankAccount }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Pay Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.payAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Tax Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.taxAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Discount Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.discountAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Write Off Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.writeOffAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Over Under Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.overUnderAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Charge Amount</strong>
          <div class="textAlign-right">{{ quickViewParam.chargeAmt }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Partner</strong>
          <div class="textAlign-right">{{ quickViewParam.partner }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Order</strong>
          <div class="textAlign-right">{{ quickViewParam.order }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Invoice</strong>
          <div class="textAlign-right">{{ quickViewParam.invoice }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Routing No</strong>
          <div class="textAlign-right">{{ quickViewParam.routingNo }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Account No</strong>
          <div class="textAlign-right">{{ quickViewParam.accountNo }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Check No</strong>
          <div class="textAlign-right">{{ quickViewParam.checkNo }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Tender Type</strong>
          <div class="textAlign-right">{{ quickViewParam.tenderType }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Currency</strong>
          <div class="textAlign-right">{{ quickViewParam.currency }}</div>
        </div>
        <div class="d-flex justify-between gap-10px">
          <strong>Document Type</strong>
          <div class="textAlign-right">{{ quickViewParam.docType }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Document Status</strong>
          <div class="textAlign-right">{{ quickViewParam.docStatus }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Charge</strong>
          <div class="textAlign-right">{{ quickViewParam.charge }}</div>
        </div>
        <div class="mb-2 d-flex justify-between gap-10px">
          <strong>Description</strong>
          <div class="textAlign-right">{{ quickViewParam.description }}</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>