|
|
@ -4,6 +4,7 @@ import Link from 'next/link'
|
|
|
|
import {Button} from '@rmwc/button'
|
|
|
|
import {Button} from '@rmwc/button'
|
|
|
|
import AdminToolbar from '~/components/admin/actionBar'
|
|
|
|
import AdminToolbar from '~/components/admin/actionBar'
|
|
|
|
import Table from '~/components/table'
|
|
|
|
import Table from '~/components/table'
|
|
|
|
|
|
|
|
import {DateTime} from 'luxon'
|
|
|
|
|
|
|
|
|
|
|
|
AdminShipments.getInitialProps = async ({ctx: {axios}}) => {
|
|
|
|
AdminShipments.getInitialProps = async ({ctx: {axios}}) => {
|
|
|
|
const {data: shipments} = await axios.get('/api/shipments')
|
|
|
|
const {data: shipments} = await axios.get('/api/shipments')
|
|
|
@ -19,7 +20,7 @@ export default function AdminShipments({shipments}){
|
|
|
|
<Table
|
|
|
|
<Table
|
|
|
|
columns={[
|
|
|
|
columns={[
|
|
|
|
{name: 'Note', extractor: shipment => shipment.description},
|
|
|
|
{name: 'Note', extractor: shipment => shipment.description},
|
|
|
|
{name: 'Date', extractor: shipment => shipment.date},
|
|
|
|
{name: 'Date', extractor: shipment => DateTime.fromISO(shipment.date).setZone('local').toFormat('LLLL dd, h:mm a')},
|
|
|
|
{name: 'Quantity', extractor: ({stockchanges}) => {
|
|
|
|
{name: 'Quantity', extractor: ({stockchanges}) => {
|
|
|
|
const totalAdded = stockchanges
|
|
|
|
const totalAdded = stockchanges
|
|
|
|
.filter(stockchange => stockchange.direction === 'added')
|
|
|
|
.filter(stockchange => stockchange.direction === 'added')
|
|
|
|