@konfuzio/document-validation-ui 0.1.10-dev.4 → 0.1.10-dev.6
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/css/app.css +1 -1
- package/dist/index.html +1 -1
- package/dist/js/app.js +1 -1
- package/dist/js/app.js.map +1 -1
- package/package.json +1 -1
- package/src/assets/scss/document_edit.scss +27 -7
- package/src/assets/scss/document_name.scss +1 -1
- package/src/assets/scss/document_top_bar.scss +4 -0
- package/src/assets/scss/main.scss +1 -1
- package/src/assets/scss/variables.scss +1 -0
- package/src/components/DocumentAnnotations/DocumentAnnotations.vue +0 -11
- package/src/components/DocumentCategory.vue +2 -2
- package/src/components/DocumentDashboard.vue +3 -15
- package/src/components/DocumentEdit/DocumentEdit.vue +80 -25
- package/src/components/DocumentEdit/EditPages.vue +5 -3
- package/src/components/DocumentEdit/{SplitOverview.vue → RenameAndCategorize.vue} +9 -8
- package/src/components/DocumentEdit/index.js +1 -1
- package/src/components/DocumentTopBar/DocumentTopBarButtons.vue +66 -30
- package/src/locales/de.json +5 -5
- package/src/locales/en.json +5 -5
- package/src/locales/es.json +18 -18
- package/src/store/document.js +14 -12
- package/src/store/edit.js +30 -14
- package/src/assets/scss/categorize_modal.scss +0 -45
- package/src/assets/scss/splitting_confirmation_modal.scss +0 -41
- package/src/components/DocumentAnnotations/CategorizeModal.vue +0 -247
- package/src/components/DocumentModals/SplittingSuggestionsModal.vue +0 -132
package/src/locales/de.json
CHANGED
|
@@ -57,17 +57,17 @@
|
|
|
57
57
|
"reorder": "Sortieren",
|
|
58
58
|
"rotate": "Rotieren",
|
|
59
59
|
"edit_error": "Die Änderungen konnten nicht gespeichert werden. Bitte versuchen Sie es später erneut.",
|
|
60
|
-
"overview": "Übersicht",
|
|
61
60
|
"select_pages": "Sie können nun Seiten drehen, neu sortieren und Dokumente splitten.",
|
|
62
61
|
"edit_document": "Dokument bearbeiten (Early Access)",
|
|
63
62
|
"edit_early_access": "Sie sind einer der Nutzer, die Zugang zu diesen Funktionalitäten vor dem offiziellen Erscheinungstermin erhalten.",
|
|
64
63
|
"selected": "ausgewählt",
|
|
65
64
|
"rotate_selected": "Ausgewählte Seite drehen",
|
|
66
65
|
"edit_not_available": "Dokumente mit dem Status 'Vorbereitung', 'Training' oder 'Test' sowie Dokumente mit dem Status 'Geprüft' können nicht bearbeitet werden.",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
66
|
+
"rotate_split_reorder": "Rotate, split or reorder",
|
|
67
|
+
"rename_and_categorize": "Rename and Categorize",
|
|
69
68
|
"submit": "Senden",
|
|
70
|
-
"next": "
|
|
69
|
+
"next": "Next: Rename and Categorize",
|
|
70
|
+
"back_to_annotations": "Back to annotation view",
|
|
71
71
|
"select_label": "Label auswählen",
|
|
72
72
|
"select_annotation_set": "Wähle Annotation Set",
|
|
73
73
|
"accept": "Akzeptieren",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"categorized_as": "Dieses Dokument ist kategorisiert als",
|
|
84
84
|
"not_categorized": "Nicht kategorisiert. Bitte wählen Sie vor dem Annotieren eine Kategorie aus: ",
|
|
85
85
|
"choose_category": "Wählen Sie bitte eine Kategorie",
|
|
86
|
-
"select_category": "Wählen Sie bitte die richtige Kategorie aus
|
|
86
|
+
"select_category": "Wählen Sie bitte die richtige Kategorie aus",
|
|
87
87
|
"categorized_error": "Wenn dies nicht die richtige Kategorie ist, ändern Sie diese bitte und wir fahren mit der erneuten Extraktion fort.",
|
|
88
88
|
"categorize_document_no_category_description": "Bitten Sie den Projektmanager, eine Beschreibung dieser Kategorie hinzuzufügen, um mehr über diese Kategorie zu erfahren.",
|
|
89
89
|
"annotations_pending": "Ausstehende Annotationen",
|
package/src/locales/en.json
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"rotate_all": "Rotate all",
|
|
47
47
|
"cancel": "Cancel",
|
|
48
48
|
"apply": "Apply",
|
|
49
|
-
"next": "Next",
|
|
49
|
+
"next": "Next: Rename and Categorize",
|
|
50
|
+
"back_to_annotations": "Back to annotation view",
|
|
50
51
|
"submit": "Submit",
|
|
51
52
|
"data_being_extracted": "New data is being extracted",
|
|
52
53
|
"analysing_document": "We are analysing your document.",
|
|
@@ -60,15 +61,14 @@
|
|
|
60
61
|
"reorder": "Reorder",
|
|
61
62
|
"rotate": "Rotate",
|
|
62
63
|
"edit_error": "The changes couldn’t be saved, please try again later.",
|
|
63
|
-
"overview": "Overview",
|
|
64
64
|
"select_pages": "You can now rotate pages, reorder and split documents.",
|
|
65
65
|
"edit_document": "Edit document (Early Access)",
|
|
66
66
|
"edit_early_access": "You are one of the users who have access to these functionalities before the release date.",
|
|
67
67
|
"selected": "selected",
|
|
68
68
|
"rotate_selected": "Rotate selected",
|
|
69
69
|
"edit_not_available": "Editing is not possible for documents with a status of 'Preparation', 'Training' or 'Test', or documents that are 'Reviewed'",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"rotate_split_reorder": "Rotate, split or reorder",
|
|
71
|
+
"rename_and_categorize": "Rename and Categorize",
|
|
72
72
|
"select_label": "Select Label",
|
|
73
73
|
"select_annotation_set": "Select Annotation Set",
|
|
74
74
|
"document_error_title": "Document error",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"categorized_as": "This document is currently categorized as",
|
|
84
84
|
"not_categorized": "This document is currently not categorized. Please select a category before annotating: ",
|
|
85
85
|
"choose_category": "Choose a category",
|
|
86
|
-
"select_category": "Select the correct category
|
|
86
|
+
"select_category": "Select the correct category",
|
|
87
87
|
"categorized_error": "If this is not the correct category, please change it and we'll proceed with the re-extraction.",
|
|
88
88
|
"categorize_document_no_category_description": "Ask the Project Manager to add a description of this Category to know more about this category.",
|
|
89
89
|
"annotations_pending": "pending",
|
package/src/locales/es.json
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
"rotate_all": "Rotar todas",
|
|
47
47
|
"cancel": "Cancelar",
|
|
48
48
|
"apply": "Aplicar",
|
|
49
|
-
"next": "Siguiente",
|
|
49
|
+
"next": "Siguiente: Cambiar nombre y categoría",
|
|
50
|
+
"back_to_annotations": "Volver a la vista de anotaciones",
|
|
50
51
|
"submit": "Enviar",
|
|
51
52
|
"data_being_extracted": "Se están extrayendo nuevos datos",
|
|
52
53
|
"analysing_document": "Estamos analizando el documento.",
|
|
@@ -60,15 +61,14 @@
|
|
|
60
61
|
"reorder": "Reordenar",
|
|
61
62
|
"rotate": "Rotar",
|
|
62
63
|
"edit_error": "No se han podido guardar los cambios, por favor, inténtelo de nuevo más tarde.",
|
|
63
|
-
"
|
|
64
|
-
"select_pages": "Ahora puedes rotar, reordenar o dividir los documentos.",
|
|
64
|
+
"select_pages": "Ahora puede rotar, reordenar o dividir los documentos.",
|
|
65
65
|
"edit_document": "Editar documento (Early Access)",
|
|
66
66
|
"edit_early_access": "Eres uno de los usuarios que tiene acceso a estas funcionalidades antes de la fecha de lanzamiento.",
|
|
67
67
|
"selected": "seleccionadas",
|
|
68
68
|
"rotate_selected": "Rotar seleccionadas",
|
|
69
69
|
"edit_not_available": "No es posible editar documentos con estado en 'Preparación', 'Entrenamiento' o 'Pruebas', así como documentos que han sido 'Revisados'",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
70
|
+
"rotate_split_reorder": "Rotar, dividir or reordenar",
|
|
71
|
+
"rename_and_categorize": "Cambiar nombre y categoría",
|
|
72
72
|
"select_label": "Seleccionar etiqueta",
|
|
73
73
|
"select_annotation_set": "Seleccionar grupo de etiquetas",
|
|
74
74
|
"document_error_title": "Error en el documento",
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"categorized_as": "Este documento ha sido categorizado como",
|
|
84
84
|
"not_categorized": "Este documento no ha sido categorizado. Por favor, seleccione una categoría antes de realizar anotaciones: ",
|
|
85
85
|
"choose_category": "Seleccione una categoría",
|
|
86
|
-
"select_category": "Seleccione la categoría correcta
|
|
86
|
+
"select_category": "Seleccione la categoría correcta",
|
|
87
87
|
"categorized_error": "Si esta no es la categoría correcta, por favor cámbiela y procederemos a realizar de nuevo la extracción.",
|
|
88
88
|
"categorize_document_no_category_description": "Solicite a su Gestor de Proyecto que agregue una descripción a esta Categoría para saber más sobre ella.",
|
|
89
89
|
"annotations_pending": "pendientes",
|
|
90
90
|
"annotations_accepted": "aceptadas",
|
|
91
|
-
"mark_all_missing": "
|
|
91
|
+
"mark_all_missing": "Marcar todas las anotaciones vacías como Faltantes",
|
|
92
92
|
"no_labels_to_choose": "Sin etiquetas",
|
|
93
93
|
"accept_group": "Aceptar todas",
|
|
94
94
|
"use_your_keyboard": "Use su teclado",
|
|
@@ -108,28 +108,28 @@
|
|
|
108
108
|
"drag_drop_columns_multi_ann": "Arrastre y suelte las columnas para ordenar las etiquetas",
|
|
109
109
|
"error_creating_multi_ann": "No todos los grupos de anotaciones fueron creados de manera exitosa.",
|
|
110
110
|
"disabled_finish_review": "Solo es posible finalizar la revisión del documento si todas las anotaciones han sido revisadas, ya sea aceptadas o marcadas como faltantes.",
|
|
111
|
-
"no_multi_ann_labelset_model": "En este documento no hay grupos de etiquetas múltiples disponibles. Para más información,
|
|
111
|
+
"no_multi_ann_labelset_model": "En este documento no hay grupos de etiquetas múltiples disponibles. Para más información, haga clic en <a href='https://help.konfuzio.com/tutorials/advanced-document-extraction/index.html#multiple-annotation-sets' target='_blank'>este enlace</a>.",
|
|
112
112
|
"single_category_in_project": "Este proyecto solo tiene una categoría. Para poder modificarla, es necesario agregar esta nueva categoría al proyecto. Para más información, visita <a href='https://help.konfuzio.com/modules/categories/index.html#add-a-category' target='_blank'>este enlace</a>.",
|
|
113
|
-
"approved_annotations": "No es posible cambiar la categoría
|
|
113
|
+
"approved_annotations": "No es posible cambiar la categoría ya que existen anotaciones aceptadas o creadas manualmente en este documento.",
|
|
114
114
|
"restore": "Restaurar",
|
|
115
115
|
"split_modal_title": "Dividir el documento",
|
|
116
|
-
"split_modal_body": "Hemos escaneado
|
|
116
|
+
"split_modal_body": "Hemos escaneado su documento y hemos encontrado <strong>{number_of_split_documents}</strong> documentos diferentes. <strong>Le recomendamos</strong> dividir el documento en esta etapa, ya que de lo contrario se perderá el progreso logrado debido a una nueva extracción de los datos del documento.",
|
|
117
117
|
"do_it_later": "Lo haré luego",
|
|
118
118
|
"review_now": "Revisar ahora",
|
|
119
119
|
"recommended": "Recomendado",
|
|
120
120
|
"smart_split": "División Inteligente",
|
|
121
121
|
"smart_split_suggestions": "Nuestras sugerencias de División Inteligente están marcadas en color verde",
|
|
122
122
|
"no_splitting_suggestions": "Este documento no tiene sugerencias de división",
|
|
123
|
-
"confirm_splitting": "¿Seguro que
|
|
124
|
-
"splitting_warning": "
|
|
123
|
+
"confirm_splitting": "¿Seguro que quiere confirmar los cambios?",
|
|
124
|
+
"splitting_warning": "Tenga en cuenta que se perderán las anotaciones que haya confirmado en el documento.",
|
|
125
125
|
"no": "No",
|
|
126
126
|
"yes": "Sí",
|
|
127
|
-
"split_modal_no_suggestions": "¿
|
|
127
|
+
"split_modal_no_suggestions": "¿Necesita dividir el documento? <strong>Te recomendamos</strong> hacerlo en este momento, o de lo contrario se perderán los cambios realizados.",
|
|
128
128
|
"missing_from_document": "Falta en el documento",
|
|
129
|
-
"edit_label": "
|
|
130
|
-
"delete_label": "
|
|
131
|
-
"table": "
|
|
132
|
-
"new_multi_ann_description": "
|
|
129
|
+
"edit_label": "Editar etiqueta",
|
|
130
|
+
"delete_label": "Eliminar etiqueta",
|
|
131
|
+
"table": "Tabla",
|
|
132
|
+
"new_multi_ann_description": "Seleccione un modelo de datos de los existentes, luego deseleccione las etiquetas que no existen en este documento.",
|
|
133
133
|
"new_multi_ann_title": "Crear múltiples anotaciones",
|
|
134
|
-
"prepare_document": "
|
|
134
|
+
"prepare_document": "Prepare el documento"
|
|
135
135
|
}
|
package/src/store/document.js
CHANGED
|
@@ -502,17 +502,6 @@ const getters = {
|
|
|
502
502
|
);
|
|
503
503
|
},
|
|
504
504
|
|
|
505
|
-
documentHasNoCorrectAnnotations: (state) => () => {
|
|
506
|
-
if (
|
|
507
|
-
state.annotations &&
|
|
508
|
-
state.annotations.filter((ann) => ann.is_correct).length > 0
|
|
509
|
-
) {
|
|
510
|
-
return false;
|
|
511
|
-
} else {
|
|
512
|
-
return true;
|
|
513
|
-
}
|
|
514
|
-
},
|
|
515
|
-
|
|
516
505
|
/**
|
|
517
506
|
* If automatic splitting is enabled for the project
|
|
518
507
|
*/
|
|
@@ -746,12 +735,25 @@ const actions = {
|
|
|
746
735
|
});
|
|
747
736
|
|
|
748
737
|
if (!state.publicView) {
|
|
749
|
-
dispatch("fetchMissingAnnotations");
|
|
738
|
+
await dispatch("fetchMissingAnnotations");
|
|
750
739
|
|
|
751
740
|
await dispatch("project/fetchCurrentUser", null, {
|
|
752
741
|
root: true,
|
|
753
742
|
});
|
|
754
743
|
|
|
744
|
+
// Check if we first open the document dashboard or the edit mode
|
|
745
|
+
if (
|
|
746
|
+
!state.selectedDocument.category ||
|
|
747
|
+
(!state.selectedDocument.category_is_revised &&
|
|
748
|
+
!getters.documentHasCorrectAnnotations() &&
|
|
749
|
+
state.missingAnnotations.length === 0)
|
|
750
|
+
) {
|
|
751
|
+
dispatch("edit/enableEditMode", null, {
|
|
752
|
+
root: true,
|
|
753
|
+
});
|
|
754
|
+
dispatch("edit/setRenameAndCategorize", true, { root: true });
|
|
755
|
+
}
|
|
756
|
+
|
|
755
757
|
if (projectId) {
|
|
756
758
|
await dispatch("category/fetchCategories", projectId, {
|
|
757
759
|
root: true,
|
package/src/store/edit.js
CHANGED
|
@@ -9,19 +9,37 @@ const HTTP = myImports.HTTP;
|
|
|
9
9
|
|
|
10
10
|
const state = {
|
|
11
11
|
editMode: false,
|
|
12
|
-
|
|
12
|
+
renameAndCategorize: false,
|
|
13
13
|
isMultipleSelection: false,
|
|
14
14
|
pagesForPostprocess: [],
|
|
15
15
|
selectedPages: [],
|
|
16
16
|
updatedDocument: [],
|
|
17
17
|
showEditConfirmationModal: false,
|
|
18
|
-
|
|
18
|
+
submitEditChanges: false,
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const getters = {
|
|
22
22
|
isPageSelected: (state) => (id) => {
|
|
23
23
|
return state.selectedPages.find((page) => page.id === id);
|
|
24
24
|
},
|
|
25
|
+
|
|
26
|
+
documentShouldBePostprocessed: (state, _, rootState) => {
|
|
27
|
+
const foundRotatedPage = state.pagesForPostprocess.find(
|
|
28
|
+
(page) => page.angle !== 0
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
let foundReorderedPage;
|
|
32
|
+
|
|
33
|
+
state.pagesForPostprocess.map((page) => {
|
|
34
|
+
foundReorderedPage = rootState.document.selectedDocument.pages.find(
|
|
35
|
+
(p) => p.id === page.id && p.number !== page.number
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
state.updatedDocument.length > 1 || foundRotatedPage || foundReorderedPage
|
|
41
|
+
);
|
|
42
|
+
},
|
|
25
43
|
};
|
|
26
44
|
|
|
27
45
|
const actions = {
|
|
@@ -31,11 +49,11 @@ const actions = {
|
|
|
31
49
|
|
|
32
50
|
disableEditMode: ({ commit }) => {
|
|
33
51
|
commit("SET_EDIT_MODE", false);
|
|
34
|
-
commit("
|
|
52
|
+
commit("SET_RENAME_AND_CATEGORIZE", false);
|
|
35
53
|
},
|
|
36
54
|
|
|
37
|
-
|
|
38
|
-
commit("
|
|
55
|
+
setRenameAndCategorize: ({ commit }, value) => {
|
|
56
|
+
commit("SET_RENAME_AND_CATEGORIZE", value);
|
|
39
57
|
},
|
|
40
58
|
|
|
41
59
|
setPagesForPostprocess: ({ commit }, pages) => {
|
|
@@ -46,8 +64,8 @@ const actions = {
|
|
|
46
64
|
commit("SET_UPDATED_DOCUMENT", updatedDocument);
|
|
47
65
|
},
|
|
48
66
|
|
|
49
|
-
|
|
50
|
-
commit("
|
|
67
|
+
setSubmitEditChanges: ({ commit }, value) => {
|
|
68
|
+
commit("SET_SUBMIT_EDIT_CHANGES", value);
|
|
51
69
|
},
|
|
52
70
|
|
|
53
71
|
selectPage: ({ state, commit }, page) => {
|
|
@@ -187,8 +205,6 @@ const actions = {
|
|
|
187
205
|
root: true,
|
|
188
206
|
});
|
|
189
207
|
|
|
190
|
-
commit("SET_DOCUMENT_BEING_SPLIT", true);
|
|
191
|
-
|
|
192
208
|
const oldId = rootState.document.documentId;
|
|
193
209
|
|
|
194
210
|
return new Promise((resolve, reject) => {
|
|
@@ -201,7 +217,7 @@ const actions = {
|
|
|
201
217
|
const newId = response.data[0].id;
|
|
202
218
|
dispatch("document/setSplittingSuggestions", null, { root: true });
|
|
203
219
|
|
|
204
|
-
commit("
|
|
220
|
+
commit("SET_SUBMIT_EDIT_CHANGES", false);
|
|
205
221
|
|
|
206
222
|
if (newId !== oldId) {
|
|
207
223
|
if (getURLQueryParam("document") || getURLPath("docs")) {
|
|
@@ -239,8 +255,8 @@ const mutations = {
|
|
|
239
255
|
state.editMode = option;
|
|
240
256
|
},
|
|
241
257
|
|
|
242
|
-
|
|
243
|
-
state.
|
|
258
|
+
SET_RENAME_AND_CATEGORIZE: (state, value) => {
|
|
259
|
+
state.renameAndCategorize = value;
|
|
244
260
|
},
|
|
245
261
|
|
|
246
262
|
SET_PAGES_FOR_POSTPROCESS: (state, pages) => {
|
|
@@ -259,8 +275,8 @@ const mutations = {
|
|
|
259
275
|
SET_SHOW_EDIT_CONFIRMATION_MODAL: (state, value) => {
|
|
260
276
|
state.showEditConfirmationModal = value;
|
|
261
277
|
},
|
|
262
|
-
|
|
263
|
-
state.
|
|
278
|
+
SET_SUBMIT_EDIT_CHANGES: (state, value) => {
|
|
279
|
+
state.submitEditChanges = value;
|
|
264
280
|
},
|
|
265
281
|
};
|
|
266
282
|
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
@import "./imports.scss";
|
|
2
|
-
|
|
3
|
-
.categorize-modal {
|
|
4
|
-
.content {
|
|
5
|
-
h3 {
|
|
6
|
-
font-weight: 500;
|
|
7
|
-
font-size: 18px;
|
|
8
|
-
line-height: 28px;
|
|
9
|
-
color: $grey-darker;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
p {
|
|
13
|
-
font-weight: 400;
|
|
14
|
-
font-size: 14px;
|
|
15
|
-
line-height: 20px;
|
|
16
|
-
color: $text-strong;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.categorize-dropdown {
|
|
20
|
-
width: 100%;
|
|
21
|
-
border: 1px solid $grey-outline;
|
|
22
|
-
height: 40px;
|
|
23
|
-
cursor: pointer;
|
|
24
|
-
box-shadow: 0px 1px 2px rgba(16, 24, 40, 0.05);
|
|
25
|
-
border-radius: 8px;
|
|
26
|
-
margin-bottom: 4px;
|
|
27
|
-
|
|
28
|
-
&.dropdown-disabled {
|
|
29
|
-
cursor: not-allowed;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.category-description {
|
|
34
|
-
font-weight: 400;
|
|
35
|
-
font-size: 14px;
|
|
36
|
-
line-height: 20px;
|
|
37
|
-
color: $text-lighter;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.submit-category {
|
|
41
|
-
margin-top: 16px;
|
|
42
|
-
width: 100%;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
@import "./imports.scss";
|
|
2
|
-
|
|
3
|
-
.splitting-confirmation-modal {
|
|
4
|
-
.header {
|
|
5
|
-
display: flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
gap: 8px;
|
|
8
|
-
padding-bottom: 15px;
|
|
9
|
-
font-weight: 500;
|
|
10
|
-
font-size: 18px;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.content {
|
|
14
|
-
text-align: left;
|
|
15
|
-
font-weight: 400;
|
|
16
|
-
font-size: 14px;
|
|
17
|
-
color: $text-color;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.modal-card-foot {
|
|
21
|
-
display: flex;
|
|
22
|
-
flex-direction: column;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
|
|
25
|
-
.recommended {
|
|
26
|
-
font-weight: 600;
|
|
27
|
-
font-size: 11px;
|
|
28
|
-
background-color: rgba(255, 255, 255, 0.2);
|
|
29
|
-
padding: 2px 5px;
|
|
30
|
-
border-radius: 36px;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.button {
|
|
34
|
-
width: 100%;
|
|
35
|
-
|
|
36
|
-
&.is-primary {
|
|
37
|
-
font-weight: 500;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="categorize-modal">
|
|
3
|
-
<b-modal
|
|
4
|
-
ref="modal"
|
|
5
|
-
v-model="show"
|
|
6
|
-
:can-cancel="canCloseModal()"
|
|
7
|
-
class="modal-absolute modal-400 modal-no-footer"
|
|
8
|
-
>
|
|
9
|
-
<section class="modal-card-body scroll-hidden">
|
|
10
|
-
<div class="content">
|
|
11
|
-
<h3>{{ $t("categorize_document_title") }}</h3>
|
|
12
|
-
<p v-if="documentCategory">
|
|
13
|
-
{{ $t("categorized_as")
|
|
14
|
-
}}<strong> {{ documentCategory.name }}</strong
|
|
15
|
-
>. {{ $t("categorized_error") }}
|
|
16
|
-
</p>
|
|
17
|
-
<p v-else>
|
|
18
|
-
{{ $t("not_categorized") }}
|
|
19
|
-
</p>
|
|
20
|
-
|
|
21
|
-
<b-tooltip
|
|
22
|
-
multilined
|
|
23
|
-
:active="tooltipIsShown"
|
|
24
|
-
size="is-large"
|
|
25
|
-
position="is-bottom"
|
|
26
|
-
class="bottom-aligned"
|
|
27
|
-
:close-delay="5000"
|
|
28
|
-
>
|
|
29
|
-
<template #content>
|
|
30
|
-
<div ref="tooltipContent"></div>
|
|
31
|
-
</template>
|
|
32
|
-
<b-dropdown
|
|
33
|
-
v-model="selectedCategory"
|
|
34
|
-
aria-role="list"
|
|
35
|
-
:class="[
|
|
36
|
-
'categorize-dropdown',
|
|
37
|
-
projectHasSingleCategory() && 'dropdown-disabled',
|
|
38
|
-
]"
|
|
39
|
-
:disabled="tooltipIsShown"
|
|
40
|
-
>
|
|
41
|
-
<template #trigger>
|
|
42
|
-
<div class="category-dropdown">
|
|
43
|
-
<div>
|
|
44
|
-
<span v-if="selectedCategory">{{
|
|
45
|
-
selectedCategory.name
|
|
46
|
-
}}</span>
|
|
47
|
-
<span v-else-if="projectHasSingleCategory()">{{
|
|
48
|
-
categories[0].name
|
|
49
|
-
}}</span>
|
|
50
|
-
<span v-else>{{ $t("choose_category") }}</span>
|
|
51
|
-
</div>
|
|
52
|
-
</div>
|
|
53
|
-
</template>
|
|
54
|
-
<b-dropdown-item
|
|
55
|
-
v-for="categoryItem in categories"
|
|
56
|
-
:key="categoryItem.id"
|
|
57
|
-
aria-role="listitem"
|
|
58
|
-
:value="categoryItem"
|
|
59
|
-
@click="setSelectedCategory(categoryItem)"
|
|
60
|
-
>
|
|
61
|
-
<span>{{ categoryItem.name }}</span>
|
|
62
|
-
</b-dropdown-item>
|
|
63
|
-
</b-dropdown>
|
|
64
|
-
</b-tooltip>
|
|
65
|
-
<div v-if="selectedCategory" class="category-description">
|
|
66
|
-
{{
|
|
67
|
-
selectedCategory.description
|
|
68
|
-
? selectedCategory.description
|
|
69
|
-
: $t("categorize_document_no_category_description")
|
|
70
|
-
}}
|
|
71
|
-
</div>
|
|
72
|
-
<div v-else class="category-description">
|
|
73
|
-
{{ $t("select_category") }}
|
|
74
|
-
</div>
|
|
75
|
-
<b-button
|
|
76
|
-
class="submit-category primary-button"
|
|
77
|
-
type="is-primary"
|
|
78
|
-
:disabled="!selectedCategory"
|
|
79
|
-
@click="submit"
|
|
80
|
-
>
|
|
81
|
-
{{ $t("submit") }}
|
|
82
|
-
</b-button>
|
|
83
|
-
</div>
|
|
84
|
-
</section>
|
|
85
|
-
</b-modal>
|
|
86
|
-
</section>
|
|
87
|
-
</template>
|
|
88
|
-
|
|
89
|
-
<script>
|
|
90
|
-
/**
|
|
91
|
-
* This component shows a modal to categorize a document
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
import { mapGetters, mapState } from "vuex";
|
|
95
|
-
|
|
96
|
-
export default {
|
|
97
|
-
name: "CategorizeModal",
|
|
98
|
-
data() {
|
|
99
|
-
return {
|
|
100
|
-
show: false,
|
|
101
|
-
selectedCategory: null, // category selected in dropdown
|
|
102
|
-
documentCategory: null, // category associated to document
|
|
103
|
-
tooltipIsShown: false,
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
computed: {
|
|
107
|
-
...mapState("category", ["categories"]),
|
|
108
|
-
...mapState("document", [
|
|
109
|
-
"selectedDocument",
|
|
110
|
-
"categorizeModalIsActive",
|
|
111
|
-
"splittingSuggestions",
|
|
112
|
-
"publicView",
|
|
113
|
-
]),
|
|
114
|
-
...mapGetters("category", ["category", "projectHasSingleCategory"]),
|
|
115
|
-
...mapGetters("document", [
|
|
116
|
-
"categorizationIsConfirmed",
|
|
117
|
-
"isDocumentReviewed",
|
|
118
|
-
]),
|
|
119
|
-
|
|
120
|
-
singleCategoryInProject() {
|
|
121
|
-
// if only 1 category in the project, we don't enable the dropdown
|
|
122
|
-
return this.categories && this.categories.length === 1;
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
watch: {
|
|
126
|
-
selectedDocument(newValue) {
|
|
127
|
-
if (newValue) {
|
|
128
|
-
this.setDocumentValues();
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
categories(newCategories, oldCategories) {
|
|
132
|
-
if (newCategories && oldCategories === null) {
|
|
133
|
-
this.setDocumentValues();
|
|
134
|
-
|
|
135
|
-
if (newCategories.length === 1) {
|
|
136
|
-
this.setTooltipText();
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
show(newValue) {
|
|
141
|
-
this.$store.dispatch("display/setCategorizeModalIsActive", newValue);
|
|
142
|
-
},
|
|
143
|
-
categorizeModalIsActive(newValue) {
|
|
144
|
-
// Show modal after split suggestion modal
|
|
145
|
-
// if no category confirmed
|
|
146
|
-
if (newValue) {
|
|
147
|
-
this.show = newValue && !this.categorizationIsConfirmed;
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
mounted() {
|
|
152
|
-
this.setDocumentValues();
|
|
153
|
-
|
|
154
|
-
this.$nextTick(() => {
|
|
155
|
-
this.setTooltipText();
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
if (this.projectHasSingleCategory()) {
|
|
159
|
-
this.tooltipIsShown = true;
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
updated() {
|
|
163
|
-
this.setTooltipText();
|
|
164
|
-
},
|
|
165
|
-
methods: {
|
|
166
|
-
setDocumentValues() {
|
|
167
|
-
if (this.selectedDocument) {
|
|
168
|
-
let category;
|
|
169
|
-
|
|
170
|
-
// Check if the document has an extracted category
|
|
171
|
-
// or if it doesn't, but the project has only 1 category
|
|
172
|
-
if (this.selectedDocument.category) {
|
|
173
|
-
category = this.category(this.selectedDocument.category);
|
|
174
|
-
this.documentCategory = category;
|
|
175
|
-
} else if (this.projectHasSingleCategory()) {
|
|
176
|
-
category = this.category(this.categories[0].id);
|
|
177
|
-
} else {
|
|
178
|
-
category = category;
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
this.selectedCategory = category;
|
|
182
|
-
this.documentCategory = category;
|
|
183
|
-
|
|
184
|
-
// By default, if the document has no category, the categorize modal is shown
|
|
185
|
-
// But if there is a category, we also need to check if there are splitting suggestions or not
|
|
186
|
-
this.show =
|
|
187
|
-
(!category || (category && !this.splittingSuggestions)) &&
|
|
188
|
-
!this.categorizationIsConfirmed &&
|
|
189
|
-
!this.publicView &&
|
|
190
|
-
!this.isDocumentReviewed;
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
canCloseModal() {
|
|
194
|
-
return !!this.documentCategory && this.documentCategory.id !== null;
|
|
195
|
-
},
|
|
196
|
-
setSelectedCategory(category) {
|
|
197
|
-
this.selectedCategory = category;
|
|
198
|
-
},
|
|
199
|
-
submit() {
|
|
200
|
-
if (
|
|
201
|
-
(this.selectedCategory &&
|
|
202
|
-
this.documentCategory &&
|
|
203
|
-
this.selectedCategory.id !== this.documentCategory.id) ||
|
|
204
|
-
(this.selectedCategory && !this.documentCategory) ||
|
|
205
|
-
(this.selectedCategory && this.projectHasSingleCategory)
|
|
206
|
-
) {
|
|
207
|
-
const updatedCategory = {
|
|
208
|
-
category: this.selectedCategory.id,
|
|
209
|
-
category_is_revised: true,
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
this.$store.dispatch("document/startRecalculatingAnnotations");
|
|
213
|
-
|
|
214
|
-
this.$store
|
|
215
|
-
.dispatch("document/updateDocument", updatedCategory)
|
|
216
|
-
.catch((error) => {
|
|
217
|
-
this.$store.dispatch("document/createErrorMessage", {
|
|
218
|
-
error,
|
|
219
|
-
serverErrorMessage: this.$t("server_error"),
|
|
220
|
-
defaultErrorMessage: this.$t("edit_error"),
|
|
221
|
-
});
|
|
222
|
-
})
|
|
223
|
-
.finally(() => {
|
|
224
|
-
this.$store.dispatch("document/endRecalculatingAnnotations");
|
|
225
|
-
this.$store.dispatch("display/setCategorizeModalIsActive", false);
|
|
226
|
-
});
|
|
227
|
-
} else {
|
|
228
|
-
// if same category, then just accept it
|
|
229
|
-
this.$store.dispatch("document/updateDocument", {
|
|
230
|
-
category_is_revised: true,
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
this.show = false;
|
|
234
|
-
},
|
|
235
|
-
setTooltipText() {
|
|
236
|
-
// Text set from innerHTML vs 'label' due to html tag in locales file string
|
|
237
|
-
if (this.projectHasSingleCategory() && this.show) {
|
|
238
|
-
this.$refs.tooltipContent.innerHTML = this.$t(
|
|
239
|
-
"single_category_in_project"
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
};
|
|
245
|
-
</script>
|
|
246
|
-
|
|
247
|
-
<style scoped lang="scss" src="../../assets/scss/categorize_modal.scss"></style>
|