Aggiornata Rendicontazione
This commit is contained in:
parent
1ffb8c4a82
commit
c58e496f15
|
@ -5,6 +5,8 @@ import java.net.URISyntaxException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
@ -43,157 +45,185 @@ public class SyncResource {
|
||||||
* {@code GET /sync/reads} : Retrieve new flux from Sistema Informativo and
|
* {@code GET /sync/reads} : Retrieve new flux from Sistema Informativo and
|
||||||
* update ePAS.
|
* update ePAS.
|
||||||
*
|
*
|
||||||
* @return the {@link ResponseEntity} with status {@code 201 (Executed)}
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
* or with status {@code 400 (Bad Request)} if there is a error.
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sync/reads")
|
@GetMapping("/sync/reads")
|
||||||
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
public ResponseEntity<Void> syncReads() throws URISyntaxException {
|
public ResponseEntity<Object> syncReads() throws URISyntaxException {
|
||||||
logger.info("REST request syncReads()");
|
logger.info("REST request syncReads()");
|
||||||
ResponseEntity<Void> res;
|
ResponseEntity<Object> res;
|
||||||
try {
|
try {
|
||||||
syncService.executeReads();
|
syncService.executeReads();
|
||||||
logger.info("Sincronizzazione delle Letture eseguita correttamente.");
|
logger.info("Sincronizzazione delle Letture eseguita correttamente.");
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
||||||
"Sincronizzazione delle letture eseguita corretamente.","")).build();
|
"Sincronizzazione delle letture eseguita corretamente.", "")).build();
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Errore nella sincronizzazione delle letture: {}", e.getLocalizedMessage(), e);
|
logger.error("Errore nella sincronizzazione delle letture: {}", e.getLocalizedMessage(), e);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res=new ResponseEntity<Object>(
|
||||||
"Errore nella sincronizzazione delle letture: {}", e.getLocalizedMessage())).build();
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /sync/writes} : Report from ePAS and
|
* {@code GET /sync/writes} : Report from ePAS and update SistemaInformativo.
|
||||||
* update SistemaInformativo.
|
|
||||||
*
|
*
|
||||||
* @param year the year.
|
* @param year the year.
|
||||||
* @param month the month.
|
* @param month the month.
|
||||||
* @return the {@link ResponseEntity} with status {@code 201 (Executed)}
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
* or with status {@code 400 (Bad Request)} if there is a error.
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sync/writes")
|
@GetMapping("/sync/writes")
|
||||||
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
public ResponseEntity<Void> syncWrites(@RequestParam("year") String year,
|
public ResponseEntity<Object> syncWrites(@RequestParam("year") String year, @RequestParam("month") String month)
|
||||||
@RequestParam("month") String month) throws URISyntaxException {
|
throws URISyntaxException {
|
||||||
logger.info("REST request syncWrites");
|
logger.info("REST request syncWrites");
|
||||||
|
|
||||||
ResponseEntity<Void> res;
|
ResponseEntity<Object> res;
|
||||||
try {
|
try {
|
||||||
syncService.executeWrites(year,month);
|
syncService.executeWrites(year, month);
|
||||||
String msg="Rendicontazione eseguita correttamente.";
|
String msg = "Rendicontazione eseguita correttamente.";
|
||||||
logger.info(msg);
|
logger.info(msg);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
|
||||||
msg,"")).build();
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Errore nella rendicontazione: {}", e.getLocalizedMessage(), e);
|
logger.error("Errore nella rendicontazione: {}", e.getLocalizedMessage(), e);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res=new ResponseEntity<Object>(
|
||||||
"Errore nella rendicontazione: {}", e.getLocalizedMessage())).build();
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /sync/writesOrario} : Report Orario from ePAS and
|
* {@code GET /sync/test} : Test api.
|
||||||
* update SistemaInformativo.
|
|
||||||
*
|
*
|
||||||
* @return the {@link ResponseEntity} with status {@code 201 (Executed)}
|
* @param year the year.
|
||||||
* or with status {@code 400 (Bad Request)} if there is a error.
|
* @param month the month.
|
||||||
*
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@GetMapping("/sync/test")
|
||||||
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
|
public ResponseEntity<Object> syncTest(@RequestParam("year") String year, @RequestParam("month") String month)
|
||||||
|
throws URISyntaxException {
|
||||||
|
logger.info("REST request syncTest");
|
||||||
|
|
||||||
|
ResponseEntity<Object> res;
|
||||||
|
try {
|
||||||
|
logger.info("Selezionato {} - {} ", year, month);
|
||||||
|
String msg = "Test eseguito correttamente.";
|
||||||
|
logger.info(msg);
|
||||||
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
|
||||||
|
//throw new Exception("Some errors in server!");
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("Errore nel test: {}", e.getLocalizedMessage(), e);
|
||||||
|
//res = ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).
|
||||||
|
// headers(HeaderUtil.createFailureAlert(applicationName, false, "Test", "Test", errore)).body(errore);
|
||||||
|
//res = ResponseEntity.noContent()
|
||||||
|
//.headers(HeaderUtil.createFailureAlert(applicationName, false, null, null, errore)).build();
|
||||||
|
res=new ResponseEntity<Object>(
|
||||||
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@code GET /sync/writesOrario} : Report Orario from ePAS and update
|
||||||
|
* SistemaInformativo.
|
||||||
|
*
|
||||||
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sync/writesOrario")
|
@GetMapping("/sync/writesOrario")
|
||||||
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
public ResponseEntity<Void> syncWritesOrario() throws URISyntaxException {
|
public ResponseEntity<Object> syncWritesOrario() throws URISyntaxException {
|
||||||
logger.info("REST request syncWritesOrario)");
|
logger.info("REST request syncWritesOrario)");
|
||||||
ResponseEntity<Void> res;
|
ResponseEntity<Object> res;
|
||||||
try {
|
try {
|
||||||
syncService.executeWritesOrario();
|
syncService.executeWritesOrario();
|
||||||
String msg="Rendicontazione dell'orario eseguita correttamente.";
|
String msg = "Rendicontazione dell'orario eseguita correttamente.";
|
||||||
logger.info(msg);
|
logger.info(msg);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
|
||||||
msg,"")).build();
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Errore nella rendicontazione dell'orario: {}", e.getLocalizedMessage(), e);
|
logger.error("Errore nella rendicontazione dell'orario: {}", e.getLocalizedMessage(), e);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res=new ResponseEntity<Object>(
|
||||||
"Errore nella rendicontazione dell'orario: {}", e.getLocalizedMessage())).build();
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /sync/writesTimeCards} : Reports TimeCards from ePAS
|
* {@code GET /sync/writesTimeCards} : Reports TimeCards from ePAS in
|
||||||
* in SistemaInformativo.
|
* SistemaInformativo.
|
||||||
*
|
*
|
||||||
* @param year the year.
|
* @param year the year.
|
||||||
* @param month the month.
|
* @param month the month.
|
||||||
* @return the {@link ResponseEntity} with status {@code 201 (Executed)}
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
* or with status {@code 400 (Bad Request)} if there is a error.
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sync/writesTimeCards")
|
@GetMapping("/sync/writesTimeCards")
|
||||||
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
public ResponseEntity<Void> syncWritesTimeCards(@RequestParam("year") String year,
|
public ResponseEntity<Object> syncWritesTimeCards(@RequestParam("year") String year,
|
||||||
@RequestParam("month") String month) throws URISyntaxException {
|
@RequestParam("month") String month) throws URISyntaxException {
|
||||||
logger.info("REST request syncWritesTimeCards)");
|
logger.info("REST request syncWritesTimeCards)");
|
||||||
ResponseEntity<Void> res;
|
ResponseEntity<Object> res;
|
||||||
try {
|
try {
|
||||||
syncService.executeWritesTimeCards(year,month);
|
syncService.executeWritesTimeCards(year, month);
|
||||||
String msg="Rendicontazione dei cartellini eseguita correttamente.";
|
String msg = "Rendicontazione dei cartellini eseguita correttamente.";
|
||||||
logger.info(msg);
|
logger.info(msg);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
|
||||||
msg,"")).build();
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Errore nella rendicontazione dei cartellini: {}", e.getLocalizedMessage(), e);
|
logger.error("Errore nella rendicontazione dei cartellini: {}", e.getLocalizedMessage(), e);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res=new ResponseEntity<Object>(
|
||||||
"Errore nella rendicontazione dei cartellini: {}", e.getLocalizedMessage())).build();
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@code GET /sync/writesOffSiteWorks} : Reports Off Site Works from ePAS
|
* {@code GET /sync/writesOffSiteWorks} : Reports Off Site Works from ePAS in
|
||||||
* in SistemaInformativo.
|
* SistemaInformativo.
|
||||||
*
|
*
|
||||||
* @param year the year.
|
* @param year the year.
|
||||||
* @param month the month.
|
* @param month the month.
|
||||||
* @return the {@link ResponseEntity} with status {@code 201 (Executed)}
|
* @return the {@link ResponseEntity} with status {@code 201 (Executed)} or with
|
||||||
* or with status {@code 400 (Bad Request)} if there is a error.
|
* status {@code 400 (Bad Request)} if there is a error.
|
||||||
*
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
@GetMapping("/sync/writesOffSiteWorks")
|
@GetMapping("/sync/writesOffSiteWorks")
|
||||||
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
@PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")")
|
||||||
public ResponseEntity<Void> syncWritesOffSiteWorks(@RequestParam("year") String year,
|
public ResponseEntity<Object> syncWritesOffSiteWorks(@RequestParam("year") String year,
|
||||||
@RequestParam("month") String month) throws URISyntaxException {
|
@RequestParam("month") String month) throws URISyntaxException {
|
||||||
logger.info("REST request syncWritesOffSiteWorks)");
|
logger.info("REST request syncWritesOffSiteWorks)");
|
||||||
ResponseEntity<Void> res;
|
ResponseEntity<Object> res;
|
||||||
try {
|
try {
|
||||||
syncService.executeWriteOffSiteWorks(year,month);
|
syncService.executeWriteOffSiteWorks(year, month);
|
||||||
String msg="Rendicontazione del lavoro fuori sede eseguita correttamente.";
|
String msg = "Rendicontazione del lavoro fuori sede eseguita correttamente.";
|
||||||
logger.info(msg);
|
logger.info(msg);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build();
|
||||||
msg,"")).build();
|
|
||||||
|
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("Errore nella rendicontazione del lavoro fuori sede: {}", e.getLocalizedMessage(), e);
|
logger.error("Errore nella rendicontazione del lavoro fuori sede: {}", e.getLocalizedMessage(), e);
|
||||||
res=ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName,
|
res=new ResponseEntity<Object>(
|
||||||
"Errore nella rendicontazione del lavoro fuori sede: {}", e.getLocalizedMessage())).build();
|
e.getLocalizedMessage(), new HttpHeaders(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,12 @@
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu" ngbDropdownMenu aria-labelledby="admin-menu">
|
<ul class="dropdown-menu" ngbDropdownMenu aria-labelledby="admin-menu">
|
||||||
|
<li>
|
||||||
|
<a class="dropdown-item" routerLink="operations/rendicontazione" routerLinkActive="active" (click)="collapseNavbar()">
|
||||||
|
<fa-icon icon="cloud" [fixedWidth]="true"></fa-icon>
|
||||||
|
<span>Rendicontazione</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" routerLink="operations/sync" routerLinkActive="active" (click)="collapseNavbar()">
|
<a class="dropdown-item" routerLink="operations/sync" routerLinkActive="active" (click)="collapseNavbar()">
|
||||||
<fa-icon icon="cloud" [fixedWidth]="true"></fa-icon>
|
<fa-icon icon="cloud" [fixedWidth]="true"></fa-icon>
|
||||||
|
|
|
@ -5,6 +5,13 @@ import { RouterModule } from '@angular/router';
|
||||||
imports: [
|
imports: [
|
||||||
RouterModule.forChild([
|
RouterModule.forChild([
|
||||||
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
|
/* jhipster-needle-add-entity-route - JHipster will add entity modules routes here */
|
||||||
|
{
|
||||||
|
path: 'rendicontazione',
|
||||||
|
loadChildren: () => import('./rendicontazione/rendicontazione.module').then(m => m.RendicontazioneModule),
|
||||||
|
data: {
|
||||||
|
pageTitle: 'Rendicontazione',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'sync',
|
path: 'sync',
|
||||||
loadChildren: () => import('./sync/sync.module').then(m => m.SyncModule),
|
loadChildren: () => import('./sync/sync.module').then(m => m.SyncModule),
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
<div class="table-responsive">
|
||||||
|
<h2 id="logs-page-heading">Rendicontazione</h2>
|
||||||
|
|
||||||
|
<jhi-alert-error></jhi-alert-error>
|
||||||
|
<jhi-alert></jhi-alert>
|
||||||
|
|
||||||
|
<p>Rendicontazione da ePAS a Sistema Informativo.</p>
|
||||||
|
|
||||||
|
<div class="page-min-height">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="annoRendicontazione">Anno</label>
|
||||||
|
<input type="number" class="form-control"
|
||||||
|
id="annoRendicontazione" name="annoRendicontazione" min="2000"
|
||||||
|
max="3000" [(ngModel)]="year">
|
||||||
|
<!-- <small id="rendicontaHelp" class="form-text text-muted">Inserire
|
||||||
|
il mese da rendicontare.</small> -->
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="meseRendicontazione">Mese</label>
|
||||||
|
<select id="meseRendicontazione" name="meseRendicontazione"
|
||||||
|
class="form-select form-control"
|
||||||
|
aria-label="Mese" [(ngModel)]="month" required>
|
||||||
|
<option value="1">Gennaio</option>
|
||||||
|
<option value="2">Febbraio</option>
|
||||||
|
<option value="3">Marzo</option>
|
||||||
|
<option value="4">Aprile</option>
|
||||||
|
<option value="5">Maggio</option>
|
||||||
|
<option value="6">Giugno</option>
|
||||||
|
<option value="7">Luglio</option>
|
||||||
|
<option value="8">Agosto</option>
|
||||||
|
<option value="9">Settembre</option>
|
||||||
|
<option value="10">Ottobre</option>
|
||||||
|
<option value="10">Novembre</option>
|
||||||
|
<option value="12">Dicembre</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
||||||
|
(click)="rendiconta()">Rendiconta</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div *ngIf="isLoading" class="d-flex justify-content-center">
|
||||||
|
<div class="spinner-border text-dark" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
import { RendicontazioneService } from './rendicontazione.service';
|
||||||
|
import { HttpErrorResponse } from '@angular/common/http';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'jhi-rendicontazione',
|
||||||
|
templateUrl: './rendicontazione.component.html',
|
||||||
|
styleUrls: ['rendicontazione.scss'],
|
||||||
|
})
|
||||||
|
export class RendicontazioneComponent implements OnInit {
|
||||||
|
year: number;
|
||||||
|
month: number;
|
||||||
|
isLoading = false; // hidden by default
|
||||||
|
|
||||||
|
constructor(private rendicontazioneService: RendicontazioneService) {
|
||||||
|
const date: Date = new Date();
|
||||||
|
this.year = date.getFullYear();
|
||||||
|
this.month = date.getMonth();
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {}
|
||||||
|
|
||||||
|
rendiconta(): void {
|
||||||
|
this.isLoading = true;
|
||||||
|
if (this.year == null || this.year <= 0) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Select the year');
|
||||||
|
this.isLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.month == null || this.month <= 0) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Select the month');
|
||||||
|
this.isLoading = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rendicontazioneService.rendiconta(this.year, this.month).subscribe(
|
||||||
|
() => this.onSuccess(),
|
||||||
|
error => this.onError(error)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private onSuccess(): void {
|
||||||
|
this.isLoading = false;
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Successo');
|
||||||
|
}
|
||||||
|
|
||||||
|
private onError(error: HttpErrorResponse): void {
|
||||||
|
this.isLoading = false;
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log('Errore Riscontrato');
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { RouterModule } from '@angular/router';
|
||||||
|
|
||||||
|
import { EpasmedSharedModule } from 'app/shared/shared.module';
|
||||||
|
import { RendicontazioneComponent } from './rendicontazione.component';
|
||||||
|
import { rendicontazioneRoute } from './rendicontazione.route';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [EpasmedSharedModule, RouterModule.forChild(rendicontazioneRoute)],
|
||||||
|
declarations: [RendicontazioneComponent],
|
||||||
|
entryComponents: [RendicontazioneComponent],
|
||||||
|
})
|
||||||
|
export class RendicontazioneModule {}
|
|
@ -0,0 +1,13 @@
|
||||||
|
import { Routes } from '@angular/router';
|
||||||
|
|
||||||
|
import { RendicontazioneComponent } from './rendicontazione.component';
|
||||||
|
|
||||||
|
export const rendicontazioneRoute: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: RendicontazioneComponent,
|
||||||
|
data: {
|
||||||
|
pageTitle: 'Rendicontazione',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
|
@ -0,0 +1,15 @@
|
||||||
|
@import '~bootstrap/scss/functions';
|
||||||
|
@import '~bootstrap/scss/variables';
|
||||||
|
|
||||||
|
button.btn.btn-outline-secondary.calendar,
|
||||||
|
button.btn.btn-outline-secondary.calendar:active {
|
||||||
|
width: 2.75rem;
|
||||||
|
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAcCAYAAAAEN20fAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEUSURBVEiJ7ZQxToVAEIY/YCHGxN6XGOIpnpaEsBSeQC9ArZbm9TZ6ADyBNzAhQGGl8Riv4BLAWAgmkpBYkH1b8FWT2WK/zJ8ZJ4qiI6XUI3ANnGKWBnht2/ZBDRK3hgVGNsCd7/ui+JkEIrKtqurLpEWaphd933+IyI3LEIdpCYCiKD6HcuOa/nwOa0ScJEnk0BJg0UTUWJRl6RxCYEzEmomsIlPU3IPW+grIAbquy+q6fluy/28RIBeRMwDXdXMgXLj/B2uimRXpui4D9sBeRLKl+1N+L+t6RwbWrZliTTTr1oxYtzVWiTQAcRxvTX+eJMnlUDaO1vpZRO5NS0x48sIwfPc87xg4B04MCzQi8hIEwe4bl1DnFMCN2zsAAAAASUVORK5CYII=') !important;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 23px;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-min-height {
|
||||||
|
min-height: 500px;
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
|
|
||||||
|
import { SERVER_API_URL } from 'app/app.constants';
|
||||||
|
|
||||||
|
@Injectable({ providedIn: 'root' })
|
||||||
|
export class RendicontazioneService {
|
||||||
|
constructor(private http: HttpClient) {}
|
||||||
|
|
||||||
|
rendiconta(year: number, month: number): Observable<{}> {
|
||||||
|
let queryParams = new HttpParams();
|
||||||
|
queryParams = queryParams.append('year', year + '');
|
||||||
|
queryParams = queryParams.append('month', month + '');
|
||||||
|
return this.http.get(SERVER_API_URL + 'api/sync/test', { params: queryParams });
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,23 +7,20 @@
|
||||||
|
|
||||||
<p>Sync Sistema Informativo ed ePAS.</p>
|
<p>Sync Sistema Informativo ed ePAS.</p>
|
||||||
|
|
||||||
|
<div class="page-min-height">
|
||||||
<div class="d-grid gap-2 d-md-block">
|
<form>
|
||||||
<ngb-datepicker (navigate)="dateNavigate($event)"
|
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
||||||
[showWeekdays]="false" class="datepicker-only-month-select"></ngb-datepicker>
|
(click)="sync('reads')">Reads</button>
|
||||||
|
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
||||||
|
(click)="sync('writes')">Writes</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
<div *ngIf="isLoading" class="d-flex justify-content-center">
|
||||||
(click)="sync('reads')">Reads</button>
|
<div class="spinner-border text-dark" role="status">
|
||||||
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
<span class="sr-only">Loading...</span>
|
||||||
(click)="sync('writes')">Writes</button>
|
</div>
|
||||||
</div>
|
|
||||||
<div *ngIf="isLoading" class="d-flex justify-content-center">
|
|
||||||
<div class="spinner-border text-dark" role="status">
|
|
||||||
<span class="sr-only">Loading...</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{{syncT}}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { NgbDatepickerNavigateEvent } from '@ng-bootstrap/ng-bootstrap';
|
// import { NgbDate } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
|
||||||
import { SyncType } from './sync.model';
|
import { SyncType } from './sync.model';
|
||||||
import { SyncService } from './sync.service';
|
import { SyncService } from './sync.service';
|
||||||
|
@ -7,6 +7,7 @@ import { SyncService } from './sync.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-sync',
|
selector: 'jhi-sync',
|
||||||
templateUrl: './sync.component.html',
|
templateUrl: './sync.component.html',
|
||||||
|
styleUrls: ['sync.scss'],
|
||||||
})
|
})
|
||||||
export class SyncComponent implements OnInit {
|
export class SyncComponent implements OnInit {
|
||||||
syncT: SyncType | null = null;
|
syncT: SyncType | null = null;
|
||||||
|
@ -50,16 +51,5 @@ export class SyncComponent implements OnInit {
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
dateNavigate($event: NgbDatepickerNavigateEvent): void {
|
|
||||||
this.year = $event.next.year;
|
|
||||||
this.month = $event.next.month;
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(this.year);
|
|
||||||
// eslint-disable-next-line no-console
|
|
||||||
console.log(this.month);
|
|
||||||
|
|
||||||
// old value is contained in $event.current
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
@import '~bootstrap/scss/functions';
|
||||||
|
@import '~bootstrap/scss/variables';
|
||||||
|
|
||||||
|
button.btn.btn-outline-secondary.calendar,
|
||||||
|
button.btn.btn-outline-secondary.calendar:active {
|
||||||
|
width: 2.75rem;
|
||||||
|
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAcCAYAAAAEN20fAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAEUSURBVEiJ7ZQxToVAEIY/YCHGxN6XGOIpnpaEsBSeQC9ArZbm9TZ6ADyBNzAhQGGl8Riv4BLAWAgmkpBYkH1b8FWT2WK/zJ8ZJ4qiI6XUI3ANnGKWBnht2/ZBDRK3hgVGNsCd7/ui+JkEIrKtqurLpEWaphd933+IyI3LEIdpCYCiKD6HcuOa/nwOa0ScJEnk0BJg0UTUWJRl6RxCYEzEmomsIlPU3IPW+grIAbquy+q6fluy/28RIBeRMwDXdXMgXLj/B2uimRXpui4D9sBeRLKl+1N+L+t6RwbWrZliTTTr1oxYtzVWiTQAcRxvTX+eJMnlUDaO1vpZRO5NS0x48sIwfPc87xg4B04MCzQi8hIEwe4bl1DnFMCN2zsAAAAASUVORK5CYII=') !important;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 23px;
|
||||||
|
background-position: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-min-height {
|
||||||
|
min-height: 500px;
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<div class="table-responsive">
|
||||||
|
<h2 id="logs-page-heading">Sync</h2>
|
||||||
|
|
||||||
|
<jhi-alert-error></jhi-alert-error>
|
||||||
|
|
||||||
|
<jhi-alert></jhi-alert>
|
||||||
|
|
||||||
|
<p>Sync Sistema Informativo ed ePAS.</p>
|
||||||
|
|
||||||
|
<div class="page-min-height">
|
||||||
|
<form>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="rendicontaData">Rendiconta</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<input id="rendicontaData" name="rendicontaData" class="form-control" placeholder="yyyy-mm" ngbDatepicker
|
||||||
|
#d="ngbDatepicker" (dateSelect)="dateNavigate($event)" required
|
||||||
|
[showWeekdays]="false" />
|
||||||
|
<button class="btn btn-outline-secondary calendar" (click)="d.toggle()" type="button"></button>
|
||||||
|
</div>
|
||||||
|
<!-- <small id="rendicontaHelp" class="form-text text-muted">Inserire
|
||||||
|
il mese da rendicontare.</small> -->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
||||||
|
(click)="sync('reads')">Reads</button>
|
||||||
|
<button class="btn btn-primary" type="button" [disabled]="isLoading"
|
||||||
|
(click)="sync('writes')">Writes</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<div *ngIf="isLoading" class="d-flex justify-content-center">
|
||||||
|
<div class="spinner-border text-dark" role="status">
|
||||||
|
<span class="sr-only">Loading...</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{syncT}}
|
||||||
|
</div>
|
||||||
|
|
|
@ -60,6 +60,13 @@ public class SyncResourceIT {
|
||||||
.andExpect(status().is2xxSuccessful());
|
.andExpect(status().is2xxSuccessful());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void syncTest() throws Exception {
|
||||||
|
restSyncMockMvc.perform(get("/api/sync/test?year="+YEAR+"&month="+MONTH))
|
||||||
|
.andExpect(status().is2xxSuccessful());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void syncWritesOrario() throws Exception {
|
public void syncWritesOrario() throws Exception {
|
||||||
restSyncMockMvc.perform(get("/api/sync/writesOrario"))
|
restSyncMockMvc.perform(get("/api/sync/writesOrario"))
|
||||||
|
|
Loading…
Reference in New Issue