<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,
  isCreditApproved: false,
  isDelivered: false,
  isInvoiced: false,
  isPrinted: false,
  isTransferred: false,
  dateOrdered: date.now('date'),
  datePromised: date.now('date'),
  dateAcct: date.now('date'),
  freightAmt: 0,
  totalLines: 1,
  grandTotal: 0,
  chargeAmt: 0,
  processed: false,
  isSOTrx: false,
  isDiscountPrinted: false,
  isTaxIncluded: false,
  isSelected: false,
  sendEMail: false,
  isSelfService: false,
  isDropShip: false,
  processedOn: 0,
  isPayScheduleValid: false,
  isPriviledgedRate: false,
  docStatus: '',
  docStatusId: 'DR',
  docType: 0,
  docTypeId: 0,
  docTypeTarget: '',
  docTypeTargetId: '',
  procurementsRep: '',
  procurementsRepId: '',
  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: '',
  billPartner: '',
  billPartnerId: '',
  billPartnerLocation: '',
  billPartnerLocationId: '',
  project: '',
  projectId: '',
  campaign: '',
  campaignId: '',
  shipper: '',
  shipperId: '',
  freightCategory: '',
  freightCategoryId:  '',
  user: '',
  userId:  '',
  billUser: '',
  billUserId:  '',
  promotionCode: '',
  dropShipPartner: '',
  dropShipPartnerId: '',
  dropShipPartnerLocation: '',
  dropShipPartnerLocationId: '',
  dropShipUser: '',
  dropShipUserId:  '',
  conversionType: '',
  conversionTypeId:  '',
  orderSource: '',
  orderSourceId:  '',
  processing: false,
  alert: {
    status: '',
    message: '',
    processing: false
  }
})

const detailRecordSelected = ref('order_line')
const detailRecord = ref({
  order_line: [],
  order_tax: [],
  payment_schedule: []
})

const retrieve = async () => {
  const res = await $fetch('/api/orders/'+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 || '',
      description: res?.Description || '',
      isApproved: res?.IsApproved ?? false,
      isCreditApproved: res?.IsCreditApproved ?? false,
      isDelivered: res?.IsDelivered ?? false,
      isInvoiced: res?.IsInvoiced ?? false,
      isPrinted: res?.IsPrinted ?? false,
      isTransferred: res?.IsTransferred ?? false,
      dateOrdered: res?.DateOrdered || date.now('date'),
      datePromised: res?.DatePromised || date.now('date'),
      dateAcct: res?.DateAcct || date.now('date'),
      freightAmt: res?.FreightAmt || 0,
      totalLines: res?.TotalLines || 0,
      grandTotal: res?.GrandTotal || 0,
      chargeAmt: res?.ChargeAmt || 0,
      processed: res?.Processed ?? false,
      isSOTrx: res?.IsSOTrx ?? false,
      isDiscountPrinted: res?.IsDiscountPrinted ?? false,
      isTaxIncluded: res?.IsTaxIncluded ?? false,
      isSelected: res?.IsSelected ?? false,
      sendEMail: res?.SendEMail ?? false,
      isSelfService: res?.IsSelfService ?? false,
      isDropShip: res?.IsDropShip ?? false,
      processedOn: res?.ProcessedOn || 0,
      isPayScheduleValid: res?.IsPayScheduleValid ?? false,
      isPriviledgedRate: res?.IsPriviledgedRate ?? false,
      docStatus: res?.DocStatus?.identifier || '',
      docStatusId: res?.DocStatus?.id || '',
      docType: res?.C_DocType_ID?.identifier || '',
      docTypeId: res?.C_DocType_ID?.id || '',
      docTypeTarget: res?.C_DocTypeTarget_ID?.identifier || '',
      docTypeTargetId: res?.C_DocTypeTarget_ID?.id || '',
      procurementsRep: res?.SalesRep_ID?.identifier || '',
      procurementsRepId: 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 || '',
      billPartner: res?.Bill_BPartner_ID?.identifier || '',
      billPartnerId: res?.Bill_BPartner_ID?.id || '',
      billPartnerLocation: res?.Bill_Location_ID?.identifier || '',
      billPartnerLocationId: res?.Bill_Location_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 || '',
      shipper: res?.M_Shipper_ID?.identifier || '',
      shipperId: res?.M_Shipper_ID?.id || '',
      freightCategory: res?.M_FreightCategory_ID?.identifier || '',
      freightCategoryId: res?.M_FreightCategory_ID?.id || '',
      user: res?.AD_User_ID?.identifier || '',
      userId:  res?.AD_User_ID?.id || '',
      billUser: res?.Bill_User_ID?.identifier || '',
      billUserId:  res?.Bill_User_ID?.id || '',
      promotionCode: res?.PromotionCode || '',
      dropShipPartner: res?.DropShip_BPartner_ID?.identifier || '',
      dropShipPartnerId: res?.DropShip_BPartner_ID?.id || '',
      dropShipPartnerLocation: res?.DropShip_Location_ID?.identifier || '',
      dropShipPartnerLocationId: res?.DropShip_Location_ID?.id || '',
      dropShipUser: res?.DropShip_User_ID?.identifier || '',
      dropShipUserId:  res?.DropShip_User_ID?.id || '',
      conversionType: res?.C_ConversionType_ID?.identifier || '',
      conversionTypeId:  res?.C_ConversionType_ID?.id || '',
      orderSource: res?.C_OrderSource_ID?.identifier || '',
      orderSourceId:  res?.C_OrderSource_ID?.id || '',
      processing: false,
      alert: {
        status: '',
        message: '',
        processing: false
      }
    }
    
    /*for(let record of ['order_line', 'order_tax', 'payment_schedule']) {
      const response = await $fetch('/api/orders/'+route.params.id+'/'+record.replaceAll('_', '-'), {
        headers: useRequestHeaders(['cookie'])
      })
      if(response) {
        let newData = []
        if(record === 'order_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 || '',
              qtyOrdered: item?.qtyOrdered || item?.QtyEntered || 0,
              qtyReserved: item?.QtyReserved || 0,
              qtyDelivered: item?.QtyDelivered || 0,
              qtyInvoiced: item?.QtyInvoiced || 0,
              qtyLostSales: item?.QtyLostSales || 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 || '',
              discount: item?.Discount || 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 === 'order_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/orders/'+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('/procurements/orders')
}
const print = () => {
  router.push('/procurements/orders/'+route.params.id+'/print')
}
const edit = () => {
  router.push(`/procurements/orders/${route.params.id}/edit`)
}
const destroy = async () => {
  const confirmation = confirm('Are you sure want to delete this record?')
  if(confirmation) {
    await $fetch('/api/orders/'+route.params.id, {
      method: 'DELETE',
      headers: useRequestHeaders(['cookie'])
    })
    router.push(`/sales/orders`)
  }
}

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: 'Procurements'},
  { link: '/procurements/orders', text: 'Orders'},
  { link: '#', text: 'View Order Details', active: true}
]))
</script>

<template>
  <Head>
    <Title>View Order 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="btn btn-ms btn-secondary waves-effect waves-light">
                <span class="tf-icon ti ti-chevron-left ti-xs me-1"></span> Back
              </button>
            </div>
            <div class="dropDown">
              <button type="button" class="btn btn-ms btn-primary waves-effect waves-light dropDownToggler" @click="dropDownHandler">
                <span class="tf-icon ti ti-settings ti-xs me-1"></span> Action
              </button>
              <div class="dropDownBackdrop" @click="dropDownHandler"></div>
              <div class="dropDownMenu dropDownRight mnw-80px">
                <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="btn btn-ms btn-primary waves-effect waves-light">
                <span class="tf-icon ti ti-file-invoice ti-xs me-1"></span> Print Preview
              </button>
            </div>
            <div class="dropDown">
              <button type="button" class="btn btn-ms btn-primary waves-effect waves-light dropDownToggler" @click="dropDownHandler">
                <span class="tf-icon ti ti-file-export ti-xs me-1"></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 mt-0">
            <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">
            <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">
            <div class="column is-half mb-2 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 Promised</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.datePromised }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-full 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">
            <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 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>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Bill Partner</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.billPartner }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Bill Location</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.billPartnerLocation }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>User Contact</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.user }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Bill Contact</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.billUser }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Warehouse</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.warehouse }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Delivery Status</strong>
                <strong>:</strong>
              </div>
              <div class="check">
                <input type="checkbox" v-model="form.isDropShip" class="checkInput" id="isDropShip" :checked="form.isDropShip" disabled>
                <label class="checkLabel" for="isDropShip">Drop Shipment</label>
              </div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Drop Shipment Partner</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dropShipPartner }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Drop Shipment Location</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dropShipPartnerLocation }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Drop Shipment Contact</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.dropShipUser }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Currency Type</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.conversionType }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Order Source</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.orderSource }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Promotion Code</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.promotionCode }}</div>
            </div>
          </div>
          <div class="columns">
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Delivery Via</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.deliveryViaRule }}</div>
            </div>
            <div class="column is-half d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Priority</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.priorityRule }}</div>
            </div>
          </div>
          <div class="columns">
            <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 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>
          <div class="columns">
            <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 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">
            <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">
            <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">
            <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>Document Type</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.docType }}</div>
            </div>
          </div>
          <div class="columns">
            <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 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>
          <div class="columns">
            <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 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>
          <div class="columns">
            <div class="column is-full d-flex gap-10px">
              <div class="w-150px d-flex justify-between gap-10px">
                <strong>Description</strong>
                <strong>:</strong>
              </div>
              <div>{{ form.description }}</div>
            </div>
          </div>
          
          <div class="columns mb-3">
            <div class="column is-full mb-3">
              <SalesOrderDetailRecord action="view" :info="form" tab="order_line" />
            </div>
          </div>

        </div>
      </div>

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