Skip to content
Snippets Groups Projects
Commit b488cca7 authored by Paulina Nogal's avatar Paulina Nogal Committed by Isaac Evavold
Browse files

ROENROLL-1791 form data

parent 067cfacb
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,6 @@ import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { A11yModule } from '@angular/cdk/a11y';
......@@ -11,7 +10,6 @@ import { AppComponent } from './app.component';
import { CoreModule } from '@app/core/core.module';
import { SharedModule } from '@app/shared/shared.module';
import { HeaderComponent } from './core/header/header.component';
import { degreePlannerReducer } from '@app/degree-planner/store/reducer';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
import { CourseDetailsDialogComponent } from './degree-planner/dialogs/course-details-dialog/course-details-dialog.component';
import { FeedbackDialogComponent } from './degree-planner/dialogs/feedback-dialog/feedback-dialog.component';
......
import { Component, OnInit, ViewChild } from '@angular/core';
import { AuditMetadata } from '../models/audit-metadata';
import { MatDialog } from '@angular/material';
import { NewAuditOptionsComponent } from './new-audit-options/new-audit-options.component';
import { NewAuditOptionsComponent } from '../new-audit-options/new-audit-options.component';
import { DARSState } from '../store/state';
import { Store } from '@ngrx/store';
import { GlobalState } from '@app/core/state';
......
......@@ -5,7 +5,7 @@ import { SharedModule } from '@app/shared/shared.module';
import { DARSEffects } from './store/effects';
import { DarsAuditComponent } from './audit/audit.component';
import { DarsMetadataTableComponent } from './metadata-table/metadata-table.component';
import { NewAuditOptionsComponent } from './dars-view/new-audit-options/new-audit-options.component';
import { NewAuditOptionsComponent } from './new-audit-options/new-audit-options.component';
import { MatStepperModule } from '@angular/material';
import { AlertContainerComponent } from '../shared/components/alert-container/alert-container.component';
import { StoreModule } from '@ngrx/store';
......
......@@ -43,24 +43,23 @@
<mat-step class="audit-step" formGroupName="1" [stepControl]="formArray?.get([1])">
<ng-template matStepLabel>Select program of study</ng-template>
<!-- If audit with declared major was selected in #1 show this -->
<mat-radio-group class="audit-radio-group" formControlName="programOfStudy">
<mat-radio-button checked="true" class="audit-radio-button" name="" id="" value="" aria-label="">
Major: Psychology
<mat-radio-group *ngIf="newAuditForm.value.formArray[0].auditType === 'declaredMajorAudit'" class="audit-radio-group" formControlName="darsDegreeProgram">
<mat-radio-button *ngFor="let program of DARSprograms" class="audit-radio-button" name="{{ program.darsDegreeProgramCode }}" id="{{ program.darsDegreeProgramCode }}" value="{{ program.darsDegreeProgramCode }}" aria-label="{{ program.darsDegreeProgramCode }}">
{{ program.darsDegreeProgramCode }}
</mat-radio-button>
</mat-radio-group>
<!-- If what-if audit was selected in #1 -->
<mat-form-field class="audit-program">
<mat-select formControlName="programOfStudy" placeholder="School, College or Population" aria-label="Select School, College or Population" [disableOptionCentering]="true">
<mat-option value="">Engineering</mat-option>
<mat-form-field *ngIf="newAuditForm.value.formArray[0].auditType === 'whatIfAudit'" class="audit-program">
<mat-select formControlName="darsInstitution" placeholder="School, College or Population" aria-label="Select School, College or Population" [disableOptionCentering]="true">
<mat-option value="{{ programOfStudy }}">{{ programOfStudy}}</mat-option>
</mat-select>
</mat-form-field>
<!-- Show after School, College or Population was selected -->
<mat-form-field class="audit-program">
<mat-select formControlName="academicProgram" placeholder="Academic Plan Program" aria-label="Academic Plan Program" [disableOptionCentering]="true">
<mat-option value="">Biomedical Engineering</mat-option>
<mat-form-field *ngIf="(newAuditForm.value.formArray[0].auditType === 'whatIfAudit') && (newAuditForm.value.formArray[1].darsInstitution)" class="audit-program">
<mat-select formControlName="darsInstitutionProgram" placeholder="Academic Plan Program" aria-label="Academic Plan Program" [disableOptionCentering]="true">
<mat-option *ngFor="let program of DARSprograms" value="{{ program.darsDegreeProgramDescription }}">{{ program.darsDegreeProgramDescription }}</mat-option>
</mat-select>
</mat-form-field>
......@@ -75,7 +74,7 @@
<mat-form-field class="audit-settings-option">
<mat-label>Honors Degree Options</mat-label>
<mat-select formControlName="honors" placeholder="Honors Degree Option" aria-label="Honors Degree Options" [disableOptionCentering]="true">
<mat-option value="">Keep current status</mat-option>
<mat-option *ngFor="let honor of honorsOptions" value="">{{ honor.darsHonorsOptionDescription }}</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="audit-settings-option">
......@@ -111,7 +110,7 @@
<div fxLayoutAlign="end center" fxFlex="20">
<mat-form-field id="audit-credits-selector">
<mat-select formControlName="credits" placeholder="" aria-label="Number of credits" [disableOptionCentering]="true">
<mat-option value="">2</mat-option>
<mat-option value=""></mat-option>
</mat-select>
</mat-form-field>
</div>
......
import { Component, OnInit } from '@angular/core';
import { MatDialogRef, MatSnackBar } from '@angular/material';
import { DarsApiService } from '../services/api.service';
import { DegreeProgram } from '../models/degree-program';
import { StudentDegreeProgram } from '../models/student-degree-program';
import {
FormBuilder,
FormGroup,
......@@ -16,6 +19,12 @@ import {
})
export class NewAuditOptionsComponent implements OnInit {
public newAuditForm: FormGroup;
public degreeProgram: DegreeProgram;
public degreePrograms: any;
public programOfStudy: string;
public studentDegreeProgram: StudentDegreeProgram[];
public DARSprograms: any;
public honorsOptions: any;
get formArray(): AbstractControl | null {
return this.newAuditForm.get('formArray');
......@@ -25,17 +34,39 @@ export class NewAuditOptionsComponent implements OnInit {
private fb: FormBuilder,
private dialogRef: MatDialogRef<NewAuditOptionsComponent>,
private snackBar: MatSnackBar,
private api: DarsApiService,
) {}
ngOnInit() {
this.api.getStaticData().subscribe(degreePrograms => {
this.degreePrograms = degreePrograms;
this.honorsOptions = [];
this.DARSprograms = [];
for (var school in this.degreePrograms) {
// Get program of study
this.programOfStudy = this.degreePrograms[
school
].darsInstitutionCodeDescription;
// Get honors options
if (this.degreePrograms[school].hasOwnProperty('honorsOptions')) {
this.honorsOptions.push(...this.degreePrograms[school].honorsOptions);
}
// Get DARS programs
if (this.degreePrograms[school].hasOwnProperty('programs')) {
this.DARSprograms.push(...this.degreePrograms[school].programs);
}
}
});
this.newAuditForm = this.fb.group({
formArray: this.fb.array([
this.fb.group({
auditType: new FormControl(''),
auditType: new FormControl('declaredMajorAudit'),
}),
this.fb.group({
programOfStudy: new FormControl(''),
academicProgram: new FormControl(''),
darsDegreeProgram: new FormControl(''),
darsInstitution: new FormControl(''),
darsInstitutionProgram: new FormControl(''),
}),
this.fb.group({
honors: new FormControl(''),
......
......@@ -9,6 +9,7 @@ import { Audit } from '../models/audit';
import { map } from 'rxjs/operators';
const auditResponse: any = require('../../../assets/mock-data/audit-response.json');
const degreeProgramsResponse: any = require('../../../assets/mock-data/degreeprograms-response.json');
const HTTP_OPTIONS = {
headers: new HttpHeaders({
......@@ -27,8 +28,16 @@ export class DarsApiService {
* The backend is going to cache all this data in S3 and create a single
* endpoint for us to hit and get all of it!
*/
public getStaticData(): Observable<DegreeProgram[]> {
return new Observable();
// Prevents errors locally
if (environment.production) {
const url =
'http://dev-enroll-app-data.s3-website-us-east-1.amazonaws.com/degreeprograms.json';
return this.http.get<DegreeProgram[]>(url, HTTP_OPTIONS);
} else {
return of(degreeProgramsResponse);
}
}
/**
......
{"L&S":{"darsInstitutionCode":"L&S","darsInstitutionCodeDescription":"Letters & Science, College of","programs":[{"darsDegreeProgramCode":"BA 916","darsInstitutionCode":"L&S","darsInstitutionCodeDescription":"Letters & Science, College of","darsDegreeProgramDescription":"SOCIAL WELFARE major: COLLEGE of LETTERS & SCIENCE - Bachelor of Arts (B.A.): BA 916"},{"darsDegreeProgramCode":"MAJ 542","darsInstitutionCode":"L&S","darsInstitutionCodeDescription":"Letters & Science, College of","darsDegreeProgramDescription":"CLASSICAL HUMANITIES major : COLLEGE of LETTERS & SCIENCE : MAJ 542"}],"honorsOptions":[{"darsInstitutionCode":"L&S","darsHonorsOptionCode":".","darsHonorsOptionDescription":"Keep current status"},{"darsInstitutionCode":"L&S","darsHonorsOptionCode":"Z","darsHonorsOptionDescription":"Omit Major, Include Liberal Arts"},{"darsInstitutionCode":"L&S","darsHonorsOptionCode":"M","darsHonorsOptionDescription":"Include Honors in Major"}]}}
\ No newline at end of file
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