description:'Get a specific Onfleet worker schedule',
},
// {
// name: 'Set Worker\'s Schedule',
// value: 'setSchedule',
// description: 'Set the worker\'s schedule',
// },
{
name:'Update',
value:'update',
description:'Update an Onfleet worker',
},
],
default:'get',
},
];
constbyLocationField={
displayName:'Search by Location',
name:'byLocation',
type:'boolean',
default:false,
description:'Whether to search for only those workers who are currently within a certain target area',
}asINodeProperties;
constnameField={
displayName:'Name',
name:'name',
type:'string',
default:'',
description:'The worker\'s name',
}asINodeProperties;
constphoneField={
displayName:'Phone',
name:'phone',
type:'string',
default:'',
description:'A list of worker’s phone numbers',
}asINodeProperties;
constcapacityField={
displayName:'Capacity',
name:'capacity',
type:'number',
default:0,
description:'The maximum number of units this worker can carry, for route optimization purposes',
}asINodeProperties;
constdisplayNameField={
displayName:'Display Name',
name:'displayName',
type:'string',
default:'',
description:'This value is used in place of the worker\'s actual name within sms notifications, delivery tracking pages, and across organization boundaries',
}asINodeProperties;
constvehicleTypeField={
displayName:'Type',
name:'type',
type:'options',
options:[
{
name:'Bicycle',
value:'BICYCLE',
},
{
name:'Car',
value:'CAR',
},
{
name:'Motorcycle',
value:'MOTORCYCLE',
},
{
name:'Truck',
value:'TRUCK',
},
],
default:'',
description:'Whether the worker has vehicle or not. If it\'s not provided, this worker will be treated as if on foot.',
}asINodeProperties;
constvehicleDescriptionField={
displayName:'Description',
name:'description',
type:'string',
default:'',
description:'The vehicle\'s make, model, year, or any other relevant identifying details',
description:'One or more teams of which the worker is a member',
}asINodeProperties;
constteamsFilterField={
displayName:'Teams ID/Name',
name:'teams',
type:'multiOptions',
typeOptions:{
loadOptionsMethod:'getTeams',
},
default:[],
description:'A list of the teams that workers must be part of',
}asINodeProperties;
conststatesFilterField={
displayName:'States',
name:'states',
type:'multiOptions',
options:[
{
name:'Active (On-Duty, Active Task)',
value: 2,
},
{
name:'Idle (On-Duty, No Active Task)',
value: 1,
},
{
name:'Off-Duty',
value: 0,
},
],
default:[],
description:'List of worker states',
}asINodeProperties;
constphonesFilterField={
displayName:'Phones',
name:'phones',
type:'string',
typeOptions:{
multipleValues: true,
multipleValueButtonText:'Add Phone',
},
default:[],
description:'A list of workers\' phone numbers',
}asINodeProperties;
constfilterField={
displayName:'Fields to Return',
name:'filter',
type:'multiOptions',
options:[
{
name:'Account Status',
value:'accountStatus',
},
{
name:'Active Task',
value:'activeTask',
},
{
name:'Capacity',
value:'capacity',
},
{
name:'Delay Time',
value:'delayTime',
},
{
name:'Display Name',
value:'displayName',
},
{
name:'Image Url',
value:'imageUrl',
},
{
name:'Location',
value:'location',
},
{
name:'Metadata',
value:'metadata',
},
{
name:'Name',
value:'name',
},
{
name:'On Duty',
value:'onDuty',
},
{
name:'Organization',
value:'organization',
},
{
name:'Phone',
value:'phone',
},
{
name:'Tasks',
value:'tasks',
},
{
name:'Teams',
value:'teams',
},
{
name:'Time Created',
value:'timeCreated',
},
{
name:'Time Last Modified',
value:'timeLastModified',
},
{
name:'Time Last Seen',
value:'timeLastSeen',
},
{
name:'User Data',
value:'userData',
},
{
name:'Vehicle',
value:'vehicle',
},
{
name:'Worker ID',
value:'id',
},
],
default:[],
description:'A list of fields to show in the response, if all are not desired',
}asINodeProperties;
constlongitudeFilterField={
displayName:'Longitude',
name:'longitude',
type:'number',
typeOptions:{
numberPrecision: 14,
},
default:0,
description:'The longitude component of the coordinate pair',
}asINodeProperties;
constlatitudeFilterField={
displayName:'Latitude',
name:'latitude',
type:'number',
typeOptions:{
numberPrecision: 14,
},
default:0,
description:'The latitude component of the coordinate pair',
}asINodeProperties;
constradiusFilterField={
displayName:'Radius',
name:'radius',
type:'number',
typeOptions:{
maxValue: 10000,
minValue: 0,
},
default:1000,
description:'The length in meters of the radius of the spherical area in which to look for workers. Defaults to 1000 if missing. Maximum value is 10000.',
}asINodeProperties;
constscheduleDateField={
displayName:'Date',
name:'date',
type:'dateTime',
default:'',
description:'Schedule\'s date',
}asINodeProperties;
constscheduleTimezoneField={
displayName:'Timezone',
name:'timezone',
type:'options',
typeOptions:{
loadOptionsMethod:'getTimezones',
},
default:'',
description:'A valid timezone',
}asINodeProperties;
constscheduleStartField={
displayName:'Start',
name:'start',
type:'dateTime',
default:'',
description:'Start time',
}asINodeProperties;
constscheduleEndField={
displayName:'End',
name:'end',
type:'dateTime',
default:'',
description:'End time',
}asINodeProperties;
exportconstworkerFields: INodeProperties[]=[
{
...byLocationField,
required: true,
displayOptions:{
show:{
resource:[
'worker',
],
operation:[
'getAll',
],
},
},
},
{
displayName:'Worker ID',
name:'id',
type:'string',
displayOptions:{
show:{
resource:[
'worker',
],
operation:[
'get',
'getSchedule',
'setSchedule',
'update',
'delete',
],
},
},
default:'',
required: true,
description:'The ID of the worker object for lookup',