project-booster-vue 9.0.4 → 9.1.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/package.json +1 -1
- package/src/components/media/upload/PbMediaUpload.vue +9 -7
- package/src/components/media/upload/document-upload-payload.json +7 -3
- package/src/components/projects/project-item-save/PbProjectItemSave.vue +1 -1
- package/src/components/question/upload-document/UploadDocument.ts +2 -1
- package/src/services/api/documentsApi.ts +2 -2
- package/src/stores/modules/mediaDocumentsStore.ts +4 -4
- package/src/types/pb/Media.ts +1 -0
package/package.json
CHANGED
|
@@ -135,10 +135,10 @@
|
|
|
135
135
|
<m-radio
|
|
136
136
|
class="pb-media-upload__preview-document-types-list"
|
|
137
137
|
name="radio-group"
|
|
138
|
-
v-for="
|
|
139
|
-
:label="
|
|
140
|
-
:key="type.
|
|
141
|
-
@click="updateMediaType(
|
|
138
|
+
v-for="mediaType in payload.viewModel.dialog.mediaTypes"
|
|
139
|
+
:label="mediaType.label"
|
|
140
|
+
:key="mediaType.type + '_' + mediaType.subtype"
|
|
141
|
+
@click="updateMediaType(mediaType)"
|
|
142
142
|
/>
|
|
143
143
|
</div>
|
|
144
144
|
<transition name="pb-media-upload--fade" mode="out-in" @before-leave="beforeLeave">
|
|
@@ -209,6 +209,7 @@ import PbStickyFooter from '../../sticky-footer/PbStickyFooter.vue';
|
|
|
209
209
|
import { isFileTypeValid, MediaValidationErrors, mediaValidator } from './mediaValidator';
|
|
210
210
|
import MEDIA_UPLOAD_PAYLOAD from './media-upload-payload.json';
|
|
211
211
|
import { MediaEventOptions, MediaUploadOptions } from '@/types/pb/Media';
|
|
212
|
+
import { UploadDocumentMediaType } from '@/components/question/upload-document/UploadDocument';
|
|
212
213
|
|
|
213
214
|
const NAME_MAX_LENGTH = 60;
|
|
214
215
|
const PDF_IMAGE = 'https://storage.googleapis.com/project-booster-media/vad/PDF/visuel_PDF_plan.png';
|
|
@@ -269,7 +270,7 @@ export default defineComponent({
|
|
|
269
270
|
displayAddDialog: false,
|
|
270
271
|
formData: null as FormData | null,
|
|
271
272
|
fileName: null as string | null,
|
|
272
|
-
selectedType: null as
|
|
273
|
+
selectedType: null as UploadDocumentMediaType | null,
|
|
273
274
|
isRoomPicture: false,
|
|
274
275
|
};
|
|
275
276
|
},
|
|
@@ -410,7 +411,8 @@ export default defineComponent({
|
|
|
410
411
|
formData: this.formData,
|
|
411
412
|
fileName: this.fileName,
|
|
412
413
|
isRoomPicture: this.isRoomPicture,
|
|
413
|
-
documentType: this.selectedType?.
|
|
414
|
+
documentType: this.selectedType?.type,
|
|
415
|
+
documentSubtype: this.selectedType?.subtype,
|
|
414
416
|
} as MediaUploadOptions);
|
|
415
417
|
} else {
|
|
416
418
|
this.displayAddDialog = false;
|
|
@@ -504,7 +506,7 @@ export default defineComponent({
|
|
|
504
506
|
return valid;
|
|
505
507
|
},
|
|
506
508
|
|
|
507
|
-
updateMediaType(type:
|
|
509
|
+
updateMediaType(type: UploadDocumentMediaType) {
|
|
508
510
|
this.selectedType = type;
|
|
509
511
|
},
|
|
510
512
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"viewModel": {
|
|
3
3
|
"title": "Ajouter un document",
|
|
4
|
+
"acceptedFileTypes": "image/jpeg, image/png, image/heif, image/heic, image/heif-sequence, image/heic-sequence, application/pdf",
|
|
4
5
|
"dialog": {
|
|
5
6
|
"hideCross": false,
|
|
6
7
|
"fullscreen": false,
|
|
@@ -14,15 +15,18 @@
|
|
|
14
15
|
"acceptedMediaTypesErrorLabel": "Seuls les formats JPG et PNG, et PDF sont acceptés",
|
|
15
16
|
"mediaTypes": [
|
|
16
17
|
{
|
|
17
|
-
"
|
|
18
|
+
"type": "PLAN",
|
|
19
|
+
"subtype": "HAND_DRAWN_PLAN",
|
|
18
20
|
"label": "Un plan fait moi même"
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
|
-
"
|
|
23
|
+
"type": "PLAN",
|
|
24
|
+
"subtype": "ARCHITECT_PLAN",
|
|
22
25
|
"label": "Un plan d’architecte"
|
|
23
26
|
},
|
|
24
27
|
{
|
|
25
|
-
"
|
|
28
|
+
"type": "PLAN",
|
|
29
|
+
"subtype": "KITCHEN_DESIGNER_PLAN",
|
|
26
30
|
"label": "Un plan d’un autre cuisiniste"
|
|
27
31
|
}
|
|
28
32
|
]
|
|
@@ -217,7 +217,7 @@ export default defineComponent({
|
|
|
217
217
|
try {
|
|
218
218
|
await store.dispatch('projects/saveProjectForItem', {
|
|
219
219
|
projectToSave,
|
|
220
|
-
metaData: store.getters['metaData/metaData']
|
|
220
|
+
metaData: store.getters['metaData/metaData'],
|
|
221
221
|
});
|
|
222
222
|
projectId = store.getters['projects/getCurrentProjectId'];
|
|
223
223
|
} catch (err) {
|
|
@@ -22,15 +22,15 @@ const uploadDocument = async (
|
|
|
22
22
|
formData: FormData,
|
|
23
23
|
inhabitantProjectId: string,
|
|
24
24
|
correlationId: string,
|
|
25
|
-
subType: string,
|
|
26
25
|
trackProgress: (progressEvent: ProgressEvent) => void,
|
|
27
26
|
fileName: string,
|
|
28
27
|
type: string,
|
|
28
|
+
subtype: string,
|
|
29
29
|
) => {
|
|
30
30
|
const [name, file] = formData.entries().next().value;
|
|
31
31
|
const data = new FormData();
|
|
32
32
|
data.append('document', file);
|
|
33
|
-
data.append('metadata', JSON.stringify({ type: type, correlationId, subType, title: fileName }, null, '\t'));
|
|
33
|
+
data.append('metadata', JSON.stringify({ type: type, correlationId, subType: subtype, title: fileName }, null, '\t'));
|
|
34
34
|
return await clientApi.post(`/inhabitant-projects/${inhabitantProjectId}/documents`, data, {
|
|
35
35
|
onUploadProgress: trackProgress,
|
|
36
36
|
});
|
|
@@ -177,10 +177,10 @@ export const mediaDocumentsUploadStoreOptions = {
|
|
|
177
177
|
uploadFile.formData,
|
|
178
178
|
state.currentProjectId,
|
|
179
179
|
correlationId,
|
|
180
|
-
uploadFile.documentType ? uploadFile.documentType : 'ROOM_PHOTO',
|
|
181
180
|
trackProgress,
|
|
182
181
|
uploadFile.fileName,
|
|
183
|
-
|
|
182
|
+
uploadFile.documentType,
|
|
183
|
+
uploadFile.documentSubtype,
|
|
184
184
|
);
|
|
185
185
|
}
|
|
186
186
|
const location = response.headers.location;
|
|
@@ -436,7 +436,7 @@ export const mediaDocumentsListStoreOptions = {
|
|
|
436
436
|
commit('setMediaList', []);
|
|
437
437
|
commit('setIsLoadingMedia', false);
|
|
438
438
|
commit('setCurrentMediaPage', 0);
|
|
439
|
-
commit('setHasStillMedia',
|
|
439
|
+
commit('setHasStillMedia', false);
|
|
440
440
|
commit('setAddedMediaNumber', 0);
|
|
441
441
|
commit('setMediaLoadError', null);
|
|
442
442
|
},
|
|
@@ -487,7 +487,7 @@ export const mediaDocumentsListStoreOptions = {
|
|
|
487
487
|
state.context.subType,
|
|
488
488
|
);
|
|
489
489
|
}
|
|
490
|
-
commit('addMedia', media.results);
|
|
490
|
+
commit('addMedia', media.results ? media.results : []);
|
|
491
491
|
|
|
492
492
|
if (media.total >= 30) {
|
|
493
493
|
commit('setIsAddPhotoDisabled', true);
|