Import payload config
This commit is contained in:
45
payload/src/collections/Couriers.ts
Normal file
45
payload/src/collections/Couriers.ts
Normal file
@ -0,0 +1,45 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Couriers: CollectionConfig = {
|
||||
slug: 'couriers',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name',
|
||||
type: 'text',
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'startingPoint',
|
||||
label: 'Traveling from',
|
||||
type: 'text', // TODO use geopicker here
|
||||
},
|
||||
{
|
||||
name: 'destination',
|
||||
label: 'Traveling to',
|
||||
type: 'text' // TODO user geopicker here
|
||||
},
|
||||
{
|
||||
name: 'departureDate',
|
||||
label: 'Departure date',
|
||||
type: 'date'
|
||||
},
|
||||
{
|
||||
name: 'arrivalDate',
|
||||
label: 'Arrival date',
|
||||
type: 'date'
|
||||
},
|
||||
{
|
||||
name: 'weightAllowance',
|
||||
label: 'Weight Allowance (KG)',
|
||||
type: 'number'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Couriers;
|
95
payload/src/collections/Dispatches.ts
Normal file
95
payload/src/collections/Dispatches.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Dispatches: CollectionConfig = {
|
||||
slug: 'dispatches',
|
||||
admin: {
|
||||
useAsTitle: 'dispatchesCode',
|
||||
},
|
||||
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',
|
||||
relationTo: 'retailers',
|
||||
hasMany: false,
|
||||
},
|
||||
{
|
||||
name: 'typeOfTransportation',
|
||||
type: 'select',
|
||||
hasMany: true,
|
||||
options: [
|
||||
{
|
||||
label: 'Air',
|
||||
value: 'air'
|
||||
},
|
||||
{
|
||||
label: 'Car',
|
||||
value: 'car'
|
||||
},
|
||||
{
|
||||
label: 'Train',
|
||||
value: 'train'
|
||||
},
|
||||
{
|
||||
label: 'Boat',
|
||||
value: 'boat'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'courier',
|
||||
type: 'relationship',
|
||||
relationTo: 'couriers',
|
||||
hasMany: false,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'timeSensitive',
|
||||
type: 'checkbox',
|
||||
},
|
||||
{
|
||||
name: 'status', // required
|
||||
type: 'select', // required
|
||||
hasMany: true,
|
||||
// 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;
|
34
payload/src/collections/Makers.ts
Normal file
34
payload/src/collections/Makers.ts
Normal file
@ -0,0 +1,34 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
import { geoPickerField } from "../customFields/geoPicker/field";
|
||||
|
||||
const Makers: CollectionConfig = {
|
||||
slug: 'makers',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
//geoPickerField, is a bit broken right now
|
||||
{
|
||||
name: 'location',
|
||||
type: 'point',
|
||||
label: 'Location',
|
||||
},
|
||||
{
|
||||
name: 'products', // required
|
||||
type: 'relationship', // required
|
||||
relationTo: 'products', // required
|
||||
hasMany: true,
|
||||
// TODO: make the name of the product visible in the dropdown
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Makers;
|
20
payload/src/collections/Products.ts
Normal file
20
payload/src/collections/Products.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Products: CollectionConfig = {
|
||||
slug: 'products',
|
||||
admin: {
|
||||
useAsTitle: 'productTitle',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'productTitle', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default Products;
|
36
payload/src/collections/Retailers.ts
Normal file
36
payload/src/collections/Retailers.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { CollectionConfig } from 'payload/types';
|
||||
|
||||
const Retailers: CollectionConfig = {
|
||||
slug: 'retailers',
|
||||
admin: {
|
||||
useAsTitle: 'name',
|
||||
},
|
||||
access: {
|
||||
read: () => true,
|
||||
},
|
||||
fields: [
|
||||
{
|
||||
name: 'name', // required
|
||||
type: 'text', // required
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
name: 'location',
|
||||
type: 'point',
|
||||
label: 'Location',
|
||||
},
|
||||
{
|
||||
name: 'products', // required
|
||||
type: 'relationship', // required
|
||||
relationTo: 'products', // required
|
||||
hasMany: true,
|
||||
},
|
||||
{
|
||||
name: 'salesPoint',
|
||||
type: 'text',
|
||||
label: 'Where do you plan to sell/exhibit products?'
|
||||
}
|
||||
],
|
||||
};
|
||||
|
||||
export default Retailers;
|
Reference in New Issue
Block a user