<script setup>
import { date } from 'alga-js'
const router = useRouter()
const route = useRoute()

definePageMeta({
  middleware: ['auth', 'org']
})

const form = ref({
  id: '',
  client: '',
  clientId: '',
  organization: '',
  organizationId: '',
  isActive: true,
  documentNo: '',
  poReference: '',
  description: '',
  isApproved: false,
  isPaid: false,
  isPrinted: false,
  isTransferred: false,
  dateOrdered: date.now('date'),
  dateAcct: date.now('date'),
  totalLines: 1,
  grandTotal: 0,
  chargeAmt: 0,
  processed: false,
  isSOTrx: true,
  isDiscountPrinted: false,
  isTaxIncluded: false,
  sendEMail: false,
  isSelfService: false,
  processedOn: 0,
  isPayScheduleValid: false,
  dateInvoiced: date.now('date'),
  isInDispute: false,
  isFixedAssetInvoice: false,
  isOverrideCurrencyRate: false,
  docBaseType: '',
  docBaseTypeId: '',
  user: '',
  userId: '',
  order: '',
  orderId: '',
  docStatus: 'Draft',
  docStatusId: 'DR',
  docType: '',
  docTypeId: 0,
  docTypeTarget: '',
  docTypeTargetId: '',
  salesRep: '',
  salesRepId: '',
  paymentTerm: '',
  paymentTermId: '',
  currency: '',
  currencyId: '',
  invoiceRule: '',
  invoiceRuleId: '',
  deliveryViaRule: '',
  deliveryViaRuleId: '',
  deliveryRule: '',
  deliveryRuleId: '',
  priorityRule: '',
  priorityRuleId: '',
  freightCostRule: '',
  freightCostRuleId: '',
  paymentRule: '',
  paymentRuleId: '',
  warehouse: '',
  warehouseId: '',
  priceList: '',
  priceListId: '',
  partner: '',
  partnerId: '',
  partnerLocation: '',
  partnerLocationId: '',
  cashLine: '',
  cashLineId: '',
  project: '',
  projectId: '',
  campaign: '',
  campaignId: '',
  processing: false,
  alert: {
    status: '',
    message: ''
  }
})

const retrieve = async () => {
  const res = await $fetch('/api/invoices/'+route.params.id, {
    headers: useRequestHeaders(['cookie'])
  })
  if(res) {
    form.value = {
      id: route.params.id,
      client: res?.AD_Client_ID?.identifier || '',
      clientId: res?.AD_Client_ID?.id || '',
      organization: res?.AD_Org_ID?.identifier || '',
      organizationId: res?.AD_Org_ID?.id || '',
      isActive: res?.IsActive ?? true,
      documentNo: res?.DocumentNo || '',
      poReference: res?.POReference || '',
      description: res?.Description || '',
      isApproved: res?.IsApproved ?? false,
      isPaid: res?.IsPaid ?? false,
      isPrinted: res?.IsPrinted ?? false,
      isTransferred: res?.IsTransferred ?? false,
      dateOrdered: res?.DateOrdered || date.now('date'),
      dateAcct: res?.DateAcct || date.now('date'),
      totalLines: res?.TotalLines || 1,
      grandTotal: res?.QrandTotal || 0,
      chargeAmt: res?.ChargeAmt || 0,
      processed: res?.Processed ?? false,
      isSOTrx: res?.IsSOTrx ?? true,
      isDiscountPrinted: res?.IsDiscountPrinted ?? false,
      isTaxIncluded: res?.IsTaxIncluded ?? false,
      isSelected: res?.IsSelected ?? false,
      sendEMail: res?.SendEMail ?? false,
      isSelfService: res?.IsSelfService ?? false,
      processedOn: res?.ProcessedOn || 0,
      isPayScheduleValid: res?.IsPayScheduleValid ?? false,
      dateInvoiced: res?.DateInvoiced || date.now('date'),
      isInDispute: res?.IsInDispute ?? false,
      isFixedAssetInvoice: res?.IsFixedAssetInvoice ?? false,
      isOverrideCurrencyRate: res?.IsOverrideCurrencyRate ?? false,
      docBaseType: res?.DocBaseType?.identifier || '',
      docBaseTypeId: res?.DocBaseType?.id || '',
      user: res?.AD_User_ID?.identifier || '',
      userId: res?.AD_User_ID?.id || '',
      order: res?.C_Order_ID?.identifier || '',
      orderId: res?.C_Order_ID?.id || '',
      docStatus: res?.DocStatus?.identifier || 'Draft',
      docStatusId: res?.DocStatus?.id || 'DR',
      docType: res?.C_DocType_ID?.identifier || '',
      docTypeId: res?.C_DocType_ID?.id || 0,
      docTypeTarget: res?.C_DocTypeTarget_ID?.identifier || '',
      docTypeTargetId: res?.C_DocTypeTarget_ID?.id || '',
      salesRep: res?.SalesRep_ID?.identifier || '',
      salesRepId: res?.SalesRep_ID?.id || '',
      paymentTerm: res?.C_PaymentTerm_ID?.identifier || '',
      paymentTermId: res?.C_PaymentTerm_ID?.id || '',
      currency: res?.C_Currency_ID?.identifier || '',
      currencyId: res?.C_Currency_ID?.id || '',
      invoiceRule: res?.InvoiceRule?.identifier || '',
      invoiceRuleId: res?.InvoiceRule?.id || '',
      deliveryViaRule: res?.DeliveryViaRule?.identifier || '',
      deliveryViaRuleId: res?.DeliveryViaRule?.id || '',
      deliveryRule: res?.DeliveryRule?.identifier || '',
      deliveryRuleId: res?.DeliveryRule?.id || '',
      priorityRule: res?.PriorityRule?.identifier || '',
      priorityRuleId: res?.PriorityRule?.id || '',
      freightCostRule: res?.FreightCostRule?.identifier || '',
      freightCostRuleId: res?.FreightCostRule?.id || '',
      paymentRule: res?.PaymentRule?.identifier || '',
      paymentRuleId: res?.PaymentRule?.id || '',
      warehouse: res?.M_Warehouse_ID?.identifier || '',
      warehouseId: res?.M_Warehouse_ID?.id || '',
      priceList: res?.M_PriceList_ID?.identifier || '',
      priceListId: res?.M_PriceList_ID?.id || '',
      partner: res?.C_BPartner_ID?.identifier || '',
      partnerId: res?.C_BPartner_ID?.id || '',
      partnerLocation: res?.C_BPartner_Location_ID?.identifier || '',
      partnerLocationId: res?.C_BPartner_Location_ID?.id || '',
      cashLine: res?.C_CashLine_ID?.identifier || '',
      cashLineId: res?.C_CashLine_ID?.id || '',
      project: res?.C_Project_ID?.identifier || '',
      projectId: res?.C_Project_ID?.id || '',
      campaign: res?.C_Campaign_ID?.identifier || '',
      campaignId: res?.C_Campaign_ID?.id || '',
      processing: false,
      alert: {
        status: '',
        message: ''
      }
    }
    
    /*for(let record of ['invoice_line', 'invoice_tax', 'payment_schedule']) {
      const response = await $fetch('/api/invoices/'+route.params.id+'/'+record.replaceAll('_', '-'), {
        headers: useRequestHeaders(['cookie'])
      })
      if(response) {
        let newData = []
        if(record === 'invoice_line') {
          newData = response.records.map(item => {
            return {
              id: item.id,
              isActive: item?.IsActive || true,
              product: item?.M_Product_ID?.identifier || item?.M_Product_ID?.Name || '',
              productId: item?.M_Product_ID?.id || '',
              qtyInvoiced: item?.QtyInvoiced || item?.QtyEntered || 0,
              qtyEntered: item?.QtyEntered || 0,
              uom: item?.C_UOM_ID?.identifier || '',
              uomId: item?.C_UOM_ID?.id || '',
              priceActual: item?.PriceActual || 0,
              priceEntered: item?.PriceEntered || 0,
              priceList: item?.PriceList || 0,
              priceLimit: item?.PriceLimit || 0,
              tax: item?.C_Tax_ID?.identifier || '',
              taxId: item?.C_Tax_ID?.id || '',
              taxAmt: item?.TaxAmt || 0,
              line: item.Line,
              lineNetAmt: item?.LineNetAmt || 0,
              attributeSetInstance: item?.M_AttributeSetInstance_ID?.identifier || '',
              attributeSetInstanceId: item?.M_AttributeSetInstance_ID?.id || '',
              charge: item?.C_Charge_ID?.identifier || '',
              chargeId: item?.C_Charge_ID?.id || '',
              project: item?.C_Project_ID?.identifier || '',
              projectId: item?.C_Project_ID?.id || '',
              campaign: item?.C_Campaign_ID?.identifier || '',
              campaignId: item?.C_Campaign_ID?.id || '',
            }
          }).sort((a, b) => Number(a.line) - Number(b.line))
        }
        if(record === 'invoice_tax') {
          newData = response.records.map(item => {
            return {
              id: item.uid,
              tax: item.C_Tax_ID.identifier,
              taxId: item.C_Tax_ID.id,
              taxAmt: item.TaxAmt,
              taxBaseAmt: item.TaxBaseAmt,
              processed: item.Processed,
              isTaxIncluded: item.IsTaxIncluded,
              isActive: item.IsActive,
            }
          })
        }
        if(record === 'payment_schedule') {
          newData = response.records.map(item => {
            return {
              id: item.id,
              paySchedule: item.C_PaySchedule_ID.identifier,
              payScheduleId: item.C_PaySchedule_ID.id,
              discountAmt: item.DiscountAmt,
              discountDate: item.DiscountDate,
              dueAmt: item.DueAmt,
              dueDate: item.DueDate,
              processed: item.Processed,
              isActive: item.IsActive,
              isValid: item.IsValid,
            }
          })
        }

        detailRecord.value[record] = newData
      }
    }*/
  }
}
onMounted(retrieve)

const printReport = async (fileType) => {
  const response = await $fetch('/api/invoices/'+route.params.id+'/print/'+fileType, {
    headers: useRequestHeaders(['cookie'])
  })
  if(response) {
    let mimeType = ''
    let blob = new Blob([])
    if(fileType === 'PDF') {
      mimeType = 'application/pdf'
      const base64Response = await fetch(`data:${mimeType};base64,${response.reportFile}`);
      blob = await base64Response.blob();
    } else if(fileType === 'HTML') {
      mimeType = 'text/html'
      blob = new Blob([atob(response.exportFile)], {type: mimeType})
    } else if(fileType === 'CSV') {
      mimeType = 'text/csv'
      blob = new Blob([atob(response.exportFile)], {type: mimeType})
    } else if(fileType === 'XLSX') {
      mimeType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
      blob = new Blob([atob(response.exportFile)], {type: mimeType})
    } else if(fileType === 'XLS') {
      mimeType = 'application/vnd.ms-excel'//data:application/octet-stream;base64
      blob = new Blob([atob(response.exportFile)], {type: mimeType})
    }
    const blobUrl = URL.createObjectURL(blob)
    open(blobUrl, '_blank')
  }
}

const back = () => {
  router.push('/sales/invoices')
}
const print = () => {
  router.push('/sales/invoices/'+route.params.id+'/print')
}
const edit = () => {
  router.push(`/sales/invoices/${route.params.id}/edit`)
}
const destroy = async () => {
  const confirmation = confirm('Are you sure want to delete this record?')
  if(confirmation) {
    await $fetch('/api/invoices/'+route.params.id, {
      method: 'DELETE',
      headers: useRequestHeaders(['cookie'])
    })
    router.push(`/sales/invoices`)
  }
}

const setDocumentAction = async (docAction) => {
  const res = await $fetch('/api/invoices/'+route.params.id+'/document-action', {
    method: 'POST',
    headers: useRequestHeaders(['cookie']),
    body: {
      documentAction: docAction
    }
  })
  if(res) {
    toast({
      message: 'Document has been successfully set to '+docAction+' status.',
      type: 'is-success',
      duration: 2000
    })
    back()
  } else {
    toast({
      message: 'Document failed to set to '+docAction+' status.',
      type: 'is-danger',
      duration: 2000
    })
  }
}

const dropDownHandler = (e) => {
  if(e.target.parentElement.classList.contains('show')) {
    e.target.parentElement.classList.remove('show')
  } else {
    e.target.parentElement.classList.add('show')
  }
}

const dropItemHandler = (e) => {
  if(e.target.parentElement.parentElement.classList.contains('show')) {
    e.target.parentElement.parentElement.classList.remove('show')
  } else {
    e.target.parentElement.parentElement.classList.add('show')
  }
}

const breadCrumb = computed(() => ([
  { link: '#', text: 'Sales'},
  { link: '/sales/invoices', text: 'Invoices'},
  { link: '#', text: 'View Invoice Details', active: true}
]))
</script>

<template>
  <Head>
    <Title>View Invoice Details</Title>
  </Head>

  <NuxtLayout name="new-dash">
    <NewBreadCrumb :items="breadCrumb" />
    <div class="banner">
      <div class="p-1.5rem">
        <div class="d-flex justify-between mb-3">
          <h4></h4>
          <div class="d-flex gap-0.75rem">
            <div>
              <button type="button" @click="back" class="button">
                <span class="tf-icon ti ti-chevron-left ti-xs me-1 color-inherit"></span> Back
              </button>
            </div>
            <div v-if="form.docStatusId !== 'CO' && form.docStatusId !== 'VO'" class="dropDown">
              <button type="button" class="button dropDownToggler" @click="dropDownHandler">
                <span class="tf-icon ti ti-settings ti-xs me-1 color-inherit"></span> Action
              </button>
              <div class="dropDownBackdrop" @click="dropDownHandler"></div>
              <div class="dropDownMenu dropDownRight mnw-80px">
                <span class="dropDownItem" @click="dropItemHandler($event); setDocumentAction('CO');">Complete</span>
                <span class="dropDownItem" @click="dropItemHandler($event); setDocumentAction('VO');">Void</span>
                <span class="dropDownItem" @click="dropItemHandler($event); edit();">Edit</span>
                <span class="dropDownItem" @click="dropItemHandler($event); destroy();">Delete</span>
              </div>
            </div>
            <div>
              <button type="button" @click="print" class="button">
                <span class="tf-icon ti ti-file-invoice ti-xs me-1 color-inherit"></span> Print Preview
              </button>
            </div>
            <div class="dropDown">
              <button type="button" class="button dropDownToggler" @click="dropDownHandler">
                <span class="tf-icon ti ti-file-export ti-xs me-1 color-inherit"></span> Print Report
              </button>
              <div class="dropDownBackdrop" @click="dropDownHandler"></div>
              <div class="dropDownMenu dropDownRight">
                <span class="dropDownItem" @click="dropItemHandler($event); printReport('PDF');">Print Report in PDF</span>
                <span class="dropDownItem" @click="dropItemHandler($event); printReport('HTML');">Print Report in HTML</span>
                <span class="dropDownItem" @click="dropItemHandler($event); printReport('CSV');">Print Report in CSV</span>
                <span class="dropDownItem" @click="dropItemHandler($event); printReport('XLSX');">Print Report in XLSX</span>
                <span class="dropDownItem" @click="dropItemHandler($event); printReport('XLS');">Print Report in XLS</span>
              </div>
            </div>
          </div>
        </div>
        <div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Tenant</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.client }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Organization</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.organization }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Document Number</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.documentNo }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Order Reference</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.poReference }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Date Ordered</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dateOrdered }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Date Invoiced</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dateInvoiced }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Date Accounted</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dateAcct }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Target Document Type</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.docTypeTarget }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Document Type</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.docType }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Business Partner</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.partner }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Partner Location</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.partnerLocation }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Price List</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.priceList }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Currency</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.currency }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Sales Representative</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.salesRep }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Printed Status</strong>
                <strong>:</strong>
              </div>
              <div class="check">
                <input type="checkbox" v-model="form.isDiscountPrinted" class="checkInput" id="isDiscountPrinted" :checked="form.isDiscountPrinted" disabled>
                <label class="checkLabel" for="isDiscountPrinted">Discount Printed</label>
              </div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Payment Rule</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.paymentRule }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Payment Term</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.paymentTerm }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Project</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.project }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Campaign</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.campaign }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Document Status</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.docStatus }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Total Lines</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.totalLines }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Grand Total</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.grandTotal }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Cash Plan Line</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.cashLine }}</div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Pay Schedule</strong>
                <strong>:</strong>
              </div>
              <div class="check">
                <input type="checkbox" v-model="form.isPayScheduleValid" class="checkInput" id="isPayScheduleValid" :checked="form.isPayScheduleValid" disabled>
                <label class="checkLabel" for="isPayScheduleValid">Pay Schedule Valid</label>
              </div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-inlineFlex justify-between gap-10px mb-2">
                <strong>Status</strong>
                <strong>:</strong>
              </div>
              <div class="d-flex flexWrap-wrap gap-10px">
                <div class="check">
                  <input type="checkbox" v-model="form.isActive" class="checkInput" id="isActive" :checked="form.isActive" disabled>
                  <label class="checkLabel" for="isActive">Active</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isApproved" class="checkInput" id="isApproved" :checked="form.isApproved" disabled>
                  <label class="checkLabel" for="isApproved">Approved</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isPaid" class="checkInput" id="isPaid" :checked="form.isPaid" disabled>
                  <label class="checkLabel" for="isPaid">Paid</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isPrinted" class="checkInput" id="isPrinted" :checked="form.isPrinted" disabled>
                  <label class="checkLabel" for="isPrinted">Printed</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isTransferred" class="checkInput" id="isTransferred" :checked="form.isTransferred" disabled>
                  <label class="checkLabel" for="isTransferred">Transferred</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isTaxIncluded" class="checkInput" id="isTaxIncluded" :checked="form.isTaxIncluded" disabled>
                  <label class="checkLabel" for="isTaxIncluded">Tax Included</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.sendEMail" class="checkInput" id="sendEMail" :checked="form.sendEMail" disabled>
                  <label class="checkLabel" for="sendEMail">Send Email</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isSelfService" class="checkInput" id="isSelfService" :checked="form.isSelfService" disabled>
                  <label class="checkLabel" for="isSelfService">Self Service</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isInDispute" class="checkInput" id="isInDispute" :checked="form.isInDispute" disabled>
                  <label class="checkLabel" for="isInDispute">In Dispute</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isFixedAssetInvoice" class="checkInput" id="isFixedAssetInvoice" :checked="form.isFixedAssetInvoice" disabled>
                  <label class="checkLabel" for="isFixedAssetInvoice">Fixed Asset Invoice</label>
                </div>
                <div class="check">
                  <input type="checkbox" v-model="form.isOverrideCurrencyRate" class="checkInput" id="isOverrideCurrencyRate" :checked="form.isOverrideCurrencyRate" disabled>
                  <label class="checkLabel" for="isOverrideCurrencyRate">Override Currency Rate</label>
                </div>
              </div>
            </div>
          </div>
          <div class="columns is-desktop">
            <div class="column is-half">
              <div class="w-150px d-flex justify-between gap-10px mb-2">
                <strong>Description</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.description }}</div>
            </div>
          </div>
          
          <div class="m-3">
            <div>
              <SalesInvoiceDetailRecord action="view" :info="form" tab="invoice_line" />
            </div>
          </div>

        </div>
      </div>

    </div>
  </NuxtLayout>
</template>