Correction navigation après enregistrement issue
This commit is contained in:
@@ -47,6 +47,20 @@
|
|||||||
background-color: #047857;
|
background-color: #047857;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cancel-button {
|
||||||
|
border: 1px solid #d1d5db;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
background-color: #ffffff;
|
||||||
|
color: #374151;
|
||||||
|
padding: 0.65rem 1rem;
|
||||||
|
font-weight: 600;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cancel-button:hover {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
}
|
||||||
|
|
||||||
.detail-card {
|
.detail-card {
|
||||||
background-color: #ffffff;
|
background-color: #ffffff;
|
||||||
border: 1px solid #e5e7eb;
|
border: 1px solid #e5e7eb;
|
||||||
@@ -93,6 +107,13 @@ tr:last-child td {
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-actions {
|
||||||
|
margin-top: 1rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.page-header {
|
.page-header {
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -3,11 +3,8 @@
|
|||||||
<h1>Detail de l'issue</h1>
|
<h1>Detail de l'issue</h1>
|
||||||
<p>Informations de creation et de suivi de l'issue.</p>
|
<p>Informations de creation et de suivi de l'issue.</p>
|
||||||
</div>
|
</div>
|
||||||
<button type="button" class="edit-button" (click)="toggleEdit()">
|
@if (!isEditing) {
|
||||||
{{ isEditing ? 'Fermer edition' : "Editer l'issue" }}
|
<button type="button" class="edit-button" (click)="startEdit()">Editer l'issue</button>
|
||||||
</button>
|
|
||||||
@if (isEditing) {
|
|
||||||
<button type="button" class="save-button" (click)="saveIssue()">Enregistrer</button>
|
|
||||||
}
|
}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
@@ -110,3 +107,11 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
@if (isEditing) {
|
||||||
|
<div class="form-actions">
|
||||||
|
<button type="button" class="cancel-button" (click)="cancelEdit()">Annuler</button>
|
||||||
|
<button type="button" class="save-button" (click)="saveIssue()">Enregistrer</button>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,35 @@ export class IssueDetail {
|
|||||||
|
|
||||||
protected issue: IssueEntity = this.buildIssue();
|
protected issue: IssueEntity = this.buildIssue();
|
||||||
protected isEditing = this.route.snapshot.queryParamMap.get('mode') === 'edit';
|
protected isEditing = this.route.snapshot.queryParamMap.get('mode') === 'edit';
|
||||||
|
private issueBeforeEdit: IssueEntity | null = null;
|
||||||
|
|
||||||
protected toggleEdit(): void {
|
constructor() {
|
||||||
this.isEditing = !this.isEditing;
|
if (this.isEditing) {
|
||||||
|
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected startEdit(): void {
|
||||||
|
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||||
|
this.isEditing = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected cancelEdit(): void {
|
||||||
|
if (this.issueBeforeEdit) {
|
||||||
|
this.issue = this.cloneIssue(this.issueBeforeEdit);
|
||||||
|
}
|
||||||
|
this.isEditing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected saveIssue(): void {
|
protected saveIssue(): void {
|
||||||
this.issuesStore.upsert(this.issue);
|
this.issuesStore.upsert(this.issue);
|
||||||
|
this.issueBeforeEdit = this.cloneIssue(this.issue);
|
||||||
this.isEditing = false;
|
this.isEditing = false;
|
||||||
this.router.navigate(['/issues']);
|
this.router.navigate(['/issues', this.issue.id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private cloneIssue(issue: IssueEntity): IssueEntity {
|
||||||
|
return { ...issue };
|
||||||
}
|
}
|
||||||
|
|
||||||
private buildIssue(): IssueEntity {
|
private buildIssue(): IssueEntity {
|
||||||
|
|||||||
Reference in New Issue
Block a user