import dayjs from 'dayjs'

const TrackingTableColumns: any = [
  {
    field: 'trackingNo',
    title: 'Tracking No.',
    slots: {
      default: 'trackingNo'
    }
  },
  {
    field: 'mBOLNo',
    title: 'MBOL No.'
  },
  {
    field: 'hbOLNo',
    title: 'HBOL No.'
  },
  {
    field: 'containerNo',
    title: 'Container No.'
  },
  {
    field: 'invoiceNo',
    title: 'Invoice No.'
  },
  {
    field: 'bookingNo',
    title: 'Booking No.'
  },
  {
    field: 'poNo',
    title: 'PO No.'
  },
  {
    field: 'quoteNo',
    title: 'Quote No.'
  },
  {
    field: 'carrierBookingNo',
    title: 'Carrier Booking No.'
  },
  {
    field: 'contractNo',
    title: 'Contract No.'
  },
  {
    field: 'fileNo',
    title: 'File No.'
  },
  {
    field: 'otherRefNo',
    title: 'Other refenrence No.'
  },
  {
    field: 'mode',
    title: 'Transportation Mode',
    slots: {
      default: 'mode'
    }
  },
  {
    field: 'service',
    title: 'Service'
  },
  {
    field: 'bolType',
    title: 'BOL Type'
  },
  {
    field: 'exim',
    title: 'EX/IM'
  },
  {
    field: 'incoterms',
    title: 'Incoterms'
  },
  {
    field: 'trackingStatus',
    title: 'Status',
    slots: {
      default: 'status'
    }
  },
  {
    field: 'shipper',
    title: 'Shipper'
  },
  {
    field: 'shipperId',
    title: 'Shipper ID'
  },
  {
    field: 'consignee',
    title: 'Consignee'
  },
  {
    field: 'consigneeId',
    title: 'Consignee ID'
  },
  {
    field: 'notifyParty',
    title: 'Notify Party'
  },
  {
    field: 'notifyPartyId',
    title: 'Notify Party ID'
  },
  {
    field: 'billTo',
    title: 'Bill to'
  },
  {
    field: 'groupName',
    title: 'Group Name'
  },
  {
    field: 'originAgent',
    title: 'Origin Agent'
  },
  {
    field: 'destinationAgent',
    title: 'Destination Agent'
  },
  {
    field: 'destinationAgent',
    title: 'Destination Operator'
  },
  {
    field: 'sales',
    title: 'Sales'
  },
  {
    field: 'etd',
    title: 'ETD',
    formatter: ({ cellValue }: any) => {
      return cellValue ? dayjs(cellValue).format('MMM-DD-YYYY') : '--'
    }
  },
  {
    field: 'eta',
    title: 'ETA',
    formatter: ({ cellValue }: any) => {
      return cellValue ? dayjs(cellValue).format('MMM-DD-YYYY') : '--'
    }
  },
  {
    field: 'creationTime',
    title: 'Creation Time',
    formatter: ({ cellValue }: any) => {
      return cellValue ? dayjs(cellValue).format('MMM-DD-YYYY HH:mm:ss') : '--'
    }
  },
  {
    field: 'origin',
    title: 'Origin'
  },
  {
    field: 'destination',
    title: 'Destination'
  },
  {
    field: 'placeOfReceipt',
    title: 'Place of Receipt'
  },
  {
    field: 'portOfLoading',
    title: 'Port of Loading'
  },
  {
    field: 'portOfDischarge',
    title: 'Port of Discharge'
  },
  {
    field: 'placeOfDelivery',
    title: 'Place of Delivery'
  },

  {
    field: 'carrier',
    title: 'Carrier'
  },
  {
    field: 'voyage',
    title: 'Voyage'
  },
  {
    field: 'vessel',
    title: 'Vessel'
  },
  {
    field: 'week',
    title: 'Week'
  },
  {
    field: 'size',
    title: 'Size'
  },
  {
    field: 'itemNo',
    title: 'Item No.'
  },
  {
    field: 'cartonNo',
    title: 'Carton No.'
  },
  {
    field: 'weightNo',
    title: 'Weight No.'
  },
  {
    field: 'file',
    title: 'File'
  },
  {
    field: 'attachment',
    title: 'ACE-M1 Status'
  },
  {
    field: 'isISF',
    title: 'Is ISF'
  },
  {
    field: 'obL_SET',
    title: 'OBL_SET'
  },
  {
    field: 'createdBy',
    title: 'Created by'
  }
]

const addOtherConfig = () => {
  TrackingTableColumns.forEach((item: any) => {
    item.sortable = true
  })
}
addOtherConfig()

const defaultColumns = [
  'Transportation Mode',
  'Status',
  'Tracking No.',
  'HBOL No.',
  'MBOL No.',
  'PO No.',
  'Booking No.',
  'Container No.',
  'Service',
  'BOL Type',
  'EX/IM',
  'Shipper',
  'Consignee',
  'Notify Party',
  'Bill to',
  // 'Agent',
  'Origin',
  'Destination',
  'Creation Time',
  'ETD',
  'ETA',
  'Carrier',
  'Week',
  'Vessel',
  'Voyage',
  'ACE-M1 Status',
  'Is ISF',
  'Created by'
]

// 分组
const groupColumns = [
  {
    name: 'All',
    children: [
      {
        label: 'Tracking No.',
        field: 'trackingNo'
      },
      {
        label: 'MBOL No.',
        field: 'mBOLNo'
      },
      {
        label: 'HBOL No.',
        field: 'hbOLNo'
      },
      {
        label: 'Container No.',
        field: 'containerNo'
      },
      {
        label: 'Invoice No.',
        field: 'invoiceNo'
      },
      {
        label: 'Booking No.',
        field: 'bookingNo'
      },
      {
        label: 'PO No.',
        field: 'poNo'
      },
      {
        label: 'Quote No.',
        field: 'quoteNo'
      },
      {
        label: 'Carrier Booking No.',
        field: 'carrierBookingNo'
      },
      {
        label: 'Contract No.',
        field: 'contractNo'
      },
      {
        label: 'File No.',
        field: 'fileNo'
      },
      {
        label: 'Other refenrence No.',
        field: 'otherRefNo'
      },
      {
        label: 'Transportation Mode',
        field: 'mode'
      },
      {
        label: 'Service',
        field: 'service'
      },
      {
        label: 'BOL Type',
        field: 'bolType'
      },
      {
        label: 'EX/IM',
        field: 'exim'
      },
      {
        label: 'Incoterms',
        field: 'incoterms'
      },
      {
        label: 'Status',
        field: 'trackingStatus'
      },
      {
        label: 'Shipper',
        field: 'shipper'
      },
      {
        label: 'Shipper ID',
        field: 'shipperId'
      },
      {
        label: 'Consignee',
        field: 'consignee'
      },
      {
        label: 'Consignee ID',
        field: 'consigneeId'
      },
      {
        label: 'Notify Party',
        field: 'notifyParty'
      },
      {
        label: 'Notify Party ID',
        field: 'notifyPartyId'
      },
      {
        label: 'Bill to',
        field: 'billTo'
      },
      {
        label: 'Group Name',
        field: 'groupName'
      },
      {
        label: 'Origin Agent',
        field: 'originAgent'
      },
      {
        label: 'Destination Agent',
        field: 'destinationAgent'
      },
      {
        label: 'Destination Operator',
        field: 'destinationOperator'
      },
      {
        label: 'Sales',
        field: 'sales'
      },
      {
        label: 'ETD',
        field: 'etd'
      },
      {
        label: 'ETA',
        field: 'eta'
      },
      {
        label: 'Creation Time',
        field: 'creationTime'
      },
      {
        label: 'Origin',
        field: 'origin'
      },
      {
        label: 'Destination',
        field: 'destination'
      },
      {
        label: 'Place of Receipt',
        field: 'placeOfReceipt'
      },
      {
        label: 'Port of Loading',
        field: 'portOfLoading'
      },
      {
        label: 'Port of Discharge',
        field: 'portOfDischarge'
      },
      {
        label: 'Place of Delivery',
        field: 'placeOfDelivery'
      },
      {
        label: 'Carrier',
        field: 'carrier'
      },
      {
        label: 'Voyage',
        field: 'voyage'
      },
      {
        label: 'Vessel',
        field: 'vessel'
      },
      {
        label: 'Week',
        field: 'week'
      },
      {
        label: 'Size',
        field: 'size'
      },
      {
        label: 'Item No.',
        field: 'itemNo'
      },
      {
        label: 'Carton No.',
        field: 'cartonNo'
      },
      {
        label: 'Weight No.',
        field: 'weightNo'
      },
      {
        label: 'File',
        field: 'file'
      },
      {
        label: 'ACE-M1 Status',
        field: 'attachment'
      },
      {
        label: 'Is ISF',
        field: 'isISF'
      },
      {
        label: 'OBL_SET',
        field: 'obL_SET'
      },
      {
        label: 'Created by',
        field: 'createdBy'
      }
    ]
  },
  {
    name: 'Reference No.',
    children: [
      {
        label: 'Tracking No.',
        field: 'trackingNo'
      },
      {
        label: 'MBOL No.',
        field: 'mBOLNo'
      },
      {
        label: 'HBOL No.',
        field: 'hbOLNo'
      },
      {
        label: 'Container No.',
        field: 'containerNo'
      },
      {
        label: 'Invoice No.',
        field: 'invoiceNo'
      },
      {
        label: 'Booking No.',
        field: 'bookingNo'
      },
      {
        label: 'PO No.',
        field: 'poNo'
      },
      {
        label: 'Quote No.',
        field: 'quoteNo'
      },
      {
        label: 'Carrier Booking No.',
        field: 'carrierBookingNo'
      },
      {
        label: 'Contract No.',
        field: 'contractNo'
      },
      {
        label: 'File No.',
        field: 'fileNo'
      },
      {
        label: 'Other refenrence No.',
        field: 'otherRefNo'
      }
    ]
  },
  {
    name: 'General',
    children: [
      {
        label: 'Transportation Mode',
        field: 'mode'
      },
      {
        label: 'Service',
        field: 'service'
      },
      {
        label: 'BOL Type',
        field: 'bolType'
      },
      {
        label: 'EX/IM',
        field: 'exim'
      },
      {
        label: 'Incoterms',
        field: 'incoterms'
      },
      {
        label: 'Status',
        field: 'trackingStatus'
      }
    ]
  },
  {
    name: 'Parties',
    children: [
      {
        label: 'Shipper',
        field: 'shipper'
      },
      {
        label: 'Shipper ID',
        field: 'shipperId'
      },
      {
        label: 'Consignee',
        field: 'consignee'
      },
      {
        label: 'Consignee ID',
        field: 'consigneeId'
      },
      {
        label: 'Notify Party',
        field: 'notifyParty'
      },
      {
        label: 'Notify Party ID',
        field: 'notifyPartyId'
      },
      {
        label: 'Bill to',
        field: 'billTo'
      },
      {
        label: 'Group Name',
        field: 'groupName'
      },
      {
        label: 'Origin Agent',
        field: 'originAgent'
      },
      {
        label: 'Destination Agent',
        field: 'destinationAgent'
      },
      {
        label: 'Destination Operator',
        field: 'destinationOperator'
      },
      {
        label: 'Sales',
        field: 'sales'
      }
    ]
  },
  {
    name: 'Date Range',
    children: [
      {
        label: 'ETD',
        field: 'etd'
      },
      {
        label: 'ETA',
        field: 'eta'
      },
      {
        label: 'Creation Time',
        field: 'creationTime'
      }
    ]
  },
  {
    name: 'Places',
    children: [
      {
        label: 'Origin',
        field: 'origin'
      },
      {
        label: 'Destination',
        field: 'destination'
      },
      {
        label: 'Place of Receipt',
        field: 'placeOfReceipt'
      },
      {
        label: 'Port of Loading',
        field: 'portOfLoading'
      },
      {
        label: 'Port of Discharge',
        field: 'portOfDischarge'
      },
      {
        label: 'Place of Delivery',
        field: 'placeOfDelivery'
      }
    ]
  },
  {
    name: 'Transportation',
    children: [
      {
        label: 'Carrier',
        field: 'carrier'
      },
      {
        label: 'Voyage',
        field: 'voyage'
      },
      {
        label: 'Vessel',
        field: 'vessel'
      },
      {
        label: 'Week',
        field: 'week'
      }
    ]
  },
  {
    name: 'Others',
    children: [
      {
        label: 'Size',
        field: 'size'
      },
      {
        label: 'Item No.',
        field: 'itemNo'
      },
      {
        label: 'Carton No.',
        field: 'cartonNo'
      },
      {
        label: 'Weight No.',
        field: 'weightNo'
      },
      {
        label: 'File',
        field: 'file'
      },
      {
        label: 'ACE-M1 Status',
        field: 'attachment'
      },
      {
        label: 'Is ISF',
        field: 'isISF'
      },
      {
        label: 'OBL_SET',
        field: 'obL_SET'
      },
      {
        label: 'Created by',
        field: 'createdBy'
      }
    ]
  }
]

export { TrackingTableColumns, defaultColumns, groupColumns }
