Skip to content
Snippets Groups Projects
Commit 3b5e6a2b authored by pnogal's avatar pnogal Committed by Paulina Nogal
Browse files

Add default selection for primary degree plan and included terms in audit request form

parent b2b55658
No related branches found
No related tags found
No related merge requests found
......@@ -64,7 +64,7 @@
<div class="step-buttons-group">
<button mat-button matStepperPrevious color="primary">Back</button>
<button mat-button matStepperNext mat-stroked-button color="primary" (click)="getPlansList()">Next</button>
<button mat-button matStepperNext mat-stroked-button color="primary">Next</button>
</div>
</mat-step>
......@@ -79,10 +79,7 @@
<mat-form-field class="audit-settings-option">
<mat-label>Include Courses From</mat-label>
<mat-select formControlName="includeCoursesFrom" placeholder="Include Courses From" aria-label="Include Courses From" [disableOptionCentering]="true">
<mat-option value="future">Previous, current, future, and planned terms</mat-option>
<mat-option value="future">Previous, current, future</mat-option>
<mat-option value="current">Previous, current</mat-option>
<mat-option value="previous">Previous</mat-option>
<mat-option *ngFor="let term of termsToInclude" [value]='term' id="{{ term.id }}">{{ term.name }}</mat-option>
</mat-select>
</mat-form-field>
......@@ -90,7 +87,7 @@
<mat-form-field class="audit-settings-option">
<mat-label>Degree Plan</mat-label>
<mat-select formControlName="runAgainst" placeholder="Degree Plan" aria-label="Degree Plan" [disableOptionCentering]="true">
<mat-option *ngFor="let degreePlan of (degreePlans$ | async)" value="{{ degreePlan.roadmapId }}">{{ degreePlan.name }}</mat-option>
<mat-option *ngFor="let degreePlan of degreePlans" value="{{ degreePlan.roadmapId }}">{{ degreePlan.name }}</mat-option>
</mat-select>
</mat-form-field>
<div class="step-buttons-group">
......
......@@ -34,10 +34,14 @@ export class NewAuditOptionsComponent implements OnInit {
public courses: any;
public variableCreditCourses: any;
public degreePlans$: Observable<DARSState['degreePlans']>;
public degreePlans: any[];
public primaryPlan: any[];
public primaryPlanId: string;
public hasVariableCredits: boolean;
public creditsRange: any[];
public isLoaded: boolean;
public selectedAuditType: string;
public termsToInclude: any[];
get formArray(): AbstractControl | null {
return this.newAuditForm.get('formArray');
}
......@@ -54,9 +58,32 @@ export class NewAuditOptionsComponent implements OnInit {
},
) {
this.selectedAuditType = data.selectedAuditType;
this.termsToInclude = [
{
name: 'Previous, current, future, and planned terms',
id: 'future-whatif',
value: 'future',
},
{
name: 'Previous, current, future',
id: 'future-degree',
value: 'future',
},
{ name: 'Previous, current', id: 'current', value: 'current' },
{ name: 'Previous', id: 'previous', value: 'previous' },
];
}
ngOnInit() {
// Get Degree plans
this.degreePlans$ = this.store.pipe(select(selectors.degreePlans));
this.degreePlans$.subscribe(plans => {
this.degreePlans = plans;
this.primaryPlan = plans.filter(function(plan) {
return plan.primary === true;
});
this.primaryPlanId = this.primaryPlan[0].roadmapId.toString();
});
// Get student degree programs
this.api.getStudentDegreePrograms().subscribe(studentDegreeProgram => {
this.studentDegreeProgram = studentDegreeProgram;
......@@ -81,7 +108,6 @@ export class NewAuditOptionsComponent implements OnInit {
}
}
});
this.newAuditForm = this.fb.group({
formArray: this.fb.array([
this.fb.group({
......@@ -94,8 +120,12 @@ export class NewAuditOptionsComponent implements OnInit {
}),
this.fb.group({
honors: new FormControl('Keep current status'),
includeCoursesFrom: new FormControl('future'),
runAgainst: new FormControl(''),
includeCoursesFrom: new FormControl(
this.selectedAuditType === 'degree'
? this.termsToInclude[1]
: this.termsToInclude[0],
),
runAgainst: new FormControl(this.primaryPlanId),
}),
this.fb.group({
credits: new FormControl(''),
......@@ -104,10 +134,6 @@ export class NewAuditOptionsComponent implements OnInit {
});
}
public getPlansList() {
this.degreePlans$ = this.store.pipe(select(selectors.degreePlans));
}
public getCoursesList(roadmapId) {
this.isLoaded = false;
......
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