@overmap-ai/core 1.0.58-asset-description.3 → 1.0.58-asset-description.5
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/dist/forms/index.d.ts
CHANGED
package/dist/overmap-core.js
CHANGED
|
@@ -7350,26 +7350,35 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7350
7350
|
// Note currently the bulkAdd method is specific to form submissions for assets
|
|
7351
7351
|
// TODO: adapt the support bulk adding to any model type
|
|
7352
7352
|
async bulkAdd(args) {
|
|
7353
|
-
const { formRevision,
|
|
7353
|
+
const { formRevision, commonFieldValues, fieldValuesByAsset } = args;
|
|
7354
7354
|
const { store } = this.client;
|
|
7355
7355
|
const offlineSubmissions = [];
|
|
7356
7356
|
const offlineAttachments = [];
|
|
7357
7357
|
const submissionOfflineIds = [];
|
|
7358
7358
|
const submissionsPayload = [];
|
|
7359
7359
|
const attachmentsPayload = [];
|
|
7360
|
-
|
|
7360
|
+
let files = {};
|
|
7361
|
+
const { values: fileSeperatedCommonFieldValues, files: commonFiles } = separateFilesFromValues(commonFieldValues);
|
|
7362
|
+
files = commonFiles;
|
|
7361
7363
|
const submittedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
7362
7364
|
const createdBy = store.getState().userReducer.currentUser.id;
|
|
7363
|
-
for (const assetId
|
|
7365
|
+
for (const assetId in fieldValuesByAsset) {
|
|
7366
|
+
const { values: fileSeperatedSubmissionSpecificValues, files: submissionSpecificFiles } = separateFilesFromValues(fieldValuesByAsset[assetId] ?? {});
|
|
7367
|
+
files = Object.assign(files, submissionSpecificFiles);
|
|
7368
|
+
const submissionValues = { ...fileSeperatedCommonFieldValues, ...fileSeperatedSubmissionSpecificValues };
|
|
7364
7369
|
const submission = offline({
|
|
7365
7370
|
form_revision: formRevision,
|
|
7366
|
-
values,
|
|
7371
|
+
values: submissionValues,
|
|
7367
7372
|
created_by: createdBy,
|
|
7368
7373
|
submitted_at: submittedAt,
|
|
7369
7374
|
asset: assetId
|
|
7370
7375
|
});
|
|
7371
7376
|
submissionOfflineIds.push(submission.offline_id);
|
|
7372
|
-
submissionsPayload.push({
|
|
7377
|
+
submissionsPayload.push({
|
|
7378
|
+
offline_id: submission.offline_id,
|
|
7379
|
+
asset_id: assetId,
|
|
7380
|
+
form_data: fileSeperatedSubmissionSpecificValues
|
|
7381
|
+
});
|
|
7373
7382
|
offlineSubmissions.push(submission);
|
|
7374
7383
|
for (const [fieldIdentifier, fileArray] of Object.entries(files)) {
|
|
7375
7384
|
for (const file of fileArray) {
|
|
@@ -7410,13 +7419,13 @@ class UserFormSubmissionService extends BaseApiService {
|
|
|
7410
7419
|
method: HttpMethod.POST,
|
|
7411
7420
|
url: `/forms/revisions/${formRevision}/bulk-respond/`,
|
|
7412
7421
|
payload: {
|
|
7413
|
-
form_data:
|
|
7422
|
+
form_data: fileSeperatedCommonFieldValues,
|
|
7414
7423
|
submitted_at: submittedAt,
|
|
7415
7424
|
submissions: submissionsPayload,
|
|
7416
7425
|
attachments: attachmentsPayload,
|
|
7417
7426
|
files: Object.values(filesRecord)
|
|
7418
7427
|
},
|
|
7419
|
-
blockers:
|
|
7428
|
+
blockers: Object.keys(fieldValuesByAsset),
|
|
7420
7429
|
blocks: submissionOfflineIds
|
|
7421
7430
|
});
|
|
7422
7431
|
promise.then(({ submissions, attachments, presigned_urls }) => {
|
|
@@ -16711,6 +16720,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
16711
16720
|
emptyTextField,
|
|
16712
16721
|
encodeFormValues,
|
|
16713
16722
|
formRevisionToSchema,
|
|
16723
|
+
initialFormValues,
|
|
16714
16724
|
isConditionMet,
|
|
16715
16725
|
useFieldInput,
|
|
16716
16726
|
useFieldInputs,
|
|
@@ -16974,6 +16984,7 @@ export {
|
|
|
16974
16984
|
hashFile,
|
|
16975
16985
|
hideAllCategories,
|
|
16976
16986
|
hideCategory,
|
|
16987
|
+
initialFormValues,
|
|
16977
16988
|
isConditionMet,
|
|
16978
16989
|
isToday,
|
|
16979
16990
|
issueReducer,
|