Skip to content
Snippets Groups Projects
Commit 0475ad20 authored by Scott Berg's avatar Scott Berg Committed by Scott Berg
Browse files

Close search when a course is added or saved from search.

parent fcbeebf5
No related branches found
No related tags found
No related merge requests found
Pipeline #36571 passed
......@@ -11,6 +11,7 @@ import {
RemoveSaveForLater,
RemoveCourse,
} from '@app/degree-planner/store/actions/course.actions';
import { CloseCourseSearch } from '@app/degree-planner/store/actions/ui.actions';
import { GlobalState } from '@app/core/state';
import { Course } from '@app/core/models/course';
import * as selectors from '@app/degree-planner/store/selectors';
......@@ -180,6 +181,7 @@ export class CourseItemComponent implements OnInit {
case 'search': {
this.addToTerm(toTermCode);
this.store.dispatch(new CloseCourseSearch());
break;
}
}
......@@ -211,13 +213,20 @@ export class CourseItemComponent implements OnInit {
);
// If course is in a term, we need to remove it
if (this.type === 'course') {
this.store.dispatch(
new RemoveCourse({
fromTermCode: new TermCode(termCode),
recordId: this.course.id as number,
}),
);
// If this course came from search, close the search
switch (this.type) {
case 'course':
this.store.dispatch(
new RemoveCourse({
fromTermCode: new TermCode(termCode),
recordId: this.course.id as number,
}),
);
break;
case 'search':
this.store.dispatch(new CloseCourseSearch());
break;
}
}
......
......@@ -12,6 +12,7 @@ import {
// Models
import * as actions from '@app/degree-planner/store/actions/course.actions';
import { CloseCourseSearch } from '@app/degree-planner/store/actions/ui.actions';
import * as selectors from '@app/degree-planner/store/selectors';
import { PlannedTerm, PlannedTermNote } from '@app/core/models/planned-term';
import { Note } from '@app/core/models/note';
......@@ -257,6 +258,8 @@ export class TermContainerComponent implements OnInit, OnDestroy {
newIndex,
}),
);
this.store.dispatch(new CloseCourseSearch());
}
}
......
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