Merge pull request 'chore: Updating branch' (#10) from Maradona/Backend:restfull into main
Reviewed-on: 2210970/Backend#10pull/1/head
commit
dfe1f20eae
|
@ -39,3 +39,6 @@ build/
|
||||||
### Database files ###
|
### Database files ###
|
||||||
*.db
|
*.db
|
||||||
*.mv.db
|
*.mv.db
|
||||||
|
|
||||||
|
### Log files ###
|
||||||
|
data/maradona/dbfile.mv.db
|
||||||
|
|
|
@ -21,6 +21,7 @@ import com.maradona.backend.services.EmployeeService;
|
||||||
*
|
*
|
||||||
* Endpoints:
|
* Endpoints:
|
||||||
* - GET /api/employee
|
* - GET /api/employee
|
||||||
|
* - GET /api/employee/{eid}
|
||||||
* - GET /api/employee/all
|
* - GET /api/employee/all
|
||||||
* - GET /api/employee/from-skill
|
* - GET /api/employee/from-skill
|
||||||
* - GET /api/employee/skill/all
|
* - GET /api/employee/skill/all
|
||||||
|
@ -40,15 +41,29 @@ public class EmployeeController {
|
||||||
Long user = Long.valueOf(1);
|
Long user = Long.valueOf(1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a specific employee from the database.
|
* Returns the employee profile of the currently logged in user.
|
||||||
*
|
*
|
||||||
* @param id The ID of the requested employee.
|
* @return The employee profile of the currently logged in user.
|
||||||
* @return The employee with the requested ID.
|
|
||||||
* @see com.maradona.backend.entities.Employee
|
* @see com.maradona.backend.entities.Employee
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public ResponseEntity<Employee> get(@RequestParam Long id) {
|
public ResponseEntity<Employee> get() {
|
||||||
var employee = employeeService.getEmployeeById(id);
|
var employee = employeeService.getEmployeeByEid(user);
|
||||||
|
return employee
|
||||||
|
.map(ResponseEntity::ok)
|
||||||
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a specific employee from the database.
|
||||||
|
*
|
||||||
|
* @param eid The ID of the requested employee.
|
||||||
|
* @return The employee with the requested ID.
|
||||||
|
* @see com.maradona.backend.entities.Employee
|
||||||
|
*/
|
||||||
|
@GetMapping("/{eid}")
|
||||||
|
public ResponseEntity<Employee> get(@RequestParam Long eid) {
|
||||||
|
var employee = employeeService.getEmployeeByEid(eid);
|
||||||
return employee
|
return employee
|
||||||
.map(ResponseEntity::ok)
|
.map(ResponseEntity::ok)
|
||||||
.orElse(ResponseEntity.notFound().build());
|
.orElse(ResponseEntity.notFound().build());
|
||||||
|
@ -68,15 +83,15 @@ public class EmployeeController {
|
||||||
/**
|
/**
|
||||||
* Returns a list of employees for a given secondary skill and level.
|
* Returns a list of employees for a given secondary skill and level.
|
||||||
*
|
*
|
||||||
* @param skillId ID of the secondary skill
|
* @param ssid ID of the secondary skill
|
||||||
* @param level Level of the secondary skill
|
* @param level Level of the secondary skill
|
||||||
* @return list of employees
|
* @return list of employees
|
||||||
* @see com.maradona.backend.entities.Employee
|
* @see com.maradona.backend.entities.Employee
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
*/
|
*/
|
||||||
@GetMapping("/from-skill")
|
@GetMapping("/from-skill")
|
||||||
public ResponseEntity<Iterable<Employee>> getFromSkill(@RequestParam Long skillId, @RequestParam Integer level) {
|
public ResponseEntity<Iterable<Employee>> getFromSkill(@RequestParam Long ssid, @RequestParam Integer level) {
|
||||||
return ResponseEntity.ok(employeeService.getEmployeesBySecondarySkill(skillId, level));
|
return ResponseEntity.ok(employeeService.getEmployeesBySecondarySkill(ssid, level));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,30 +112,30 @@ public class EmployeeController {
|
||||||
/**
|
/**
|
||||||
* Updates the level of a secondary skill in the user profile.
|
* Updates the level of a secondary skill in the user profile.
|
||||||
*
|
*
|
||||||
* @param skillId ID of the secondary skill
|
* @param ssid ID of the secondary skill
|
||||||
* @param level Level of the secondary skill
|
* @param level Level of the secondary skill
|
||||||
* @return HTTP status indicating the outcome of the operation
|
* @return HTTP status indicating the outcome of the operation
|
||||||
* @see com.maradona.backend.entities.Employee
|
* @see com.maradona.backend.entities.Employee
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
* @see com.maradona.backend.entities.EmployeeSecondarySkill
|
* @see com.maradona.backend.entities.EmployeeSecondarySkill
|
||||||
*/
|
*/
|
||||||
@PutMapping("/skill/level")
|
@PutMapping("/skill/level")
|
||||||
public ResponseEntity<Void> putSkillLevel(@RequestParam Long skillId, @RequestParam Integer level) {
|
public ResponseEntity<Void> putSkillLevel(@RequestParam Long ssid, @RequestParam Integer level) {
|
||||||
employeeService.updateSecondarySkillLevel(user, skillId, level);
|
employeeService.updateSecondarySkillLevel(user, ssid, level);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a secondary skill from the user profile.
|
* Removes a secondary skill from the user profile.
|
||||||
*
|
*
|
||||||
* @param id The ID of the secondary skill to be removed
|
* @param ssid The ID of the secondary skill to be removed
|
||||||
* @return HTTP status indicating the outcome of the operation
|
* @return HTTP status indicating the outcome of the operation
|
||||||
* @see com.maradona.backend.entities.Employee
|
* @see com.maradona.backend.entities.Employee
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
*/
|
*/
|
||||||
@DeleteMapping("/skill")
|
@DeleteMapping("/skill")
|
||||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
public ResponseEntity<Void> delete(@RequestParam Long ssid) {
|
||||||
employeeService.deleteSecondarySkillFromEmployee(user, id);
|
employeeService.deleteSecondarySkillFromEmployee(user, ssid);
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -37,13 +37,13 @@ class FormOfAdressController {
|
||||||
/**
|
/**
|
||||||
* Returns the form of address with the given ID.
|
* Returns the form of address with the given ID.
|
||||||
*
|
*
|
||||||
* @param id The ID of the form of address to return.
|
* @param fid The ID of the form of address to return.
|
||||||
* @return The description of the form of address with the given ID.
|
* @return The description of the form of address with the given ID.
|
||||||
* @see com.maradona.backend.entities.FormOfAddress
|
* @see com.maradona.backend.entities.FormOfAddress
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public ResponseEntity<FormOfAddress> getFormOfAdress(@RequestParam Long id) {
|
public ResponseEntity<FormOfAddress> getFormOfAdress(@RequestParam Long fid) {
|
||||||
return formOfAdressService.getFormOfAddressById(id)
|
return formOfAdressService.getFormOfAddressByFid(fid)
|
||||||
.map(ResponseEntity::ok)
|
.map(ResponseEntity::ok)
|
||||||
.orElse(ResponseEntity.notFound().build());
|
.orElse(ResponseEntity.notFound().build());
|
||||||
}
|
}
|
||||||
|
@ -78,14 +78,14 @@ class FormOfAdressController {
|
||||||
/**
|
/**
|
||||||
* Updates the description of a form of address.
|
* Updates the description of a form of address.
|
||||||
*
|
*
|
||||||
* @param id The ID of the form of address to update.
|
* @param fid The ID of the form of address to update.
|
||||||
* @param description The new description of the form of address.
|
* @param description The new description of the form of address.
|
||||||
* @return The updated form of address.
|
* @return The updated form of address.
|
||||||
* @see com.maradona.backend.entities.FormOfAddress
|
* @see com.maradona.backend.entities.FormOfAddress
|
||||||
*/
|
*/
|
||||||
@PutMapping({ "/", "" })
|
@PutMapping({ "/", "" })
|
||||||
public ResponseEntity<Void> updateFormOfAdress(@RequestParam Long id, @RequestBody String description) {
|
public ResponseEntity<Void> updateFormOfAdress(@RequestParam Long fid, @RequestBody String description) {
|
||||||
var formOfAddress = formOfAdressService.getFormOfAddressById(id).orElse(null);
|
var formOfAddress = formOfAdressService.getFormOfAddressByFid(fid).orElse(null);
|
||||||
if (formOfAddress == null) {
|
if (formOfAddress == null) {
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
|
@ -97,17 +97,17 @@ class FormOfAdressController {
|
||||||
/**
|
/**
|
||||||
* Deletes a form of address.
|
* Deletes a form of address.
|
||||||
*
|
*
|
||||||
* @param id The ID of the form of address to delete.
|
* @param fid The ID of the form of address to delete.
|
||||||
* @return The deleted form of address.
|
* @return The deleted form of address.
|
||||||
* @see com.maradona.backend.entities.FormOfAddress
|
* @see com.maradona.backend.entities.FormOfAddress
|
||||||
*/
|
*/
|
||||||
@DeleteMapping({ "/", "" })
|
@DeleteMapping({ "/", "" })
|
||||||
public ResponseEntity<Void> deleteFormOfAdress(@RequestParam Long id) {
|
public ResponseEntity<Void> deleteFormOfAdress(@RequestParam Long fid) {
|
||||||
var formOfAddress = formOfAdressService.getFormOfAddressById(id).orElse(null);
|
var formOfAddress = formOfAdressService.getFormOfAddressByFid(fid).orElse(null);
|
||||||
if (formOfAddress == null) {
|
if (formOfAddress == null) {
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
}
|
}
|
||||||
formOfAdressService.deleteFormOfAddress(id);
|
formOfAdressService.deleteFormOfAddress(fid);
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -42,13 +42,13 @@ public class PrimarySkillController {
|
||||||
/**
|
/**
|
||||||
* Returns a specific primary skill from the database.
|
* Returns a specific primary skill from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the requested primary skill.
|
* @param pid The ID of the requested primary skill.
|
||||||
* @return The primary skill with the requested ID.
|
* @return The primary skill with the requested ID.
|
||||||
* @see com.maradona.backend.entities.PrimarySkill
|
* @see com.maradona.backend.entities.PrimarySkill
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public ResponseEntity<PrimarySkill> get(@RequestParam Long id) {
|
public ResponseEntity<PrimarySkill> get(@RequestParam Long pid) {
|
||||||
return primarySkillService.getPrimarySkillById(id)
|
return primarySkillService.getPrimarySkillByPsid(pid)
|
||||||
.map(ResponseEntity::ok)
|
.map(ResponseEntity::ok)
|
||||||
.orElse(ResponseEntity.notFound().build());
|
.orElse(ResponseEntity.notFound().build());
|
||||||
}
|
}
|
||||||
|
@ -93,21 +93,21 @@ public class PrimarySkillController {
|
||||||
/**
|
/**
|
||||||
* Deletes a primary skill from the database.
|
* Deletes a primary skill from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the primary skill to be deleted
|
* @param pid The ID of the primary skill to be deleted
|
||||||
* @return HTTP status indicating the outcome of the operation
|
* @return HTTP status indicating the outcome of the operation
|
||||||
* @see com.maradona.backend.entities.PrimarySkill
|
* @see com.maradona.backend.entities.PrimarySkill
|
||||||
*/
|
*/
|
||||||
@DeleteMapping({ "/", "" })
|
@DeleteMapping({ "/", "" })
|
||||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
public ResponseEntity<Void> delete(@RequestParam Long pid) {
|
||||||
var primarySkill = primarySkillService.getPrimarySkillById(id);
|
var primarySkill = primarySkillService.getPrimarySkillByPsid(pid);
|
||||||
if (primarySkill.isPresent()) {
|
if (primarySkill.isPresent()) {
|
||||||
var secondarySkills = secondarySkillService.getAllSecondarySkills();
|
var secondarySkills = secondarySkillService.getAllSecondarySkills();
|
||||||
for (SecondarySkill secondarySkill : secondarySkills) {
|
for (SecondarySkill secondarySkill : secondarySkills) {
|
||||||
if (secondarySkill.getPrimarySkill().getPsid().equals(id)) {
|
if (secondarySkill.getPrimarySkill().getPsid().equals(pid)) {
|
||||||
secondarySkillService.deleteSecondarySkill(secondarySkill.getSsid());
|
secondarySkillService.deleteSecondarySkill(secondarySkill.getSsid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
primarySkillService.deletePrimarySkill(id);
|
primarySkillService.deletePrimarySkill(pid);
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
} else {
|
} else {
|
||||||
return ResponseEntity.notFound().build();
|
return ResponseEntity.notFound().build();
|
||||||
|
|
|
@ -41,13 +41,13 @@ public class ProjectController {
|
||||||
/**
|
/**
|
||||||
* Returns a specific project from the database.
|
* Returns a specific project from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the requested project.
|
* @param psid The ID of the requested project.
|
||||||
* @return The project with the requested ID.
|
* @return The project with the requested ID.
|
||||||
* @see com.maradona.backend.entities.Project
|
* @see com.maradona.backend.entities.Project
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public ResponseEntity<Project> get(@RequestParam Long id) {
|
public ResponseEntity<Project> get(@RequestParam Long psid) {
|
||||||
Optional<Project> project = projectService.getProjectById(id);
|
Optional<Project> project = projectService.getProjectByPid(psid);
|
||||||
return project.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
return project.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,15 +63,15 @@ public class ProjectController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a list of projects for a given user.
|
* Returns a list of projects for a given employee.
|
||||||
*
|
*
|
||||||
* @param userId ID of the user
|
* @param eid ID of the employee
|
||||||
* @return list of projects
|
* @return list of projects
|
||||||
* @see com.maradona.backend.entities.Project
|
* @see com.maradona.backend.entities.Project
|
||||||
*/
|
*/
|
||||||
@GetMapping("/from-user")
|
@GetMapping("/from-employee")
|
||||||
public ResponseEntity<Iterable<Project>> getFromUser(@RequestParam Long userId) {
|
public ResponseEntity<Iterable<Project>> getFromUser(@RequestParam Long eid) {
|
||||||
return ResponseEntity.ok(projectService.getProjectsByUserId(userId));
|
return ResponseEntity.ok(projectService.getProjectsByEid(eid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,13 +103,13 @@ public class ProjectController {
|
||||||
/**
|
/**
|
||||||
* Deletes a project from the database.
|
* Deletes a project from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the project to be deleted
|
* @param pid The ID of the project to be deleted
|
||||||
* @return HTTP status indicating the outcome of the operation
|
* @return HTTP status indicating the outcome of the operation
|
||||||
* @see com.maradona.backend.entities.Project
|
* @see com.maradona.backend.entities.Project
|
||||||
*/
|
*/
|
||||||
@DeleteMapping({ "/", "" })
|
@DeleteMapping({ "/", "" })
|
||||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
public ResponseEntity<Void> delete(@RequestParam Long pid) {
|
||||||
projectService.deleteProject(id);
|
projectService.deleteProject(pid);
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -40,13 +40,13 @@ public class SecondarySkillController {
|
||||||
/**
|
/**
|
||||||
* Returns a specific secondary skill from the database.
|
* Returns a specific secondary skill from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the requested secondary skill.
|
* @param ssid The ID of the requested secondary skill.
|
||||||
* @return The secondary skill with the requested ID.
|
* @return The secondary skill with the requested ID.
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public ResponseEntity<SecondarySkill> get(@RequestParam Long id) {
|
public ResponseEntity<SecondarySkill> get(@RequestParam Long ssid) {
|
||||||
Optional<SecondarySkill> secondarySkill = secondarySkillService.getSecondarySkillById(id);
|
Optional<SecondarySkill> secondarySkill = secondarySkillService.getSecondarySkillBySsid(ssid);
|
||||||
return secondarySkill.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
return secondarySkill.map(ResponseEntity::ok).orElseGet(() -> ResponseEntity.notFound().build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +64,14 @@ public class SecondarySkillController {
|
||||||
/**
|
/**
|
||||||
* Returns a list of secondary skills for a given primary skill.
|
* Returns a list of secondary skills for a given primary skill.
|
||||||
*
|
*
|
||||||
* @param primarySkillId ID of the primary skill
|
* @param psid ID of the primary skill
|
||||||
* @return list of secondary skills
|
* @return list of secondary skills
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
* @see com.maradona.backend.entities.PrimarySkill
|
* @see com.maradona.backend.entities.PrimarySkill
|
||||||
*/
|
*/
|
||||||
@GetMapping("/from-primary-skill")
|
@GetMapping("/from-primary-skill")
|
||||||
public ResponseEntity<Iterable<SecondarySkill>> getSecondarySkills(@RequestParam Long primarySkillId) {
|
public ResponseEntity<Iterable<SecondarySkill>> getSecondarySkills(@RequestParam Long psid) {
|
||||||
return ResponseEntity.ok(secondarySkillService.getSecondarySkillsByPrimarySkillId(primarySkillId));
|
return ResponseEntity.ok(secondarySkillService.getSecondarySkillsByPrimarySkillId(psid));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -103,13 +103,13 @@ public class SecondarySkillController {
|
||||||
/**
|
/**
|
||||||
* Deletes a secondary skill from the database.
|
* Deletes a secondary skill from the database.
|
||||||
*
|
*
|
||||||
* @param id The ID of the secondary skill to be deleted
|
* @param ssid The ID of the secondary skill to be deleted
|
||||||
* @return HTTP status indicating the outcome of the operation
|
* @return HTTP status indicating the outcome of the operation
|
||||||
* @see com.maradona.backend.entities.SecondarySkill
|
* @see com.maradona.backend.entities.SecondarySkill
|
||||||
*/
|
*/
|
||||||
@DeleteMapping({ "/", "" })
|
@DeleteMapping({ "/", "" })
|
||||||
public ResponseEntity<Void> delete(@RequestParam Long id) {
|
public ResponseEntity<Void> delete(@RequestParam Long ssid) {
|
||||||
secondarySkillService.deleteSecondarySkill(id);
|
secondarySkillService.deleteSecondarySkill(ssid);
|
||||||
return ResponseEntity.noContent().build();
|
return ResponseEntity.noContent().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -52,7 +52,7 @@ public class SkillsPage {
|
||||||
*/
|
*/
|
||||||
@GetMapping({ "/", "" })
|
@GetMapping({ "/", "" })
|
||||||
public String profile(Model model) {
|
public String profile(Model model) {
|
||||||
model.addAttribute("employee", employeeService.getEmployeeById(user).orElse(null));
|
model.addAttribute("employee", employeeService.getEmployeeByEid(user).orElse(null));
|
||||||
model.addAttribute("skills", skillService.getUserSkills(user));
|
model.addAttribute("skills", skillService.getUserSkills(user));
|
||||||
return "/pages/skills/overview";
|
return "/pages/skills/overview";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +1,24 @@
|
||||||
package com.maradona.backend.dto;
|
package com.maradona.backend.dto;
|
||||||
|
|
||||||
public class SkillPrototype {
|
public class SkillPrototype {
|
||||||
private Long primarySkillId;
|
private Long psid;
|
||||||
private Long secondarySkillId;
|
private Long ssid;
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
public Long getPrimarySkillId() {
|
public Long getPsid() {
|
||||||
return primarySkillId;
|
return psid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPrimarySkillId(Long primarySkillId) {
|
public void setPsid(Long psid) {
|
||||||
this.primarySkillId = primarySkillId;
|
this.psid = psid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getSecondarySkillId() {
|
public Long getSsid() {
|
||||||
return secondarySkillId;
|
return ssid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSecondarySkillId(Long secondarySkillId) {
|
public void setSsid(Long ssid) {
|
||||||
this.secondarySkillId = secondarySkillId;
|
this.ssid = ssid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getLevel() {
|
public Integer getLevel() {
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class Employee {
|
||||||
private String lastName;
|
private String lastName;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "AID")
|
@JoinColumn(name = "FID")
|
||||||
private FormOfAddress formOfAddress;
|
private FormOfAddress formOfAddress;
|
||||||
|
|
||||||
private LocalTime dStart;
|
private LocalTime dStart;
|
||||||
|
|
|
@ -9,10 +9,10 @@ import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||||
public class EmployeeSecondarySkill {
|
public class EmployeeSecondarySkill {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long essid;
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "employee_id", nullable = false)
|
@JoinColumn(name = "employee_eid", nullable = false)
|
||||||
@JsonBackReference
|
@JsonBackReference
|
||||||
private Employee employee;
|
private Employee employee;
|
||||||
|
|
||||||
|
@ -23,12 +23,12 @@ public class EmployeeSecondarySkill {
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setEssid(Long essid) {
|
||||||
this.id = id;
|
this.essid = essid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getEssid() {
|
||||||
return id;
|
return essid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmployee(Employee employee) {
|
public void setEmployee(Employee employee) {
|
||||||
|
|
|
@ -9,17 +9,17 @@ public class FormOfAddress {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long fid;
|
||||||
|
|
||||||
@Column(nullable = false, length = 50)
|
@Column(nullable = false, length = 50)
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public void setId(Long id) {
|
public void setFid(Long fid) {
|
||||||
this.id = id;
|
this.fid = fid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId() {
|
public Long getFid() {
|
||||||
return id;
|
return fid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ public class Project {
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
private Long id;
|
private Long pid;
|
||||||
|
|
||||||
@Column(nullable = false, length = 255)
|
@Column(nullable = false, length = 255)
|
||||||
private String name;
|
private String name;
|
||||||
|
@ -23,6 +23,14 @@ public class Project {
|
||||||
@Column(columnDefinition = "TEXT")
|
@Column(columnDefinition = "TEXT")
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
public void setPid(Long pid) {
|
||||||
|
this.pid = pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPid() {
|
||||||
|
return pid;
|
||||||
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@ package com.maradona.backend.repositories;
|
||||||
|
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import com.maradona.backend.entities.EmployeeSecondarySkill;
|
import com.maradona.backend.entities.EmployeeSecondarySkill;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface EmployeeSecondarySkillRepository extends CrudRepository<EmployeeSecondarySkill, Long> {
|
public interface EmployeeSecondarySkillRepository extends CrudRepository<EmployeeSecondarySkill, Long> {
|
||||||
List<EmployeeSecondarySkill> findByEmployeeId(Long employeeId);
|
|
||||||
}
|
}
|
|
@ -21,19 +21,19 @@ public class EmployeeService {
|
||||||
return employeeRepository.save(employee);
|
return employeeRepository.save(employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Employee> getEmployeeById(Long id) {
|
public Optional<Employee> getEmployeeByEid(Long eid) {
|
||||||
var employees = employeeRepository.findAll();
|
var employees = employeeRepository.findAll();
|
||||||
for (Employee employee : employees) {
|
for (Employee employee : employees) {
|
||||||
if (employee.getEid().equals(id)) {
|
if (employee.getEid().equals(eid)) {
|
||||||
return Optional.of(employee);
|
return Optional.of(employee);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteEmployee(Long id) {
|
public void deleteEmployee(Long eid) {
|
||||||
for (Employee employee : employeeRepository.findAll()) {
|
for (Employee employee : employeeRepository.findAll()) {
|
||||||
if (employee.getEid().equals(id)) {
|
if (employee.getEid().equals(eid)) {
|
||||||
employeeRepository.delete(employee);
|
employeeRepository.delete(employee);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -44,13 +44,13 @@ public class EmployeeService {
|
||||||
return employeeRepository.findAll();
|
return employeeRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addSecondarySkillToEmployee(Long userId, SkillPrototype skillPrototype) {
|
public void addSecondarySkillToEmployee(Long eid, SkillPrototype skillPrototype) {
|
||||||
var employee = getEmployeeById(userId).orElseThrow(() -> new RuntimeException("Employee not found"));
|
var employee = getEmployeeByEid(eid).orElseThrow(() -> new RuntimeException("Employee not found"));
|
||||||
var secondarySkill = secondarySkillService.getSecondarySkillById(skillPrototype.getSecondarySkillId())
|
var secondarySkill = secondarySkillService.getSecondarySkillBySsid(skillPrototype.getSsid())
|
||||||
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
||||||
|
|
||||||
for (EmployeeSecondarySkill skill : employee.getSecondarySkills()) {
|
for (EmployeeSecondarySkill skill : employee.getSecondarySkills()) {
|
||||||
if (skill.getSecondarySkill().getSsid().equals(skillPrototype.getSecondarySkillId())) {
|
if (skill.getSecondarySkill().getSsid().equals(skillPrototype.getSsid())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,13 +63,14 @@ public class EmployeeService {
|
||||||
saveEmployee(employee);
|
saveEmployee(employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateSecondarySkillLevel(Long userId, Long skillId, Integer level) {
|
public void updateSecondarySkillLevel(Long eid, Long ssid, Integer level) {
|
||||||
var employee = getEmployeeById(userId).orElseThrow(() -> new RuntimeException("Employee not found"));
|
var employee = getEmployeeByEid(eid).orElseThrow(() -> new RuntimeException("Employee not found"));
|
||||||
secondarySkillService.getSecondarySkillById(skillId)
|
secondarySkillService.getSecondarySkillBySsid(
|
||||||
|
ssid)
|
||||||
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
||||||
|
|
||||||
for (EmployeeSecondarySkill skill : employee.getSecondarySkills()) {
|
for (EmployeeSecondarySkill skill : employee.getSecondarySkills()) {
|
||||||
if (skill.getSecondarySkill().getSsid().equals(skillId)) {
|
if (skill.getSecondarySkill().getSsid().equals(ssid)) {
|
||||||
skill.setLevel(level);
|
skill.setLevel(level);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -78,18 +79,19 @@ public class EmployeeService {
|
||||||
saveEmployee(employee);
|
saveEmployee(employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteSecondarySkillFromEmployee(Long userId, Long skillId) {
|
public void deleteSecondarySkillFromEmployee(Long eid, Long ssid) {
|
||||||
var employee = getEmployeeById(userId).orElseThrow(() -> new RuntimeException("Employee not found"));
|
var employee = getEmployeeByEid(eid).orElseThrow(() -> new RuntimeException("Employee not found"));
|
||||||
secondarySkillService.getSecondarySkillById(skillId)
|
secondarySkillService.getSecondarySkillBySsid(
|
||||||
|
ssid)
|
||||||
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
.orElseThrow(() -> new RuntimeException("Secondary Skill not found"));
|
||||||
|
|
||||||
employee.getSecondarySkills().removeIf(skill -> skill.getSecondarySkill().getSsid().equals(skillId));
|
employee.getSecondarySkills().removeIf(skill -> skill.getSecondarySkill().getSsid().equals(ssid));
|
||||||
saveEmployee(employee);
|
saveEmployee(employee);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<Employee> getEmployeesBySecondarySkill(Long skillId, Integer level) {
|
public Iterable<Employee> getEmployeesBySecondarySkill(Long ssid, Integer level) {
|
||||||
// Implement logic to fetch employees by secondary skill and level
|
// Implement logic to fetch employees by secondary skill and level
|
||||||
// This is a placeholder implementation
|
// TODO: This is a placeholder implementation
|
||||||
return employeeRepository.findAll();
|
return employeeRepository.findAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -17,25 +17,32 @@ public class FormOfAddressService {
|
||||||
return formOfAddressRepository.save(formOfAddress);
|
return formOfAddressRepository.save(formOfAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<FormOfAddress> getFormOfAddressById(Long id) {
|
public Optional<FormOfAddress> getFormOfAddressByFid(Long fid) {
|
||||||
return formOfAddressRepository.findById(id);
|
var formOfAddresses = formOfAddressRepository.findAll();
|
||||||
|
for (FormOfAddress formOfAddress : formOfAddresses) {
|
||||||
|
if (formOfAddress.getFid().equals(fid)) {
|
||||||
|
return Optional.of(formOfAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteFormOfAddress(Long id) {
|
public void deleteFormOfAddress(Long fid) {
|
||||||
formOfAddressRepository.deleteById(id);
|
for (FormOfAddress formOfAddress : formOfAddressRepository.findAll()) {
|
||||||
|
if (formOfAddress.getFid().equals(fid)) {
|
||||||
|
formOfAddressRepository.delete(formOfAddress);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<FormOfAddress> getAllFormOfAddresses() {
|
public Iterable<FormOfAddress> getAllFormOfAddresses() {
|
||||||
return formOfAddressRepository.findAll();
|
return formOfAddressRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long updateFormOfAddress(Long id, String description) {
|
public void updateFormOfAddress(Long fid, String description) {
|
||||||
var formOfAddress = formOfAddressRepository.findById(id).orElse(null);
|
var formOfAddress = getFormOfAddressByFid(fid).orElseThrow(() -> new RuntimeException("Form of Address not found"));
|
||||||
if (formOfAddress != null) {
|
formOfAddress.setDescription(description);
|
||||||
formOfAddress.setDescription(description);
|
saveFormOfAddress(formOfAddress);
|
||||||
formOfAddressRepository.save(formOfAddress);
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.maradona.backend.services;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.maradona.backend.entities.PrimarySkill;
|
import com.maradona.backend.entities.PrimarySkill;
|
||||||
|
import com.maradona.backend.entities.SecondarySkill;
|
||||||
import com.maradona.backend.repositories.PrimarySkillRepository;
|
import com.maradona.backend.repositories.PrimarySkillRepository;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
@ -13,16 +14,36 @@ public class PrimarySkillService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PrimarySkillRepository primarySkillRepository;
|
private PrimarySkillRepository primarySkillRepository;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SecondarySkillService secondarySkillRepository;
|
||||||
|
|
||||||
public PrimarySkill savePrimarySkill(PrimarySkill primarySkill) {
|
public PrimarySkill savePrimarySkill(PrimarySkill primarySkill) {
|
||||||
return primarySkillRepository.save(primarySkill);
|
return primarySkillRepository.save(primarySkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<PrimarySkill> getPrimarySkillById(Long id) {
|
public Optional<PrimarySkill> getPrimarySkillByPsid(Long psid) {
|
||||||
return primarySkillRepository.findById(id);
|
var primarySkills = primarySkillRepository.findAll();
|
||||||
|
for (PrimarySkill primarySkill : primarySkills) {
|
||||||
|
if (primarySkill.getPsid().equals(psid)) {
|
||||||
|
return Optional.of(primarySkill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deletePrimarySkill(Long id) {
|
public void deletePrimarySkill(Long psid) {
|
||||||
primarySkillRepository.deleteById(id);
|
var primarySkills = primarySkillRepository.findAll();
|
||||||
|
var secondarySkills = secondarySkillRepository.getAllSecondarySkills();
|
||||||
|
for (SecondarySkill secondarySkill : secondarySkills) {
|
||||||
|
if (secondarySkill.getPrimarySkill().getPsid().equals(psid)) {
|
||||||
|
secondarySkillRepository.deleteSecondarySkill(secondarySkill.getSsid());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (PrimarySkill primarySkill : primarySkills) {
|
||||||
|
if (primarySkill.getPsid().equals(psid)) {
|
||||||
|
primarySkillRepository.delete(primarySkill);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<PrimarySkill> getAllPrimarySkills() {
|
public Iterable<PrimarySkill> getAllPrimarySkills() {
|
||||||
|
|
|
@ -17,19 +17,30 @@ public class ProjectService {
|
||||||
return projectRepository.save(project);
|
return projectRepository.save(project);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Project> getProjectById(Long id) {
|
public Optional<Project> getProjectByPid(Long pid) {
|
||||||
return projectRepository.findById(id);
|
var projects = projectRepository.findAll();
|
||||||
|
for (Project project : projects) {
|
||||||
|
if (project.getPid().equals(pid)) {
|
||||||
|
return Optional.of(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteProject(Long id) {
|
public void deleteProject(Long pid) {
|
||||||
projectRepository.deleteById(id);
|
var projects = projectRepository.findAll();
|
||||||
|
for (Project project : projects) {
|
||||||
|
if (project.getPid().equals(pid)) {
|
||||||
|
projectRepository.delete(project);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<Project> getAllProjects() {
|
public Iterable<Project> getAllProjects() {
|
||||||
return projectRepository.findAll();
|
return projectRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<Project> getProjectsByUserId(Long userId) {
|
public Iterable<Project> getProjectsByEid(Long eid) {
|
||||||
// TODO: Actually filter by user
|
// TODO: Actually filter by user
|
||||||
return projectRepository.findAll();
|
return projectRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,23 +28,29 @@ public class SecondarySkillService {
|
||||||
return secondarySkillRepository.save(secondarySkill);
|
return secondarySkillRepository.save(secondarySkill);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<SecondarySkill> getSecondarySkillById(Long id) {
|
public Optional<SecondarySkill> getSecondarySkillBySsid(Long ssid) {
|
||||||
return secondarySkillRepository.findById(id);
|
var secondarySkills = secondarySkillRepository.findAll();
|
||||||
|
for (SecondarySkill secondarySkill : secondarySkills) {
|
||||||
|
if (secondarySkill.getSsid().equals(ssid)) {
|
||||||
|
return Optional.of(secondarySkill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteSecondarySkill(Long id) {
|
public void deleteSecondarySkill(Long ssid) {
|
||||||
secondarySkillRepository.deleteById(id);
|
secondarySkillRepository.deleteById(ssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<SecondarySkill> getAllSecondarySkills() {
|
public Iterable<SecondarySkill> getAllSecondarySkills() {
|
||||||
return secondarySkillRepository.findAll();
|
return secondarySkillRepository.findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<SecondarySkill> getSecondarySkillsByPrimarySkillId(Long primarySkillId) {
|
public Iterable<SecondarySkill> getSecondarySkillsByPrimarySkillId(Long psid) {
|
||||||
var skills = secondarySkillRepository.findAll();
|
var skills = secondarySkillRepository.findAll();
|
||||||
var result = new java.util.ArrayList<SecondarySkill>();
|
var result = new java.util.ArrayList<SecondarySkill>();
|
||||||
for (SecondarySkill skill : skills) {
|
for (SecondarySkill skill : skills) {
|
||||||
if (skill.getPrimarySkill().getPsid().equals(primarySkillId)) {
|
if (skill.getPrimarySkill().getPsid().equals(psid)) {
|
||||||
result.add(skill);
|
result.add(skill);
|
||||||
System.out.println(skill.getDescription());
|
System.out.println(skill.getDescription());
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,6 @@ import com.maradona.backend.dto.SkillList;
|
||||||
import com.maradona.backend.entities.Employee;
|
import com.maradona.backend.entities.Employee;
|
||||||
import com.maradona.backend.entities.PrimarySkill;
|
import com.maradona.backend.entities.PrimarySkill;
|
||||||
import com.maradona.backend.entities.SecondarySkill;
|
import com.maradona.backend.entities.SecondarySkill;
|
||||||
import com.maradona.backend.repositories.EmployeeRepository;
|
|
||||||
import com.maradona.backend.repositories.PrimarySkillRepository;
|
|
||||||
import com.maradona.backend.repositories.SecondarySkillRepository;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.data.util.Pair;
|
import org.springframework.data.util.Pair;
|
||||||
|
@ -19,24 +16,24 @@ import java.util.Map;
|
||||||
public class SkillService {
|
public class SkillService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PrimarySkillRepository primarySkillRepository;
|
private PrimarySkillService primarySkillService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SecondarySkillRepository secondarySkillRepository;
|
private SecondarySkillService secondarySkillService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmployeeRepository employeeRepository;
|
private EmployeeService employeeService;
|
||||||
|
|
||||||
public Iterable<SkillList> getAllSkills() {
|
public Iterable<SkillList> getAllSkills() {
|
||||||
Iterable<PrimarySkill> primarySkills = primarySkillRepository.findAll();
|
Iterable<PrimarySkill> primarySkills = primarySkillService.getAllPrimarySkills();
|
||||||
Iterable<SecondarySkill> secondarySkills = secondarySkillRepository.findAll();
|
Iterable<SecondarySkill> secondarySkills = secondarySkillService.getAllSecondarySkills();
|
||||||
List<SkillList> skills = new ArrayList<>();
|
List<SkillList> skills = new ArrayList<>();
|
||||||
|
|
||||||
for (PrimarySkill primarySkill : primarySkills) {
|
for (PrimarySkill primarySkill : primarySkills) {
|
||||||
List<Pair<SecondarySkill, Integer>> secondarySkillList = new ArrayList<>();
|
List<Pair<SecondarySkill, Integer>> secondarySkillList = new ArrayList<>();
|
||||||
for (SecondarySkill secondarySkill : secondarySkills) {
|
for (SecondarySkill secondarySkill : secondarySkills) {
|
||||||
if (secondarySkill.getPrimarySkill().getPsid().equals(primarySkill.getPsid())) {
|
if (secondarySkill.getPrimarySkill().getPsid().equals(primarySkill.getPsid())) {
|
||||||
secondarySkillList.add(Pair.of(secondarySkill, 3)); // Placeholder level
|
secondarySkillList.add(Pair.of(secondarySkill, 3));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skills.add(new SkillList(primarySkill, secondarySkillList));
|
skills.add(new SkillList(primarySkill, secondarySkillList));
|
||||||
|
@ -44,11 +41,11 @@ public class SkillService {
|
||||||
return skills;
|
return skills;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<SkillList> getUserSkills(Long userId) {
|
public Iterable<SkillList> getUserSkills(Long eid) {
|
||||||
if (userId == null) {
|
if (eid == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
Employee employee = employeeRepository.findById(userId).orElse(null);
|
Employee employee = employeeService.getEmployeeByEid(eid).orElse(null);
|
||||||
if (employee == null) {
|
if (employee == null) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +53,7 @@ public class SkillService {
|
||||||
Map<SecondarySkill, Integer> secondarySkillLevels = employee.getSecondarySkillLevels();
|
Map<SecondarySkill, Integer> secondarySkillLevels = employee.getSecondarySkillLevels();
|
||||||
List<SkillList> skills = new ArrayList<>();
|
List<SkillList> skills = new ArrayList<>();
|
||||||
|
|
||||||
for (PrimarySkill primarySkill : primarySkillRepository.findAll()) {
|
for (PrimarySkill primarySkill : primarySkillService.getAllPrimarySkills()) {
|
||||||
List<Pair<SecondarySkill, Integer>> secondarySkillList = new ArrayList<>();
|
List<Pair<SecondarySkill, Integer>> secondarySkillList = new ArrayList<>();
|
||||||
for (Map.Entry<SecondarySkill, Integer> entry : secondarySkillLevels.entrySet()) {
|
for (Map.Entry<SecondarySkill, Integer> entry : secondarySkillLevels.entrySet()) {
|
||||||
if (entry.getKey().getPrimarySkill().getPsid().equals(primarySkill.getPsid())) {
|
if (entry.getKey().getPrimarySkill().getPsid().equals(primarySkill.getPsid())) {
|
||||||
|
|
|
@ -26,7 +26,7 @@ spring:
|
||||||
prefix: "classpath:/templates/" # Path where Thymeleaf templates are stored
|
prefix: "classpath:/templates/" # Path where Thymeleaf templates are stored
|
||||||
suffix: ".html" # File extension for Thymeleaf templates
|
suffix: ".html" # File extension for Thymeleaf templates
|
||||||
cache: false # Disable caching for development (set to true in production)
|
cache: false # Disable caching for development (set to true in production)
|
||||||
mode: "HTML5" # Template mode; Thymeleaf parses the templates as HTML5
|
mode: "HTML" # Template mode; Thymeleaf parses the templates as HTML5
|
||||||
encoding: "UTF-8" # Character encoding for the templates
|
encoding: "UTF-8" # Character encoding for the templates
|
||||||
servlet:
|
servlet:
|
||||||
content-type: "text/html" # Content type for the Thymeleaf-rendered HTML responses
|
content-type: "text/html" # Content type for the Thymeleaf-rendered HTML responses
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
.alert {
|
||||||
|
padding: 15px;
|
||||||
|
margin-top: 10px;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: var(--cosmic-dark-darker);
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 100%;
|
||||||
|
animation: fadeInOut 5s ease-in-out;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert.show {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Alert types */
|
||||||
|
.alert-info {
|
||||||
|
background-color: #17a2b8;
|
||||||
|
border: 1px solid #17a2b8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-error {
|
||||||
|
background-color: var(--aurora-yellowgreen-lighter);
|
||||||
|
border: 1px solid var(--aurora-yellowgreen-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.alert-success {
|
||||||
|
background-color: #28a745;
|
||||||
|
border: 1px solid #28a745;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Fade animation */
|
||||||
|
@keyframes fadeInOut {
|
||||||
|
0%,
|
||||||
|
100% {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
10%,
|
||||||
|
90% {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Additional styling for improved visibility */
|
||||||
|
.alert-icon {
|
||||||
|
margin-right: 8px;
|
||||||
|
font-size: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Additional spacing */
|
||||||
|
.mt-2 {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
|
@ -65,11 +65,3 @@
|
||||||
.form-control::placeholder {
|
.form-control::placeholder {
|
||||||
color: var(--cosmic-dark-dark);
|
color: var(--cosmic-dark-dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
.star-filled {
|
|
||||||
color: var(--aurora-yellowgreen-lighter);
|
|
||||||
}
|
|
||||||
|
|
||||||
.star-empty {
|
|
||||||
color: var(--cosmic-dark-light) !important;
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
.star-rating-container {
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
min-width: 300px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star-rating {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star {
|
||||||
|
font-size: 24px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star i {
|
||||||
|
color: transparent;
|
||||||
|
-webkit-text-stroke: 1.5px var(--aurora-yellowgreen-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.star.active i {
|
||||||
|
color: var(--aurora-yellowgreen-lighter);
|
||||||
|
-webkit-text-stroke: 1px var(--aurora-yellowgreen-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.star:hover i {
|
||||||
|
color: var(--aurora-yellowgreen-lighter);
|
||||||
|
-webkit-text-stroke: 1px var(--aurora-yellowgreen-lighter);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-description {
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
min-width: 300px;
|
||||||
|
width: max-content;
|
||||||
|
max-width: 400px;
|
||||||
|
margin-top: 8px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
background-color: var(--starlight-white-lighter);
|
||||||
|
border: 1px solid var(--starlight-white-dark);
|
||||||
|
border-radius: 4px;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
color: var(--cosmic-dark-medium);
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transition: opacity 0.2s, visibility 0.2s;
|
||||||
|
z-index: 1000;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-description.visible {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.star + .star {
|
||||||
|
margin-left: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label + .star-rating-container {
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-bottom: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group input[type="hidden"] {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.rating-description {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
max-width: none;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-group label + .star-rating-container {
|
||||||
|
margin-left: 0;
|
||||||
|
display: block;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +1,175 @@
|
||||||
document.getElementById("primarySkill").addEventListener("change", function () {
|
/**
|
||||||
var primarySkillId = this.value;
|
* @fileoverview Handles the dynamic population of secondary skills dropdown based on primary skill selection
|
||||||
fetch("/skills/secondary-skills?primarySkillId=" + primarySkillId)
|
* @version 4.1.0
|
||||||
.then((response) => response.json())
|
*/
|
||||||
.then((data) => {
|
|
||||||
console.log("Fetch response data:", data);
|
/**
|
||||||
var secondarySkillSelect = document.getElementById("secondarySkill");
|
* @typedef {Object} SecondarySkill
|
||||||
secondarySkillSelect.innerHTML =
|
* @property {number} ssid - The secondary skill ID
|
||||||
'<option value="" disabled selected>Select a secondary skill</option>';
|
* @property {string} description - The description of the secondary skill
|
||||||
data.forEach(function (secondarySkill) {
|
*/
|
||||||
var option = document.createElement("option");
|
|
||||||
option.value = secondarySkill.ssid;
|
/**
|
||||||
option.text = secondarySkill.description;
|
* Creates and returns an option element for the select dropdown
|
||||||
secondarySkillSelect.add(option);
|
* @param {string} text - The text to display in the option
|
||||||
});
|
* @param {boolean} [disabled=false] - Whether the option should be disabled
|
||||||
})
|
* @param {boolean} [selected=false] - Whether the option should be selected
|
||||||
.catch((error) => console.error("Error fetching secondary skills:", error));
|
* @param {string|number} [value=""] - The value for the option
|
||||||
});
|
* @returns {HTMLOptionElement} The created option element
|
||||||
|
*/
|
||||||
|
function createOption(text, disabled = false, selected = false, value = "") {
|
||||||
|
const option = document.createElement("option");
|
||||||
|
option.textContent = text;
|
||||||
|
option.disabled = disabled;
|
||||||
|
option.selected = selected;
|
||||||
|
option.value = value;
|
||||||
|
return option;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shows a temporary message below the secondary skills dropdown
|
||||||
|
* @param {string} message - The message to display
|
||||||
|
* @param {string} type - The type of alert (info, error, success, etc.)
|
||||||
|
* @param {number} [duration=5000] - How long to show the message in milliseconds
|
||||||
|
* @param {HTMLElement} container - The element to append the message to
|
||||||
|
*/
|
||||||
|
function showTemporaryMessage(message, type, duration = 5000, container) {
|
||||||
|
const messageElement = document.createElement("div");
|
||||||
|
messageElement.className = `alert alert-${type} mt-2`;
|
||||||
|
messageElement.textContent = message;
|
||||||
|
container.appendChild(messageElement);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
messageElement.classList.add("show");
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
messageElement.classList.remove("show");
|
||||||
|
setTimeout(() => {
|
||||||
|
if (messageElement.parentNode) {
|
||||||
|
messageElement.parentNode.removeChild(messageElement);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the secondary skills dropdown based on the API response
|
||||||
|
* @param {SecondarySkill[]} secondarySkills - Array of secondary skills from the API
|
||||||
|
* @param {HTMLSelectElement} selectElement - The secondary skills select element
|
||||||
|
*/
|
||||||
|
function updateSecondarySkillsDropdown(secondarySkills, selectElement) {
|
||||||
|
selectElement.innerHTML = ""; // Clear existing options
|
||||||
|
|
||||||
|
if (!secondarySkills || secondarySkills.length === 0) {
|
||||||
|
selectElement.appendChild(
|
||||||
|
createOption("No secondary skills available", true, true)
|
||||||
|
);
|
||||||
|
selectElement.disabled = true;
|
||||||
|
|
||||||
|
showTemporaryMessage(
|
||||||
|
"There are no secondary skills available for this primary skill. Please contact an administrator to add some.",
|
||||||
|
"info",
|
||||||
|
5000,
|
||||||
|
selectElement.parentNode
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
selectElement.appendChild(
|
||||||
|
createOption("Select a secondary skill", true, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
secondarySkills.forEach((skill) => {
|
||||||
|
selectElement.appendChild(
|
||||||
|
createOption(skill.description, false, false, skill.ssid)
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
selectElement.disabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the event listeners and handlers for the skills dropdowns
|
||||||
|
* This is the main function that sets up all the functionality
|
||||||
|
*/
|
||||||
|
function initializeSkillsDropdowns() {
|
||||||
|
const primarySkillSelect = document.getElementById("primarySkill");
|
||||||
|
const secondarySkillSelect = document.getElementById("secondarySkill");
|
||||||
|
|
||||||
|
if (!primarySkillSelect || !secondarySkillSelect) {
|
||||||
|
console.error("Required select elements not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
secondarySkillSelect.disabled = true;
|
||||||
|
|
||||||
|
primarySkillSelect.addEventListener("change", async function () {
|
||||||
|
const selectedPrimarySkillId = this.value;
|
||||||
|
secondarySkillSelect.innerHTML = "";
|
||||||
|
secondarySkillSelect.appendChild(
|
||||||
|
createOption("Select a secondary skill", true, true)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!selectedPrimarySkillId) {
|
||||||
|
secondarySkillSelect.disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
secondarySkillSelect.innerHTML = "";
|
||||||
|
secondarySkillSelect.appendChild(createOption("Loading...", true, true));
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(
|
||||||
|
`/api/skills/secondary/${selectedPrimarySkillId}`,
|
||||||
|
{
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
const errorMessage = `Server returned ${response.status}: ${response.statusText}`;
|
||||||
|
throw new Error(errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
const secondarySkills = await response.json();
|
||||||
|
updateSecondarySkillsDropdown(secondarySkills, secondarySkillSelect);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Error fetching secondary skills:", error);
|
||||||
|
secondarySkillSelect.innerHTML = "";
|
||||||
|
secondarySkillSelect.appendChild(
|
||||||
|
createOption("Error loading secondary skills", true, true)
|
||||||
|
);
|
||||||
|
secondarySkillSelect.disabled = true;
|
||||||
|
|
||||||
|
let userMessage = "";
|
||||||
|
if (error.name === "TypeError" && !window.navigator.onLine) {
|
||||||
|
userMessage =
|
||||||
|
"No internet connection. Please check your network and try again.";
|
||||||
|
} else if (error.message.includes("Server returned 404")) {
|
||||||
|
userMessage =
|
||||||
|
"The selected primary skill was not found. Please refresh and try again.";
|
||||||
|
} else if (error.message.includes("Server returned 500")) {
|
||||||
|
userMessage =
|
||||||
|
"Server error occurred. Please try again in a few minutes.";
|
||||||
|
} else if (error.message.includes("Server returned 403")) {
|
||||||
|
userMessage =
|
||||||
|
"You don't have permission to access these skills. Please contact support.";
|
||||||
|
} else {
|
||||||
|
userMessage = `Failed to load secondary skills: ${error.message}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
showTemporaryMessage(
|
||||||
|
userMessage,
|
||||||
|
"error",
|
||||||
|
5000,
|
||||||
|
secondarySkillSelect.parentNode
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", initializeSkillsDropdowns);
|
||||||
|
|
|
@ -0,0 +1,103 @@
|
||||||
|
/***
|
||||||
|
* @fileoverview Star Rating Component - Initializes and manages an interactive star rating system
|
||||||
|
* with hover effects, click handling, and dynamic descriptions.
|
||||||
|
* @version 2.2.0
|
||||||
|
*/
|
||||||
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
const stars = document.querySelectorAll(".star");
|
||||||
|
const ratingInput = document.getElementById("level");
|
||||||
|
const descriptionElement = document.querySelector(".rating-description");
|
||||||
|
const initialValue = parseInt(ratingInput.value) || 0;
|
||||||
|
updateStars(initialValue);
|
||||||
|
|
||||||
|
stars.forEach((star) => {
|
||||||
|
/**
|
||||||
|
* Handle click events on stars
|
||||||
|
* Updates the rating value and displays the corresponding description
|
||||||
|
*/
|
||||||
|
star.addEventListener("click", function () {
|
||||||
|
const value = parseInt(this.dataset.value);
|
||||||
|
ratingInput.value = value;
|
||||||
|
updateStars(value);
|
||||||
|
showDescription(this.dataset.description);
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle mouseenter events on stars
|
||||||
|
* Temporarily highlights stars and shows description on hover
|
||||||
|
*/
|
||||||
|
star.addEventListener("mouseenter", function () {
|
||||||
|
const value = parseInt(this.dataset.value);
|
||||||
|
highlightStars(value);
|
||||||
|
showDescription(this.dataset.description);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle mouseleave events on the entire star rating container
|
||||||
|
* Resets the display to the current selected rating
|
||||||
|
*/
|
||||||
|
document
|
||||||
|
.querySelector(".star-rating")
|
||||||
|
.addEventListener("mouseleave", function () {
|
||||||
|
const currentValue = parseInt(ratingInput.value) || 0;
|
||||||
|
updateStars(currentValue);
|
||||||
|
if (currentValue > 0) {
|
||||||
|
const selectedStar = document.querySelector(
|
||||||
|
`.star[data-value="${currentValue}"]`
|
||||||
|
);
|
||||||
|
showDescription(selectedStar.dataset.description);
|
||||||
|
} else {
|
||||||
|
hideDescription();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the visual state of stars based on a value
|
||||||
|
* @param {number} value - The rating value to display (1-5)
|
||||||
|
*/
|
||||||
|
function updateStars(value) {
|
||||||
|
stars.forEach((star) => {
|
||||||
|
const starValue = parseInt(star.dataset.value);
|
||||||
|
if (starValue <= value) {
|
||||||
|
star.classList.add("active");
|
||||||
|
} else {
|
||||||
|
star.classList.remove("active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Temporarily highlights stars up to a specific value
|
||||||
|
* Used for hover effects
|
||||||
|
* @param {number} value - The rating value to highlight (1-5)
|
||||||
|
*/
|
||||||
|
function highlightStars(value) {
|
||||||
|
stars.forEach((star) => {
|
||||||
|
const starValue = parseInt(star.dataset.value);
|
||||||
|
if (starValue <= value) {
|
||||||
|
star.classList.add("active");
|
||||||
|
} else {
|
||||||
|
star.classList.remove("active");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays a description for the current rating
|
||||||
|
* @param {string} description - The description text to display
|
||||||
|
*/
|
||||||
|
function showDescription(description) {
|
||||||
|
if (description) {
|
||||||
|
descriptionElement.textContent = description;
|
||||||
|
descriptionElement.classList.add("visible");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hides the rating description
|
||||||
|
*/
|
||||||
|
function hideDescription() {
|
||||||
|
descriptionElement.classList.remove("visible");
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,16 +1,22 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<div th:replace="~{/core/_metadata :: metadata}"></div>
|
<meta th:replace="~{/core/_metadata :: metadata}" />
|
||||||
<title>Add Skill</title>
|
<title>Add Skill</title>
|
||||||
<link rel="stylesheet" href="/css/skills/skills.css" />
|
<link rel="stylesheet" href="/css/skills/skills.css" />
|
||||||
<link rel="stylesheet" href="/css/core/style.css" />
|
<link rel="stylesheet" href="/css/core/style.css" />
|
||||||
<link rel="stylesheet" href="/css/core/header.css" />
|
<link rel="stylesheet" href="/css/core/header.css" />
|
||||||
<link rel="stylesheet" href="/css/core/footer.css" />
|
<link rel="stylesheet" href="/css/core/footer.css" />
|
||||||
|
<link rel="stylesheet" href="/css/skills/starRating.css" />
|
||||||
|
<link rel="stylesheet" href="/css/core/alerts.css" />
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css"
|
||||||
|
/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
<div th:replace="~{/core/_header :: header(activePage=${skills})}"></div>
|
<div th:replace="~{/core/_header :: header(activePage='skills')}"></div>
|
||||||
<div class="content container mt-4">
|
<div class="content container mt-4">
|
||||||
<h2 class="mb-4">Add Skill</h2>
|
<h2 class="mb-4">Add Skill</h2>
|
||||||
<form
|
<form
|
||||||
|
@ -39,7 +45,6 @@
|
||||||
></option>
|
></option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Secondary Skill Dropdown -->
|
<!-- Secondary Skill Dropdown -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="secondarySkill">Secondary Skill</label>
|
<label for="secondarySkill">Secondary Skill</label>
|
||||||
|
@ -54,25 +59,52 @@
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- Star Rating System -->
|
||||||
<!-- Skill Level Dropdown -->
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="level">Level</label>
|
<label for="level">Skill Level</label>
|
||||||
<select
|
<div class="star-rating-container">
|
||||||
|
<div class="star-rating">
|
||||||
|
<span
|
||||||
|
class="star"
|
||||||
|
data-value="1"
|
||||||
|
data-description="Beginner - Basic knowledge and limited experience"
|
||||||
|
><i class="fas fa-star"></i
|
||||||
|
></span>
|
||||||
|
<span
|
||||||
|
class="star"
|
||||||
|
data-value="2"
|
||||||
|
data-description="Elementary - Can handle simple tasks with guidance"
|
||||||
|
><i class="fas fa-star"></i
|
||||||
|
></span>
|
||||||
|
<span
|
||||||
|
class="star"
|
||||||
|
data-value="3"
|
||||||
|
data-description="Intermediate - Independent work on most tasks"
|
||||||
|
><i class="fas fa-star"></i
|
||||||
|
></span>
|
||||||
|
<span
|
||||||
|
class="star"
|
||||||
|
data-value="4"
|
||||||
|
data-description="Advanced - Deep knowledge and extensive experience"
|
||||||
|
><i class="fas fa-star"></i
|
||||||
|
></span>
|
||||||
|
<span
|
||||||
|
class="star"
|
||||||
|
data-value="5"
|
||||||
|
data-description="Expert - Master level with ability to teach others"
|
||||||
|
><i class="fas fa-star"></i
|
||||||
|
></span>
|
||||||
|
</div>
|
||||||
|
<div class="rating-description"></div>
|
||||||
|
</div>
|
||||||
|
<input
|
||||||
|
type="hidden"
|
||||||
id="level"
|
id="level"
|
||||||
name="level"
|
name="level"
|
||||||
class="form-control"
|
|
||||||
th:field="*{level}"
|
th:field="*{level}"
|
||||||
>
|
value="1"
|
||||||
<option value="" disabled selected>Select skill level</option>
|
/>
|
||||||
<option
|
|
||||||
th:each="level : ${#numbers.sequence(1, 5)}"
|
|
||||||
th:value="${level}"
|
|
||||||
th:text="${level}"
|
|
||||||
></option>
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Submit Button -->
|
<!-- Submit Button -->
|
||||||
<button type="submit" class="btn-create-project">Add Skill</button>
|
<button type="submit" class="btn-create-project">Add Skill</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,5 +113,6 @@
|
||||||
<div th:replace="~{/core/_footer :: footer}"></div>
|
<div th:replace="~{/core/_footer :: footer}"></div>
|
||||||
</div>
|
</div>
|
||||||
<script src="/js/skills/fetchSecondarySkills.js"></script>
|
<script src="/js/skills/fetchSecondarySkills.js"></script>
|
||||||
|
<script src="/js/skills/starRating.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<div th:replace="~{/core/_metadata :: metadata}"></div>
|
<meta th:replace="~{/core/_metadata :: metadata}"></meta>
|
||||||
<title>Create Skill</title>
|
<title>Create Skill</title>
|
||||||
<link rel="stylesheet" href="/css/skills/skills.css" />
|
<link rel="stylesheet" href="/css/skills/skills.css" />
|
||||||
<link rel="stylesheet" href="/css/core/style.css" />
|
<link rel="stylesheet" href="/css/core/style.css" />
|
||||||
|
|
Loading…
Reference in New Issue