diff --git a/src/app/admin/admin.module.ts b/src/app/admin/admin.module.ts index f3cf33c00887bf0ddd3a5897977f97f16b57e643..8c8c3fbc6eec76c846a0da64033b2a9860e1c8dc 100644 --- a/src/app/admin/admin.module.ts +++ b/src/app/admin/admin.module.ts @@ -4,7 +4,6 @@ import { PanelComponent } from './components/panel/panel.component'; import { ClaimStructureComponent } from './components/claim-structure/claim-structure.component'; import { ManageUsersComponent } from './components/manage-users/manage-users.component'; import { SharedModule } from '../shared/shared.module'; -import { NewsletterUsersComponent } from './components/newsletter-users/newsletter-users.component'; import { AdminStructuresListComponent } from './components/structures-list/admin-structures-list.component'; import { ManageLockdownInfoComponent } from './components/lockdown-info/manage-lockdown-info.component'; import { AdminRoutingModule } from './admin-routing.module'; @@ -26,7 +25,6 @@ import { JobPersonalOffer } from './components/manage-jobs/jobPersonalOffer/job- declarations: [ PanelComponent, ClaimStructureComponent, - NewsletterUsersComponent, AdminStructuresListComponent, ManageLockdownInfoComponent, ManageUsersComponent, @@ -41,13 +39,13 @@ import { JobPersonalOffer } from './components/manage-jobs/jobPersonalOffer/job- AdministredStructuresComponent, AttachedUsersComponent, ManageJobsComponent, - ManageEmployersComponent, + ManageEmployersComponent ], imports: [ CommonModule, AdminRoutingModule, SharedModule, - AgGridModule.withComponents([DeleteUserComponent, AdministredStructuresComponent]), - ], + AgGridModule.withComponents([DeleteUserComponent, AdministredStructuresComponent]) + ] }) export class AdminModule {} diff --git a/src/app/admin/components/newsletter-users/newsletter-users.component.html b/src/app/admin/components/newsletter-users/newsletter-users.component.html deleted file mode 100644 index ece8e1fef1b235ea75a139efe392960c89ef86fe..0000000000000000000000000000000000000000 --- a/src/app/admin/components/newsletter-users/newsletter-users.component.html +++ /dev/null @@ -1,27 +0,0 @@ -<div fxLayout="column" fxLayoutGap="5px" fxLayoutAlign="center center" class="userBlock"> - <h2>Gestion abonnement newsletter</h2> - <div fxLayout="row" fxLayoutGap="20px" fxLayoutAlign="center center"> - <button (click)="copySubscription()">Copier les adresses dans le presse papier</button> - <button (click)="searchSubscribedEmail('')">Afficher tous les inscrits</button> - </div> - <div fxLayout="row">Il y a actuellement {{ subscriptionsCount }} abonnés à la newsletter.</div> - <div fxLayout="row"> - <input #searchstring (keyup)="(0)" /> - <button (click)="searchSubscribedEmail(searchstring.value)">Rechercher</button> - </div> - <div class="userList"> - <tr *ngFor="let subscription of subscriptions"> - <td>{{ subscription.email }}</td> - <td> - <button (click)="toggleUnsubscribeModal(subscription.email)">Désabonner</button> - </td> - </tr> - <app-modal-confirmation - *ngIf="emailToUnsubscribe" - [openned]="deleteModalOpenned" - [content]="'Voulez-vous vraiment supprimer ' + emailToUnsubscribe + ' de la newsletter ?'" - (closed)="unsubscribeEmail(emailToUnsubscribe, $event)" - ></app-modal-confirmation> - <div *ngIf="subscriptions && subscriptions.length == 0">Aucun résultat</div> - </div> -</div> diff --git a/src/app/admin/components/newsletter-users/newsletter-users.component.spec.ts b/src/app/admin/components/newsletter-users/newsletter-users.component.spec.ts deleted file mode 100644 index 119aadb28d6b6e3661c3f11edc834287a58f4b04..0000000000000000000000000000000000000000 --- a/src/app/admin/components/newsletter-users/newsletter-users.component.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { HttpClientModule } from '@angular/common/http'; -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { NewsletterUsersComponent } from './newsletter-users.component'; - -describe('DeleteUserComponent', () => { - let component: NewsletterUsersComponent; - let fixture: ComponentFixture<NewsletterUsersComponent>; - let USERS; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [HttpClientModule], - declarations: [NewsletterUsersComponent], - }).compileComponents(); - }); - - beforeEach(() => { - fixture = TestBed.createComponent(NewsletterUsersComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/admin/components/newsletter-users/newsletter-users.component.ts b/src/app/admin/components/newsletter-users/newsletter-users.component.ts deleted file mode 100644 index 73b142f9e8e41a5f6fb12c11336abd022c0091bf..0000000000000000000000000000000000000000 --- a/src/app/admin/components/newsletter-users/newsletter-users.component.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Component } from '@angular/core'; -import { NewsletterSubscription } from '../../../models/subscription-model'; -import { AdminService } from '../../services/admin.service'; - -@Component({ - selector: 'app-admin-newsletter-users', - templateUrl: './newsletter-users.component.html', -}) -export class NewsletterUsersComponent { - public subscriptions: NewsletterSubscription[]; - public deleteModalOpenned = false; - public emailToUnsubscribe: string = null; - public subscriptionsCount: number = 0; - - constructor(private adminService: AdminService) {} - - ngOnInit(): void { - this.adminService.countNewsletterSubscriptions().subscribe((count) => { - this.subscriptionsCount = count; - }); - } - - public toggleUnsubscribeModal(emailToUnsubscribe: string): void { - this.emailToUnsubscribe = emailToUnsubscribe; - this.deleteModalOpenned = !this.deleteModalOpenned; - } - - public searchSubscribedEmail(searchString: string): void { - this.adminService.searchNewsletterSubscriptions(searchString).subscribe((emails) => { - this.subscriptions = emails; - }); - } - - public unsubscribeEmail(email: string, shouldUnsubscribe: boolean): void { - this.toggleUnsubscribeModal(email); - if (shouldUnsubscribe) { - this.adminService.unsubscribeEmail(email).subscribe((_data) => { - this.subscriptions = this.subscriptions.filter((obj) => obj.email !== email); - this.subscriptionsCount = this.subscriptions.length; - }); - } - } - - public copySubscription(): void { - this.adminService.searchNewsletterSubscriptions('').subscribe((emails) => { - let emailsToBeCopied = emails.map((e) => e.email).join(';'); - let copyElement = document.createElement('textarea'); - copyElement.textContent = decodeURI(emailsToBeCopied); - let body = document.getElementsByTagName('body')[0]; - body.appendChild(copyElement); - copyElement.select(); - document.execCommand('copy'); - body.removeChild(copyElement); - }); - } -} diff --git a/src/app/admin/components/panel/panel.component.html b/src/app/admin/components/panel/panel.component.html index 29397d59422504715dee7600ccdd7d0dba481558..71e5616b62e4fd69c03ba6ae1e8380772e12d0e7 100644 --- a/src/app/admin/components/panel/panel.component.html +++ b/src/app/admin/components/panel/panel.component.html @@ -5,7 +5,6 @@ <button (click)="changeActiveFeature(features.structuresList)">Liste structures</button> <button (click)="changeActiveFeature(features.manageUsers)">Gestion des utilisateurs</button> <button (click)="changeActiveFeature(features.lockdownInfo)">Gestion des infos covid</button> - <button (click)="changeActiveFeature(features.newsletterUsers)">Newsletter</button> <button (click)="changeActiveFeature(features.jobsList)">Fonctions</button> <button (click)="changeActiveFeature(features.employersList)">Employeurs</button> <a target="_blank" class="custom-link" rel="noopener noreferrer" [href]="ghostLink">Ghost</a> @@ -22,9 +21,6 @@ <div *ngIf="selectedFeature === features.lockdownInfo"> <app-admin-manage-lockdown-info></app-admin-manage-lockdown-info> </div> - <div *ngIf="selectedFeature === features.newsletterUsers"> - <app-admin-newsletter-users></app-admin-newsletter-users> - </div> <div *ngIf="selectedFeature === features.jobsList"> <app-admin-manage-jobs></app-admin-manage-jobs> </div> diff --git a/src/app/admin/components/panel/panel.component.ts b/src/app/admin/components/panel/panel.component.ts index 715bdb65343dfb201b52c4516763120a3658ba22..62ca26ee8c511e28c31f72cfd53a7d11aecb8da9 100644 --- a/src/app/admin/components/panel/panel.component.ts +++ b/src/app/admin/components/panel/panel.component.ts @@ -6,7 +6,7 @@ import { PanelRouteService } from '../../services/panel-route.service'; @Component({ selector: 'app-admin-panel', templateUrl: './panel.component.html', - providers: [PanelRouteService], + providers: [PanelRouteService] }) export class PanelComponent implements OnInit { public features = AdminPannelEnum; diff --git a/src/app/shared/enum/adminPanel.enum.ts b/src/app/shared/enum/adminPanel.enum.ts index 5197a31d90aed0ca7d3134568b6b55a83b836162..8c81a0ef3ac8f413b67f3fac2dd4ab7417ef918f 100644 --- a/src/app/shared/enum/adminPanel.enum.ts +++ b/src/app/shared/enum/adminPanel.enum.ts @@ -1,9 +1,8 @@ export enum AdminPannelEnum { manageUsers, pendingStructures, - newsletterUsers, structuresList, jobsList, employersList, - lockdownInfo, + lockdownInfo }