diff --git a/frontend/src/app/modules/imports/components/action-modal/action-modal.component.html b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.html new file mode 100644 index 0000000000..905ab51c36 --- /dev/null +++ b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.html @@ -0,0 +1,42 @@ + + diff --git a/frontend/src/app/modules/imports/components/action-modal/action-modal.component.scss b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.scss new file mode 100644 index 0000000000..52331cda3c --- /dev/null +++ b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.scss @@ -0,0 +1,4 @@ +.attention-message { + color: red; + font-weight: bold; +} diff --git a/frontend/src/app/modules/imports/components/action-modal/action-modal.component.ts b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.ts new file mode 100644 index 0000000000..1a0b03c110 --- /dev/null +++ b/frontend/src/app/modules/imports/components/action-modal/action-modal.component.ts @@ -0,0 +1,58 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { CommonService } from '@geonature_common/service/common.service'; +import { ImportDataService } from '../../services/data.service'; +import { Import } from '../../models/import.model'; +import { ModalData } from '../../models/modal-data.model'; + +@Component({ + selector: 'import-action-modal', + templateUrl: './action-modal.component.html', + styleUrls: ['./action-modal.component.scss'], +}) +export class ModalActionImport implements OnInit { + @Input() data: Import; + @Input() c: any; + @Input() actionType: 'delete' | 'edit' = 'delete'; + @Input() modalData: ModalData = { + title: 'Confirmation', + bodyMessage: 'Êtes-vous sûr de vouloir effectuer cette action ?', + additionalMessage: '', + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'generic-modal-header', + confirmButtonDataQa: 'modal-confirm-action', + }; + @Output() onAction = new EventEmitter<{ confirmed: boolean; actionType: string; data?: any }>(); + + constructor( + private _commonService: CommonService, + private _ds: ImportDataService + ) {} + + ngOnInit() {} + + // Méthode générique pour traiter les actions + performAction() { + if (this.actionType === 'delete') { + this.deleteImport(); + } else if (this.actionType === 'edit') { + this.editImport(); + } + } + + // Supprimer l'import + deleteImport() { + this._ds.deleteImport(this.data.id_import).subscribe(() => { + this._commonService.translateToaster('success', 'Import.ImportStatus.DeleteSuccessfully'); + this.onAction.emit({ confirmed: true, actionType: this.actionType, data: this.data }); + this.c(); + }); + } + + // Modifier l'import + editImport() { + this.onAction.emit({ confirmed: true, actionType: this.actionType, data: this.data }); + this.c(); + } +} diff --git a/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.html b/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.html deleted file mode 100644 index 8766f11d0d..0000000000 --- a/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.html +++ /dev/null @@ -1,39 +0,0 @@ - - diff --git a/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.ts b/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.ts deleted file mode 100644 index 029285b3c1..0000000000 --- a/frontend/src/app/modules/imports/components/delete-modal/delete-modal.component.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; -import { CommonService } from '@geonature_common/service/common.service'; -import { ImportDataService } from '../../services/data.service'; -import { TranslateService } from '@ngx-translate/core'; -import { Import } from '../../models/import.model'; - -@Component({ - selector: 'import-delete', - templateUrl: './delete-modal.component.html', -}) -export class ModalDeleteImport implements OnInit { - @Input() row: Import; - @Input() c: any; - @Output() onDelete = new EventEmitter(); - constructor( - private _commonService: CommonService, - private _ds: ImportDataService, - private translate: TranslateService - ) {} - - ngOnInit() {} - - deleteImport() { - this._ds.deleteImport(this.row.id_import).subscribe(() => { - this._commonService.translateToaster('success', 'Import.ImportStatus.DeleteSuccessfully'); - this.onDelete.emit(); - this.c(); - }); - } -} diff --git a/frontend/src/app/modules/imports/components/import_list/import-list.component.html b/frontend/src/app/modules/imports/components/import_list/import-list.component.html index e69c7af8bf..eee5d7db8c 100644 --- a/frontend/src/app/modules/imports/components/import_list/import-list.component.html +++ b/frontend/src/app/modules/imports/components/import_list/import-list.component.html @@ -207,7 +207,7 @@
Liste des imports
mat-icon-button color="primary" class="Datatable__button" - (click)="onFinishImport(row)" + (click)="openModal(editModal, 'edit', row)" [attr.data-qa]="'import-list-table-row-' + index + '-actions-edit'" > edit @@ -241,7 +241,7 @@
Liste des imports
mat-icon-button color="warn" class="Datatable__button" - (click)="openDeleteModal(row, deleteModal)" + (click)="openModal(deleteModal, 'delete', row)" [matTooltip]="getTooltip(row, 'delete')" [attr.data-qa]="'import-list-table-row-' + index + '-actions-delete'" > @@ -258,17 +258,35 @@
Liste des imports
data-qa="import-list-modal-destination" > + + + + + - + (onAction)="handleModalAction($event)" + > diff --git a/frontend/src/app/modules/imports/components/import_list/import-list.component.ts b/frontend/src/app/modules/imports/components/import_list/import-list.component.ts index 2dfe14f1d2..f2d6564d38 100644 --- a/frontend/src/app/modules/imports/components/import_list/import-list.component.ts +++ b/frontend/src/app/modules/imports/components/import_list/import-list.component.ts @@ -1,6 +1,6 @@ // @ts-ignore -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { Router } from '@angular/router'; import { FormControl } from '@angular/forms'; import { saveAs } from 'file-saver'; @@ -13,6 +13,7 @@ import { Import } from '../../models/import.model'; import { ConfigService } from '@geonature/services/config.service'; import { CsvExportService } from '../../services/csv-export.service'; import { formatRowCount } from '../../utils/format-row-count'; +import { ModalData } from '../../models/modal-data.model'; @Component({ styleUrls: ['import-list.component.scss'], @@ -22,7 +23,7 @@ export class ImportListComponent implements OnInit { public history; public filteredHistory; public empty: boolean = false; - public deleteOne: Import; + public selectedRow: Import; public interval: any; public search = new FormControl(); public selectDestinationForm = new FormControl(); @@ -41,12 +42,14 @@ export class ImportListComponent implements OnInit { private destinationCode: string; public searchString: string = ''; + public editModalData:ModalData; + public deleteModalData:ModalData; constructor( public _cruvedStore: CruvedStoreService, private _ds: ImportDataService, private _router: Router, private _commonService: CommonService, - private modal: NgbModal, + private _modalService: NgbModal, private importProcessService: ImportProcessService, public _csvExport: CsvExportService, public config: ConfigService @@ -178,10 +181,51 @@ export class ImportListComponent implements OnInit { return formatRowCount(row); } - openDeleteModal(row: Import, modalDelete) { - this.deleteOne = row; - this._ds.setDestination(row.destination.code); - this.modal.open(modalDelete); + openModal(modalTemplate: TemplateRef, actionType: 'edit' | 'delete', row: Import) { + this.selectedRow = row; + // Prépare les données de la modale en fonction de l'action + if (actionType === 'edit') { + let additionalMessage:string; + if(!!this.selectedRow.date_end_import) { + additionalMessage = 'Attention : Vous vous apprêtez à modifier un import terminé. Toute modification entraînera la suppression des données importées.' + } else { + additionalMessage = 'Attention : à chaque confirmation de chaque étape de cet import en cours , les données seront écrasées.' + } + this.editModalData = { + title: 'Modification', + bodyMessage: `Modifier cet import associé au JDD "${this.selectedRow.dataset.dataset_name}" et commencé le ${this.selectedRow.date_create_import}?`, + additionalMessage: additionalMessage, + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-edit', + confirmButtonDataQa: 'modal-edit-validate', + }; + } else if (actionType === 'delete') { + this._ds.setDestination(this.selectedRow.destination.code); + this.deleteModalData = { + title: 'Suppression', + bodyMessage: `Supprimer cet import associé au JDD "${row.dataset.dataset_name}" et commencé le ${row.date_create_import}?`, + additionalMessage: this.selectedRow.date_end_import + ? 'Attention : cela supprimera aussi les données importées.' + : '', + cancelButtonText: 'Annuler', + confirmButtonText: 'Supprimer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-delete', + confirmButtonDataQa: 'modal-delete-validate', + }; + } + this._modalService.open(modalTemplate); + } + handleModalAction(event: { confirmed: boolean; actionType: string; data?: any }) { + if (event.confirmed) { + if (event.actionType === 'edit') { + this.onFinishImport(event.data); + } else if (event.actionType === 'delete') { + this.onImportList({offset :this.offset, search: this.searchString}); + } + } } onSort(e) { diff --git a/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.html b/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.html index c6b05dbc67..6e095c3e7f 100644 --- a/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.html +++ b/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.html @@ -264,7 +264,7 @@
Correspondance des nomenclatures
+ + + diff --git a/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.ts b/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.ts index 534b7a784e..7fdeea39ad 100644 --- a/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.ts +++ b/frontend/src/app/modules/imports/components/import_process/content-mapping-step/content-mapping-step.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild, ViewEncapsulation } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild, ViewEncapsulation } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { Validators } from '@angular/forms'; import { FormControl, FormGroup, FormBuilder } from '@angular/forms'; @@ -18,6 +18,7 @@ import { Step } from '../../../models/enums.model'; import { Import, ImportValues, Nomenclature } from '../../../models/import.model'; import { ImportProcessService } from '../import-process.service'; import _ from 'lodash'; +import { ModalData } from '@geonature/modules/imports/models/modal-data.model'; @Component({ selector: 'content-mapping-step', @@ -41,11 +42,12 @@ export class ContentMappingStepComponent implements OnInit { public renameMappingFormVisible: boolean = false; public mappedFields: Set = new Set(); // TODO public unmappedFields: Set = new Set(); // TODO + public modalData:ModalData; @ViewChild('modalConfirm') modalConfirm: any; @ViewChild('modalRedir') modalRedir: any; @ViewChild('deleteConfirmModal') deleteConfirmModal: any; - + @ViewChild('editModal') editModal: TemplateRef; constructor( //private stepService: StepsService, private _fb: FormBuilder, @@ -57,7 +59,8 @@ export class ContentMappingStepComponent implements OnInit { private _route: ActivatedRoute, private _modalService: NgbModal, public cruvedStore: CruvedStoreService, - private importProcessService: ImportProcessService + private importProcessService: ImportProcessService, + ) {} ngOnInit() { @@ -307,4 +310,36 @@ export class ContentMappingStepComponent implements OnInit { } return values; } + + checkBeforeNextStep(){ + if (this.importData?.contentmapping) { + this.openModal(this.editModal); + return; + } + else{ + this.onNextStep(); + } + } + + openModal(editModal: TemplateRef) { + this.modalData = { + title: 'Modification', + bodyMessage:'Des modifications ont été apportées à la correspondances des nomenclatures. L\'ancienne correspondance des nomenclatures sera supprimé.', + additionalMessage: 'Etes-vous sur de continuer ?', + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-edit', + confirmButtonDataQa: 'modal-edit-validate', + }; + this._modalService.open(editModal); + } + + handleModalAction(event: { confirmed: boolean; actionType: string; data?: any }) { + if (event.confirmed) { + if (event.actionType === 'edit') { + this.onNextStep(); + } + } + } } diff --git a/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.html b/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.html index 9e18b1af59..d72b3155a5 100644 --- a/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.html +++ b/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.html @@ -101,7 +101,7 @@
{{ 'Import.FieldMapping.Title' | translate }}
mat-raised-button color="primary" [disabled]="!isNextStepAvailable()" - (click)="onNextStep()" + (click)="checkBeforeNextStep()" data-qa="import-new-fieldmapping-model-validate" > {{ 'Import.Next' | translate }} @@ -216,4 +216,19 @@
{{ 'Import.FieldMapping.Title' | translate }}
+ + + + diff --git a/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.ts b/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.ts index e07236f264..682f3465c7 100644 --- a/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.ts +++ b/frontend/src/app/modules/imports/components/import_process/fields-mapping-step/fields-mapping-step.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { ImportDataService } from '../../../services/data.service'; import { FieldMappingService } from '@geonature/modules/imports/services/mappings/field-mapping.service'; import { Cruved, toBooleanCruved } from '@geonature/modules/imports/models/cruved.model'; @@ -17,6 +17,7 @@ import { import { ConfigService } from '@geonature/services/config.service'; import { FormControl } from '@angular/forms'; import { AuthService } from '@geonature/components/auth/auth.service'; +import { ModalData } from '@geonature/modules/imports/models/modal-data.model'; @Component({ selector: 'pnx-fields-mapping-step', @@ -25,6 +26,7 @@ import { AuthService } from '@geonature/components/auth/auth.service'; }) export class FieldsMappingStepComponent implements OnInit { @ViewChild('saveMappingModal') saveMappingModal; + @ViewChild('editModal') editModal: TemplateRef; public targetFields; public sourceFields: Array = []; public isReady: boolean = false; @@ -34,7 +36,7 @@ export class FieldsMappingStepComponent implements OnInit { public step: Step; public modalCreateMappingForm = new FormControl(''); public defaultValueFormDefs: any = {}; - + public modalData:ModalData; constructor( public _fieldMappingService: FieldMappingService, private _route: ActivatedRoute, @@ -276,4 +278,37 @@ export class FieldsMappingStepComponent implements OnInit { getUnmappedFields() { return this._fieldMappingService.getUnmappedFields(); } + + checkBeforeNextStep(){ + if (this.importData?.fieldmapping) { + this.openModal(this.editModal); + return; + } + else{ + this.onNextStep(); + } + } + + openModal(editModal: TemplateRef) { + this.modalData = { + title: 'Modification', + bodyMessage: 'Des modifications ont été apportées à la correspondances des champs. L\'ancienne correspondance des champs sera supprimée', + additionalMessage: 'Etes-vous sur de continuer ?', + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-edit', + confirmButtonDataQa: 'modal-edit-validate', + }; + this._modalService.open(editModal); + } + + handleModalAction(event: { confirmed: boolean; actionType: string; data?: any }) { + if (event.confirmed) { + if (event.actionType === 'edit') { + this.onNextStep(); + } + } + } + } diff --git a/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.html b/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.html index 51a29f10a2..e5d05ebcbf 100644 --- a/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.html +++ b/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.html @@ -156,7 +156,7 @@
+ + + diff --git a/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.ts b/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.ts index 8f637eae16..407994e677 100644 --- a/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.ts +++ b/frontend/src/app/modules/imports/components/import_process/import-step/import-step.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewChild } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { ImportProcessService } from '../import-process.service'; import { ImportDataService } from '../../../services/data.service'; @@ -8,6 +8,8 @@ import { Import, ImportPreview } from '../../../models/import.model'; import { ConfigService } from '@geonature/services/config.service'; import { CsvExportService } from '../../../services/csv-export.service'; import { ImportStepComponentsError } from './import-step.component-errors'; +import { ModalData } from '@geonature/modules/imports/models/modal-data.model'; +import { NgbModal } from '@librairies/@ng-bootstrap/ng-bootstrap'; @Component({ selector: 'import-step', @@ -31,9 +33,10 @@ export class ImportStepComponent implements OnInit { public errorStatus: ImportStepComponentsError = ImportStepComponentsError.NONE; private timeout: number = 100; private runningTimeout: any; + public modalData:ModalData; @ViewChild('modalRedir') modalRedir: any; - + @ViewChild('editModal') editModal: TemplateRef; constructor( private importProcessService: ImportProcessService, private _router: Router, @@ -41,7 +44,8 @@ export class ImportStepComponent implements OnInit { private _ds: ImportDataService, private _commonService: CommonService, public _csvExport: CsvExportService, - public config: ConfigService + public config: ConfigService, + private _modalService: NgbModal, ) {} // @@ -193,4 +197,36 @@ export class ImportStepComponent implements OnInit { onRedirect() { this._router.navigate([this.config.IMPORT.MODULE_URL]); } + + checkBeforeNextStep(){ + if (!!this.importData?.date_end_import) { + this.openModal(this.editModal); + return; + } + else{ + this.onImport(); + } + } + + openModal(editModal: TemplateRef) { + this.modalData = { + title: 'Modification', + bodyMessage: 'Des données ont déjà été importées. Si vous continuez ces dernières seront supprimées.', + additionalMessage: 'Etes-vous sur de continuer ?', + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-edit', + confirmButtonDataQa: 'modal-edit-validate', + }; + this._modalService.open(editModal); + } + + handleModalAction(event: { confirmed: boolean; actionType: string; data?: any }) { + if (event.confirmed) { + if (event.actionType === 'edit') { + this.onImport(); + } + } + } } diff --git a/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.html b/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.html index de00e46965..5b0bd7beee 100644 --- a/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.html +++ b/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.html @@ -79,7 +79,7 @@
{{ 'Import.FileUpload' | translate }}
mat-raised-button color="primary" [disabled]="!isNextStepAvailable()" - (click)="onNextStep()" + (click)="checkBeforeNextStep()" id="validate" data-qa="import-new-upload-validate" > @@ -101,3 +101,17 @@
{{ 'Import.FileUpload' | translate }}
[strokeWidth]="12" > + + + diff --git a/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.ts b/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.ts index 9cb702b5b9..88578cf008 100644 --- a/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.ts +++ b/frontend/src/app/modules/imports/components/import_process/upload-file-step/upload-file-step.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { Observable } from 'rxjs'; import { ImportDataService } from '../../../services/data.service'; @@ -8,6 +8,8 @@ import { Step } from '../../../models/enums.model'; import { Destination, Import } from '../../../models/import.model'; import { ImportProcessService } from '../import-process.service'; import { ConfigService } from '@geonature/services/config.service'; +import { NgbModal } from '@librairies/@ng-bootstrap/ng-bootstrap'; +import { ModalData } from '@geonature/modules/imports/models/modal-data.model'; @Component({ selector: 'upload-file-step', @@ -15,6 +17,8 @@ import { ConfigService } from '@geonature/services/config.service'; templateUrl: 'upload-file-step.component.html', }) export class UploadFileStepComponent implements OnInit { + + @ViewChild('editModal') editModal!: TemplateRef; public step: Step; public importData: Import; public uploadForm: FormGroup; @@ -27,6 +31,7 @@ export class UploadFileStepComponent implements OnInit { public maxFileNameLength: number = 255; public acceptedExtensions: string = null; public destination: Destination = null; + public modalData:ModalData; constructor( private ds: ImportDataService, @@ -34,7 +39,8 @@ export class UploadFileStepComponent implements OnInit { private fb: FormBuilder, private importProcessService: ImportProcessService, private route: ActivatedRoute, - public config: ConfigService + public config: ConfigService, + private modal: NgbModal ) { this.acceptedExtensions = this.config.IMPORT.ALLOWED_EXTENSIONS.toString(); this.maxFileSize = this.config.IMPORT.MAX_FILE_SIZE; @@ -102,6 +108,7 @@ export class UploadFileStepComponent implements OnInit { return this.ds.addFile(this.uploadForm.get('dataset').value, this.file); } } + onNextStep() { if (this.uploadForm.pristine) { this.importProcessService.navigateToNextStep(this.step); @@ -128,4 +135,37 @@ export class UploadFileStepComponent implements OnInit { } ); } + + checkBeforeNextStep(){ + if (this.importData?.fieldmapping) { + this.openModal(this.editModal); + return; + } + else{ + this.onNextStep(); + } + } + + openModal(editModal: TemplateRef) { + this.modalData = { + title: 'Modification', + bodyMessage:'Le fichier existant en base de données sera supprimé !', + additionalMessage: 'Etes-vous sur de continuer ?', + cancelButtonText: 'Annuler', + confirmButtonText: 'Confirmer', + confirmButtonColor: 'warn', + headerDataQa: 'import-modal-edit', + confirmButtonDataQa: 'modal-edit-validate', + }; + this.modal.open(editModal); + } + + handleModalAction(event: { confirmed: boolean; actionType: string; data?: any }) { + if (event.confirmed) { + if (event.actionType === 'edit') { + this.onNextStep(); + } + } + } + } diff --git a/frontend/src/app/modules/imports/imports.module.ts b/frontend/src/app/modules/imports/imports.module.ts index 46e0c25747..cc0dbb77c5 100644 --- a/frontend/src/app/modules/imports/imports.module.ts +++ b/frontend/src/app/modules/imports/imports.module.ts @@ -9,7 +9,6 @@ import { MatCheckboxModule } from '@angular/material/checkbox'; import { NgChartsModule } from 'ng2-charts'; import { ImportModalDestinationComponent } from './components/modal_destination/import-modal-destination.component'; -import { ModalDeleteImport } from './components/delete-modal/delete-modal.component'; import { ImportDataService } from './services/data.service'; import { CsvExportService } from './services/csv-export.service'; import { FieldMappingService } from './services/mappings/field-mapping.service'; @@ -35,6 +34,7 @@ import { Step } from './models/enums.model'; import { ImportReportComponent } from './components/import_report/import_report.component'; import { DestinationsComponent } from './components/destinations/destinations.component'; import { FieldMappingModalComponent } from './components/import_process/fields-mapping-step/field-mapping-modal/field-mapping-modal.component'; +import { ModalActionImport } from './components/action-modal/action-modal.component'; const routes: Routes = [ { path: '', component: ImportListComponent }, @@ -97,7 +97,7 @@ const routes: Routes = [ ImportListComponent, ImportErrorsComponent, ImportModalDestinationComponent, - ModalDeleteImport, + ModalActionImport, UploadFileStepComponent, DecodeFileStepComponent, FieldsMappingStepComponent, @@ -126,7 +126,7 @@ const routes: Routes = [ MatCheckboxModule, NgbModule, ], - entryComponents: [ModalDeleteImport], + entryComponents: [ModalActionImport], providers: [ ImportDataService, ImportProcessService, diff --git a/frontend/src/app/modules/imports/models/modal-data.model.ts b/frontend/src/app/modules/imports/models/modal-data.model.ts new file mode 100644 index 0000000000..fbbd863a41 --- /dev/null +++ b/frontend/src/app/modules/imports/models/modal-data.model.ts @@ -0,0 +1,11 @@ +export interface ModalData { + title: string; // Titre de la modal + bodyMessage: string; // Message principal de la modal + additionalMessage?: string; // Message supplémentaire (optionnel) + cancelButtonText?: string; // Texte du bouton Annuler (optionnel) + confirmButtonText?: string; // Texte du bouton Confirmer (optionnel) + confirmButtonColor?: 'primary' | 'accent' | 'warn'; // Couleur du bouton Confirmer (optionnel) + headerDataQa?: string; // Attribut `data-qa` pour le header de la modal (optionnel) + confirmButtonDataQa?: string; // Attribut `data-qa` pour le bouton Confirmer (optionnel) + } + \ No newline at end of file