Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #280 from CampusDual/develop
Browse files Browse the repository at this point in the history
Spring 6
  • Loading branch information
eluiui authored Jan 17, 2025
2 parents 3e3343b + d7621e8 commit 6bb8e5c
Show file tree
Hide file tree
Showing 15 changed files with 238 additions and 210 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ h3 {
overflow-x: auto;
background-color: #f5f0f2;
padding: 20px 0;
border-radius: 0;
margin: 0px;
}

.rounded_top{
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}

.rounded_bottom{
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
}

.aligned-container {
border-top-left-radius: 15px;
border-top-right-radius: 15px;
}

.input-button-container {
Expand Down Expand Up @@ -318,15 +335,7 @@ div.notification label {
height: 100%;
}

.table_containerfichero {
width: 98%;
overflow-x: hidden;
margin: 0 auto;
margin-top: 25px;
padding: 0 10px;
}

.table_containerhorarios {
.mat_table_container {
width: 98%;
overflow-x: hidden;
margin: 0 auto;
Expand Down Expand Up @@ -559,11 +568,6 @@ div.notification label {
border-radius: 15px;
padding: 20px;
}
.table_sesions{
background-color: #f5f0f2;
font-family: 'Roboto', sans-serif;
height: auto;
}

o-list img {
width: 50px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<o-form #bootcampDetailForm attr="bootcampsDetail" service="bootcamps" entity="bootcamp" keys="id"
header-actions="R;U;D" (onUpdate)="volver($event)" (onDelete)="volver($event)" show-header-navigation="no"
confirm-exit="false" (onDataLoaded)="onBootcampChange($event);inicialDR()">
confirm-exit="false" (onDataLoaded)="onBootcampChange($event);inicialDR()" (onBeforeUpdate)="asistencia.saveAttendaces()">
<o-text-input #idNumber attr="id" sql-type="INTEGER" enabled="no" hidden="true"></o-text-input>

<div class="grid-container">
Expand Down Expand Up @@ -33,7 +33,8 @@
</div>
<div class="especial fecha-inicio" hidden="true">
<o-date-input #startdate class="fechas" attr="start_date" hidden="true" required="yes"
format="DD/MM/YYYY"></o-date-input>
format="DD/MM/YYYY">
</o-date-input>
</div>
<div class="especial fecha-fin" hidden="true">
<o-date-input #enddate attr="end_date" required="yes" hidden="true" [validators]="validatorsArray"
Expand All @@ -42,7 +43,7 @@
</o-date-input>
</div>
</div>
<mat-tab-group class="tab" animationDuration="0ms" dynamicHeight>
<mat-tab-group class="tab" animationDuration="0ms" dynamicHeight (selectedTabChange)="onTabChange($event)">
<mat-tab label="{{ 'StudentsAndMentors' | oTranslate }}">
<div class="general_container">
<div class="table_container">
Expand Down Expand Up @@ -129,11 +130,11 @@ <h3> {{'Mentors' | oTranslate}}</h3>
</div>
</mat-tab>
<mat-tab label="{{ 'Schedule' | oTranslate }}">
<div class="table_containerhorarios">
<div class="mat_table_container">
<div class="table_horario">
<o-form-layout-manager attr="" mode="dialog" title="Timetable" virtual-scroll="false">
<o-form-layout-dialog-options class="popup">
<o-table class="timetable_table" virtual-scroll="false" attr="bootcampTimetable"
<o-table #bootcampTimetable class="timetable_table" virtual-scroll="false" attr="bootcampTimetable"
service="bootcampTimetable" insert-form-route="newTimetable" pagination-controls="false"
detail-mode="none" update-button="false" entity="bootcampTimetable" keys="id"
parent-keys="id_bootcamp:id;start_date;end_date"
Expand All @@ -157,7 +158,7 @@ <h3> {{'Mentors' | oTranslate}}</h3>
</div>
</mat-tab>
<mat-tab label="{{ 'Documents' | oTranslate }}">
<div class="table_containerfichero">
<div class="mat_table_container">
<div class="table_ficheros">
<div class="upload-container">
<label for="fileinput">{{ 'fileinput' | oTranslate }}</label>
Expand Down Expand Up @@ -196,12 +197,12 @@ <h3>{{ 'BootcampDoc' | oTranslate }}</h3>
</div>
</div>
</mat-tab>
<o-form-layout-manager attr="popupNewSession" title="Session" mode="dialog">
<o-form-layout-manager attr="popupNewSession" title="Session" mode="dialog" >
<o-form-layout-dialog-options class="popup">
<mat-tab label="{{ 'Sesiones' | oTranslate }}">
<div class="table_sesions general_table">
<div class="mat_table_container">
<div class="calendar-container">
<o-column>
<o-column class="rounded_top">

<o-combo
attr="status"
Expand Down Expand Up @@ -246,7 +247,7 @@ <h3>{{ 'BootcampDoc' | oTranslate }}</h3>
sort="session_date:ASC">
</o-filter-builder>

<o-table #sessionsTable class="general_table" virtual-scroll="false" attr="sessionBootcamp_table" detail-form-route="session"
<o-table #sessionsTable class="general_table rounded_bottom" virtual-scroll="false" attr="sessionBootcamp_table" detail-form-route="session"
service="sessionBootcamp"
entity="sessionBootcamp" keys="id"
parent-keys="id_bootcamp:id"
Expand All @@ -255,6 +256,7 @@ <h3>{{ 'BootcampDoc' | oTranslate }}</h3>
select-all-checkbox-visible="true" selection-mode="multiple"
[row-class]="getRowClass"
sort-columns="session_date"
detail-mode="dblclick"
>

<o-table-column class="center" attr="session_date" title="session_date" type="date" format="DD/MM/YYYY"></o-table-column>
Expand All @@ -276,7 +278,9 @@ <h3>{{ 'BootcampDoc' | oTranslate }}</h3>
</div>
</mat-tab>
<mat-tab label="{{'Asistencia'|oTranslate}}">
<app-calendar-attendance #asistencia [bootcampId]="bootcampId"></app-calendar-attendance>
<div class="mat_table_container">
<app-calendar-attendance #asistencia [bootcampId]="bootcampId"></app-calendar-attendance>
</div>
</mat-tab>

</o-form-layout-dialog-options>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { DialogService, Expression, FilterExpressionUtils, OFileInputComponent,
import moment from 'moment';
import { ODateInputComponent, ODateRangeInputComponent, OFormComponent, OntimizeService, OTranslateService } from 'ontimize-web-ngx';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
import { MatTabChangeEvent } from '@angular/material/tabs';
import { CalendarAttendanceComponent } from '../../data/personal-tutor-info/calendar-attendance/calendar-attendance.component';

@Component({
Expand All @@ -17,16 +18,22 @@ import { CalendarAttendanceComponent } from '../../data/personal-tutor-info/cale
})
export class BootcampDetailsComponent {

@ViewChild('bootcampDetailForm') bootcampDetailForm:OFormComponent;
@ViewChild('bootcampDetailForm') bootcampDetailForm: OFormComponent;
@ViewChild("idNumber") idNumber: OTextInputComponent;
@ViewChild("documentsTable") documentsTable: OTableComponent;
@ViewChild("fileinput") fileinput: OFileInputComponent;
@ViewChild('studentsTable', { static: true }) studentsTable!: OTableComponent;
@ViewChild('sessionBootcampTable', { static: true }) table: OTableComponent;
selectedStatuses: string[] = ['Started', 'Pending'];
@ViewChild('bootcampTimetable', { static: true }) bootcampTimetable: OTableComponent;
@ViewChild('asistencia') asistencia: CalendarAttendanceComponent;

selectedStatuses: string[] = ['Started', 'Pending'];
months: Date[] = [];
bootcampId: number;

previousTabIndex: number | null = null;


validatorsArray: ValidatorFn[] = [];
validatorsArray1: ValidatorFn[] = [];
validatorsWithoutSpace: ValidatorFn[] = [];
Expand All @@ -39,7 +46,7 @@ export class BootcampDetailsComponent {
@Inject(MAT_DATE_LOCALE) private _locale: string,
private translateService: OTranslateService,
protected dialogService: DialogService
) {
) {
this.validatorsArray.push(this.dateValidator);
this.validatorsWithoutSpace.push(OValidators.patternValidator(/^(?!\s*$).+/, 'hasSpecialCharacters'));
this.service = this.injector.get(OntimizeService);
Expand All @@ -55,13 +62,31 @@ export class BootcampDetailsComponent {
goToStudentDetail(event: any) {
const studentId = event.student_id;
this.router.navigate([`/main/students/${studentId}`]);
this.clearTableSelection();
this.clearTableSelection();
}

onTabChange(event: MatTabChangeEvent) {
const previousIndex = this.previousTabIndex;
const currentIndex = event.index;

switch (currentIndex) {
case 0:
this.configureStudentBootcamps();
this.studentsTable.refresh();
break;
case 2:
this.configureBootcampTimetable()
this.bootcampTimetable.refresh();
break;

}
this.previousTabIndex = currentIndex;
}

goToTutorDetail(tutor: any) {
const tutorId = tutor.tutor_id;
this.router.navigate([`/main/tutors/${tutorId}`]);
this.clearTableSelection();
this.clearTableSelection();
}

clearTableSelection(): void {
Expand Down Expand Up @@ -90,6 +115,7 @@ export class BootcampDetailsComponent {
}

inicialDR() {

const startDateValue = this.startDateInput.getValue();
const endDateValue = this.endDateInput.getValue();

Expand All @@ -115,7 +141,7 @@ export class BootcampDetailsComponent {
this.bootcampDetailForm.setFieldValue("start_date", startDate);
this.bootcampDetailForm.setFieldValue("end_date", endDate);

}
}

@ViewChild("startdate") startDateInput: ODateInputComponent;
@ViewChild("enddate") endDateInput: ODateInputComponent;
Expand All @@ -130,15 +156,29 @@ export class BootcampDetailsComponent {


ngOnInit() {

}
//this.configureBootcamps();
}

protected configureBootcamps() {
const conf = this.service.getDefaultServiceConfiguration('bootcamps');
this.service.configureService(conf);

}



protected configureBootcampTimetable() {
const conf = this.service.getDefaultServiceConfiguration('bootcampTimetable');
this.service.configureService(conf);

}

protected configureStudentBootcamps() {
const conf = this.service.getDefaultServiceConfiguration('studentBootcamps');
this.service.configureService(conf);

}

protected configureDocuments() {
const documentConf = this.service.getDefaultServiceConfiguration('documents');
this.service.configureService(documentConf);
Expand All @@ -151,6 +191,7 @@ export class BootcampDetailsComponent {


onBootcampChange(event: any) {

this.studentsTable.refresh();
this.configureBootcamps();
const bootcampId = event.id;
Expand Down Expand Up @@ -227,7 +268,7 @@ export class BootcampDetailsComponent {
} else {
return null;
}

}


Expand Down Expand Up @@ -283,17 +324,17 @@ export class BootcampDetailsComponent {

this.configureTutorsBootcamp();
this.dialogService.confirm('Confirm_dialog_title', 'Do_you_really_want_to_delete');
this.dialogService.dialogRef.afterClosed().subscribe( result => {
if(result) {
this.service.delete({id: tutors.id}, 'tutorBootcamp').subscribe(res => {
this.dialogService.dialogRef.afterClosed().subscribe(result => {
if (result) {
this.service.delete({ id: tutors.id }, 'tutorBootcamp').subscribe(res => {
if (res.code === 0) {
this.list.reloadData();
}
});
}
});

}
}

showAlert() {
if (this.dialogService) {
Expand All @@ -302,13 +343,13 @@ export class BootcampDetailsComponent {
}
getRowClass(rowData: any): string {
const today = new Date();
const sessionDate = new Date(rowData.session_date);
const sessionDate = new Date(rowData.session_date);
if (isNaN(sessionDate.getTime())) {
console.error('Invalid date format:', rowData.session_date);
return '';
return '';
}
if (sessionDate.toDateString() === today.toDateString()) {
return 'highlight-today';
return 'highlight-today';
}
return '';
}
Expand All @@ -321,7 +362,7 @@ export class BootcampDetailsComponent {
this.sessionFilters = null;
} else {
const filter = [{ attr: 'status', value: selectedStatuses }];
this.table.queryData(filter);
this.table.queryData(filter);
}
}
createFilter(values: Array<{ attr: string, value: any }>): Expression {
Expand All @@ -346,7 +387,7 @@ export class BootcampDetailsComponent {

return filters.length > 0
? filters.reduce((exp1, exp2) =>
FilterExpressionUtils.buildComplexExpression(exp1, exp2, FilterExpressionUtils.OP_AND))
FilterExpressionUtils.buildComplexExpression(exp1, exp2, FilterExpressionUtils.OP_AND))
: null;
}

Expand All @@ -362,9 +403,9 @@ export class BootcampDetailsComponent {
this.selectedStatuses = ['Started', 'Pending'];
}
}
@ViewChild('asistencia', { static: true }) asistencia!: CalendarAttendanceComponent;

loadBootcamp() {
this.bootcampId= this.bootcampDetailForm.getFieldValue("id");
this.bootcampId = this.bootcampDetailForm.getFieldValue("id");
this.asistencia.refresh();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
show-header-navigation="no" confirm-exit="false" show-header="no" (onDataLoaded)="loadData()">
<o-text-input #bootcampIdComp attr="id" sql-type="INTEGER" enabled="no" hidden></o-text-input>
<mat-tab-group mat-stretch-tabs="true" mat-align-tabs="center" animationDuration="0ms">
<mat-tab label="{{'Asistencia'|oTranslate}}">
<app-calendar-attendance [bootcampId]="bootcampId"></app-calendar-attendance>
</mat-tab>
<mat-tab label="{{'Estudiante'|oTranslate}}">
<div class="student-sesion-grid">
<fieldset class="estudiantes">
Expand Down Expand Up @@ -97,9 +100,6 @@
</div>
</mat-tab>

<mat-tab label="{{'Asistencia'|oTranslate}}">
<app-calendar-attendance [bootcampId]="bootcampId"></app-calendar-attendance>
</mat-tab>
</mat-tab-group>
</o-form>

Loading

0 comments on commit 6bb8e5c

Please sign in to comment.