n8n-nodes-servicem8-jobcreation 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +517 -0
- package/dist/credentials/ServiceM8Api.credentials.d.ts +9 -0
- package/dist/credentials/ServiceM8Api.credentials.js +38 -0
- package/dist/credentials/ServiceM8Api.credentials.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.d.ts +18 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.js +39 -0
- package/dist/nodes/ServiceM8JobCreation/ServiceM8JobCreation.node.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/execute.d.ts +6 -0
- package/dist/nodes/ServiceM8JobCreation/execute.js +47 -0
- package/dist/nodes/ServiceM8JobCreation/execute.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.d.ts +56 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.js +124 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/addressUtils.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.d.ts +180 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.js +418 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/api.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.d.ts +67 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.js +216 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/clientMatcher.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.d.ts +35 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.js +122 -0
- package/dist/nodes/ServiceM8JobCreation/helpers/phoneUtils.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.d.ts +13 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.js +17 -0
- package/dist/nodes/ServiceM8JobCreation/methods/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.d.ts +9 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/methods/loadOptions.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.d.ts +22 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/categoryAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.d.ts +36 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.js +66 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.d.ts +28 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.js +46 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/clientLookup.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.d.ts +18 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.js +48 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/contactLookup.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.js +40 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.d.ts +63 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.js +176 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/inputProcessor.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.d.ts +43 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.js +82 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/jobCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.d.ts +38 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.js +123 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/notifications.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.js +192 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/orchestrator.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.d.ts +22 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.js +61 -0
- package/dist/nodes/ServiceM8JobCreation/operations/create/queueAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.d.ts +8 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.js +35 -0
- package/dist/nodes/ServiceM8JobCreation/operations/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.d.ts +41 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.js +243 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/attachmentsUpload.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.d.ts +21 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/badgesAssign.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.d.ts +7 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.js +15 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.d.ts +42 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.js +103 -0
- package/dist/nodes/ServiceM8JobCreation/operations/shared/notesCreate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.js +9 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.d.ts +10 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.js +239 -0
- package/dist/nodes/ServiceM8JobCreation/operations/update/jobUpdate.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.js +145 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/address.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.js +22 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/business.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.js +85 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/contact.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.d.ts +10 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.js +30 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.js +43 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/job.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.js +49 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/additionalOptions.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.js +151 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/attachments.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/badges.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/category.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.d.ts +12 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.js +38 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.js +49 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notes.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.js +197 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/notifications.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.js +65 -0
- package/dist/nodes/ServiceM8JobCreation/properties/create/options/queue.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.d.ts +9 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.js +23 -0
- package/dist/nodes/ServiceM8JobCreation/properties/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.js +28 -0
- package/dist/nodes/ServiceM8JobCreation/properties/operation.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.js +74 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/fields.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.d.ts +8 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.js +22 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.js +63 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/jobSelection.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.d.ts +5 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.js +142 -0
- package/dist/nodes/ServiceM8JobCreation/properties/update/options.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/servicem8.svg +75 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.d.ts +59 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.js +34 -0
- package/dist/nodes/ServiceM8JobCreation/types/api.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.d.ts +7 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.js +21 -0
- package/dist/nodes/ServiceM8JobCreation/types/index.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.d.ts +119 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.js +6 -0
- package/dist/nodes/ServiceM8JobCreation/types/input.js.map +1 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.d.ts +79 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.js +96 -0
- package/dist/nodes/ServiceM8JobCreation/types/result.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Job Update Orchestrator
|
|
4
|
+
* Coordinates all operations for updating an existing ServiceM8 job
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.executeJobUpdate = void 0;
|
|
8
|
+
const types_1 = require("../../types");
|
|
9
|
+
const api_1 = require("../../helpers/api");
|
|
10
|
+
const badgesAssign_1 = require("../shared/badgesAssign");
|
|
11
|
+
const attachmentsUpload_1 = require("../shared/attachmentsUpload");
|
|
12
|
+
/**
|
|
13
|
+
* Look up a job by its generated job ID (job number)
|
|
14
|
+
*/
|
|
15
|
+
async function lookupJobByNumber(context, jobNumber) {
|
|
16
|
+
const filter = `active eq 1 and generated_job_id eq '${(0, api_1.escapeOData)(jobNumber)}'`;
|
|
17
|
+
const response = await (0, api_1.serviceM8Request)(context, {
|
|
18
|
+
method: 'GET',
|
|
19
|
+
endpoint: '/api_1.0/job.json',
|
|
20
|
+
query: { $filter: filter },
|
|
21
|
+
});
|
|
22
|
+
const jobs = (0, api_1.parseArrayResponse)(response);
|
|
23
|
+
return jobs.length > 0 ? jobs[0] : null;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Get job details by UUID
|
|
27
|
+
*/
|
|
28
|
+
async function getJobByUuid(context, jobUuid) {
|
|
29
|
+
try {
|
|
30
|
+
const response = await (0, api_1.serviceM8Request)(context, {
|
|
31
|
+
method: 'GET',
|
|
32
|
+
endpoint: `/api_1.0/job/${jobUuid}.json`,
|
|
33
|
+
});
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Update job fields
|
|
42
|
+
*/
|
|
43
|
+
async function updateJobFields(context, jobUuid, fields) {
|
|
44
|
+
const updatedFields = [];
|
|
45
|
+
if (Object.keys(fields).length === 0) {
|
|
46
|
+
return updatedFields;
|
|
47
|
+
}
|
|
48
|
+
await (0, api_1.serviceM8Request)(context, {
|
|
49
|
+
method: 'POST',
|
|
50
|
+
endpoint: `/api_1.0/job/${jobUuid}.json`,
|
|
51
|
+
body: fields,
|
|
52
|
+
});
|
|
53
|
+
return Object.keys(fields);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Add a note to a job
|
|
57
|
+
*/
|
|
58
|
+
async function addNoteToJob(context, jobUuid, noteContent) {
|
|
59
|
+
var _a;
|
|
60
|
+
if (!noteContent.trim()) {
|
|
61
|
+
return { added: false, uuid: '' };
|
|
62
|
+
}
|
|
63
|
+
const response = await (0, api_1.serviceM8Request)(context, {
|
|
64
|
+
method: 'POST',
|
|
65
|
+
endpoint: '/api_1.0/note.json',
|
|
66
|
+
body: {
|
|
67
|
+
related_object: 'job',
|
|
68
|
+
related_object_uuid: jobUuid,
|
|
69
|
+
note: noteContent,
|
|
70
|
+
active: 1,
|
|
71
|
+
},
|
|
72
|
+
returnFullResponse: true,
|
|
73
|
+
});
|
|
74
|
+
const uuid = (_a = (0, api_1.extractUuidFromResponse)(response)) !== null && _a !== void 0 ? _a : '';
|
|
75
|
+
return { added: true, uuid };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build the system report note for job update
|
|
79
|
+
*/
|
|
80
|
+
function buildUpdateReportNote(input) {
|
|
81
|
+
const reportLines = [];
|
|
82
|
+
reportLines.push('📝 JOB UPDATE REPORT');
|
|
83
|
+
reportLines.push('─'.repeat(30));
|
|
84
|
+
reportLines.push(`Job #${input.jobNumber}`);
|
|
85
|
+
reportLines.push('');
|
|
86
|
+
// Fields updated
|
|
87
|
+
if (input.fieldsUpdated.length > 0) {
|
|
88
|
+
reportLines.push(`✅ Fields updated: ${input.fieldsUpdated.join(', ')}`);
|
|
89
|
+
}
|
|
90
|
+
// Badges status
|
|
91
|
+
if (input.badgesAssigned.length > 0) {
|
|
92
|
+
reportLines.push(`✅ Badges added: ${input.badgesAssigned.join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
if (input.badgesMissing.length > 0) {
|
|
95
|
+
reportLines.push(`⚠️ Badges not found: ${input.badgesMissing.join(', ')}`);
|
|
96
|
+
}
|
|
97
|
+
// Attachments status
|
|
98
|
+
if (input.attachmentsUploaded.length > 0) {
|
|
99
|
+
reportLines.push(`✅ Attachments: ${input.attachmentsUploaded.join(', ')}`);
|
|
100
|
+
}
|
|
101
|
+
if (input.attachmentsFailed.length > 0) {
|
|
102
|
+
reportLines.push(`⚠️ Attachments failed: ${input.attachmentsFailed.join(', ')}`);
|
|
103
|
+
}
|
|
104
|
+
// Custom note status
|
|
105
|
+
if (input.noteAdded) {
|
|
106
|
+
reportLines.push('✅ Custom note added');
|
|
107
|
+
}
|
|
108
|
+
// Branding footer
|
|
109
|
+
reportLines.push('');
|
|
110
|
+
reportLines.push('─'.repeat(30));
|
|
111
|
+
reportLines.push('n8n ServiceM8 Smart Job Creator');
|
|
112
|
+
reportLines.push('Updated by Trade Magnet🧲');
|
|
113
|
+
reportLines.push('www.trademagnet.com.au');
|
|
114
|
+
return reportLines.join('\n');
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Execute job update for a single item
|
|
118
|
+
*/
|
|
119
|
+
async function executeJobUpdate(context, itemIndex) {
|
|
120
|
+
var _a;
|
|
121
|
+
// 1. Get the job UUID
|
|
122
|
+
const jobSelectionMode = context.getNodeParameter('jobSelectionMode', itemIndex, 'dropdown');
|
|
123
|
+
let jobUuid;
|
|
124
|
+
let jobNumber;
|
|
125
|
+
if (jobSelectionMode === 'dropdown') {
|
|
126
|
+
jobUuid = context.getNodeParameter('jobUuid', itemIndex, '');
|
|
127
|
+
if (!jobUuid) {
|
|
128
|
+
throw new Error('No job selected. Please select a job from the dropdown.');
|
|
129
|
+
}
|
|
130
|
+
// Look up job to get job number
|
|
131
|
+
const job = await getJobByUuid(context, jobUuid);
|
|
132
|
+
if (!job) {
|
|
133
|
+
throw new Error(`Job with UUID ${jobUuid} not found`);
|
|
134
|
+
}
|
|
135
|
+
jobNumber = job.generated_job_id;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
jobNumber = context.getNodeParameter('jobNumber', itemIndex, '');
|
|
139
|
+
if (!jobNumber) {
|
|
140
|
+
throw new Error('No job number provided. Please enter a job number.');
|
|
141
|
+
}
|
|
142
|
+
// Look up job by number
|
|
143
|
+
const job = await lookupJobByNumber(context, jobNumber);
|
|
144
|
+
if (!job) {
|
|
145
|
+
throw new Error(`Job with number ${jobNumber} not found`);
|
|
146
|
+
}
|
|
147
|
+
jobUuid = job.uuid;
|
|
148
|
+
}
|
|
149
|
+
// 2. Update job fields if provided
|
|
150
|
+
const updateFields = context.getNodeParameter('updateFields', itemIndex, {});
|
|
151
|
+
const fieldsUpdated = await updateJobFields(context, jobUuid, updateFields);
|
|
152
|
+
// 3. Add badges if enabled
|
|
153
|
+
let badgesAssigned = [];
|
|
154
|
+
let badgesMissing = [];
|
|
155
|
+
const enableBadges = context.getNodeParameter('updateEnableBadges', itemIndex, false);
|
|
156
|
+
if (enableBadges) {
|
|
157
|
+
const badgeUuids = context.getNodeParameter('updateBadges', itemIndex, []);
|
|
158
|
+
if (badgeUuids.length > 0) {
|
|
159
|
+
const badgesResult = await (0, badgesAssign_1.assignBadges)(context, {
|
|
160
|
+
jobUuid,
|
|
161
|
+
enableBadges: true,
|
|
162
|
+
badgesDynamic: false,
|
|
163
|
+
badgeUuidsInput: badgeUuids,
|
|
164
|
+
badgeNamesInput: '',
|
|
165
|
+
});
|
|
166
|
+
badgesAssigned = badgesResult.badgesAssigned;
|
|
167
|
+
badgesMissing = badgesResult.badgesMissing;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// 4. Upload attachments if enabled
|
|
171
|
+
let attachmentsUploaded = [];
|
|
172
|
+
let attachmentsFailed = [];
|
|
173
|
+
let attachmentUuids = [];
|
|
174
|
+
const enableAttachments = context.getNodeParameter('updateEnableAttachments', itemIndex, false);
|
|
175
|
+
if (enableAttachments) {
|
|
176
|
+
const attachmentMode = context.getNodeParameter('updateAttachmentMode', itemIndex, 'allBinary');
|
|
177
|
+
const attachmentUrlList = attachmentMode === 'urlList'
|
|
178
|
+
? context.getNodeParameter('updateAttachmentUrlList', itemIndex, '')
|
|
179
|
+
: '';
|
|
180
|
+
const attachmentsResult = await (0, attachmentsUpload_1.uploadAttachments)(context, itemIndex, jobUuid, {
|
|
181
|
+
enableAttachments: true,
|
|
182
|
+
attachmentMode,
|
|
183
|
+
attachmentUrlList,
|
|
184
|
+
attachmentsInput: {},
|
|
185
|
+
});
|
|
186
|
+
attachmentsUploaded = attachmentsResult.attachmentsUploaded;
|
|
187
|
+
attachmentsFailed = attachmentsResult.attachmentsFailed;
|
|
188
|
+
attachmentUuids = attachmentsResult.attachmentUuids;
|
|
189
|
+
}
|
|
190
|
+
// 5. Add custom note if enabled
|
|
191
|
+
let noteAdded = false;
|
|
192
|
+
let customNoteUuid = '';
|
|
193
|
+
const enableNote = context.getNodeParameter('updateEnableNote', itemIndex, false);
|
|
194
|
+
if (enableNote) {
|
|
195
|
+
const noteContent = context.getNodeParameter('updateNoteContent', itemIndex, '');
|
|
196
|
+
const noteResult = await addNoteToJob(context, jobUuid, noteContent);
|
|
197
|
+
noteAdded = noteResult.added;
|
|
198
|
+
customNoteUuid = noteResult.uuid;
|
|
199
|
+
}
|
|
200
|
+
// 6. Create system report note
|
|
201
|
+
const systemReportContent = buildUpdateReportNote({
|
|
202
|
+
jobNumber,
|
|
203
|
+
fieldsUpdated,
|
|
204
|
+
badgesAssigned,
|
|
205
|
+
badgesMissing,
|
|
206
|
+
attachmentsUploaded,
|
|
207
|
+
attachmentsFailed,
|
|
208
|
+
noteAdded,
|
|
209
|
+
});
|
|
210
|
+
const systemNoteResult = await addNoteToJob(context, jobUuid, systemReportContent);
|
|
211
|
+
const systemNoteUuid = systemNoteResult.uuid;
|
|
212
|
+
// 7. Get additional options
|
|
213
|
+
const additionalOptions = context.getNodeParameter('updateAdditionalOptions', itemIndex, {});
|
|
214
|
+
const returnHeaders = (_a = additionalOptions.returnHeaders) !== null && _a !== void 0 ? _a : false;
|
|
215
|
+
// Build createdRecords (only populated when returnHeaders is true)
|
|
216
|
+
let createdRecords = (0, types_1.createEmptyCreatedRecordsUpdate)();
|
|
217
|
+
if (returnHeaders) {
|
|
218
|
+
createdRecords = {
|
|
219
|
+
systemNoteUuid,
|
|
220
|
+
customNoteUuid,
|
|
221
|
+
attachmentUuids,
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
success: true,
|
|
226
|
+
error: '',
|
|
227
|
+
jobUuid,
|
|
228
|
+
jobNumber,
|
|
229
|
+
fieldsUpdated,
|
|
230
|
+
badgesAssigned,
|
|
231
|
+
badgesMissing,
|
|
232
|
+
attachmentsUploaded,
|
|
233
|
+
attachmentsFailed,
|
|
234
|
+
noteAdded,
|
|
235
|
+
createdRecords,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
exports.executeJobUpdate = executeJobUpdate;
|
|
239
|
+
//# sourceMappingURL=jobUpdate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobUpdate.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/operations/update/jobUpdate.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,uCAA8D;AAC9D,2CAA+G;AAC/G,yDAAsD;AACtD,mEAAqF;AAErF;;GAEG;AACH,KAAK,UAAU,iBAAiB,CAC/B,OAA0B,EAC1B,SAAiB;IAEjB,MAAM,MAAM,GAAG,wCAAwC,IAAA,iBAAW,EAAC,SAAS,CAAC,GAAG,CAAC;IACjF,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAgB,EAAC,OAAO,EAAE;QAChD,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,mBAAmB;QAC7B,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;KAC1B,CAAC,CAAC;IAEH,MAAM,IAAI,GAAG,IAAA,wBAAkB,EAAe,QAAQ,CAAC,CAAC;IACxD,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC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AW,CAAC;QAC3F,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACrE,SAAS,GAAG,UAAU,CAAC,KAAK,CAAC;QAC7B,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;KACjC;IAED,+BAA+B;IAC/B,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;QACjD,SAAS;QACT,aAAa;QACb,cAAc;QACd,aAAa;QACb,mBAAmB;QACnB,iBAAiB;QACjB,SAAS;KACT,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC;IACnF,MAAM,cAAc,GAAG,gBAAgB,CAAC,IAAI,CAAC;IAE7C,4BAA4B;IAC5B,MAAM,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,yBAAyB,EAAE,SAAS,EAAE,EAAE,CAE1F,CAAC;IACF,MAAM,aAAa,GAAG,MAAA,iBAAiB,CAAC,aAAa,mCAAI,KAAK,CAAC;IAE/D,mEAAmE;IACnE,IAAI,cAAc,GAAyB,IAAA,uCAA+B,GAAE,CAAC;IAC7E,IAAI,aAAa,EAAE;QAClB,cAAc,GAAG;YAChB,cAAc;YACd,cAAc;YACd,eAAe;SACf,CAAC;KACF;IAED,OAAO;QACN,OAAO,EAAE,IAAI;QACb,KAAK,EAAE,EAAE;QACT,OAAO;QACP,SAAS;QACT,aAAa;QACb,cAAc;QACd,aAAa;QACb,mBAAmB;QACnB,iBAAiB;QACjB,SAAS;QACT,cAAc;KACd,CAAC;AACH,CAAC;AAnID,4CAmIC"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Address Properties (Create Job)
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addressProperties = void 0;
|
|
7
|
+
exports.addressProperties = [
|
|
8
|
+
// Client Address
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Client Address',
|
|
11
|
+
name: 'clientAddress',
|
|
12
|
+
type: 'fixedCollection',
|
|
13
|
+
placeholder: 'Add Address',
|
|
14
|
+
default: {},
|
|
15
|
+
displayOptions: {
|
|
16
|
+
show: {
|
|
17
|
+
operation: ['create'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
options: [
|
|
21
|
+
{
|
|
22
|
+
displayName: 'Address',
|
|
23
|
+
name: 'address',
|
|
24
|
+
values: [
|
|
25
|
+
{
|
|
26
|
+
displayName: 'Street',
|
|
27
|
+
name: 'street',
|
|
28
|
+
type: 'string',
|
|
29
|
+
default: '',
|
|
30
|
+
placeholder: '123 Main Street',
|
|
31
|
+
description: 'Street address including unit/suite number',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
displayName: 'City',
|
|
35
|
+
name: 'city',
|
|
36
|
+
type: 'string',
|
|
37
|
+
default: '',
|
|
38
|
+
placeholder: 'Sydney',
|
|
39
|
+
description: 'City or suburb',
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
displayName: 'State/Province',
|
|
43
|
+
name: 'state',
|
|
44
|
+
type: 'string',
|
|
45
|
+
default: '',
|
|
46
|
+
placeholder: 'NSW',
|
|
47
|
+
description: 'State, province, or region',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Postcode',
|
|
51
|
+
name: 'postcode',
|
|
52
|
+
type: 'string',
|
|
53
|
+
default: '',
|
|
54
|
+
placeholder: '2000',
|
|
55
|
+
description: 'Postal or ZIP code',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
displayName: 'Country',
|
|
59
|
+
name: 'country',
|
|
60
|
+
type: 'string',
|
|
61
|
+
default: '',
|
|
62
|
+
placeholder: 'Australia',
|
|
63
|
+
description: 'Country name',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
// Job Address Same as Client
|
|
70
|
+
{
|
|
71
|
+
displayName: 'Job Address Same as Client',
|
|
72
|
+
name: 'jobAddressSameAsClient',
|
|
73
|
+
type: 'boolean',
|
|
74
|
+
default: true,
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
operation: ['create'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
description: 'Whether to use the client address for the job site',
|
|
81
|
+
},
|
|
82
|
+
// Job Address
|
|
83
|
+
{
|
|
84
|
+
displayName: 'Job Address',
|
|
85
|
+
name: 'jobAddress',
|
|
86
|
+
type: 'fixedCollection',
|
|
87
|
+
placeholder: 'Add Address',
|
|
88
|
+
default: {},
|
|
89
|
+
displayOptions: {
|
|
90
|
+
show: {
|
|
91
|
+
operation: ['create'],
|
|
92
|
+
jobAddressSameAsClient: [false],
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
options: [
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Address',
|
|
98
|
+
name: 'address',
|
|
99
|
+
values: [
|
|
100
|
+
{
|
|
101
|
+
displayName: 'Street',
|
|
102
|
+
name: 'street',
|
|
103
|
+
type: 'string',
|
|
104
|
+
default: '',
|
|
105
|
+
placeholder: '456 Job Site Road',
|
|
106
|
+
description: 'Street address including unit/suite number',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
displayName: 'City',
|
|
110
|
+
name: 'city',
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: '',
|
|
113
|
+
placeholder: 'Melbourne',
|
|
114
|
+
description: 'City or suburb',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
displayName: 'State/Province',
|
|
118
|
+
name: 'state',
|
|
119
|
+
type: 'string',
|
|
120
|
+
default: '',
|
|
121
|
+
placeholder: 'VIC',
|
|
122
|
+
description: 'State, province, or region',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Postcode',
|
|
126
|
+
name: 'postcode',
|
|
127
|
+
type: 'string',
|
|
128
|
+
default: '',
|
|
129
|
+
placeholder: '3000',
|
|
130
|
+
description: 'Postal or ZIP code',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Country',
|
|
134
|
+
name: 'country',
|
|
135
|
+
type: 'string',
|
|
136
|
+
default: '',
|
|
137
|
+
placeholder: 'Australia',
|
|
138
|
+
description: 'Country name',
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
];
|
|
145
|
+
//# sourceMappingURL=address.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/properties/create/address.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,iBAAiB,GAAsB;IACnD,iBAAiB;IACjB;QACC,WAAW,EAAE,gBAAgB;QAC7B,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,aAAa;QAC1B,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,SAAS;gBACtB,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE;oBACP;wBACC,WAAW,EAAE,QAAQ;wBACrB,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,iBAAiB;wBAC9B,WAAW,EAAE,4CAA4C;qBACzD;oBACD;wBACC,WAAW,EAAE,MAAM;wBACnB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,QAAQ;wBACrB,WAAW,EAAE,gBAAgB;qBAC7B;oBACD;wBACC,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,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,EAAE,MAAM;wBACnB,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,WAAW;wBACxB,WAAW,EAAE,gBAAgB;qBAC7B;oBACD;wBACC,WAAW,EAAE,gBAAgB;wBAC7B,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,KAAK;wBAClB,WAAW,EAAE,4BAA4B;qBACzC;oBACD;wBACC,WAAW,EAAE,UAAU;wBACvB,IAAI,EAAE,UAAU;wBAChB,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,MAAM;wBACnB,WAAW,EAAE,oBAAoB;qBACjC;oBACD;wBACC,WAAW,EAAE,SAAS;wBACtB,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,EAAE;wBACX,WAAW,EAAE,WAAW;wBACxB,WAAW,EAAE,cAAc;qBAC3B;iBACD;aACD;SACD;KACD;CACD,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Business Name Property (Create Job)
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.businessProperties = void 0;
|
|
7
|
+
exports.businessProperties = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Business Name',
|
|
10
|
+
name: 'businessName',
|
|
11
|
+
type: 'string',
|
|
12
|
+
default: '',
|
|
13
|
+
placeholder: 'Acme Plumbing Pty Ltd',
|
|
14
|
+
displayOptions: {
|
|
15
|
+
show: {
|
|
16
|
+
operation: ['create'],
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
description: 'If provided, client will be created as a business; otherwise as individual',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
//# sourceMappingURL=business.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/properties/create/business.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,kBAAkB,GAAsB;IACpD;QACC,WAAW,EAAE,eAAe;QAC5B,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,4EAA4E;KACzF;CACD,CAAC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Contact Information Properties (Create Job)
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.contactProperties = void 0;
|
|
7
|
+
exports.contactProperties = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Contact Information',
|
|
10
|
+
name: 'contactNotice',
|
|
11
|
+
type: 'notice',
|
|
12
|
+
default: '',
|
|
13
|
+
displayOptions: {
|
|
14
|
+
show: {
|
|
15
|
+
operation: ['create'],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'First Name',
|
|
21
|
+
name: 'firstName',
|
|
22
|
+
type: 'string',
|
|
23
|
+
default: '',
|
|
24
|
+
placeholder: 'John',
|
|
25
|
+
displayOptions: {
|
|
26
|
+
show: {
|
|
27
|
+
operation: ['create'],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
description: 'Contact first name',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Last Name',
|
|
34
|
+
name: 'lastName',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '',
|
|
37
|
+
placeholder: 'Smith',
|
|
38
|
+
displayOptions: {
|
|
39
|
+
show: {
|
|
40
|
+
operation: ['create'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
description: 'Contact last name',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
displayName: 'Email',
|
|
47
|
+
name: 'email',
|
|
48
|
+
type: 'string',
|
|
49
|
+
default: '',
|
|
50
|
+
placeholder: 'john.smith@example.com',
|
|
51
|
+
displayOptions: {
|
|
52
|
+
show: {
|
|
53
|
+
operation: ['create'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
description: 'Contact email address (primary lookup identifier)',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Phone',
|
|
60
|
+
name: 'phone',
|
|
61
|
+
type: 'string',
|
|
62
|
+
default: '',
|
|
63
|
+
placeholder: '02 9876 5432',
|
|
64
|
+
displayOptions: {
|
|
65
|
+
show: {
|
|
66
|
+
operation: ['create'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
description: 'Landline phone number',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Mobile',
|
|
73
|
+
name: 'mobile',
|
|
74
|
+
type: 'string',
|
|
75
|
+
default: '',
|
|
76
|
+
placeholder: '0412 345 678',
|
|
77
|
+
displayOptions: {
|
|
78
|
+
show: {
|
|
79
|
+
operation: ['create'],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
description: 'Mobile phone number',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
//# sourceMappingURL=contact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contact.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/properties/create/contact.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,qBAAqB;QAClC,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE;YAC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AW,EAAE,qBAAqB;KAClC;CACD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create Job Properties Index
|
|
3
|
+
*/
|
|
4
|
+
import type { INodeProperties } from 'n8n-workflow';
|
|
5
|
+
export declare const createProperties: INodeProperties[];
|
|
6
|
+
export { contactProperties } from './contact';
|
|
7
|
+
export { businessProperties } from './business';
|
|
8
|
+
export { addressProperties } from './address';
|
|
9
|
+
export { jobProperties } from './job';
|
|
10
|
+
export { optionsProperties } from './options';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Create Job Properties Index
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.optionsProperties = exports.jobProperties = exports.addressProperties = exports.businessProperties = exports.contactProperties = exports.createProperties = void 0;
|
|
7
|
+
const contact_1 = require("./contact");
|
|
8
|
+
const business_1 = require("./business");
|
|
9
|
+
const address_1 = require("./address");
|
|
10
|
+
const job_1 = require("./job");
|
|
11
|
+
const options_1 = require("./options");
|
|
12
|
+
exports.createProperties = [
|
|
13
|
+
...contact_1.contactProperties,
|
|
14
|
+
...business_1.businessProperties,
|
|
15
|
+
...address_1.addressProperties,
|
|
16
|
+
...job_1.jobProperties,
|
|
17
|
+
...options_1.optionsProperties,
|
|
18
|
+
];
|
|
19
|
+
// Re-export individual property groups
|
|
20
|
+
var contact_2 = require("./contact");
|
|
21
|
+
Object.defineProperty(exports, "contactProperties", { enumerable: true, get: function () { return contact_2.contactProperties; } });
|
|
22
|
+
var business_2 = require("./business");
|
|
23
|
+
Object.defineProperty(exports, "businessProperties", { enumerable: true, get: function () { return business_2.businessProperties; } });
|
|
24
|
+
var address_2 = require("./address");
|
|
25
|
+
Object.defineProperty(exports, "addressProperties", { enumerable: true, get: function () { return address_2.addressProperties; } });
|
|
26
|
+
var job_2 = require("./job");
|
|
27
|
+
Object.defineProperty(exports, "jobProperties", { enumerable: true, get: function () { return job_2.jobProperties; } });
|
|
28
|
+
var options_2 = require("./options");
|
|
29
|
+
Object.defineProperty(exports, "optionsProperties", { enumerable: true, get: function () { return options_2.optionsProperties; } });
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/properties/create/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIH,uCAA8C;AAC9C,yCAAgD;AAChD,uCAA8C;AAC9C,+BAAsC;AACtC,uCAA8C;AAEjC,QAAA,gBAAgB,GAAsB;IAClD,GAAG,2BAAiB;IACpB,GAAG,6BAAkB;IACrB,GAAG,2BAAiB;IACpB,GAAG,mBAAa;IAChB,GAAG,2BAAiB;CACpB,CAAC;AAEF,uCAAuC;AACvC,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA;AAC1B,uCAAgD;AAAvC,8GAAA,kBAAkB,OAAA;AAC3B,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA;AAC1B,6BAAsC;AAA7B,oGAAA,aAAa,OAAA;AACtB,qCAA8C;AAArC,4GAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Job Information Properties (Create Job)
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.jobProperties = void 0;
|
|
7
|
+
exports.jobProperties = [
|
|
8
|
+
{
|
|
9
|
+
displayName: 'Job Details',
|
|
10
|
+
name: 'jobDetails',
|
|
11
|
+
type: 'string',
|
|
12
|
+
typeOptions: {
|
|
13
|
+
rows: 4,
|
|
14
|
+
},
|
|
15
|
+
default: '',
|
|
16
|
+
placeholder: 'Describe the work to be done...',
|
|
17
|
+
displayOptions: {
|
|
18
|
+
show: {
|
|
19
|
+
operation: ['create'],
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
description: 'Job description/notes',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
displayName: 'Job Status',
|
|
26
|
+
name: 'jobStatus',
|
|
27
|
+
type: 'options',
|
|
28
|
+
options: [
|
|
29
|
+
{ name: 'Quote', value: 'Quote' },
|
|
30
|
+
{ name: 'Work Order', value: 'Work Order' },
|
|
31
|
+
{ name: 'Completed', value: 'Completed' },
|
|
32
|
+
{ name: 'Unsuccessful', value: 'Unsuccessful' },
|
|
33
|
+
],
|
|
34
|
+
default: 'Quote',
|
|
35
|
+
displayOptions: {
|
|
36
|
+
show: {
|
|
37
|
+
operation: ['create'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
description: 'Initial status for the job',
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
//# sourceMappingURL=job.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.js","sourceRoot":"","sources":["../../../../../nodes/ServiceM8JobCreation/properties/create/job.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAIU,QAAA,aAAa,GAAsB;IAC/C;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE;YACZ,IAAI,EAAE,CAAC;SACP;QACD,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,iCAAiC;QAC9C,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,uBAAuB;KACpC;IACD;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,OAAO,EAAE;YACR,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;YACjC,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;YAC3C,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE;YACzC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;SAC/C;QACD,OAAO,EAAE,OAAO;QAChB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,SAAS,EAAE,CAAC,QAAQ,CAAC;aACrB;SACD;QACD,WAAW,EAAE,4BAA4B;KACzC;CACD,CAAC"}
|