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 #305 from CampusDual/develop
Browse files Browse the repository at this point in the history
flayway y asistencias dialog
  • Loading branch information
juanjo-alvarez authored Jan 24, 2025
2 parents 5a9299f + 2589ae7 commit f1b7b03
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public interface IAttendanceService {
EntityResult attendanceInsert(Map<String, Object> attrMap) throws OntimizeJEERuntimeException;
EntityResult attendanceUpdate(Map<String, Object> attrMap, Map<String, Object> keyMap) throws OntimizeJEERuntimeException;
EntityResult attendanceDelete(Map<String, Object> keyMap) throws OntimizeJEERuntimeException;
EntityResult attendanceDeleteAll(Map<String,Object> keymao) throws OntimizeJEERuntimeException;
AdvancedEntityResult attendancePaginationQuery(final Map<String, Object> keyMap, final List<?> attrList, final int recordNumber, final int startIndex, final List<?> orderBy) throws OntimizeJEERuntimeException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ <h3>{{'STUDENTS_IN_BOOTCAMP'| oTranslate}}</h3>
columns="id;name;surname1;surname2;personal_email;student_id;student_status;sb_start_date;sb_end_date;Detalle;userphotostudent"
visible-columns="userphotostudent;name;surname1;surname2;student_status;sb_start_date;sb_end_date;Detalle"
sort-columns="name" query-rows="10" show-report-on-demand-option="false"query-on-init="true" pageable="true"
show-charts-on-demand-option="false" select-all-checkbox-visible="true" selection-mode="multiple"
detail-mode="click" (onDataLoaded)="loadBootcamp()">
show-charts-on-demand-option="false" select-all-checkbox-visible="true" selection-mode="single"
detail-mode="click" (onDataLoaded)="loadBootcamp()" delete-button="false" (onRowSelected)="activeDelete()"
(onRowDeselected)="desactiveButton()">
<o-table-button #deleteButtton attr="deleteButtton" label="delete" icon="delete" enabled="{{flagEnabled}}"></o-table-button>
<o-table-column attr="sb_start_date" title="start_date" type="date"
format="DD/MM/YYYY"></o-table-column>
<o-table-column attr="sb_end_date" title="end_date" type="date" format="DD/MM/YYYY"></o-table-column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FormControl, ValidationErrors, ValidatorFn } from '@angular/forms';
import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core';
import { MatCalendarCellClassFunction } from '@angular/material/datepicker';
import { ActivatedRoute, Router } from '@angular/router';
import { DialogService, Expression, FilterExpressionUtils, OFileInputComponent, OListComponent, OTableComponent, OTextInputComponent, OValidators } from 'ontimize-web-ngx';
import { DialogService, Expression, FilterExpressionUtils, OFileInputComponent, OListComponent, OTableButtonComponent, OTableComponent, OTextInputComponent, OValidators } from 'ontimize-web-ngx';
import moment from 'moment';
import { ODateInputComponent, ODateRangeInputComponent, OFormComponent, OntimizeService, OTranslateService } from 'ontimize-web-ngx';
import { MatSlideToggleChange } from '@angular/material/slide-toggle';
Expand All @@ -26,6 +26,7 @@ export class BootcampDetailsComponent {
@ViewChild('sessionBootcampTable', { static: true }) table: OTableComponent;
@ViewChild('bootcampTimetable', { static: true }) bootcampTimetable: OTableComponent;
@ViewChild('asistencia') asistencia: CalendarAttendanceComponent;
@ViewChild('deleteButtton', {static: false}) deleteButtton: OTableButtonComponent;

selectedStatuses: string[] = ['Started', 'Pending'];
months: Date[] = [];
Expand All @@ -38,6 +39,7 @@ export class BootcampDetailsComponent {
validatorsArray1: ValidatorFn[] = [];
validatorsWithoutSpace: ValidatorFn[] = [];
sessionsTable: any;
flagEnabled: boolean = false;

constructor(private router: Router,
private actRoute: ActivatedRoute,
Expand Down Expand Up @@ -148,6 +150,12 @@ export class BootcampDetailsComponent {
@ViewChild("dateRange") dateRange: ODateRangeInputComponent;
@ViewChild("list") list: OListComponent;

ngAfterViewInit() {
this.deleteButtton.onClick.subscribe(event => {
this.deleteStudentbootcamp();
});
}

selected = false;
startAtDate: Date;
protected service: OntimizeService;
Expand All @@ -165,7 +173,10 @@ export class BootcampDetailsComponent {

}


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

protected configureBootcampTimetable() {
const conf = this.service.getDefaultServiceConfiguration('bootcampTimetable');
Expand Down Expand Up @@ -409,6 +420,29 @@ export class BootcampDetailsComponent {
this.asistencia.refresh();
}


deleteStudentbootcamp(){
this.dialogService.confirm('Confirm_dialog_title','Do_you_really_want_to_delete_student_bootcamp');
this.dialogService.dialogRef.afterClosed().subscribe( result => {
if(result) {
this.configureServiceStudentBootcamp();
this.service.delete({id: this.studentsTable.getSelectedItems()[0].id}, 'studentsWithBootcamp').subscribe(res => {
if (res.code === 0) {
this.studentsTable.reloadData();
}
});
}
});

this.configureBootcamps();
}

activeDelete(){
this.flagEnabled = true;
}

desactiveButton(){
this.flagEnabled = false;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -449,4 +449,3 @@ grid-column: 1 / 3;
display: block;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@
<o-form-layout-dialog-options class="popup">
<fieldset class="fieldsetDoc">
<legend align="left">{{'Bootcamps Asigned' | oTranslate}}</legend>
<o-table class="general_table_segunda" attr="bootcampsStudentTable" sort-columns="status:ASC;start_date:ASC" service="studentBootcamps"
<o-table #bootcampsStudentTable class="general_table_segunda" attr="bootcampsStudentTable" sort-columns="status:ASC;start_date:ASC" service="studentBootcamps"
entity="studentsWithBootcamp" keys="id" parent-keys="student_id:id"
columns="id;bootcampname;start_date;end_date;sb_start_date;sb_end_date;student_bootcamp_status"
visible-columns="bootcampname;start_date;end_date;sb_start_date;sb_end_date;student_bootcamp_status" detail-mode="none"
show-report-on-demand-option="false" show-charts-on-demand-option="false"
select-all-checkbox-visible="true" quick-filter="false" selection-mode="none" insert-form-route="new">
select-all-checkbox-visible="true" quick-filter="false" selection-mode="single" insert-form-route="new"
delete-button="false" (onRowSelected)="activeDelete()" (onRowDeselected)="desactiveButton()">
<o-table-button #deleteButtton attr="deleteButtton" label="delete" icon="delete" enabled="{{flagEnabled}}"></o-table-button>
<o-table-paginator page-size="20" page-size-options="10;20;40"></o-table-paginator>
<o-table-context-menu view-detail="false" edit="false" delete="false"
insert="false"></o-table-context-menu>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Injector, ViewChild } from '@angular/core';
import { DialogService, OFileInputComponent, OFormComponent, OImageComponent, OListComponent, OntimizeService, OTableComponent, OTextareaInputComponent, OTextInputComponent, OValidators } from 'ontimize-web-ngx';
import { DialogService, OButtonComponent, OFileInputComponent, OFormComponent, OImageComponent, OListComponent, OntimizeService, OTableButtonComponent, OTableComponent, OTextareaInputComponent, OTextInputComponent, OValidators } from 'ontimize-web-ngx';
import { ODateInputComponent } from 'ontimize-web-ngx';
import { FormControl, ValidationErrors, ValidatorFn } from '@angular/forms';
import { Router } from '@angular/router';
Expand Down Expand Up @@ -28,6 +28,7 @@ notesLoaded(event: any) {
@ViewChild("form") form: OFormComponent;
@ViewChild("bootcampsStudentTable") bootcampTable: OTableComponent;
@ViewChildren(MatTab) tabs!: QueryList<MatTab>;
@ViewChild('deleteButtton', {static: false}) deleteButtton: OTableButtonComponent;

selected = false;
isUpdatingImage: boolean = false;
Expand All @@ -41,6 +42,7 @@ notesLoaded(event: any) {
showNotice:boolean=false;
notesBool: boolean = false;
isNoteAreaValid: boolean = false;
flagEnabled: boolean = false;

// Valor predeterminado (opcional)
valueSimple = "Madrid"; // Elige el valor que deseas predeterminar
Expand Down Expand Up @@ -73,6 +75,11 @@ protected configureServiceStudent() {
this.service.configureService(conf);
}

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

dateValidator(control: FormControl): ValidationErrors {
let result = {};

Expand Down Expand Up @@ -110,6 +117,9 @@ protected configureServiceStudent() {
console.log("TiSt"+this.todayTimestamp);
console.log("Date: "+ this.noteDate.getValue().toString());
}
this.deleteButtton.onClick.subscribe(event => {
this.deleteStudentbootcamp();
});
}
@ViewChild("studentIdNote") studentIdNote: OTextInputComponent;

Expand Down Expand Up @@ -393,4 +403,28 @@ onNoteAreaChange(noteArea: OTextareaInputComponent): void {
this.isNoteAreaValid = hasValidContent;
}

deleteStudentbootcamp(){
this.dialogService.confirm('Confirm_dialog_title','Do_you_really_want_to_delete_student_bootcamp');
this.dialogService.dialogRef.afterClosed().subscribe( result => {
if(result) {
this.configureServiceStudentBootcamp();
this.service.delete({id: this.bootcampTable.getSelectedItems()[0].id}, 'studentsWithBootcamp').subscribe(res => {
if (res.code === 0) {
this.bootcampTable.reloadData();
}
});
}
});

this.configureServiceStudent();
}

activeDelete(){
this.flagEnabled = true;
}

desactiveButton(){
this.flagEnabled = false;
}

}
3 changes: 2 additions & 1 deletion cd2024bfs4g1-frontend/src/main/ngx/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,5 +414,6 @@
"LLNOTE":"Last note",
"NNOTES":"There are no comments yet...",
"creation_date": "Creation date",
"comercial_status":"Student bootcamp status"
"comercial_status":"Student bootcamp status",
"Do_you_really_want_to_delete_student_bootcamp":"Are you sure you want to delete it? Assistance related to this student in the bootcamp will be eliminated."
}
3 changes: 2 additions & 1 deletion cd2024bfs4g1-frontend/src/main/ngx/src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,6 @@
"NONEXISTENT CODE":"No existe el código",
"MISSING CODE":"Código faltante",
"creation_date": "Fecha de alta",
"comercial_status":"Estado del alumno en Bootcamp"
"comercial_status":"Estado del alumno en Bootcamp",
"Do_you_really_want_to_delete_student_bootcamp":"Seguro que quieres borrarlo? Se eliminarán las asistencias relacionadas a este estudiante en el bootcamp."
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;

@Service("AttendanceService")
@Lazy
Expand Down Expand Up @@ -105,6 +103,18 @@ public EntityResult attendanceDelete(Map<String, Object> keyMap) throws Ontimize
return this.daoHelper.delete(this.attendanceDao, keyMap);
}

@Override
public EntityResult attendanceDeleteAll(Map<String,Object> keyMap) throws OntimizeJEERuntimeException{

EntityResult allAttendancesQuery = this.daoHelper.query(this.attendanceDao,keyMap, Arrays.asList(AttendanceDao.ATTR_ID));
List<?> attendanceIdList = (List<?>) allAttendancesQuery.get(AttendanceDao.ATTR_ID);
Map<String, Object> attendanceKey = new Hashtable<>();

for (int i = 0; i<attendanceIdList.size();i++){
attendanceKey.put(AttendanceDao.ATTR_ID,attendanceIdList.get(i));
}
return this.daoHelper.delete(this.attendanceDao,attendanceKey);
}
@Override
public AdvancedEntityResult attendancePaginationQuery(Map<String, Object> keyMap, List<?> attrList, int recordNumber, int startIndex, List<?> orderBy) throws OntimizeJEERuntimeException {
return this.daoHelper.paginationQuery(this.attendanceDao, keyMap, attrList, recordNumber, startIndex, orderBy);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.campusdual.cd2024bfs4g1.model.core.service;

import com.campusdual.cd2024bfs4g1.api.core.service.IStudentBootcampService;
import com.campusdual.cd2024bfs4g1.model.core.dao.AttendanceDao;
import com.campusdual.cd2024bfs4g1.model.core.dao.StudentBootcampDao;
import com.ontimize.jee.common.db.AdvancedEntityResult;
import com.ontimize.jee.common.dto.EntityResult;
Expand All @@ -12,9 +13,7 @@
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;

@Service("StudentBootcampService")
@Lazy
Expand All @@ -26,6 +25,11 @@ public class StudentBootcampService implements IStudentBootcampService {
@Autowired
private DefaultOntimizeDaoHelper daoHelper;

@Autowired
private AttendanceDao attendanceDao;
@Autowired
private AttendanceService attendanceService;

@Override
public EntityResult studentsWithComputableQuery(Map<String, Object> keysValues, List<String> attributes) {
return this.daoHelper.query(this.studentBootcampDao, keysValues, attributes, StudentBootcampDao.QUERY_STUDENTS_WITH_COMPUTABLE);
Expand Down Expand Up @@ -55,7 +59,14 @@ public EntityResult studentBootcampInsert(Map<String, Object> attrMap) throws On

@Override
public EntityResult studentsWithBootcampDelete(Map<String, Object> keyMap) throws OntimizeJEERuntimeException {
return this.daoHelper.delete(this.studentBootcampDao, keyMap);
EntityResult studentIdQuery = this.daoHelper.query(this.studentBootcampDao,keyMap, Arrays.asList(StudentBootcampDao.STUDENT_ID));
List<?> studentIdList = (List<?>) studentIdQuery.get(StudentBootcampDao.STUDENT_ID);
Object studentId = studentIdList.get(0);
Map<String, Object> studentKey = new HashMap<>();
studentKey.put(StudentBootcampDao.STUDENT_ID,studentId);

attendanceService.attendanceDeleteAll(studentKey);
return this.daoHelper.delete(this.studentBootcampDao, keyMap);
}
@Override
public EntityResult studentsWithBootcampQuery(Map<String, Object> keysValues, List<String> attributes) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ALTER TABLE public.students ADD creation_date timestamp with time zone DEFAULT now() NOT NULL;

drop view if exists public.v_comercial_students_status
drop view if exists public.v_comercial_students_status;

CREATE OR REPLACE VIEW public.v_comercial_students_status
AS SELECT
Expand Down Expand Up @@ -28,7 +28,7 @@ LEFT JOIN (
GROUP BY sb_1.student_id
) AS bot_activ ON s.id = bot_activ.student_id;

drop view if exists public.v_commercial_students
drop view if exists public.v_commercial_students;

CREATE OR REPLACE VIEW public.v_commercial_students
AS SELECT DISTINCT ON (s.id) s.id,
Expand Down Expand Up @@ -60,4 +60,4 @@ AS SELECT DISTINCT ON (s.id) s.id,
left JOIN v_recent_employment_status v ON v.student_id = s.id
left JOIN v_last_note vn ON vn.student_id = s.id
left join v_comercial_students_status css on css.view_student_id=s.id
WHERE (b.end_date IS NULL OR b.end_date >= CURRENT_DATE)
WHERE (b.end_date IS NULL OR b.end_date >= CURRENT_DATE);
2 changes: 1 addition & 1 deletion charts/cd2024bfs4g1/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ image:
pullPolicy: IfNotPresent
## provided as basic setup. replace as needed
repository: ghcr.io/campusdual/cd2024bfs4g1
version: deve143253
version: dev5cf465d
imagePullSecrets:
- name: "github-ecr-cred"
nameOverride: ""
Expand Down

0 comments on commit f1b7b03

Please sign in to comment.