#10-Registro-Informacion-Profesional #38

Merged
alex merged 13 commits from #10-Registro-Informacion-Profesional into main 2024-10-08 18:00:45 +00:00
2 changed files with 185 additions and 4 deletions
Showing only changes of commit 8bf4a97c88 - Show all commits

View File

@ -18,6 +18,7 @@
private String lastName; private String lastName;
private LocalDate birthday; private LocalDate birthday;
private String birthCity; private String birthCity;
private String age;
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private MaritalStatus maritalStatus; private MaritalStatus maritalStatus;
private String residenceAddress; private String residenceAddress;
@ -29,6 +30,51 @@
private String emergencyCAddress; private String emergencyCAddress;
private String emergencyCPhone; private String emergencyCPhone;
private String emergencyCEmail; private String emergencyCEmail;
private String numberOfChildren;
private String departmentAndProvinceResidence;
private String gender;
private String ci;
private String issuedIn;
private String pTitle1;
private String pTitle2;
private String pTitle3;
private String pStudy1;
private String pStudy2;
private String pStudy3;
private String certification1;
private String certification2;
private String certification3;
private String certification4;
private String recognition;
private String achievements;
private String language;
private String languageLevel;
private String cod;
private String leadManager;
private String project;
private LocalDate dateOfEntry;
private LocalDate dateOfExit;
private String contractType;
private Integer seniority;
private Double salary;
private String bankName;
private String accountNumber;
private String gpss;
private String sss;
private String beneficiaries;
@Column(columnDefinition = "TEXT") @Column(columnDefinition = "TEXT")
private String profileImage; private String profileImage;
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)

View File

@ -6,6 +6,7 @@ import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.button.Button; import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.button.ButtonVariant; import com.vaadin.flow.component.button.ButtonVariant;
import com.vaadin.flow.component.combobox.ComboBox; import com.vaadin.flow.component.combobox.ComboBox;
import com.vaadin.flow.component.datepicker.DatePicker;
import com.vaadin.flow.component.html.H2; import com.vaadin.flow.component.html.H2;
import com.vaadin.flow.component.html.H3; import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Image; import com.vaadin.flow.component.html.Image;
@ -75,6 +76,50 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
private final H3 ss = new H3("Datos de Contacto de Emergencia"); private final H3 ss = new H3("Datos de Contacto de Emergencia");
private final H3 si = new H3("Foto del Empleado"); private final H3 si = new H3("Foto del Empleado");
private final TextField age = createTextField("Edad", 3, false);
private final TextField gender = createTextField("Genero:", 10, false);
private final TextField numberOfChildren = createTextField("Number of Children", 3, false);
private final TextField ci = createTextField("CI", 30, false);
private final TextField issuedIn = createTextField("Issued In", 30, false);
private final TextField pTitle1 = createTextField("Professional Title 1", 30, false);
private final TextField pTitle2 = createTextField("Professional Title 2", 30, false);
private final TextField pTitle3 = createTextField("Professional Title 3", 30, false);
private final TextField pStudy1 = createTextField("Study 1", 30, false);
private final TextField pStudy2 = createTextField("Study 2", 30, false);
private final TextField pStudy3 = createTextField("Study 3", 30, false);
private final TextField certification1 = createTextField("Certification 1", 30, false);
private final TextField certification2 = createTextField("Certification 2", 30, false);
private final TextField certification3 = createTextField("Certification 3", 30, false);
private final TextField certification4 = createTextField("Certification 4", 30, false);
private final TextField recognition = createTextField("Recognition", 30, false);
private final TextField achievements = createTextField("Achievements", 30, false);
private final TextField language = createTextField("Language", 30, false);
private final TextField languageLevel = createTextField("Language Level", 30, false);
private final TextField cod = createTextField("Code", 30, false);
private final TextField leadManager = createTextField("Lead Manager", 30, false);
private final TextField project = createTextField("Project", 30, false);
private final DatePicker dateOfEntry = new DatePicker("Date of Entry");
private final DatePicker dateOfExit = new DatePicker("Date of Exit");
private final TextField contractType = createTextField("Contract Type", 30, false);
private final TextField seniority = createTextField("Seniority", 30, false);
private final TextField salary = createTextField("Salary", 30, false);
private final TextField bankName = createTextField("Bank Name", 30, false);
private final TextField accountNumber = createTextField("Account Number", 30, false);
private final TextField gpss = createTextField("GPSS", 30, false);
private final TextField sss = createTextField("SSS", 30, false);
private final TextField beneficiaries = createTextField("Beneficiaries", 30, false);
public EmployeeView(final EmployeeService employeeService) { public EmployeeView(final EmployeeService employeeService) {
super(Employee.class); super(Employee.class);
this.employeeService = employeeService; this.employeeService = employeeService;
@ -92,6 +137,18 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
configureUpload(); configureUpload();
saveButton.setVisible(true); saveButton.setVisible(true);
editButton.setVisible(true); editButton.setVisible(true);
birthday.addValueChangeListener(event -> calculateAge());
}
private void calculateAge() {
if (birthday.getValue() != null) {
int currentYear = java.time.LocalDate.now().getYear();
int birthYear = birthday.getValue().getYear();
int ages = currentYear - birthYear;
age.setValue(String.valueOf(ages));
}
} }
private void configureUpload() { private void configureUpload() {
@ -132,16 +189,23 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
lastName, lastName,
status, status,
birthday, birthday,
age,
birthCity, birthCity,
maritalStatus, maritalStatus,
numberOfChildren,
residenceAddress, residenceAddress,
phoneNumber, phoneNumber,
personalEmail, personalEmail,
position, position,
team); team, gender, status, ci, issuedIn);
contentLayout2.add( contentLayout2.add(
ss, emergencyCName, emergencyCAddress, ss, emergencyCName, emergencyCAddress,
emergencyCPhone, emergencyCEmail, si, upload, emergencyCPhone, emergencyCEmail, pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
certification1, certification2, certification3, certification4,
recognition, achievements, language, languageLevel,
cod, leadManager, project, dateOfEntry, dateOfExit,
contractType, seniority, salary, bankName, accountNumber,
gpss, sss, beneficiaries, si, upload,
profileImagePreview, saveButton, editButton); profileImagePreview, saveButton, editButton);
mainLayout.add(contentLayout1, contentLayout2); mainLayout.add(contentLayout1, contentLayout2);
@ -277,6 +341,38 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCEmail.setReadOnly(true); emergencyCEmail.setReadOnly(true);
upload.setVisible(true); upload.setVisible(true);
profileImagePreview.setVisible(true); profileImagePreview.setVisible(true);
age.setVisible(true);
gender.setVisible(true);
status.setVisible(true);
ci.setVisible(true);
issuedIn.setVisible(true);
pTitle1.setVisible(true);
pTitle2.setVisible(true);
pTitle3.setVisible(true);
pStudy1.setVisible(true);
pStudy2.setVisible(true);
pStudy3.setVisible(true);
certification1.setVisible(true);
certification2.setVisible(true);
certification3.setVisible(true);
certification4.setVisible(true);
recognition.setVisible(true);
achievements.setVisible(true);
language.setVisible(true);
languageLevel.setVisible(true);
cod.setVisible(true);
leadManager.setVisible(true);
project.setVisible(true);
dateOfEntry.setVisible(true);
dateOfExit.setVisible(true);
contractType.setVisible(true);
seniority.setVisible(true);
salary.setVisible(true);
bankName.setVisible(true);
accountNumber.setVisible(true);
gpss.setVisible(true);
sss.setVisible(true);
beneficiaries.setVisible(true);
} }
private void setFieldsEditable() { private void setFieldsEditable() {
@ -296,14 +392,53 @@ public class EmployeeView extends BeanValidationForm<Employee> implements HasUrl
emergencyCPhone.setReadOnly(false); emergencyCPhone.setReadOnly(false);
emergencyCEmail.setReadOnly(false); emergencyCEmail.setReadOnly(false);
upload.setVisible(true); upload.setVisible(true);
age.setVisible(false);
gender.setVisible(false);
status.setVisible(false);
ci.setVisible(false);
issuedIn.setVisible(false);
pTitle1.setVisible(false);
pTitle2.setVisible(false);
pTitle3.setVisible(false);
pStudy1.setVisible(false);
pStudy2.setVisible(false);
pStudy3.setVisible(false);
certification1.setVisible(false);
certification2.setVisible(false);
certification3.setVisible(false);
certification4.setVisible(false);
recognition.setVisible(false);
achievements.setVisible(false);
language.setVisible(false);
languageLevel.setVisible(false);
cod.setVisible(false);
leadManager.setVisible(false);
project.setVisible(false);
dateOfEntry.setVisible(false);
dateOfExit.setVisible(false);
contractType.setVisible(false);
seniority.setVisible(false);
salary.setVisible(false);
bankName.setVisible(false);
accountNumber.setVisible(false);
gpss.setVisible(false);
sss.setVisible(false);
beneficiaries.setVisible(false);
} }
@Override @Override
protected List<Component> getFormComponents() { protected List<Component> getFormComponents() {
return List.of( return List.of(
mt, fs, userName, firstName, lastName, status, birthday, birthCity, maritalStatus, mt, fs, userName, firstName, lastName, status, birthday, age, birthCity, maritalStatus,
residenceAddress, phoneNumber, personalEmail, position, team, ss, emergencyCName, residenceAddress, phoneNumber, personalEmail, position, team, ss, emergencyCName,
emergencyCAddress, emergencyCPhone, emergencyCEmail, si, upload, profileImagePreview, emergencyCAddress, emergencyCPhone, emergencyCEmail, age,
gender, status, ci, issuedIn,
pTitle1, pTitle2, pTitle3, pStudy1, pStudy2, pStudy3,
certification1, certification2, certification3, certification4,
recognition, achievements, language, languageLevel,
cod, leadManager, project, dateOfEntry, dateOfExit,
contractType, seniority, salary, bankName, accountNumber,
gpss, sss, beneficiaries, si, upload, profileImagePreview,
saveButton, editButton saveButton, editButton
); );
} }