Skip to content
Snippets Groups Projects
Commit 7633d28a authored by Marlène SIMONDANT's avatar Marlène SIMONDANT
Browse files

Update details following refining

parent 40ab9910
No related branches found
No related tags found
1 merge request!983feat(dashboard) : create dashboard !
Pipeline #124244 passed
......@@ -16,25 +16,18 @@
</div>
</div>
<app-button
*ngIf="from === 'todoOrientations'"
*ngIf="from === 'todoOrientations' && !isClosed"
class="hide-on-mobile"
[label]="'Clôturer'"
[variant]="'primaryBlack'"
(action)="showModal()"
/>
<app-button
*ngIf="!isEditMode && from === 'todoOrientations'"
*ngIf="from === 'todoOrientations' && isClosed"
class="hide-on-mobile"
[label]="'Modifier'"
[variant]="'secondary'"
(action)="editOrientation()"
/>
<app-button
*ngIf="isEditMode && from === 'todoOrientations'"
class="hide-on-mobile"
[label]="'Enregistrer'"
[variant]="'primary'"
(action)="editOrientation()"
(action)="showModal()"
/>
</div>
......@@ -42,25 +35,19 @@
<section>
<span class="secondary-header">
<h2>Traitement</h2>
<!--app-button
*ngIf="from === 'todoOrientations'"
class="hide-on-desktop"
[label]="'Clôturer'"
[variant]="'primaryBlack'"
(action)="showModal()" /-->
<app-button
*ngIf="!isEditMode && from === 'todoOrientations'"
*ngIf="from === 'todoOrientations' && !isClosed"
class="hide-on-desktop"
[label]="'Modifier'"
[variant]="'secondary'"
(action)="editOrientation()"
[label]="'Clôturer'"
[variant]="'primaryBlack'"
(action)="showModal()"
/>
<app-button
*ngIf="isEditMode && from === 'todoOrientations'"
*ngIf="from === 'todoOrientations' && isClosed"
class="hide-on-desktop"
[label]="'Modifier'"
[variant]="'primary'"
(action)="editOrientation()"
[variant]="'secondary'"
(action)="showModal()"
/>
</span>
<div class="content">
......@@ -109,10 +96,9 @@
<div class="inline">
<app-svg-icon [iconClass]="'icon-20'" [folder]="'tags'" [icon]="'calendarBlue'" />
<div class="datePickerContainer">
<span class="category-name">Date de RDV :</span>
<span class="category-name" id="dateLabel">Date de RDV :</span>
<span class="datePicker">
<label for="date">Date:</label>
<input type="date" id="date" name="date" />
<input type="date" id="date" name="date" aria-labelledby="dateLabel" />
</span>
</div>
</div>
......@@ -179,14 +165,7 @@
<app-svg-icon [iconClass]="'icon-20'" [folder]="'tags'" [icon]="'commentBlue'" />
<p class="inline">
<span class="category-name" id="processingCommentLabel">Commentaire :</span>
<ng-container *ngIf="!isEditMode">{{ orientation.processingComment || 'Non renseigné' }}</ng-container>
<app-textarea
*ngIf="isEditMode"
id="processingComment"
aria-labelledby="processingCommentLabel"
[value]="orientation.processingComment"
(valueChange)="setProcessingComment($event)"
/>
{{ orientation.processingComment || 'Non renseigné' }}
</p>
</div>
</ng-container>
......@@ -298,12 +277,10 @@
<div class="modalForm">
<div class="subtitle">Statut de l'accompagnement :</div>
<div class="inline">
{{ orientation.status }}
<input id="completed" type="radio" name="status" value="completed" [(ngModel)]="selectedStatus" />
<label for="completed">Terminé</label>
</div>
<div class="inline">
{{ orientation.status }}
<input id="uncompleted" type="radio" name="status" value="uncompleted" [(ngModel)]="selectedStatus" />
<label for="uncompleted">Non réalisé</label>
</div>
......
......@@ -120,6 +120,10 @@
padding: 8px;
}
}
@media #{$phone} {
flex-direction: column;
align-items: self-start;
}
}
.pipe {
......
......@@ -26,10 +26,10 @@ export class OrientationDetailsComponent implements OnInit {
public orientation;
public isModalOpenned = false;
public userProfile: User;
public isEditMode = false;
public from: string;
public closingComment = '';
public selectedStatus = '';
public isClosed: boolean;
ngOnInit(): void {
this.route.queryParams.subscribe((params) => {
......@@ -42,6 +42,7 @@ export class OrientationDetailsComponent implements OnInit {
this.orientationService.getOrientation(orientationId).subscribe((orientation) => {
this.orientation = orientation;
this.acknowledgeNewOrientation();
this.isOrientationClosed();
this.selectedStatus = this.orientation.status;
});
}
......@@ -66,6 +67,7 @@ export class OrientationDetailsComponent implements OnInit {
const sanitizedComment = this.sanitizer.sanitize(SecurityContext.HTML, comment);
this.patchOrientation({
status: this.selectedStatus,
action: null,
closingComment: sanitizedComment,
closingDate: new Date(),
modifiedBy: this.userProfile._id,
......@@ -76,32 +78,20 @@ export class OrientationDetailsComponent implements OnInit {
public acknowledgeNewOrientation(): void {
if (this.orientation.status === 'new') {
this.patchOrientation({ status: 'waiting', modifiedBy: this.userProfile._id });
this.patchOrientation({ status: 'waiting', action: 'defineAppointment', modifiedBy: this.userProfile._id });
}
}
public editOrientation(): void {
// TODO : edit orientation
if (this.isEditMode) {
// wip test patch
this.patchOrientation({
// status: 'completed',
processingComment: 'processing comment',
modifiedBy: this.userProfile._id,
});
}
this.isEditMode = !this.isEditMode;
}
public setProcessingComment(comment): void {
// TODO : patch comment
}
get isValidateDisabled(): boolean {
console.log(!this.selectedStatus || !this.commentTextarea?.value?.trim());
return !this.selectedStatus || !this.commentTextarea?.value?.trim();
}
public isOrientationClosed(): void {
const closedStatuses = ['completed', 'uncompleted', 'expired'];
this.isClosed = closedStatuses.includes(this.orientation.status);
}
private patchOrientation(updatedFields): void {
this.orientationService.patchOrientation(this.orientation._id, updatedFields).subscribe({
next: (orientation) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment