Corrections des bugs

This commit is contained in:
HarmandI 2022-03-06 18:50:11 +01:00
parent cca4e96f2b
commit c162d50605
3 changed files with 22 additions and 10 deletions

View file

@ -58,7 +58,7 @@
} }
.deleteTache { .deleteTache {
width: 75%; width: 10%;
cursor: pointer; cursor: pointer;
margin-left: 14px; margin-left: 14px;
&:hover { &:hover {
@ -77,7 +77,7 @@
} }
.modifier-element { .modifier-element {
font-size: 24px; font-size: 18px;
color: white; color: white;
margin-left: 12px; margin-left: 12px;
width: 100%; width: 100%;

View file

@ -4,7 +4,6 @@ import { Tache } from 'src/app/models/tache';
import { ToDoList } from 'src/app/models/to-do-list'; import { ToDoList } from 'src/app/models/to-do-list';
import { TodoService } from 'src/app/services/todo.service'; import { TodoService } from 'src/app/services/todo.service';
@Component({ @Component({
selector: 'app-to-do-list', selector: 'app-to-do-list',
templateUrl: './to-do-list.component.html', templateUrl: './to-do-list.component.html',
@ -52,6 +51,7 @@ export class ToDoListComponent implements OnInit {
addTache(idTodoList: number) { addTache(idTodoList: number) {
//idTodoList id que la todoList que l'on récupère //idTodoList id que la todoList que l'on récupère
console.log(idTodoList); console.log(idTodoList);
//permet de construire l'objet à passer en base
const tache: Tache = { const tache: Tache = {
id: 0, id: 0,
texte: this.todoTitle, texte: this.todoTitle,
@ -70,9 +70,19 @@ export class ToDoListComponent implements OnInit {
//modifier le titre de la to-do-list //modifier le titre de la to-do-list
updateTodo(todoList: ToDoList): void { updateTodo(todoList: ToDoList): void {
this.TodoService.updateTodo(todoList)?.subscribe((resp) => { let nouvelleTodolist = {
id: todoList.id,
nom: todoList.nom,
team: todoList.team,
};
console.log(todoList.team);
if (nouvelleTodolist.nom != '') {
this.TodoService.updateTodo(nouvelleTodolist)?.subscribe((resp) => {
window.location.reload(); window.location.reload();
}); });
} else {
window.alert('Il faut saisir du texte'); // sinon msg d'erreur}
}
} }
//modifier la tâche par l'input //modifier la tâche par l'input
@ -94,12 +104,14 @@ export class ToDoListComponent implements OnInit {
}); });
} }
// annuler la modification // annuler la modification de la tâche
cancelEdit(tache: Tache): void { cancelEdit(tache: Tache): void {
tache.texte = this.beforeEditCache; tache.texte = this.beforeEditCache;
tache.editing = false; tache.editing = false;
} }
//supprimer la tache //supprimer la tache
deleteTache(id: number) { deleteTache(id: number) {
this.TodoService.deleteTacheById(id).subscribe((resp) => { this.TodoService.deleteTacheById(id).subscribe((resp) => {
@ -123,7 +135,6 @@ export class ToDoListComponent implements OnInit {
this.todo.taches[i].etat = this.masterSelected; this.todo.taches[i].etat = this.masterSelected;
this.TodoService.updateTache(this.todo.taches[i]).subscribe((resp) => { this.TodoService.updateTache(this.todo.taches[i]).subscribe((resp) => {
console.log(this.todo.taches[i]); console.log(this.todo.taches[i]);
}); });
} }
//this.cocherAllTodoList(); //this.cocherAllTodoList();

View file

@ -5,4 +5,5 @@ export interface ToDoList {
nom: string; nom: string;
taches: Tache[]; taches: Tache[];
id: number; id: number;
team? : Team;
} }