diff --git a/README.md b/README.md
index e2350ca..30a7ecf 100644
--- a/README.md
+++ b/README.md
@@ -62,11 +62,12 @@ Angular CLI does not come with an end-to-end testing framework by default. You c
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
--implement total visits and total clicks on register button
-minor things
+-fix upload of the image in edit mode
+-add deletion button to the card
-centralize scss check the same styles for differnet buttons
-adjust to mobile format
+
****animations transitions (prev next cards)
diff --git a/src/app/components/application-list/application-list.component.html b/src/app/components/application-list/application-list.component.html
index 4bfee01..333dcf0 100644
--- a/src/app/components/application-list/application-list.component.html
+++ b/src/app/components/application-list/application-list.component.html
@@ -1,7 +1,7 @@
}
diff --git a/src/app/components/application-list/application-list.component.scss b/src/app/components/application-list/application-list.component.scss
index 94ece74..b53c583 100644
--- a/src/app/components/application-list/application-list.component.scss
+++ b/src/app/components/application-list/application-list.component.scss
@@ -131,6 +131,33 @@
color: #00ffff;
}
+.delete-button {
+ margin-left: 12px;
+ width: 40px;
+ height: 40px;
+ min-width: 40px;
+ background: rgba(255, 68, 68, 0.1);
+ border: 1px solid #ff4444;
+ border-radius: 8px;
+ color: #ff4444;
+ cursor: pointer;
+ transition: all 0.3s ease;
+ flex-shrink: 0;
+}
+
+.delete-button:hover {
+ background: rgba(255, 68, 68, 0.2);
+ color: #ff6666;
+ box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
+ transform: translateY(-2px);
+ border-color: #ff6666;
+}
+
+.delete-button mat-icon {
+ font-size: 20px;
+ width: 20px;
+ height: 20px;
+}
.charts-row {
display: flex;
diff --git a/src/app/components/application-list/application-list.component.ts b/src/app/components/application-list/application-list.component.ts
index b5d00b0..7c625cd 100644
--- a/src/app/components/application-list/application-list.component.ts
+++ b/src/app/components/application-list/application-list.component.ts
@@ -12,6 +12,7 @@ import { SocketIOService } from '../../services/socket-io.service';
import { BaseChartDirective } from 'ng2-charts';
import { ChartData, ChartOptions, Chart, registerables } from 'chart.js';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
+import { MatSnackBar } from '@angular/material/snack-bar';
Chart.register(...registerables);
@@ -32,10 +33,10 @@ Chart.register(...registerables);
styleUrls: ['./application-list.component.scss']
})
export class ApplicationListComponent implements OnInit {
- private dataService = inject(CandidateDataService);
- private socketService = inject(SocketIOService);
- private router = inject(Router);
-
+ dataService = inject(CandidateDataService);
+ socketService = inject(SocketIOService);
+ router = inject(Router);
+ snackBar = inject(MatSnackBar)
environment = environment;
applicationList = signal([]);
@@ -94,7 +95,7 @@ export class ApplicationListComponent implements OnInit {
constructor() {
effect(() => {
const data = this.applicationList();
-
+
if (data.length === 0) {
this.ageChartData.set({ labels: [], datasets: [] });
this.cityChartData.set({ labels: [], datasets: [] });
@@ -108,7 +109,7 @@ export class ApplicationListComponent implements OnInit {
'46-60': 0,
'60+': 0,
};
-
+
data.forEach(app => {
if (app.age <= 25) ageGroups['18-25']++;
else if (app.age <= 35) ageGroups['26-35']++;
@@ -192,11 +193,16 @@ export class ApplicationListComponent implements OnInit {
);
this.availableCities.set(this.getUniqueCities(this.applicationList()));
});
+
+ this.socketService.onCandidateDeleted().subscribe(deletedCandidateId => {
+ this.applicationList.update(list =>
+ list.filter(app => app.id !== deletedCandidateId)
+ );
+ this.availableCities.set(this.getUniqueCities(this.applicationList()));
+ });
}
- goBack(): void {
- this.router.navigate(['/landing']);
- }
+
getUniqueCities(data: any[]): City[] {
const seen: string[] = [];
@@ -209,4 +215,24 @@ export class ApplicationListComponent implements OnInit {
})
.sort((a, b) => a.name.localeCompare(b.name));
}
+
+ onDeleteClick(event: any, id: number) {
+ event.stopPropagation();
+ this.dataService.deleteCandidate(id).subscribe({
+ next: () => {
+ this.snackBar.open('✅ Application deleted!', 'Close', {
+ duration: 5000,
+ horizontalPosition: 'center',
+ verticalPosition: 'top',
+ });
+ },
+ error: () => {
+ this.snackBar.open('Error deleting application!', 'Close', {
+ duration: 5000,
+ horizontalPosition: 'center',
+ verticalPosition: 'top',
+ });
+ },
+ });
+ }
}
\ No newline at end of file
diff --git a/src/app/components/application/application.component.html b/src/app/components/application/application.component.html
index 87fad1e..5dc59f1 100644
--- a/src/app/components/application/application.component.html
+++ b/src/app/components/application/application.component.html
@@ -1,6 +1,6 @@