From eb12311a600cd9214668643be39e4968a328ff8f Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 24 Oct 2022 16:31:38 +0200 Subject: [PATCH] Aggiornata gestione di Personale Orario --- .../epasmed/config/SyncConfiguration.java | 27 +- .../it/cnr/isti/epasmed/sync/SyncService.java | 43 ++- .../epasmed/web/rest/sync/SyncResource.java | 33 ++- src/main/webapp/app/entities/entity.module.ts | 7 + .../persorario-delete-dialog.component.html | 23 ++ .../persorario-delete-dialog.component.ts | 27 ++ .../persorario-detail.component.html | 69 +++++ .../persorario/persorario-detail.component.ts | 18 ++ .../persorario-update.component.html | 247 ++++++++++++++++++ .../persorario/persorario-update.component.ts | 119 +++++++++ .../persorario/persorario.component.html | 79 ++++++ .../persorario/persorario.component.ts | 97 +++++++ .../entities/persorario/persorario.model.ts | 43 +++ .../entities/persorario/persorario.module.ts | 16 ++ .../entities/persorario/persorario.route.ts | 53 ++++ .../entities/persorario/persorario.service.ts | 35 +++ .../app/layouts/navbar/navbar.component.html | 17 +- .../epasmed/web/rest/sync/SyncResourceIT.java | 34 ++- 18 files changed, 966 insertions(+), 21 deletions(-) create mode 100755 src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.html create mode 100755 src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario-detail.component.html create mode 100755 src/main/webapp/app/entities/persorario/persorario-detail.component.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario-update.component.html create mode 100755 src/main/webapp/app/entities/persorario/persorario-update.component.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario.component.html create mode 100755 src/main/webapp/app/entities/persorario/persorario.component.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario.model.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario.module.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario.route.ts create mode 100755 src/main/webapp/app/entities/persorario/persorario.service.ts diff --git a/src/main/java/it/cnr/isti/epasmed/config/SyncConfiguration.java b/src/main/java/it/cnr/isti/epasmed/config/SyncConfiguration.java index c45574e..ba4b1c8 100755 --- a/src/main/java/it/cnr/isti/epasmed/config/SyncConfiguration.java +++ b/src/main/java/it/cnr/isti/epasmed/config/SyncConfiguration.java @@ -24,10 +24,10 @@ public class SyncConfiguration { } @Scheduled(cron = "0 50 7 * * ?") - public void cronJobSch() { + public void cronJobSyncRead() { LocalDateTime start = LocalDateTime.now(); - logger.info("Scheduled Sync Start : {}", start); + logger.info("Scheduled Sync Read Start : {}", start); try { syncService.executeReads(); @@ -36,7 +36,28 @@ public class SyncConfiguration { } LocalDateTime end = LocalDateTime.now(); - logger.info("Scheduled Sync End : {}", end); + logger.info("Scheduled Sync Read End : {}", end); } + + @Scheduled(cron = "0 0 3 * * ?") + public void cronJobSyncWrite() { + + LocalDateTime start = LocalDateTime.now(); + logger.info("Scheduled Sync Write Start : {}", start); + String year=String.valueOf(start.getYear()); + String month=String.valueOf(start.getMonthValue()); + + + try { + syncService.executeWritesScheduled(year, month); + } catch (Exception e) { + logger.error(e.getLocalizedMessage(), e); + } + + LocalDateTime end = LocalDateTime.now(); + logger.info("Scheduled Sync Write End : {}", end); + + } + } diff --git a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java index e64cda2..58da0c9 100755 --- a/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java +++ b/src/main/java/it/cnr/isti/epasmed/sync/SyncService.java @@ -216,6 +216,15 @@ public class SyncService { siMasterLogService.closeFluxWrites(fluxId, writeTabs()); } + public void executeWritesScheduled(String year, String month) throws Exception { + setBWriteTables(); + List tabsSI = tabsSIService.getAllTabsSI(); + Long fluxId = siMasterLogService.startFluxWrites(); + writeScheduledData(fluxId, tabsSI, year, month); + siMasterLogService.closeFluxWrites(fluxId, writeTabs()); + } + + public void executeWritesOrario() throws Exception { setBWriteTables(); List tabsSI = tabsSIService.getAllTabsSI(); @@ -870,6 +879,38 @@ public class SyncService { return writeTabs; } + private void writeScheduledData(Long fluxId, List tabsSI, String year, String month) throws Exception { + logger.info("Report {}-{}", year, month); + LocalDateTime now = LocalDateTime.now(); + // checkValidMonthToSend(year, month); + + for (TabsSI tab : tabsSI) { + logger.info("TabSI: {}", tab); + if (tab.getOperazioni() != null && !tab.getOperazioni().isEmpty() + && tab.getOperazioni().compareTo("W") == 0) { + if (tab.getNome() == null || tab.getNome().isEmpty()) { + continue; + } + + switch (tab.getNome()) { + case "aspettative": + syncAspettative(fluxId, tab, year, month, now); + break; + case "orario": + syncOrario(fluxId, tab); + break; + case "pers_orario": + syncPersOrario(fluxId, tab, year, month, now); + break; + default: + break; + } + + } + } + } + + private void writeOrarioData(Long fluxId, List tabsSI) { for (TabsSI tab : tabsSI) { logger.info("TabSI: {}", tab); @@ -1513,7 +1554,7 @@ public class SyncService { } - logger.info("Peronale Orario scritto su SI: {}",count); + logger.info("Personale Orario scritto su SI: {}",count); logger.info("SIPersOrario Updated"); bpers_orario = true; diff --git a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java index 8432d27..1826d62 100755 --- a/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java +++ b/src/main/java/it/cnr/isti/epasmed/web/rest/sync/SyncResource.java @@ -72,7 +72,7 @@ public class SyncResource { * */ @GetMapping("/sync/writes") - @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") public ResponseEntity syncWrites(@RequestParam("year") String year, @RequestParam("month") String month) throws Exception { logger.info("REST request syncWrites"); @@ -85,6 +85,35 @@ public class SyncResource { return res; } + + /** + * {@code GET /sync/writesscheduled} : Report from ePAS and update SistemaInformativo scheduled info. + * + * @param year the year. + * @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. + * @throws Exception + * + * + */ + @GetMapping("/sync/writesscheduled") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") + public ResponseEntity syncWritesScheduled(@RequestParam("year") String year, @RequestParam("month") String month) + throws Exception { + logger.info("REST request syncWritesScheduled"); + + ResponseEntity res; + syncService.executeWritesScheduled(year, month); + String msg = "Sincronizzazione delle scritture schedulate eseguita correttamente."; + logger.info(msg); + res = ResponseEntity.noContent().headers(HeaderUtil.createAlert(applicationName, msg, "")).build(); + + return res; + } + + + /** * {@code GET /sync/test} : Test api. @@ -181,7 +210,7 @@ public class SyncResource { * */ @GetMapping("/sync/writesSingleTimeCards") - @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\")") + @PreAuthorize("hasAuthority(\"" + AuthoritiesConstants.ADMIN + "\",\""+AuthoritiesConstants.USER+"\")") public ResponseEntity syncSingleWritesTimeCards(@RequestParam("year") String year, @RequestParam("month") String month, @RequestParam("fiscalCode") String fc) throws Exception { logger.info("REST request syncSingleWritesTimeCards)"); diff --git a/src/main/webapp/app/entities/entity.module.ts b/src/main/webapp/app/entities/entity.module.ts index 831cb2c..0bf603e 100755 --- a/src/main/webapp/app/entities/entity.module.ts +++ b/src/main/webapp/app/entities/entity.module.ts @@ -26,6 +26,13 @@ import { RouterModule } from '@angular/router'; pageTitle: 'Leaves', }, }, + { + path: 'persorario', + loadChildren: () => import('./persorario/persorario.module').then(m => m.PersOrarioModule), + data: { + pageTitle: 'Pers Orario', + }, + }, ]), ], }) diff --git a/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.html b/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.html new file mode 100755 index 0000000..6834a13 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.html @@ -0,0 +1,23 @@ +
+ + + + + +
diff --git a/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.ts b/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.ts new file mode 100755 index 0000000..6431a76 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-delete-dialog.component.ts @@ -0,0 +1,27 @@ +import { Component } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { JhiEventManager } from 'ng-jhipster'; + +import { PersOrario } from './persorario.model'; +import { PersOrarioService } from './persorario.service'; + +@Component({ + selector: 'jhi-persorario-delete-dialog', + templateUrl: './persorario-delete-dialog.component.html', +}) +export class PersOrarioDeleteDialogComponent { + persOrario?: PersOrario; + + constructor(private persOrarioService: PersOrarioService, public activeModal: NgbActiveModal, private eventManager: JhiEventManager) {} + + cancel(): void { + this.activeModal.dismiss(); + } + + confirmDelete(id: string): void { + this.persOrarioService.delete(id).subscribe(() => { + this.eventManager.broadcast('persOrarioListModification'); + this.activeModal.close(); + }); + } +} diff --git a/src/main/webapp/app/entities/persorario/persorario-detail.component.html b/src/main/webapp/app/entities/persorario/persorario-detail.component.html new file mode 100755 index 0000000..45f6fbf --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-detail.component.html @@ -0,0 +1,69 @@ +
+
+
+

+ Personale Orario [{{ persOrario.id }}] +

+
+
Id
+
{{ persOrario.id }}
+ +
Id Persona
+
{{ persOrario.idPersona }}
+ +
Codice Fiscale
+
{{ persOrario.cf }}
+ +
Dal
+
{{ persOrario.dal }}
+ +
Al
+
{{ persOrario.al }}
+ +
Descrizione
+
{{ persOrario.descrizione }}
+ +
Lun
+
{{ persOrario.lun }}
+ +
Mar
+
{{ persOrario.mar }}
+ +
Mer
+
{{ persOrario.mer }}
+ +
Gio
+
{{ persOrario.gio }}
+ +
Ven
+
{{ persOrario.ven }}
+ +
Sab
+
{{ persOrario.sab }}
+ +
Percentuale
+
{{ persOrario.percentuale }}
+ +
Turno
+
{{ persOrario.turno }}
+ +
Ore Turno
+
{{ persOrario.oreTurno }}
+ +
Festivo
+
{{ persOrario.festivo }}
+ +
Notturno
+
{{ persOrario.notturno }}
+ +
Data Mod
+
{{ persOrario.dataMod }}
+ +
+ + +
+
+
diff --git a/src/main/webapp/app/entities/persorario/persorario-detail.component.ts b/src/main/webapp/app/entities/persorario/persorario-detail.component.ts new file mode 100755 index 0000000..b87f676 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-detail.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; + +import { PersOrario } from './persorario.model'; + +@Component({ + selector: 'jhi-persorario-detail', + templateUrl: './persorario-detail.component.html', +}) +export class PersOrarioDetailComponent implements OnInit { + persOrario: PersOrario | null = null; + + constructor(private route: ActivatedRoute) {} + + ngOnInit(): void { + this.route.data.subscribe(({ persOrario }) => (this.persOrario = persOrario)); + } +} diff --git a/src/main/webapp/app/entities/persorario/persorario-update.component.html b/src/main/webapp/app/entities/persorario/persorario-update.component.html new file mode 100755 index 0000000..6af0a62 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-update.component.html @@ -0,0 +1,247 @@ +
+
+
+

Create or edit Personale Orario

+ +
+ + +
+ +
+ + +
+ + +
+ This + field is required. +
+
+ +
+ + +
+ This field + is required. +
+
+ +
+ + +
+ + This field is required. +
+
+ +
+ + +
+ This + field is required. +
+
+ + +
+ + + +
+ + This field is required. +
+
+ +
+ + +
+ + This field is required. +
+
+ +
+ + +
+ + This field is required. +
+
+ +
+ + +
+ + This field is required. +
+
+
+ + +
+ + This field is required. +
+
+
+ + +
+ + This field is required. +
+
+
+ + +
+ + This field is required. +
+
+
+ + +
+ + This field is required. +
+
+ +
+ + +
+ + This field is required. +
+
+ +
+ + +
+ This + field is required. +
+
+ +
+ + +
+ This + field is required. +
+
+ +
+ + +
+ This + field is required. +
+
+ +
+ + +
+ This + field is required. +
+
+
+ +
+ + + +
+
+
+
diff --git a/src/main/webapp/app/entities/persorario/persorario-update.component.ts b/src/main/webapp/app/entities/persorario/persorario-update.component.ts new file mode 100755 index 0000000..8abda32 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario-update.component.ts @@ -0,0 +1,119 @@ +import { Component, OnInit } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; +import { ActivatedRoute } from '@angular/router'; + +import { PersOrario } from './persorario.model'; +import { PersOrarioService } from './persorario.service'; + +@Component({ + selector: 'jhi-persorario-update', + templateUrl: './persorario-update.component.html', +}) +export class PersOrarioUpdateComponent implements OnInit { + persOrario!: PersOrario; + isSaving = false; + + editForm = this.fb.group({ + id: [], + idPersona: ['', [Validators.required]], + cf: ['', [Validators.required]], + dal: ['', [Validators.required]], + al: [''], + descrizione: ['', [Validators.required]], + lun: [''], + mar: [''], + mer: [''], + gio: [''], + ven: [''], + sab: [''], + percentuale: [''], + turno: [''], + oreTurno: [''], + festivo: [''], + notturno: [''], + dataMod: ['', [Validators.required]], + }); + + constructor(private persOrarioService: PersOrarioService, private route: ActivatedRoute, private fb: FormBuilder) {} + + ngOnInit(): void { + this.route.data.subscribe(({ persOrario }) => { + if (persOrario) { + this.persOrario = persOrario; + this.updateForm(persOrario); + } + }); + } + + previousState(): void { + window.history.back(); + } + + save(): void { + this.isSaving = true; + this.updatePersOrario(this.persOrario); + if (this.persOrario.id !== undefined) { + this.persOrarioService.update(this.persOrario).subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } else { + this.persOrarioService.create(this.persOrario).subscribe( + () => this.onSaveSuccess(), + () => this.onSaveError() + ); + } + } + + private updateForm(persOrario: PersOrario): void { + this.editForm.patchValue({ + id: persOrario.id, + idPersona: persOrario.idPersona, + cf: persOrario.cf, + dal: persOrario.dal, + al: persOrario.al, + descrizione: persOrario.descrizione, + lun: persOrario.lun, + mar: persOrario.mar, + mer: persOrario.mer, + gio: persOrario.gio, + ven: persOrario.ven, + sab: persOrario.sab, + percentuale: persOrario.percentuale, + turno: persOrario.turno, + oreTurno: persOrario.oreTurno, + festivo: persOrario.festivo, + notturno: persOrario.notturno, + dataMod: persOrario.dataMod, + }); + } + + private updatePersOrario(persOrario: PersOrario): void { + persOrario.idPersona = this.editForm.get(['idPersona'])!.value; + persOrario.cf = this.editForm.get(['cf'])!.value; + persOrario.dal = this.editForm.get(['dal'])!.value; + persOrario.al = this.editForm.get(['al'])!.value; + persOrario.descrizione = this.editForm.get(['descrizione'])!.value; + persOrario.lun = this.editForm.get(['lun'])!.value; + persOrario.mar = this.editForm.get(['mar'])!.value; + persOrario.mer = this.editForm.get(['mer'])!.value; + persOrario.gio = this.editForm.get(['gio'])!.value; + persOrario.ven = this.editForm.get(['ven'])!.value; + persOrario.sab = this.editForm.get(['sab'])!.value; + persOrario.percentuale = this.editForm.get(['percentuale'])!.value; + persOrario.turno = this.editForm.get(['turno'])!.value; + persOrario.oreTurno = this.editForm.get(['oreTurno'])!.value; + persOrario.festivo = this.editForm.get(['festivo'])!.value; + persOrario.notturno = this.editForm.get(['notturno'])!.value; + persOrario.dataMod = this.editForm.get(['dataMod'])!.value; + } + + private onSaveSuccess(): void { + this.isSaving = false; + this.previousState(); + } + + private onSaveError(): void { + this.isSaving = false; + } +} diff --git a/src/main/webapp/app/entities/persorario/persorario.component.html b/src/main/webapp/app/entities/persorario/persorario.component.html new file mode 100755 index 0000000..d0dd45b --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.component.html @@ -0,0 +1,79 @@ +
+

+ Personale Orario + + +

+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Id Id PersonaCodice FiscaleDalAlDescrizioneData Mod
{{ persOrario.id }}{{ persOrario.idPersona }}{{ persOrario.cf }}{{ persOrario.dal }}{{ persOrario.al }}{{ persOrario.descrizione }}{{ persOrario.dataMod }} +
+ + + +
+
+
+ +
+
+ +
+ +
+ +
+
+
diff --git a/src/main/webapp/app/entities/persorario/persorario.component.ts b/src/main/webapp/app/entities/persorario/persorario.component.ts new file mode 100755 index 0000000..9076b19 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.component.ts @@ -0,0 +1,97 @@ +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 { PersOrarioService } from './persorario.service'; +import { PersOrario } from './persorario.model'; +import { PersOrarioDeleteDialogComponent } from './persorario-delete-dialog.component'; + +@Component({ + selector: 'jhi-persorario', + templateUrl: './persorario.component.html', +}) +export class PersOrarioComponent implements OnInit, OnDestroy { + persOrarioArray: PersOrario[] | null = null; + persOrarioListSubscription?: Subscription; + totalItems = 0; + itemsPerPage = ITEMS_PER_PAGE; + page!: number; + predicate!: string; + ascending!: boolean; + + constructor( + private persOrarioService: PersOrarioService, + private activatedRoute: ActivatedRoute, + private router: Router, + private eventManager: JhiEventManager, + private modalService: NgbModal + ) {} + + ngOnInit(): void { + this.persOrarioListSubscription = this.eventManager.subscribe('persOrarioListModification', () => this.loadAll()); + this.handleNavigation(); + } + + ngOnDestroy(): void { + if (this.persOrarioListSubscription) { + this.eventManager.destroy(this.persOrarioListSubscription); + } + } + + trackIdentity(index: number, item: PersOrario): any { + return item.id; + } + + deletePersOrario(persOrario: PersOrario): void { + const modalRef = this.modalService.open(PersOrarioDeleteDialogComponent, { size: 'lg', backdrop: 'static' }); + modalRef.componentInstance.persOrario = persOrario; + } + + 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.persOrarioService + .query({ + page: this.page - 1, + size: this.itemsPerPage, + sort: this.sort(), + }) + .subscribe((res: HttpResponse) => 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(persOrarioArray: PersOrario[] | null, headers: HttpHeaders): void { + this.totalItems = Number(headers.get('X-Total-Count')); + this.persOrarioArray = persOrarioArray; + } +} diff --git a/src/main/webapp/app/entities/persorario/persorario.model.ts b/src/main/webapp/app/entities/persorario/persorario.model.ts new file mode 100755 index 0000000..37d66f8 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.model.ts @@ -0,0 +1,43 @@ +export interface IPersOrario { + id?: any; + idPersona?: any; + cf?: string; + dal?: any; + al?: any; + descrizione?: string; + lun?: any; + mar?: any; + mer?: any; + gio?: any; + ven?: any; + sab?: any; + percentuale?: any; + turno?: string; + oreTurno?: any; + festivo?: string; + notturno?: string; + dataMod?: any; +} + +export class PersOrario implements IPersOrario { + constructor( + public id?: any, + public idPersona?: any, + public cf?: string, + public dal?: any, + public al?: any, + public descrizione?: string, + public lun?: any, + public mar?: any, + public mer?: any, + public gio?: any, + public ven?: any, + public sab?: any, + public percentuale?: any, + public turno?: string, + public oreTurno?: any, + public festivo?: string, + public notturno?: string, + public dataMod?: any + ) {} +} diff --git a/src/main/webapp/app/entities/persorario/persorario.module.ts b/src/main/webapp/app/entities/persorario/persorario.module.ts new file mode 100755 index 0000000..2bd51c2 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +import { EpasmedSharedModule } from 'app/shared/shared.module'; +import { PersOrarioComponent } from './persorario.component'; +import { PersOrarioDetailComponent } from './persorario-detail.component'; +import { PersOrarioUpdateComponent } from './persorario-update.component'; +import { PersOrarioDeleteDialogComponent } from './persorario-delete-dialog.component'; +import { persOrarioRoute } from './persorario.route'; + +@NgModule({ + imports: [EpasmedSharedModule, RouterModule.forChild(persOrarioRoute)], + declarations: [PersOrarioComponent, PersOrarioDetailComponent, PersOrarioUpdateComponent, PersOrarioDeleteDialogComponent], + entryComponents: [PersOrarioComponent], +}) +export class PersOrarioModule {} diff --git a/src/main/webapp/app/entities/persorario/persorario.route.ts b/src/main/webapp/app/entities/persorario/persorario.route.ts new file mode 100755 index 0000000..69bf922 --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.route.ts @@ -0,0 +1,53 @@ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot, Routes } from '@angular/router'; +import { Observable, of } from 'rxjs'; + +import { PersOrario, IPersOrario } from './persorario.model'; +import { PersOrarioService } from './persorario.service'; +import { PersOrarioComponent } from './persorario.component'; +import { PersOrarioDetailComponent } from './persorario-detail.component'; +import { PersOrarioUpdateComponent } from './persorario-update.component'; + +@Injectable({ providedIn: 'root' }) +export class PersOrarioResolve implements Resolve { + constructor(private service: PersOrarioService) {} + + resolve(route: ActivatedRouteSnapshot): Observable { + const id = route.params['id']; + if (id) { + return this.service.find(id); + } + return of(new PersOrario()); + } +} + +export const persOrarioRoute: Routes = [ + { + path: '', + component: PersOrarioComponent, + data: { + defaultSort: 'id,asc', + }, + }, + { + path: ':id/view', + component: PersOrarioDetailComponent, + resolve: { + persOrario: PersOrarioResolve, + }, + }, + { + path: 'new', + component: PersOrarioUpdateComponent, + resolve: { + persOrario: PersOrarioResolve, + }, + }, + { + path: ':id/edit', + component: PersOrarioUpdateComponent, + resolve: { + persOrario: PersOrarioResolve, + }, + }, +]; diff --git a/src/main/webapp/app/entities/persorario/persorario.service.ts b/src/main/webapp/app/entities/persorario/persorario.service.ts new file mode 100755 index 0000000..de8a27f --- /dev/null +++ b/src/main/webapp/app/entities/persorario/persorario.service.ts @@ -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 { IPersOrario } from './persorario.model'; + +@Injectable({ providedIn: 'root' }) +export class PersOrarioService { + public resourceUrl = SERVER_API_URL + 'api/persorario'; + + constructor(private http: HttpClient) {} + + query(req?: Pagination): Observable> { + const options = createRequestOption(req); + return this.http.get(this.resourceUrl, { params: options, observe: 'response' }); + } + + create(persOrario: IPersOrario): Observable { + return this.http.post(this.resourceUrl, persOrario); + } + + update(persOrario: IPersOrario): Observable { + return this.http.put(this.resourceUrl, persOrario); + } + + find(id: string): Observable { + return this.http.get(`${this.resourceUrl}/${id}`); + } + + delete(id: string): Observable<{}> { + return this.http.delete(`${this.resourceUrl}/${id}`); + } +} diff --git a/src/main/webapp/app/layouts/navbar/navbar.component.html b/src/main/webapp/app/layouts/navbar/navbar.component.html index 5a40f5d..886caad 100755 --- a/src/main/webapp/app/layouts/navbar/navbar.component.html +++ b/src/main/webapp/app/layouts/navbar/navbar.component.html @@ -33,16 +33,25 @@ Tabs SI + +
  • - TimeCards Reporting + Cartellini Rendicontazioni +
  • +
  • - Leaves + Aspettative + +
  • +
  • + + + Pers Orario
  • - -
  • +
  • Sync diff --git a/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java b/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java index 013efad..8fb143d 100755 --- a/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java +++ b/src/test/java/it/cnr/isti/epasmed/web/rest/sync/SyncResourceIT.java @@ -36,7 +36,6 @@ public class SyncResourceIT { private static final Logger logger = LoggerFactory.getLogger(SyncResourceIT.class); - private final Logger log = LoggerFactory.getLogger(getClass()); private static final String YEAR = "2022"; private static final String MONTH = "9"; @@ -111,24 +110,37 @@ public class SyncResourceIT { DateTimeFormatter formatter = new DateTimeFormatterBuilder().parseCaseInsensitive() .append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).optionalStart().appendPattern(".SSSSSS").optionalEnd() .optionalStart().appendZoneOrOffsetId().optionalEnd().toFormatter(); - //DateTimeFormatter formatterDataMod = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); - - Timestamp dataMod; + // DateTimeFormatter formatterDataMod = DateTimeFormatter.ofPattern("yyyy-MM-dd + // HH:mm:ss"); + + Timestamp dataMod; try { LocalDateTime dMod = LocalDateTime.parse("2021-02-03T19:49:05.231072", formatter); - dMod=dMod.truncatedTo(ChronoUnit.SECONDS); - //dMod= LocalDateTime.parse(dMod.format(formatterDataMod)); - //dataMod = Timestamp.valueOf(dMod.format(formatterDataMod)); + dMod = dMod.truncatedTo(ChronoUnit.SECONDS); + // dMod= LocalDateTime.parse(dMod.format(formatterDataMod)); + // dataMod = Timestamp.valueOf(dMod.format(formatterDataMod)); dataMod = Timestamp.valueOf(dMod); - - - + } catch (IllegalArgumentException | DateTimeParseException e) { logger.error("Invalid stamping data format: {}", e.getLocalizedMessage(), e); return; } + + logger.info("Result: {}", dataMod); + } + + @Test + public void testLocalData() throws Exception { + + LocalDateTime data = LocalDateTime.now(); + + logger.info("Data: {}", data); + logger.info("Year: {}", data.getYear()); + logger.info("Month: {}", data.getMonth()); + logger.info("Month Value: {}", data.getMonthValue()); + + - logger.info("Result: {}",dataMod); } }