You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
894 B
JavaScript

import React, {useState} from 'react'
import Router from 'next/router'
import ActionBar from '~/components/admin/actionBar'
import {FormController, DateInput, Input, Button} from '~/components/form'
EnterTracking.getInitialProps = async ({ctx: {axios, query: {id}}}) => {
const {data: order} = await axios.get(`/api/orders/${id}`)
return {order}
}
export default function EnterTracking({order}){
return (
<>
<ActionBar title="Enter Tracking"/>
<FormController afterSubmit={() => Router.push(`/admin/orders/${order.uuid}`)} url={`/api/orders/${order.uuid}/ship/tracking`}>
<Input label="Tracking Code" validate={val => val.length > 0} type="text" name="code" hint="Please enter the USPS Tracking code" />
<DateInput label="Ship Date" placeholder="Today" name="date" />
<Button type="submit">Submit</Button>
</FormController>
</>
)
}