Skip to content

Commit

Permalink
Fresh updates
Browse files Browse the repository at this point in the history
  • Loading branch information
RbkGh committed Feb 26, 2017
1 parent 5e73a11 commit a7483ce
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@
</div>

<div class="panel-title text-capitalize text-blue">Choose Type of Subject</div>
<div class="panel-title text-capitalize text-danger">Remember that if you choose a core subject,
you can not set the same subject as a practical subject</div>
<div class="row form-group m-b-40" id="subjectTypeId">
<div class="m-t-10 col-lg-6 col-md-6 col-sm-12 col-xs-12">
<div class="radio radio-primary has-feedback">
Expand Down
51 changes: 23 additions & 28 deletions src/app/components/main-content/subject/subject.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,37 +359,32 @@ export class SubjectComponent implements OnInit {
CORE_SUBJECT_NOTATION: string = "CORE";
ELECTIVE_SUBJECT_NOTATION: string = "ELECTIVE";

isSubjectOkToBeSubmitted(subjectJsonObject: SubjectEntity): Map<boolean,string> {
let booleanStringRequest: Map<boolean,string> = new Map();
let isSubjectAPracticalSubject:boolean = subjectJsonObject.isSubjectAPracticalSubject;
let subjectTypeOfSubjectObject:string = subjectJsonObject.subjectType;
console.log("isSubjectAPracticalSubjectObject= "+isSubjectAPracticalSubject+", subjectTypeOfSubjectObject="+subjectTypeOfSubjectObject);
console.log("compring isSubjectAPracticalSubject === true response ===>"+(isSubjectAPracticalSubject === true));
if (isSubjectAPracticalSubject){
console.log("its a practical subject,check if type is elective")
console.log("subjectTypeOfSubjectObject ="+subjectTypeOfSubjectObject+" compared string="+this.ELECTIVE_SUBJECT_NOTATION);
if(subjectTypeOfSubjectObject === this.ELECTIVE_SUBJECT_NOTATION) {
booleanStringRequest.set(true, "Everything ok");
console.log(subjectTypeOfSubjectObject+" is the same as "+this.ELECTIVE_SUBJECT_NOTATION);
}else {
booleanStringRequest.set(false, "If Subject is a practical subject,it cannot be a core subject at the same time.");
}
} else {
booleanStringRequest.set(true,"Everything ok paaaa");
}
console.log("response =>",booleanStringRequest);
return booleanStringRequest;
}
// isSubjectOkToBeSubmitted(subjectJsonObject: SubjectEntity): Map<boolean,string> {
// let booleanStringRequest: Map<boolean,string> = new Map();
// let isSubjectAPracticalSubject:boolean = subjectJsonObject.isSubjectAPracticalSubject;
// let subjectTypeOfSubjectObject:string = subjectJsonObject.subjectType;
// console.log("isSubjectAPracticalSubjectObject= "+isSubjectAPracticalSubject+", subjectTypeOfSubjectObject="+subjectTypeOfSubjectObject);
// console.log("compring isSubjectAPracticalSubject === true response ===>"+(isSubjectAPracticalSubject === true));
// if (isSubjectAPracticalSubject===true && isSubjectAPracticalSubject){
// console.log("its a practical subject,check if type is elective")
// console.log("subjectTypeOfSubjectObject ="+subjectTypeOfSubjectObject+" compared string="+this.ELECTIVE_SUBJECT_NOTATION);
// if(subjectTypeOfSubjectObject === this.ELECTIVE_SUBJECT_NOTATION) {
// booleanStringRequest.set(true, "Everything ok");
// console.log(subjectTypeOfSubjectObject+" is the same as "+this.ELECTIVE_SUBJECT_NOTATION);
// }else {
// booleanStringRequest.set(false, "If Subject is a practical subject,it cannot be a core subject at the same time.");
// }
// } else {
// booleanStringRequest.set(true,"Everything ok paaaa");
// }
// console.log("response =>",booleanStringRequest);
// return booleanStringRequest;
// }

public addSubject(addSubjectForm: AbstractControl): void {

let subjectJsonObject = this.prepareSubjectJson(addSubjectForm);
let isSubjectOkToBeSubmittedMap: Map<boolean,string> = this.isSubjectOkToBeSubmitted(subjectJsonObject);
if (isSubjectOkToBeSubmittedMap.has(false)) {
console.info("message == " + isSubjectOkToBeSubmittedMap.get(false));
swal("Error", isSubjectOkToBeSubmittedMap.get(false), "error");
return;
} else {

this.accessingService = true;
this.subjectService.createSubject(subjectJsonObject).subscribe(
(response: TutorResponsePayload) => {
Expand All @@ -408,7 +403,7 @@ export class SubjectComponent implements OnInit {
console.log(error);
}
);
}

}

public openUpdateSubjectModal(subject: SubjectEntity): void {
Expand Down

0 comments on commit a7483ce

Please sign in to comment.