import { i18next, localize } from '@things-factory/i18n-base'
export const WORKSHEET_REPLENISHMENT_CONFIG = {
  LIST: {
    list: {
      fields: ['orderNo', 'type', 'status', 'assignedPicker', 'createdAt', 'startedAt', 'endedAt', 'updater']
    },
    pagination: { limit: 100, pages: [100, 200, 500, 1000] },
    rows: { selectable: { multiple: true } },
    columns: [
      { type: 'gutter', gutterName: 'sequence' },
      { type: 'gutter', gutterName: 'row-selector', multiple: true },
      {
        type: 'gutter',
        gutterName: 'button',
        icon: 'reorder',
        handlers: {
          click: (columns, data, column, record, rowIndex) => {
            navigate(`replenishment/detail/${record.name}`) // 1. move to rejected detail page
          }
        }
      },
      {
        type: 'string',
        name: 'orderNo',
        header: i18next.t('field.order_no'),
        width: 150
      },
      {
        type: 'string',
        name: 'type',
        header: i18next.t('field.type'),
        width: 150
      },
      {
        type: 'string',
        name: 'status',
        header: i18next.t('field.status'),
        width: 150
      },
      {
        type: 'string',
        name: 'assignedPicker',
        header: i18next.t('field.assigned_picker'),
        width: 150
      },
      {
        type: 'datetime',
        name: 'createdAt',
        header: i18next.t('field.created_at'),
        width: 150
      },
      {
        type: 'datetime',
        name: 'startedAt',
        header: i18next.t('field.started_at'),
        width: 150
      },
      {
        type: 'datetime',
        name: 'endedAt',
        header: i18next.t('field.ended_at'),
        width: 150
      },
      {
        type: 'string',
        name: 'updater',
        header: i18next.t('field.updater'),
        width: 150
      }
    ]
  },
  DETAIL: {
    list: {
      fields: ['cartonId', 'sku', 'product.name', 'storageLocation', 'transferQty', 'status', 'updater']
    },
    pagination: { limit: 100, pages: [100, 200, 500, 1000] },
    rows: { selectable: { multiple: true } },
    columns: [
      { type: 'gutter', gutterName: 'sequence' },
      { type: 'gutter', gutterName: 'row-selector', multiple: true },
      {
        type: 'string',
        name: 'cartonId',
        header: i18next.t('field.carton_id'),
        width: 150
      },
      {
        type: 'string',
        name: 'sku',
        header: i18next.t('field.sku'),
        width: 150
      },
      {
        type: 'object',
        name: 'product.name',
        header: i18next.t('field.product'),
        width: 150
      },
      {
        type: 'string',
        name: 'storageLocation',
        header: i18next.t('field.storage_location'),
        width: 150
      },
      {
        type: 'integer',
        name: 'transferQty',
        header: i18next.t('field.transfer_qty'),
        width: 150
      },
      {
        type: 'string',
        name: 'status',
        header: i18next.t('field.status'),
        width: 150
      }
    ]
  }
}
