From 18f28f1f39f0bc72ccbaebb84fbccbf787f0a2fc Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 2 Oct 2024 10:24:47 +0200 Subject: [PATCH] refs #731. Added exception UX --- .../calendar/calendar.component.html | 9 ++----- .../components/calendar/calendar.component.ts | 26 ++++++++++++++++--- .../create-calendar-rule.component.html | 19 +++++++++----- .../create-calendar.component.html | 3 ++- .../create-calendar.component.ts | 12 +++++++++ 5 files changed, 51 insertions(+), 18 deletions(-) diff --git a/ogWebconsole/src/app/components/calendar/calendar.component.html b/ogWebconsole/src/app/components/calendar/calendar.component.html index 990232f..9e6a6b6 100644 --- a/ogWebconsole/src/app/components/calendar/calendar.component.html +++ b/ogWebconsole/src/app/components/calendar/calendar.component.html @@ -23,12 +23,6 @@ - - - {{ image.downloadUrl ? image.downloadUrl.substring(0, 20) + '...' : '' }} - - - {{ column.cell(image) }} @@ -40,7 +34,8 @@ Acciones - + + diff --git a/ogWebconsole/src/app/components/calendar/calendar.component.ts b/ogWebconsole/src/app/components/calendar/calendar.component.ts index 0a1671d..d21d2d4 100644 --- a/ogWebconsole/src/app/components/calendar/calendar.component.ts +++ b/ogWebconsole/src/app/components/calendar/calendar.component.ts @@ -29,21 +29,27 @@ export class CalendarComponent implements OnInit { alertMessage: string | null = null; readonly panelOpenState = signal(false); datePipe: DatePipe = new DatePipe('es-ES'); + syncUds: boolean = false; columns = [ { columnDef: 'id', header: 'ID', - cell: (user: any) => `${user.id}`, + cell: (remoteCalendar: any) => `${remoteCalendar.id}`, }, { columnDef: 'name', header: 'Nombre', - cell: (user: any) => `${user.name}` + cell: (remoteCalendar: any) => `${remoteCalendar.name}` + }, + { + columnDef: 'rulesLength', + header: 'Nº de reglas', + cell: (remoteCalendar: any) => `${remoteCalendar.remoteCalendarRules.length}` }, { columnDef: 'createdAt', header: 'Fecha de creación', - cell: (user: any) => `${this.datePipe.transform(user.createdAt, 'dd/MM/yyyy hh:mm:ss')}`, + cell: (remoteCalendar: any) => `${this.datePipe.transform(remoteCalendar.createdAt, 'dd/MM/yyyy hh:mm:ss')}`, } ]; displayedColumns = [...this.columns.map(column => column.columnDef), 'actions']; @@ -88,6 +94,20 @@ export class CalendarComponent implements OnInit { sync(calendar: any): void { console.log('Syncing calendars'); + this.syncUds = true; + this.http.post(`${this.apiUrl}/${calendar.uuid}/sync-uds`, {}).subscribe({ + next: () => { + console.log('Calendars synced successfully'); + this.toastService.success('Calendarios sincronizados correctamente'); + this.search(); + this.syncUds = false; + }, + error: (error) => { + console.error('Error al sincronizar los calendarios:', error); + this.toastService.error(error.error['hydra:description']); + this.syncUds = false; + } + }); } editCalendar(calendar: any): void { diff --git a/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.html b/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.html index 8249a20..9fe6871 100644 --- a/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.html +++ b/ogWebconsole/src/app/components/calendar/create-calendar-rule/create-calendar-rule.component.html @@ -17,16 +17,15 @@ -
Hora de inicio - + Hora de fin - +
@@ -34,19 +33,19 @@
Razón - +
Fecha de inicio - + MM/DD/YYYY Fecha de fin - + MM/DD/YYYY @@ -57,5 +56,11 @@ - + diff --git a/ogWebconsole/src/app/components/calendar/create-calendar/create-calendar.component.html b/ogWebconsole/src/app/components/calendar/create-calendar/create-calendar.component.html index c90baeb..803f79b 100644 --- a/ogWebconsole/src/app/components/calendar/create-calendar/create-calendar.component.html +++ b/ogWebconsole/src/app/components/calendar/create-calendar/create-calendar.component.html @@ -23,7 +23,8 @@
{{ rule.isRemoteAvailable ? 'Disponible' : 'No disponible ( periodo presencial )' }}
{{ rule.busyFromHour }} - {{ rule.busyToHour }}
-
{{ rule.availableReason }} | {{ rule.busyFromHour }} - {{ rule.busyToHour }}
+
{{ rule.busyWeekDaysMap }}
+
{{ rule.availableReason }} | {{ rule.availableFromDate | date }} - {{ rule.availableToDate | date }}