Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

BUG#128-Volunteer specialization by instittution field #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
(click)="click1$.next($event.target.value)" #instance="ngbTypeahead" />
</div>
</div>

<div class="mt-4 col-md-4 col-sm-12">
<div class="form-group">
<label>Localitate *</label>
Expand Down Expand Up @@ -159,7 +159,7 @@
</td>
<td>
<div class="form-group">
<input formControlName="accredited_by" class="form-control" readonlytype="text"/>
<input formControlName="accredited_by" class="form-control" readonlytype="text" readonly/>
</div>
</td>
<td>
Expand All @@ -176,7 +176,7 @@
<tr>
<td style="padding-right:15px">
<div class="form-group">
<input
<input
[(ngModel)]="coursename"
[ngModelOptions]="{ standalone: true }"
type="text"
Expand Down Expand Up @@ -222,10 +222,9 @@
[inputFormatter]="formatter"
(focus)="focus4$.next($event.target.value)"
(click)="click4$.next($event.target.value)"
#instance="ngbTypeahead"
placeholder="Acreditat de"/>
#instance="ngbTypeahead"
placeholder="Acreditat de"/>
</div>
<span class="error-message" *ngIf="accreditedError">*Acest câmp este obligatoriu</span>
</td>
<td>
<button placement="top" ngbTooltip="Adaugă cursul"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class AddVolunteerComponent implements OnInit {
/**
* formater to display only name from object
*/
formatter = (result: { name: string }) => result.name;
formatter = (result: { name: string }) => result.name ? result.name : result;
/**
* trigger for organistion typeahead. registers typing, focus, and click and searches the backend
* @param {Observable} text observable event with the filter text
Expand Down Expand Up @@ -250,7 +250,7 @@ export class AddVolunteerComponent implements OnInit {
if (event.code !== 'Enter') {
this.coursenameError = true;
this.static_accreditor = false;
this.acreditedby = '';
this.resetAccreditedByField();
}
}
/**
Expand All @@ -268,47 +268,46 @@ export class AddVolunteerComponent implements OnInit {
this.acreditedby = obj.item.static_accreditor;
this.static_accreditor = true;
} else {
this.acreditedby = {
};
this.resetAccreditedByField();
this.static_accreditor = false;
}
this.coursenameError = false;
}

resetAccreditedByField() {
this.acreditedby = '';
}

resetCourseForm() {
this.static_accreditor = false;
this.coursename = null;
this.obtained = null;
this.dateError = false;
this.accreditedError = false;
this.coursenameError = false;
this.resetAccreditedByField();
}
/**
* trigger for add course from course table footer. willbe added to form and displayed in table
*/
addCourse() {
const now = new Date();
if (!this.acreditedby) {
this.accreditedError = true;
}
if (!this.coursename) {
this.coursenameError = true;
}
if (!this.obtained) {
this.dateError = true;
}
// if (this.obtained > now) {
if (!this.coursenameError && this.coursename && this.acreditedby) {
this.c.push(
this.fb.group({
course_name: this.coursename.name,
course_name_id: this.coursename._id,
obtained: moment(this.obtained).format('DD.MM.YYYY'),
accredited_by: this.acreditedby.hasOwnProperty('name') ? this.acreditedby.name : this.acreditedby
})
);
this.static_accreditor = false;
this.coursename = null;
this.acreditedby = null;
this.obtained = null;
this.dateError = false;
this.accreditedError = false;
this.coursenameError = false;
}
// } else {
// this.dateError = true;
// }
if (!this.coursenameError && this.coursename) {
this.c.push(
this.fb.group({
course_name: this.coursename.name,
course_name_id: this.coursename._id,
obtained: moment(this.obtained).format('DD.MM.YYYY'),
accredited_by: this.acreditedby.hasOwnProperty('name') ? this.acreditedby.name : this.acreditedby
})
);
this.resetCourseForm();
}
}
/**
* remove one of the courses from the table by index
Expand Down