diff --git a/src/admin/components/edition/importer-edition-form.vue b/src/admin/components/edition/importer-edition-form.vue index 2e1fadadb..ca526621a 100644 --- a/src/admin/components/edition/importer-edition-form.vue +++ b/src/admin/components/edition/importer-edition-form.vue @@ -118,27 +118,58 @@

{{ $i18n.get('info_select_collection_to_list_metadata') }}

- + {{ $i18n.get('label_add_more_metadata') }}
{ + this.metadatum = metadatum; + this.editedMetadatum = JSON.parse(JSON.stringify(metadatum)); + this.editedMetadatum.saved = false; + this.editedMetadatum.status = 'publish'; + this.isEditingMetadatum = true; + }) + .catch((error) => { + this.$console.error(error); + }); }, - onEditionCanceled() { - // this.formWithErrors = ''; - // delete this.editForms[this.openedMetadatumId]; - // this.openedMetadatumId = ''; - console.log("Metadatum Edition Canceled"); + createNewMetadatum() { + this.fetchMetadatumTypes() + .then(() => { + this.isLoadingMetadatumTypes = false; + this.isNewMetadatumModalActive = true; + }) + .catch(() => { + this.isLoadingMetadatumTypes = false; + }); + }, + onMetadatumEditionFinished() { + // Reset variables for metadatum creation + delete this.metadatum; + delete this.editedMetadatum; + this.isEditingMetadatum = false; + this.isNewMetadatumModalActive = false; + this.selectedMetadatumType = undefined; + + // Generates options for metadata listing + this.isFetchingCollectionMetadata = true; + this.fetchMetadata({collectionId: this.collectionId, isRepositoryLevel: false, isContextEdit: false }) + .then((metadata) => { + this.collectionMetadata = JSON.parse(JSON.stringify(metadata)); + this.isFetchingCollectionMetadata = false; + }) + .catch((error) => { + this.$console.error(error); + this.isFetchingCollectionMetadata = false; + }); + }, + onMetadatumEditionCanceled() { + // Reset variables for metadatum creation + delete this.metadatum; + delete this.editedMetadatum; + this.isEditingMetadatum = false; + this.isNewMetadatumModalActive = false; + this.selectedMetadatumType = undefined; } }, created() { @@ -404,6 +496,16 @@ export default { margin: 12px 0 6px 0; } + .modal .animation-content { + width: 100%; + z-index: 99999; + + #metadatumEditForm { + background-color: white; + } + } + + diff --git a/src/admin/components/edition/metadatum-edition-form.vue b/src/admin/components/edition/metadatum-edition-form.vue index e849912bd..6a11ab045 100644 --- a/src/admin/components/edition/metadatum-edition-form.vue +++ b/src/admin/components/edition/metadatum-edition-form.vue @@ -2,6 +2,7 @@
__( 'URL Source link', 'tainacan' ), 'label_metadata_mapping' => __( 'Metadata mapping', 'tainacan' ), 'label_select_metadatum' => __( 'Select metadatum', 'tainacan' ), + 'label_select_metadatum_type' => __( 'Select a metadatum type', 'tainacan' ), 'label_add_more_metadata' => __( 'Add more metadata', 'tainacan' ), 'label_from_source_collection' => __( 'From source collection', 'tainacan' ), 'label_to_target_collection' => __( 'To target collection', 'tainacan' ), @@ -258,6 +259,8 @@ return apply_filters('tainacan-admin-i18n',[ 'instruction_select_a_target_collection' => __( 'Select a target collection', 'tainacan' ), 'instruction_select_an_importer_type' => __( 'Select an importer type from the options above:', 'tainacan' ), 'instruction_drop_file_or_click_to_upload' => __( 'Drop your source file or click here to upload.', 'tainacan' ), + 'instruction_select_metadatum_type' => __( 'Select a metadatum type.', 'tainacan' ), + 'instruction_configure_new_metadatum' => __( 'Configure new metadatum.', 'tainacan' ), // Info. Other feedback to user. 'info_search_results' => __( 'Search Results', 'tainacan' ),