Updated Leaves sync

This commit is contained in:
Giancarlo Panichi 2022-10-18 18:47:42 +02:00
parent 2ab230a3ba
commit ce44e0ea8d
21 changed files with 1297 additions and 15 deletions

View File

@ -0,0 +1,176 @@
package it.cnr.isti.epasmed.domain;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
/**
* Leaves
*/
@Entity
@Table(name = "leaves")
public class Leaves implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
private Integer idPersona;
@NotNull
@Column(nullable = false)
private String cf;
private String codiceAssenzaDescrizione;
@NotNull
@Column(nullable = false)
private LocalDate dataInizio;
private LocalDate dataFine;
@NotNull
@Column(nullable = false)
private LocalDateTime dataMod;
private Integer codiceAssenzaCodice;
private String codiceAssenzaCnr;
private Integer durata;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getIdPersona() {
return idPersona;
}
public void setIdPersona(Integer idPersona) {
this.idPersona = idPersona;
}
public String getCf() {
return cf;
}
public void setCf(String cf) {
this.cf = cf;
}
public String getCodiceAssenzaDescrizione() {
return codiceAssenzaDescrizione;
}
public void setCodiceAssenzaDescrizione(String codiceAssenzaDescrizione) {
this.codiceAssenzaDescrizione = codiceAssenzaDescrizione;
}
public LocalDate getDataInizio() {
return dataInizio;
}
public void setDataInizio(LocalDate dataInizio) {
this.dataInizio = dataInizio;
}
public LocalDate getDataFine() {
return dataFine;
}
public void setDataFine(LocalDate dataFine) {
this.dataFine = dataFine;
}
public LocalDateTime getDataMod() {
return dataMod;
}
public void setDataMod(LocalDateTime dataMod) {
this.dataMod = dataMod;
}
public Integer getCodiceAssenzaCodice() {
return codiceAssenzaCodice;
}
public void setCodiceAssenzaCodice(Integer codiceAssenzaCodice) {
this.codiceAssenzaCodice = codiceAssenzaCodice;
}
public String getCodiceAssenzaCnr() {
return codiceAssenzaCnr;
}
public void setCodiceAssenzaCnr(String codiceAssenzaCnr) {
this.codiceAssenzaCnr = codiceAssenzaCnr;
}
public Integer getDurata() {
return durata;
}
public void setDurata(Integer durata) {
this.durata = durata;
}
@Override
public String toString() {
return "Leaves [id=" + id + ", idPersona=" + idPersona + ", cf=" + cf + ", codiceAssenzaDescrizione="
+ codiceAssenzaDescrizione + ", dataInizio=" + dataInizio + ", dataFine=" + dataFine + ", dataMod="
+ dataMod + ", codiceAssenzaCodice=" + codiceAssenzaCodice + ", codiceAssenzaCnr=" + codiceAssenzaCnr
+ ", durata=" + durata + "]";
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Leaves)) {
return false;
}
return id != null && id.equals(((Leaves) o).id);
}
public boolean same(Leaves l) {
boolean same = false;
if (id != null && id.compareTo(l.getId()) == 0) {
if (cf != null && cf.compareTo(l.getCf()) == 0) {
if (idPersona != null && idPersona.compareTo(l.getIdPersona()) == 0) {
if (dataInizio != null && dataInizio.compareTo(l.getDataInizio()) == 0) {
if (dataFine == null && l.getDataFine() == null) {
if (codiceAssenzaCodice != null
&& codiceAssenzaCodice.compareTo(l.getCodiceAssenzaCodice()) == 0) {
return true;
}
} else {
if (dataFine != null && dataFine.compareTo(l.getDataFine()) == 0) {
if (codiceAssenzaCodice != null
&& codiceAssenzaCodice.compareTo(l.getCodiceAssenzaCodice()) == 0) {
return true;
}
}
}
}
}
}
}
return same;
}
}

View File

@ -0,0 +1,18 @@
package it.cnr.isti.epasmed.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import it.cnr.isti.epasmed.domain.Leaves;
/**
* Spring Data JPA repository for the {@link Leaves} entity.
*/
@Repository
public interface LeavesRepository extends JpaRepository<Leaves, Integer> {
Optional<Leaves> findOneByCf(String cf);
}

View File

@ -0,0 +1,144 @@
package it.cnr.isti.epasmed.service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import it.cnr.isti.epasmed.domain.Leaves;
import it.cnr.isti.epasmed.repository.LeavesRepository;
/**
* Service class for managing Leaves.
*/
@Service
@Transactional("epasMedTransactionManager")
public class LeavesService {
private final Logger log = LoggerFactory.getLogger(LeavesService.class);
private final LeavesRepository leavesRepository;
// @Autowired
// FormattingConversionService conversionDateTimeService;
public LeavesService(LeavesRepository leavesRepository) {
this.leavesRepository = leavesRepository;
}
@Transactional(value = "epasMedTransactionManager", readOnly = true)
public Page<Leaves> getAllLeaves(Pageable pageable) {
log.debug("LeavesService getAllLeaves(): {}", pageable);
leavesRepository.findAll();
return leavesRepository.findAll(pageable);
}
@Transactional(value = "epasMedTransactionManager", readOnly = true)
public List<Leaves> getAllLeaves() {
log.debug("LeavesService getAllLeaves()");
return leavesRepository.findAll();
}
@Transactional(value = "epasMedTransactionManager", readOnly = true)
public Optional<Leaves> getLeavesById(Integer id) {
return leavesRepository.findById(id);
}
public Leaves createLeaves(Leaves leavesDTO) {
log.debug("Creating new Leaves: {}", leavesDTO);
Leaves leaves = new Leaves();
leaves.setId(leavesDTO.getId());
leaves.setIdPersona(leavesDTO.getIdPersona());
leaves.setCf(leavesDTO.getCf());
leaves.setDataInizio(leavesDTO.getDataInizio());
leaves.setDataFine(leavesDTO.getDataFine());
leaves.setCodiceAssenzaCodice(leavesDTO.getCodiceAssenzaCodice());
leaves.setCodiceAssenzaCnr(leavesDTO.getCodiceAssenzaCnr());
leaves.setCodiceAssenzaDescrizione(leavesDTO.getCodiceAssenzaDescrizione());
leaves.setDurata(leavesDTO.getDurata());
leaves.setDataMod(leavesDTO.getDataMod());
leavesRepository.save(leaves);
log.debug("Created Leaves: {}", leaves);
return leaves;
}
/**
* Update all information for a specific leaves, and return the modified leaves.
*
* @param leavesDTO leave to update.
* @return updated table.
*/
public Optional<Leaves> updateLeaves(Leaves leavesDTO) {
Optional<Leaves> l = leavesRepository.findById(leavesDTO.getId());
if (l.isPresent()) {
Leaves leaves = l.get();
leaves.setId(leavesDTO.getId());
leaves.setIdPersona(leavesDTO.getIdPersona());
leaves.setCf(leavesDTO.getCf());
leaves.setDataInizio(leavesDTO.getDataInizio());
leaves.setDataFine(leavesDTO.getDataInizio());
leaves.setCodiceAssenzaCodice(leavesDTO.getCodiceAssenzaCodice());
leaves.setCodiceAssenzaCnr(leavesDTO.getCodiceAssenzaCnr());
leaves.setCodiceAssenzaDescrizione(leavesDTO.getCodiceAssenzaDescrizione());
leaves.setDurata(leavesDTO.getDurata());
leaves.setDataMod(leavesDTO.getDataMod());
leaves = leavesRepository.save(leaves);
log.debug("Changed Information for Leaves: {}", leaves);
return Optional.of(leaves);
} else {
return l;
}
}
public void deleteLeaves(Integer id) {
leavesRepository.findById(id).ifPresent(leaves -> {
leavesRepository.delete(leaves);
log.debug("Deleted Leaves: {}", leaves);
});
}
public void updateLeaves(String id, String idPersona, String cf, String dataInizio, String dataFine,
String codiceAssenzaCodice, String codiceAssenzaCnr, String codiceAssenzaDescrizione, String durata,
String dataMod) {
Optional.of(leavesRepository.findById(Integer.valueOf(id))).filter(Optional::isPresent).map(Optional::get)
.map(leaves -> {
LocalDate dataI = null;
LocalDate dataF = null;
LocalDateTime dataM = null;
if (dataInizio != null && !dataInizio.isEmpty()) {
dataI = LocalDate.parse(dataInizio);
}
if (dataFine != null && !dataFine.isEmpty()) {
dataF = LocalDate.parse(dataFine);
}
if (dataMod != null && !dataMod.isEmpty()) {
dataM = LocalDateTime.parse(dataMod);
}
leaves.setIdPersona(Integer.valueOf(idPersona));
leaves.setCf(cf);
leaves.setDataInizio(dataI);
leaves.setDataFine(dataF);
leaves.setCodiceAssenzaCodice(Integer.parseInt(codiceAssenzaCodice));
leaves.setCodiceAssenzaCnr(codiceAssenzaCnr);
leaves.setCodiceAssenzaDescrizione(codiceAssenzaDescrizione);
leaves.setDurata(Integer.parseInt(durata));
leaves.setDataMod(dataM);
log.debug("Changed Information for Leaves: {}", leaves);
return leaves;
});
}
}

View File

@ -0,0 +1,43 @@
package it.cnr.isti.epasmed.service.mapper;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import org.springframework.stereotype.Service;
import it.cnr.isti.epasmed.domain.Leaves;
import it.cnr.isti.epasmed.sistemainformativo.model.SIAspettative;
@Service
public class LeavesMapper {
private final SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
public Leaves siAspettativeToLeaves(SIAspettative siAspettative) {
if (siAspettative == null) {
return null;
} else {
Leaves leave = new Leaves();
leave.setId(siAspettative.getId());
leave.setIdPersona(siAspettative.getIdpersona());
leave.setCf(siAspettative.getCf());
leave.setCodiceAssenzaDescrizione(siAspettative.getCodice_assenza_descrizione());
LocalDate dataInizio = null;
if (siAspettative.getData_inizio() != null) {
dataInizio = LocalDate.parse(sdfDate.format(siAspettative.getData_inizio()));
}
LocalDate dataFine = null;
if (siAspettative.getData_fine() != null) {
dataFine = LocalDate.parse(sdfDate.format(siAspettative.getData_fine()));
}
leave.setDataInizio(dataInizio);
leave.setDataFine(dataFine);
leave.setCodiceAssenzaCodice(siAspettative.getCodice_assenza_codice());
leave.setCodiceAssenzaCnr(siAspettative.getCodice_assenza_cnr());
leave.setDurata(siAspettative.getDurata());
leave.setDataMod(siAspettative.getData_mod().toLocalDateTime());
return leave;
}
}
}

View File

@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import it.cnr.isti.epasmed.domain.Leaves;
import it.cnr.isti.epasmed.domain.TabsSI;
import it.cnr.isti.epasmed.domain.TimeCardsReporting;
import it.cnr.isti.epasmed.epas.dto.EPASAffiliationsDTO;
@ -56,8 +57,10 @@ import it.cnr.isti.epasmed.epas.service.EPASPersonsService;
import it.cnr.isti.epasmed.epas.service.EPASTimeCardsService;
import it.cnr.isti.epasmed.epas.service.EPASValidatesService;
import it.cnr.isti.epasmed.epas.service.EPASWorkingTimeTypesService;
import it.cnr.isti.epasmed.service.LeavesService;
import it.cnr.isti.epasmed.service.TabsSIService;
import it.cnr.isti.epasmed.service.TimeCardsReportingService;
import it.cnr.isti.epasmed.service.mapper.LeavesMapper;
import it.cnr.isti.epasmed.sistemainformativo.model.SIAnagrafico;
import it.cnr.isti.epasmed.sistemainformativo.model.SIAspettative;
import it.cnr.isti.epasmed.sistemainformativo.model.SICartellini;
@ -105,6 +108,10 @@ public class SyncService {
TabsSIService tabsSIService;
@Autowired
TimeCardsReportingService timeCardsReportingService;
@Autowired
LeavesService leavesService;
@Autowired
LeavesMapper leavesMapper;
@Autowired
SIMasterLogService siMasterLogService;
@ -1036,7 +1043,7 @@ public class SyncService {
throws Exception {
logger.info("Report {}-{}", year, month);
LocalDateTime now = LocalDateTime.now();
for (TabsSI tab : tabsSI) {
logger.info("TabSI: {}", tab);
if (tab.getOperazioni() != null && !tab.getOperazioni().isEmpty()
@ -1074,7 +1081,7 @@ public class SyncService {
if (eWTT.getUpdatedAt() != null && !eWTT.getUpdatedAt().isEmpty()) {
LocalDateTime updatedAt = LocalDateTime.parse(eWTT.getUpdatedAt(), formatter);
if (lastUpdate.compareTo(updatedAt) < 0) {
LocalDateTime dMod=updatedAt.truncatedTo(ChronoUnit.SECONDS);
LocalDateTime dMod = updatedAt.truncatedTo(ChronoUnit.SECONDS);
Timestamp dataMod = Timestamp.valueOf(dMod);
SIOrario siOrario = new SIOrario(Long.valueOf(eWTT.getId()), eWTT.getDescription(),
Boolean.valueOf(eWTT.getHorizontal()), Boolean.valueOf(eWTT.getDisabled()), dataMod,
@ -1179,7 +1186,7 @@ public class SyncService {
Timestamp dataMod;
try {
LocalDateTime dMod = LocalDateTime.parse(epasStamping.getDate(), formatter);
dMod=dMod.truncatedTo(ChronoUnit.SECONDS);
dMod = dMod.truncatedTo(ChronoUnit.SECONDS);
dataMod = Timestamp.valueOf(dMod);
} catch (IllegalArgumentException | DateTimeParseException e) {
logger.error("Invalid stamping data format: {}", e.getLocalizedMessage(), e);
@ -1270,6 +1277,8 @@ public class SyncService {
private void writeAspettativeOnSI(Long fluxId, LocalDateTime now, List<EPASLeaves> epasLeavesList,
LinkedHashMap<String, EPASAbsenceTypes> epasAbsenceTypeMap) {
int count=0;
// SI
for (EPASLeaves leave : epasLeavesList) {
logger.debug("Writing Leave: {}", leave);
@ -1336,9 +1345,9 @@ public class SyncService {
}
}
LocalDateTime dMod=now.truncatedTo(ChronoUnit.SECONDS);
LocalDateTime dMod = now.truncatedTo(ChronoUnit.SECONDS);
Timestamp dataMod = Timestamp.valueOf(dMod);
Integer durata = 0;
if (startDate != null && endDate != null) {
LocalDate startD = LocalDate.parse(leave.getStart());
@ -1359,10 +1368,38 @@ public class SyncService {
SIAspettative siAspettative = new SIAspettative(leave.getPerson().getFiscalCode(),
epasAbsenceType.getDescription(), startDate, endDate, dataMod, SI_FLAG_DEL_FALSE, fluxId, id,
idPersona, absenceId, epasAbsenceType.getCode(), durata);
logger.info("Write SIAspettativa: {}", siAspettative);
siAspettativeService.writeNewFlux(fluxId, siAspettative);
if (checkSIAspettativeIsUpgradeable(siAspettative)) {
logger.info("Write SIAspettativa: {}", siAspettative);
count=count+1;
siAspettativeService.writeNewFlux(fluxId, siAspettative);
}
}
logger.info("Aspettative scritte su SI: {}",count);
}
private boolean checkSIAspettativeIsUpgradeable(SIAspettative siAspettative) {
boolean upgradeable = false;
try {
Optional<Leaves> leaves = leavesService.getLeavesById(siAspettative.getId());
if (leaves.isPresent()) {
Leaves found = leaves.get();
Leaves leavesDTO = leavesMapper.siAspettativeToLeaves(siAspettative);
if (!found.same(leavesDTO)) {
upgradeable = true;
leavesService.updateLeaves(leavesDTO);
}
} else {
upgradeable = true;
Leaves leavesDTO = leavesMapper.siAspettativeToLeaves(siAspettative);
leavesService.createLeaves(leavesDTO);
}
} catch (Exception e) {
logger.error("Error in check SI Aspettative: {}", e.getLocalizedMessage(), e);
}
return upgradeable;
}
private void syncPersOrario(Long fluxId, TabsSI tab, String year, String month, LocalDateTime now)
@ -1382,7 +1419,7 @@ public class SyncService {
logger.error("PersonWorkingTimeDTOList not found");
return;
} else {
logger.info("PersonWorkingTimeDTOList size: {}",epasPersonWorkingTimeDTOList.size());
logger.info("PersonWorkingTimeDTOList size: {}", epasPersonWorkingTimeDTOList.size());
}
// SI
@ -1451,7 +1488,7 @@ public class SyncService {
}
}
LocalDateTime dMod=now.truncatedTo(ChronoUnit.SECONDS);
LocalDateTime dMod = now.truncatedTo(ChronoUnit.SECONDS);
Timestamp dataMod = Timestamp.valueOf(dMod);
SIPersOrario siPersOrario = new SIPersOrario(id, idPersona, pwtDTO.getCf(), startDate, endDate,
@ -1487,7 +1524,7 @@ public class SyncService {
// }
// Set Update DateTime
LocalDateTime dMod=now.truncatedTo(ChronoUnit.SECONDS);
LocalDateTime dMod = now.truncatedTo(ChronoUnit.SECONDS);
Timestamp dataMod = Timestamp.valueOf(dMod);
logger.info("Persons Validated: {}", epasValidates.getValidatedPersons().length);
@ -1560,7 +1597,7 @@ public class SyncService {
logger.info("Reference: {}-{}", year, month);
// Set Update DateTime
LocalDateTime dMod=now.truncatedTo(ChronoUnit.SECONDS);
LocalDateTime dMod = now.truncatedTo(ChronoUnit.SECONDS);
Timestamp dataMod = Timestamp.valueOf(dMod);
// logger.info("Persons Validated: {}",

View File

@ -0,0 +1,166 @@
package it.cnr.isti.epasmed.web.rest;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import javax.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import io.github.jhipster.web.util.HeaderUtil;
import io.github.jhipster.web.util.PaginationUtil;
import io.github.jhipster.web.util.ResponseUtil;
import it.cnr.isti.epasmed.config.Constants;
import it.cnr.isti.epasmed.domain.Leaves;
import it.cnr.isti.epasmed.security.AuthoritiesConstants;
import it.cnr.isti.epasmed.service.LeavesService;
import it.cnr.isti.epasmed.web.rest.errors.BadRequestAlertException;
/**
* REST controller for managing Leaves.
* <p>
* This class accesses the {@link Leaves} entity.
*
*
*/
@RestController
@RequestMapping("/api")
public class LeavesResource {
private static final List<String> ALLOWED_ORDERED_PROPERTIES = Collections
.unmodifiableList(Arrays.asList("id", "idPersona", "cf", "codiceAssenzaDescrizione", "dataInizio",
"dataFine","dataMod"));
private final Logger log = LoggerFactory.getLogger(LeavesResource.class);
@Value("${jhipster.clientApp.name}")
private String applicationName;
private final LeavesService leavesService;
public LeavesResource(LeavesService leavesService) {
this.leavesService = leavesService;
}
/**
* {@code GET /leaves} : get all leaves.
*
* @param pageable the pagination information.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
* all leaves.
*/
@GetMapping("/leaves")
public ResponseEntity<List<Leaves>> getAllLeaves(Pageable pageable) {
log.info("REST request to read Leaves : {}", pageable);
if (!onlyContainsAllowedProperties(pageable)) {
return ResponseEntity.badRequest().build();
}
final Page<Leaves> page = leavesService.getAllLeaves(pageable);
HttpHeaders headers = PaginationUtil
.generatePaginationHttpHeaders(ServletUriComponentsBuilder.fromCurrentRequest(), page);
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
private boolean onlyContainsAllowedProperties(Pageable pageable) {
return pageable.getSort().stream().map(Sort.Order::getProperty).allMatch(ALLOWED_ORDERED_PROPERTIES::contains);
}
/**
* {@code POST /leaves} : Creates a new Leaves.
* <p>
*
* @param leavesDTO Leave to create.
* @return the {@link ResponseEntity} with status {@code 201 (Created)} and with
* body the new table SI, or with status {@code 400 (Bad Request)} if
* the id is already in use.
* @throws URISyntaxException if the Location URI syntax is incorrect.
*/
@PostMapping("/leaves")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Leaves> createLeaves(@Valid @RequestBody Leaves leavesDTO) throws URISyntaxException {
log.info("REST request to save Leaves : {}", leavesDTO);
if (leavesDTO.getId() != null) {
throw new BadRequestAlertException("A new leave cannot already have an ID", "Leaves", "idexists");
} else {
Leaves leave = leavesService.createLeaves(leavesDTO);
return ResponseEntity.created(new URI("/api/leaves/" + leave.getId())).headers(HeaderUtil
.createAlert(applicationName, "A leave is created with identifier " + leave.getId(), leave.getCf()))
.body(leave);
}
}
/**
* {@code PUT /leaves} : Updates leaves.
*
* @param leavesDTO the leave to update.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
* the updated leave.
*
*/
@PutMapping("/leaves")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Leaves> updateLeaves(@Valid @RequestBody Leaves leavesDTO) {
log.debug("REST request to update Leaves : {}", leavesDTO);
Optional<Leaves> updatedLeaves = leavesService.updateLeaves(leavesDTO);
return ResponseUtil.wrapOrNotFound(updatedLeaves, HeaderUtil.createAlert(applicationName,
"A leave is updated with identifier " + leavesDTO.getId(), leavesDTO.getCf()));
}
/**
* {@code GET /leaves/:id} : get the "id" of leave.
*
* @param id the id of the leave to find.
* @return the {@link ResponseEntity} with status {@code 200 (OK)} and with body
* the leave, or with status {@code 404 (Not Found)}.
*/
@GetMapping("/leaves/{id:" + Constants.VALID_NUMBER_REGEX + "}")
public ResponseEntity<Leaves> getLeaves(@PathVariable String id) {
log.debug("REST request to get Leave : {}", id);
return ResponseUtil.wrapOrNotFound(leavesService.getLeavesById(Integer.valueOf(id)));
}
/**
* {@code DELETE /leaves/:id} : delete the "id" Leave.
*
* @param id the id of the leave to delete.
* @return the {@link ResponseEntity} with status {@code 204 (NO_CONTENT)}.
*/
@DeleteMapping("/leaves/{id:" + Constants.VALID_NUMBER_REGEX + "}")
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
public ResponseEntity<Void> deleteLeaves(@PathVariable String id) {
log.debug("REST request to delete Leaves id: {}", id);
leavesService.deleteLeaves(Integer.valueOf(id));
return ResponseEntity.noContent()
.headers(HeaderUtil.createAlert(applicationName, "A Leave is deleted with identifier " + id, id))
.build();
}
}

View File

@ -221,5 +221,23 @@
</loadData>
</changeSet>
<changeSet id="00000000000004" author="jhipster">
<createTable tableName="leaves">
<column name="id" type="int">
<constraints primaryKey="true"
primaryKeyName="leaves_id" />
</column>
<column name="id_persona" type="int" />
<column name="cf" type="varchar(16)" />
<column name="codice_assenza_descrizione" type="varchar(100)" />
<column name="data_inizio" type="date" />
<column name="data_fine" type="date" />
<column name="codice_assenza_codice" type="int" />
<column name="codice_assenza_cnr" type="varchar(20)" />
<column name="durata" type="int" />
<column name="data_mod" type="timestamp" />
</createTable>
</changeSet>
</databaseChangeLog>

View File

@ -19,6 +19,13 @@ import { RouterModule } from '@angular/router';
pageTitle: 'TimeCards Reporting',
},
},
{
path: 'leaves',
loadChildren: () => import('./leaves/leaves.module').then(m => m.LeavesModule),
data: {
pageTitle: 'Leaves',
},
},
]),
],
})

View File

@ -0,0 +1,23 @@
<form *ngIf="leaves" name="deleteForm" (ngSubmit)="confirmDelete(leaves?.id!)">
<div class="modal-header">
<h4 class="modal-title">Confirm delete operation</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true" (click)="cancel()">&times;</button>
</div>
<div class="modal-body">
<jhi-alert-error></jhi-alert-error>
<p>Are you sure you want to delete this Leave?</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="cancel()">
<fa-icon icon="ban"></fa-icon>&nbsp;<span>Cancel</span>
</button>
<button type="submit" class="btn btn-danger">
<fa-icon icon="times"></fa-icon>&nbsp;<span>Delete</span>
</button>
</div>
</form>

View File

@ -0,0 +1,27 @@
import { Component } from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { JhiEventManager } from 'ng-jhipster';
import { Leaves } from './leaves.model';
import { LeavesService } from './leaves.service';
@Component({
selector: 'jhi-leaves-delete-dialog',
templateUrl: './leaves-delete-dialog.component.html',
})
export class LeavesDeleteDialogComponent {
leaves?: Leaves;
constructor(private leavesService: LeavesService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {}
cancel(): void {
this.activeModal.dismiss();
}
confirmDelete(id: string): void {
this.leavesService.delete(id).subscribe(() => {
this.eventManager.broadcast('leavesListModification');
this.activeModal.close();
});
}
}

View File

@ -0,0 +1,45 @@
<div class="row justify-content-center">
<div class="col-8">
<div *ngIf="leaves">
<h2>
<span>Leaves</span> [<b>{{ leaves.id }}</b>]
</h2>
<dl class="row-md jh-entity-details">
<dt><span>Id</span></dt>
<dd>{{ leaves.id }}</dd>
<dt><span>Id Persona</span></dt>
<dd>{{ leaves.idPersona }}</dd>
<dt><span>Codice Fiscale</span></dt>
<dd>{{ leaves.cf }}</dd>
<dt><span>Codice Assenza Descrizione</span></dt>
<dd>{{ leaves.codiceAssenzaDescrizione }}</dd>
<dt><span>Data Inizio</span></dt>
<dd>{{ leaves.dataInizio }}</dd>
<dt><span>Data Fine</span></dt>
<dd>{{ leaves.dataFine }}</dd>
<dt><span>Codice Assenza Codice</span></dt>
<dd>{{ leaves.codiceAssenzaCodice }}</dd>
<dt><span>Codice Assenza Cnr</span></dt>
<dd>{{ leaves.codiceAssenzaCnr }}</dd>
<dt><span>Durata</span></dt>
<dd>{{ leaves.durata }}</dd>
<dt><span>Data Mod</span></dt>
<dd>{{ leaves.dataMod }}</dd>
</dl>
<button type="submit" routerLink="../../" class="btn btn-info">
<fa-icon icon="arrow-left"></fa-icon>&nbsp;<span>Back</span>
</button>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Leaves } from './leaves.model';
@Component({
selector: 'jhi-leaves-detail',
templateUrl: './leaves-detail.component.html',
})
export class LeavesDetailComponent implements OnInit {
leaves: Leaves | null = null;
constructor(private route: ActivatedRoute) {}
ngOnInit(): void {
this.route.data.subscribe(({ leaves }) => (this.leaves = leaves));
}
}

View File

@ -0,0 +1,149 @@
<div class="row justify-content-center">
<div class="col-8">
<form name="editForm" role="form" novalidate (ngSubmit)="save()"
[formGroup]="editForm">
<h2 id="myLeavesLabel">Create or edit Leaves</h2>
<div *ngIf="leaves">
<jhi-alert-error></jhi-alert-error>
<div class="form-group" [hidden]="!leaves.id">
<label>Id</label> <input type="text" class="form-control" name="id"
formControlName="id" readonly>
</div>
<div class="form-group">
<label class="form-control-label">Id Persona</label> <input
type="text" class="form-control" name="idPersona"
formControlName="idPersona">
<div
*ngIf="editForm.get('idPersona')!.invalid && (editForm.get('idPersona')!.dirty || editForm.get('idPersona')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('idPersona')?.errors?.required"> This
field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Codice Fiscale</label> <input
type="text" class="form-control" name="cf" formControlName="cf">
<div
*ngIf="editForm.get('cf')!.invalid && (editForm.get('cf')!.dirty || editForm.get('cf')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('cf')?.errors?.required"> This field
is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Codice Assenza
Descrizione</label> <input type="text" class="form-control"
name="codiceAssenzaDescrizione"
formControlName="codiceAssenzaDescrizione">
<div
*ngIf="editForm.get('codiceAssenzaDescrizione')!.invalid && (editForm.get('codiceAssenzaDescrizione')!.dirty || editForm.get('codiceAssenzaDescrizione')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('codiceAssenzaDescrizione')?.errors?.required">
This field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Data Inizio</label> <input
type="text" class="form-control" name="dataInizio"
formControlName="dataInizio">
<div
*ngIf="editForm.get('dataInizio')!.invalid && (editForm.get('dataInizio')!.dirty || editForm.get('dataInizio')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('dataInizio')?.errors?.required">
This field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Data Fine</label> <input
type="text" class="form-control" name="dataFine"
formControlName="dataFine">
<div
*ngIf="editForm.get('dataFine')!.invalid && (editForm.get('dataFine')!.dirty || editForm.get('dataFine')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('dataFine')?.errors?.required"> This
field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Codice Assenza Codice</label> <input
type="text" class="form-control" name="codiceAssenzaCodice"
formControlName="codiceAssenzaCodice">
<div
*ngIf="editForm.get('codiceAssenzaCodice')!.invalid && (editForm.get('codiceAssenzaCodice')!.dirty || editForm.get('codiceAssenzaCodice')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('codiceAssenaCodice')?.errors?.required">
This field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Codice Assenza Cnr</label> <input
type="text" class="form-control" name="codiceAssenzaCnr"
formControlName="codiceAssenzaCnr">
<div
*ngIf="editForm.get('codiceAssenzaCnr')!.invalid && (editForm.get('codiceAssenzaCnr')!.dirty || editForm.get('codiceAssenzaCnr')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('codiceAssenaCnr')?.errors?.required">
This field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Durata</label> <input type="text"
class="form-control" name="durata" formControlName="durata">
<div
*ngIf="editForm.get('durata')!.invalid && (editForm.get('durata')!.dirty || editForm.get('durata')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('durata')?.errors?.required"> This
field is required. </small>
</div>
</div>
<div class="form-group">
<label class="form-control-label">Data Mod</label> <input
type="text" class="form-control" name="dataMod"
formControlName="dataMod">
<div
*ngIf="editForm.get('dataMod')!.invalid && (editForm.get('dataMod')!.dirty || editForm.get('dataMod')!.touched)">
<small class="form-text text-danger"
*ngIf="editForm.get('dataMod')?.errors?.required"> This
field is required. </small>
</div>
</div>
</div>
<div *ngIf="leaves">
<button type="button" class="btn btn-secondary"
(click)="previousState()">
<fa-icon icon="ban"></fa-icon>
&nbsp;<span>Cancel</span>
</button>
<button type="submit" [disabled]="editForm.invalid || isSaving"
class="btn btn-primary">
<fa-icon icon="save"></fa-icon>
&nbsp;<span>Save</span>
</button>
</div>
</form>
</div>
</div>

View File

@ -0,0 +1,95 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, Validators } from '@angular/forms';
import { ActivatedRoute } from '@angular/router';
import { Leaves } from './leaves.model';
import { LeavesService } from './leaves.service';
@Component({
selector: 'jhi-leaves-update',
templateUrl: './leaves-update.component.html',
})
export class LeavesUpdateComponent implements OnInit {
leaves!: Leaves;
isSaving = false;
editForm = this.fb.group({
id: [],
idPersona: ['', [Validators.required]],
cf: ['', [Validators.required]],
codiceAssenzaDescrizione: ['', [Validators.required]],
dataInizio: ['', [Validators.required]],
dataFine: [''],
codiceAssenzaCodice: ['', [Validators.required]],
codiceAssenzaCnr: ['', [Validators.required]],
durata: ['', [Validators.required]],
dataMod: ['', [Validators.required]],
});
constructor(private leavesService: LeavesService, private route: ActivatedRoute, private fb: FormBuilder) {}
ngOnInit(): void {
this.route.data.subscribe(({ leaves }) => {
if (leaves) {
this.leaves = leaves;
this.updateForm(leaves);
}
});
}
previousState(): void {
window.history.back();
}
save(): void {
this.isSaving = true;
this.updateLeaves(this.leaves);
if (this.leaves.id !== undefined) {
this.leavesService.update(this.leaves).subscribe(
() => this.onSaveSuccess(),
() => this.onSaveError()
);
} else {
this.leavesService.create(this.leaves).subscribe(
() => this.onSaveSuccess(),
() => this.onSaveError()
);
}
}
private updateForm(leaves: Leaves): void {
this.editForm.patchValue({
id: leaves.id,
idPersona: leaves.idPersona,
cf: leaves.cf,
codiceAssenzaDescrizione: leaves.codiceAssenzaDescrizione,
dataInizio: leaves.dataInizio,
dataFine: leaves.dataFine,
codiceAssenzaCodice: leaves.codiceAssenzaCodice,
codiceAssenzaCnr: leaves.codiceAssenzaCnr,
durata: leaves.durata,
dataMod: leaves.dataMod,
});
}
private updateLeaves(leaves: Leaves): void {
leaves.idPersona = this.editForm.get(['idPersona'])!.value;
leaves.cf = this.editForm.get(['cf'])!.value;
leaves.codiceAssenzaDescrizione = this.editForm.get(['codiceAssenzaDescrizione'])!.value;
leaves.dataInizio = this.editForm.get(['dataInizio'])!.value;
leaves.dataFine = this.editForm.get(['dataFine'])!.value;
leaves.codiceAssenzaCodice = this.editForm.get(['codiceAssenzaCodice'])!.value;
leaves.codiceAssenzaCnr = this.editForm.get(['codiceAssenzaCnr'])!.value;
leaves.durata = this.editForm.get(['durata'])!.value;
leaves.dataMod = this.editForm.get(['dataMod'])!.value;
}
private onSaveSuccess(): void {
this.isSaving = false;
this.previousState();
}
private onSaveError(): void {
this.isSaving = false;
}
}

View File

@ -0,0 +1,79 @@
<div>
<h2>
<span id="leaves-page-heading">Leaves</span>
<button class="btn btn-primary float-right jh-create-entity"
[routerLink]="['./new']">
<fa-icon icon="plus"></fa-icon>
<span>Create a new Leave</span>
</button>
</h2>
<jhi-alert-error></jhi-alert-error>
<jhi-alert></jhi-alert>
<div class="table-responsive" *ngIf="leavesArray">
<table class="table table-striped"
aria-describedby="user-management-page-heading">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending"
[callback]="transition.bind(this)">
<th scope="col" jhiSortBy="id"><span>Id</span> <fa-icon
icon="sort"></fa-icon></th>
<th scope="col"><span>Id Persona</span></th>
<th scope="col"><span>Codice Fiscale</span></th>
<th scope="col"><span>Codice Assenza Descrizione</span></th>
<th scope="col"><span>Data Inizio</span></th>
<th scope="col"><span>Data Fine</span></th>
<th scope="col"><span>Data Mod</span></th>
<th scope="col"></th>
</tr>
</thead>
<tbody *ngIf="leavesArray">
<tr *ngFor="let leave of leavesArray; trackBy: trackIdentity">
<td><a [routerLink]="['./', leave.id, 'view']">{{ leave.id }}</a></td>
<td>{{ leave.idPersona }}</td>
<td>{{ leave.cf }}</td>
<td>{{ leave.codiceAssenzaDescrizione }}</td>
<td>{{ leave.dataInizio }}</td>
<td>{{ leave.dataFine }}</td>
<td>{{ leave.dataMod }}</td>
<td class="text-right">
<div class="btn-group">
<button type="submit" [routerLink]="['./', leave.id, 'view']"
class="btn btn-info btn-sm">
<fa-icon icon="eye"></fa-icon>
<span class="d-none d-md-inline">View</span>
</button>
<button type="submit" [routerLink]="['./', leave.id, 'edit']"
queryParamsHandling="merge" class="btn btn-primary btn-sm">
<fa-icon icon="pencil-alt"></fa-icon>
<span class="d-none d-md-inline">Edit</span>
</button>
<button type="button" (click)="deleteLeaves(leave)"
class="btn btn-danger btn-sm">
<fa-icon icon="times"></fa-icon>
<span class="d-none d-md-inline">Delete</span>
</button>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div *ngIf="leavesArray">
<div class="row justify-content-center">
<jhi-item-count [page]="page" [total]="totalItems"
[itemsPerPage]="itemsPerPage"></jhi-item-count>
</div>
<div class="row justify-content-center">
<ngb-pagination [collectionSize]="totalItems" [(page)]="page"
[pageSize]="itemsPerPage" [maxSize]="5" [rotate]="true"
[boundaryLinks]="true" (pageChange)="transition()"></ngb-pagination>
</div>
</div>
</div>

View File

@ -0,0 +1,102 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { HttpResponse, HttpHeaders } from '@angular/common/http';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { Subscription, combineLatest } from 'rxjs';
import { ActivatedRoute, ParamMap, Router, Data } from '@angular/router';
import { JhiEventManager } from 'ng-jhipster';
import { ITEMS_PER_PAGE } from 'app/shared/constants/pagination.constants';
// import { AccountService } from 'app/core/auth/account.service';
// import { Account } from 'app/core/user/account.model';
import { LeavesService } from './leaves.service';
import { Leaves } from './leaves.model';
import { LeavesDeleteDialogComponent } from './leaves-delete-dialog.component';
@Component({
selector: 'jhi-leaves',
templateUrl: './leaves.component.html',
})
export class LeavesComponent implements OnInit, OnDestroy {
// currentAccount: Account | null = null;
leavesArray: Leaves[] | null = null;
leavesListSubscription?: Subscription;
totalItems = 0;
itemsPerPage = ITEMS_PER_PAGE;
page!: number;
predicate!: string;
ascending!: boolean;
constructor(
private leavesService: LeavesService,
// private accountService: AccountService,
private activatedRoute: ActivatedRoute,
private router: Router,
private eventManager: JhiEventManager,
private modalService: NgbModal
) {}
ngOnInit(): void {
// this.accountService.identity().subscribe(account => (this.currentAccount = account));
this.leavesListSubscription = this.eventManager.subscribe('leavesListModification', () => this.loadAll());
this.handleNavigation();
}
ngOnDestroy(): void {
if (this.leavesListSubscription) {
this.eventManager.destroy(this.leavesListSubscription);
}
}
trackIdentity(index: number, item: Leaves): any {
return item.id;
}
deleteLeaves(leaves: Leaves): void {
const modalRef = this.modalService.open(LeavesDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
modalRef.componentInstance.leaves = leaves;
}
transition(): void {
this.router.navigate(['./'], {
relativeTo: this.activatedRoute.parent,
queryParams: {
page: this.page,
sort: this.predicate + ',' + (this.ascending ? 'asc' : 'desc'),
},
});
}
private handleNavigation(): void {
combineLatest(this.activatedRoute.data, this.activatedRoute.queryParamMap, (data: Data, params: ParamMap) => {
const page = params.get('page');
this.page = page !== null ? +page : 1;
const sort = (params.get('sort') ?? data['defaultSort']).split(',');
this.predicate = sort[0];
this.ascending = sort[1] === 'asc';
this.loadAll();
}).subscribe();
}
private loadAll(): void {
this.leavesService
.query({
page: this.page - 1,
size: this.itemsPerPage,
sort: this.sort(),
})
.subscribe((res: HttpResponse<Leaves[]>) => this.onSuccess(res.body, res.headers));
}
private sort(): string[] {
const result = [this.predicate + ',' + (this.ascending ? 'asc' : 'desc')];
if (this.predicate !== 'id') {
result.push('id');
}
return result;
}
private onSuccess(leavesArray: Leaves[] | null, headers: HttpHeaders): void {
this.totalItems = Number(headers.get('X-Total-Count'));
this.leavesArray = leavesArray;
}
}

View File

@ -0,0 +1,27 @@
export interface ILeaves {
id?: any;
idPersona?: any;
cf?: string;
codiceAssenzaDescrizione?: string;
dataInizio?: any;
dataFine?: any;
codiceAssenzaCodice?: any;
codiceAssenzaCnr?: string;
durata?: any;
dataMod?: any;
}
export class Leaves implements ILeaves {
constructor(
public id?: any,
public idPersona?: any,
public cf?: string,
public codiceAssenzaDescrizione?: string,
public dataInizio?: any,
public dataFine?: any,
public codiceAssenzaCodice?: any,
public codiceAssenzaCnr?: string,
public durata?: any,
public dataMod?: any
) {}
}

View File

@ -0,0 +1,16 @@
import { NgModule } from '@angular/core';
import { RouterModule } from '@angular/router';
import { EpasmedSharedModule } from 'app/shared/shared.module';
import { LeavesComponent } from './leaves.component';
import { LeavesDetailComponent } from './leaves-detail.component';
import { LeavesUpdateComponent } from './leaves-update.component';
import { LeavesDeleteDialogComponent } from './leaves-delete-dialog.component';
import { leavesRoute } from './leaves.route';
@NgModule({
imports: [EpasmedSharedModule, RouterModule.forChild(leavesRoute)],
declarations: [LeavesComponent, LeavesDetailComponent, LeavesUpdateComponent, LeavesDeleteDialogComponent],
entryComponents: [LeavesComponent],
})
export class LeavesModule {}

View File

@ -0,0 +1,53 @@
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot, Routes } from '@angular/router';
import { Observable, of } from 'rxjs';
import { Leaves, ILeaves } from './leaves.model';
import { LeavesService } from './leaves.service';
import { LeavesComponent } from './leaves.component';
import { LeavesDetailComponent } from './leaves-detail.component';
import { LeavesUpdateComponent } from './leaves-update.component';
@Injectable({ providedIn: 'root' })
export class LeavesResolve implements Resolve<ILeaves> {
constructor(private service: LeavesService) {}
resolve(route: ActivatedRouteSnapshot): Observable<ILeaves> {
const id = route.params['id'];
if (id) {
return this.service.find(id);
}
return of(new Leaves());
}
}
export const leavesRoute: Routes = [
{
path: '',
component: LeavesComponent,
data: {
defaultSort: 'id,asc',
},
},
{
path: ':id/view',
component: LeavesDetailComponent,
resolve: {
leaves: LeavesResolve,
},
},
{
path: 'new',
component: LeavesUpdateComponent,
resolve: {
leaves: LeavesResolve,
},
},
{
path: ':id/edit',
component: LeavesUpdateComponent,
resolve: {
leaves: LeavesResolve,
},
},
];

View File

@ -0,0 +1,35 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { SERVER_API_URL } from 'app/app.constants';
import { createRequestOption, Pagination } from 'app/shared/util/request-util';
import { ILeaves } from './leaves.model';
@Injectable({ providedIn: 'root' })
export class LeavesService {
public resourceUrl = SERVER_API_URL + 'api/leaves';
constructor(private http: HttpClient) {}
query(req?: Pagination): Observable<HttpResponse<ILeaves[]>> {
const options = createRequestOption(req);
return this.http.get<ILeaves[]>(this.resourceUrl, { params: options, observe: 'response' });
}
create(leave: ILeaves): Observable<ILeaves> {
return this.http.post<ILeaves>(this.resourceUrl, leave);
}
update(leave: ILeaves): Observable<ILeaves> {
return this.http.put<ILeaves>(this.resourceUrl, leave);
}
find(id: string): Observable<ILeaves> {
return this.http.get<ILeaves>(`${this.resourceUrl}/${id}`);
}
delete(id: string): Observable<{}> {
return this.http.delete(`${this.resourceUrl}/${id}`);
}
}

View File

@ -17,7 +17,7 @@
</a>
</li>
<!-- jhipster-needle-add-element-to-menu - JHipster will add new menu items here -->
<li *ngSwitchCase="true" ngbDropdown class="nav-item dropdown pointer" display="dynamic" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
<li *jhiHasAnyAuthority="'ROLE_ADMIN'" ngbDropdown class="nav-item dropdown pointer" display="dynamic" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
<a class="nav-link dropdown-toggle" ngbDropdownToggle href="javascript:void(0);" id="entity-menu">
<span>
<fa-icon icon="th-list"></fa-icon>
@ -37,12 +37,16 @@
<fa-icon icon="user" [fixedWidth]="true"></fa-icon>
<span>TimeCards Reporting</span>
</a>
<a class="dropdown-item" routerLink="entities/leaves" routerLinkActive="active" (click)="collapseNavbar()">
<fa-icon icon="user" [fixedWidth]="true"></fa-icon>
<span>Leaves</span>
</a>
</li>
</ul>
</li>
<li *jhiHasAnyAuthority="'ROLE_ADMIN'" ngbDropdown class="nav-item dropdown pointer" display="dynamic" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
<a class="nav-link dropdown-toggle" ngbDropdownToggle href="javascript:void(0);" id="admin-menu">
<li *ngSwitchCase="true" ngbDropdown class="nav-item dropdown pointer" display="dynamic" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }">
<a class="nav-link dropdown-toggle" ngbDropdownToggle href="javascript:void(0);" id="operation-menu">
<span>
<fa-icon icon="road"></fa-icon>
<span>Operations</span>