2023-01-24 12:20:27 +00:00
|
|
|
import { CollectionConfig } from 'payload/types';
|
|
|
|
|
|
|
|
const Dispatches: CollectionConfig = {
|
|
|
|
slug: 'dispatches',
|
2023-01-24 14:15:42 +00:00
|
|
|
admin: {
|
|
|
|
useAsTitle: 'dispatchesCode',
|
|
|
|
},
|
2023-01-24 12:20:27 +00:00
|
|
|
access: {
|
|
|
|
read: () => true,
|
|
|
|
},
|
|
|
|
fields: [
|
|
|
|
{
|
|
|
|
name: 'dispatchesCode',
|
|
|
|
type: 'text',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'products',
|
|
|
|
type: 'relationship',
|
|
|
|
relationTo: 'products',
|
|
|
|
hasMany: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'startingPoint',
|
|
|
|
type: 'relationship',
|
|
|
|
relationTo: 'makers',
|
|
|
|
hasMany: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'endPoint',
|
|
|
|
type: 'relationship',
|
2023-01-30 07:34:03 +00:00
|
|
|
relationTo: 'retailers',
|
2023-01-24 12:20:27 +00:00
|
|
|
hasMany: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'courier',
|
|
|
|
type: 'relationship',
|
|
|
|
relationTo: 'couriers',
|
|
|
|
hasMany: false,
|
|
|
|
},
|
2024-02-20 09:20:08 +00:00
|
|
|
{
|
|
|
|
name: 'timeSensitive',
|
|
|
|
type: 'select',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'Yes',
|
|
|
|
value: 'yes',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'No',
|
|
|
|
value: 'no',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2023-01-24 12:20:27 +00:00
|
|
|
{
|
|
|
|
name: 'status', // required
|
|
|
|
type: 'select', // required
|
2024-01-19 13:00:34 +00:00
|
|
|
hasMany: true,
|
2023-01-24 12:20:27 +00:00
|
|
|
// admin: {
|
|
|
|
// isClearable: true,
|
|
|
|
// isSortable: true, // use mouse to drag and drop different values, and sort them according to your choice
|
|
|
|
// },
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
label: 'Route requested',
|
|
|
|
value: 'routeRequested',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'In transit',
|
|
|
|
value: 'inTransit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
label: 'Completed',
|
|
|
|
value: 'completed',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Dispatches;
|