Merge pull request #90 from AlineRinquin/isa2

Corrections des bugs
This commit is contained in:
AlineRinquin 2022-03-06 19:24:07 +01:00 committed by GitHub
commit 53408a220e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 10 deletions

View file

@ -58,7 +58,7 @@
}
.deleteTache {
width: 75%;
width: 10%;
cursor: pointer;
margin-left: 14px;
&:hover {
@ -77,7 +77,7 @@
}
.modifier-element {
font-size: 24px;
font-size: 18px;
color: white;
margin-left: 12px;
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 { TodoService } from 'src/app/services/todo.service';
@Component({
selector: 'app-to-do-list',
templateUrl: './to-do-list.component.html',
@ -36,8 +35,8 @@ export class ToDoListComponent implements OnInit {
this.casesRestantes = true;
this.filter = 'tous';
this.todoTitle = '';
if (this.toDoRest()===0){
this.masterSelected=true;
if (this.toDoRest() === 0) {
this.masterSelected = true;
}
}
//supprimer la todoList en fonction de son id
@ -52,6 +51,7 @@ export class ToDoListComponent implements OnInit {
addTache(idTodoList: number) {
//idTodoList id que la todoList que l'on récupère
console.log(idTodoList);
//permet de construire l'objet à passer en base
const tache: Tache = {
id: 0,
texte: this.todoTitle,
@ -70,9 +70,19 @@ export class ToDoListComponent implements OnInit {
//modifier le titre de la to-do-list
updateTodo(todoList: ToDoList): void {
this.TodoService.updateTodo(todoList)?.subscribe((resp) => {
window.location.reload();
});
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();
});
} else {
window.alert('Il faut saisir du texte'); // sinon msg d'erreur}
}
}
//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 {
tache.texte = this.beforeEditCache;
tache.editing = false;
}
//supprimer la tache
deleteTache(id: number) {
this.TodoService.deleteTacheById(id).subscribe((resp) => {
@ -123,7 +135,6 @@ export class ToDoListComponent implements OnInit {
this.todo.taches[i].etat = this.masterSelected;
this.TodoService.updateTache(this.todo.taches[i]).subscribe((resp) => {
console.log(this.todo.taches[i]);
});
}
//this.cocherAllTodoList();

View file

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