mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
list events
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
export interface SharedCalendar {
|
||||||
|
TypeShare: number;
|
||||||
|
OwnerUserId: number;
|
||||||
|
Id: number;
|
||||||
|
CalendarId: string;
|
||||||
|
CalendarName: string;
|
||||||
|
CalendarRoleId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface OwnCalendar {
|
||||||
|
Id: number;
|
||||||
|
CalendarId: string;
|
||||||
|
CalendarName: string;
|
||||||
|
CalendarRoleId: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
// Define the schema for a single event
|
||||||
|
const eventListSchema = z.array(z.object({
|
||||||
|
HasAttachments: z.boolean(),
|
||||||
|
IsAllDayEvent: z.boolean(),
|
||||||
|
EventId: z.string(),
|
||||||
|
Subject: z.string(),
|
||||||
|
Location: z.string().nullable(),
|
||||||
|
CalendarId: z.string(),
|
||||||
|
CalendarName: z.string(),
|
||||||
|
StartDate: z.string(), // Ideally, you would validate this with a date regex or a specific date type if using Zod's date feature
|
||||||
|
EndDate: z.string(), // Same as above
|
||||||
|
Schedule: z.string(),
|
||||||
|
RequiredAttendees: z.string().nullable(),
|
||||||
|
OptionalAttendees: z.string().nullable(),
|
||||||
|
HumanDate: z.string(),
|
||||||
|
TimeZone: z.string(),
|
||||||
|
IsPrivate: z.boolean()
|
||||||
|
}));
|
||||||
|
|
||||||
|
export type EventList = z.infer<typeof eventListSchema>
|
||||||
@@ -30,10 +30,10 @@ import { BackgroundService } from 'src/app/services/background.service';
|
|||||||
import { ThemeService } from 'src/app/services/theme.service'
|
import { ThemeService } from 'src/app/services/theme.service'
|
||||||
import { SessionStore } from 'src/app/store/session.service';
|
import { SessionStore } from 'src/app/store/session.service';
|
||||||
import { PermissionService } from 'src/app/services/permission.service';
|
import { PermissionService } from 'src/app/services/permission.service';
|
||||||
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
import { RoleIdService } from 'src/app/services/role-id.service'
|
import { RoleIdService } from 'src/app/services/role-id.service'
|
||||||
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
|
||||||
import { ContactsService } from 'src/app/services/contacts.service';
|
|
||||||
import { Cy } from 'cypress/enum'
|
import { Cy } from 'cypress/enum'
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-agenda',
|
selector: 'app-agenda',
|
||||||
@@ -184,7 +184,8 @@ export class AgendaPage implements OnInit {
|
|||||||
private backgroundservice: BackgroundService,
|
private backgroundservice: BackgroundService,
|
||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
public p: PermissionService,
|
public p: PermissionService,
|
||||||
public RoleIdService: RoleIdService
|
public RoleIdService: RoleIdService,
|
||||||
|
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||||
) {
|
) {
|
||||||
|
|
||||||
this.dateAdapter.setLocale('es');
|
this.dateAdapter.setLocale('es');
|
||||||
@@ -280,13 +281,8 @@ export class AgendaPage implements OnInit {
|
|||||||
if (this.segment == null) {
|
if (this.segment == null) {
|
||||||
this.segment = "Combinado";
|
this.segment = "Combinado";
|
||||||
}
|
}
|
||||||
if (realoadCounter != 0) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.calendar.currentDate = new Date();
|
this.calendar.currentDate = new Date();
|
||||||
//this.onCurrentChanged(new Date())
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
@@ -425,6 +421,9 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
onCurrentChanged = (ev: Date) => {
|
onCurrentChanged = (ev: Date) => {
|
||||||
// timeline change date
|
// timeline change date
|
||||||
|
|
||||||
|
// console.log(new Date(ev))
|
||||||
|
|
||||||
this.timelineDate = momentG(new Date(ev), 'dd MMMM yyyy');
|
this.timelineDate = momentG(new Date(ev), 'dd MMMM yyyy');
|
||||||
|
|
||||||
this.monthNum = new Date(ev).getMonth()
|
this.monthNum = new Date(ev).getMonth()
|
||||||
@@ -435,8 +434,7 @@ export class AgendaPage implements OnInit {
|
|||||||
this.eventSelectedDate = new Date(ev);
|
this.eventSelectedDate = new Date(ev);
|
||||||
|
|
||||||
this.updateEventListBox();
|
this.updateEventListBox();
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
// onDropDownScrollWeal() {
|
// onDropDownScrollWeal() {
|
||||||
|
|
||||||
@@ -605,15 +603,7 @@ export class AgendaPage implements OnInit {
|
|||||||
this.rangeEndDate = endTime
|
this.rangeEndDate = endTime
|
||||||
this.showLoader = true;
|
this.showLoader = true;
|
||||||
|
|
||||||
const index = `${startTime}${endTime}`
|
this.loadRangeEventRun(startTime, endTime)
|
||||||
if (!this.loadRequest[index]) {
|
|
||||||
this.loadRequest[index] = { startTime, endTime }
|
|
||||||
this.loadRequestHistory[index] = { lastTimeUpdate: new Date() }
|
|
||||||
|
|
||||||
this.loadRangeEventRun(startTime, endTime)
|
|
||||||
} else {
|
|
||||||
// alert('other')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteLoadRangeEvent(startTime: Date, endTime: Date) {
|
deleteLoadRangeEvent(startTime: Date, endTime: Date) {
|
||||||
@@ -644,11 +634,10 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let load = 0;
|
let load = 0;
|
||||||
|
|
||||||
for (const selectedCalendar of selectedCalendarIds) {
|
for (const selectedCalendar of selectedCalendarIds) {
|
||||||
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.CalendarId).then((response: any) => {
|
|
||||||
|
this.AgendaDataRepositoryService.EventList({userId: selectedCalendar.OwnerUserId, calendarOwnerName: selectedCalendar['FullName'] }).subscribe( response => {
|
||||||
|
|
||||||
let label;
|
let label;
|
||||||
|
|
||||||
@@ -661,7 +650,6 @@ export class AgendaPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let eventsList = response;
|
let eventsList = response;
|
||||||
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.CalendarId)
|
|
||||||
this.CalendarStore.pushEvent(eventsList, label);
|
this.CalendarStore.pushEvent(eventsList, label);
|
||||||
|
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
@@ -669,9 +657,6 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
this.showTimelinePR = true;
|
this.showTimelinePR = true;
|
||||||
|
|
||||||
}).finally(() => {
|
|
||||||
this.deleteLoadRangeEvent(startTime, endTime);
|
|
||||||
|
|
||||||
load++
|
load++
|
||||||
if (load == selectedCalendarIds.length) {
|
if (load == selectedCalendarIds.length) {
|
||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
@@ -679,6 +664,18 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
this.myCal.update();
|
this.myCal.update();
|
||||||
this.myCal.loadEvents();
|
this.myCal.loadEvents();
|
||||||
|
this.updateEventListBox()
|
||||||
|
}, () => {
|
||||||
|
|
||||||
|
load++
|
||||||
|
if (load == selectedCalendarIds.length) {
|
||||||
|
this.showLoader = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.myCal.update();
|
||||||
|
this.myCal.loadEvents();
|
||||||
|
|
||||||
|
console.log('111b')
|
||||||
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
|
||||||
this.updateEventListBox()
|
this.updateEventListBox()
|
||||||
})
|
})
|
||||||
@@ -687,17 +684,15 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
selectedAgenda = {}
|
selectedAgenda = {}
|
||||||
|
|
||||||
getSelectedAgendaCalendars() {
|
getSelectedAgendaCalendars(): any {
|
||||||
|
|
||||||
if (this.CalendarName == 'PR+MDGPR') {
|
if (this.CalendarName == 'PR+MDGPR') {
|
||||||
|
|
||||||
let result = this.SessionStore.user.OwnerCalendars
|
return[{
|
||||||
|
...this.eventService.calendarNamesType['Meu calendario'],
|
||||||
|
OwnerUserId: this.SessionStore.user.UserId
|
||||||
|
}]
|
||||||
|
|
||||||
const pr = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PRES.toString())
|
|
||||||
const md = this.SessionStore.user.SharedCalendars.filter(e => e.CalendarRoleId == this.RoleIdService.PV.toString())
|
|
||||||
const join = pr.concat(md)
|
|
||||||
|
|
||||||
return result.concat(join)
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
const calendar = this.eventService.calendarNamesType[this.CalendarName];
|
const calendar = this.eventService.calendarNamesType[this.CalendarName];
|
||||||
@@ -708,23 +703,29 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
OwnerUserId: calendar.OwnerId,
|
||||||
CalendarId: Oficial,
|
CalendarId: Oficial,
|
||||||
OwnerId: calendar.OwnerId,
|
OwnerId: calendar.OwnerId,
|
||||||
CalendarName: calendar.CalendarName
|
CalendarName: calendar.CalendarName,
|
||||||
|
FullName: calendar.FullName
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
OwnerUserId: calendar.OwnerId,
|
||||||
OwnerId: calendar.OwnerId,
|
OwnerId: calendar.OwnerId,
|
||||||
CalendarId: Pessoal,
|
CalendarId: Pessoal,
|
||||||
CalendarName: calendar.CalendarName
|
CalendarName: calendar.CalendarName,
|
||||||
|
FullName: calendar.FullName
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
} else if (Oficial) {
|
} else if (Oficial) {
|
||||||
try {
|
try {
|
||||||
return [{
|
return [{
|
||||||
|
OwnerUserId: calendar.OwnerId,
|
||||||
OwnerId: calendar.OwnerId,
|
OwnerId: calendar.OwnerId,
|
||||||
CalendarId: Oficial,
|
CalendarId: Oficial,
|
||||||
CalendarName: calendar.CalendarName
|
CalendarName: calendar.CalendarName,
|
||||||
|
FullName: calendar.FullName
|
||||||
}]
|
}]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@@ -732,9 +733,11 @@ export class AgendaPage implements OnInit {
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
return [{
|
return [{
|
||||||
|
OwnerUserId: calendar.OwnerId,
|
||||||
OwnerId: calendar.OwnerId,
|
OwnerId: calendar.OwnerId,
|
||||||
CalendarId: Pessoal,
|
CalendarId: Pessoal,
|
||||||
CalendarName: calendar.CalendarName
|
CalendarName: calendar.CalendarName,
|
||||||
|
FullName: calendar.FullName
|
||||||
}]
|
}]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
@@ -743,8 +746,6 @@ export class AgendaPage implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateEventListBox() {
|
updateEventListBox() {
|
||||||
@@ -1139,8 +1140,8 @@ export class AgendaPage implements OnInit {
|
|||||||
reloadCalendar() {
|
reloadCalendar() {
|
||||||
//
|
//
|
||||||
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
|
||||||
|
this.updateEventListBox();
|
||||||
this.onCurrentChanged(new Date(this.timelineDate))
|
// this.onCurrentChanged(new Date(this.timelineDate))
|
||||||
}
|
}
|
||||||
|
|
||||||
async EventToApproveGoBack() {
|
async EventToApproveGoBack() {
|
||||||
|
|||||||
+1
-3
@@ -395,6 +395,7 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
try {
|
try {
|
||||||
loader.remove()
|
loader.remove()
|
||||||
await this.attachmentsService.AddAttachment(body).toPromise()
|
await this.attachmentsService.AddAttachment(body).toPromise()
|
||||||
|
this.LoadTaskDetail(this.serialNumber);
|
||||||
this.toastService._successMessage()
|
this.toastService._successMessage()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.status == 0) {
|
if (error.status == 0) {
|
||||||
@@ -405,9 +406,6 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
|
||||||
this.LoadTaskDetail(this.serialNumber);
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
|||||||
@@ -208,7 +208,6 @@ export class ExpedientePrPage implements OnInit {
|
|||||||
modal.onDidDismiss().then((res)=>{
|
modal.onDidDismiss().then((res)=>{
|
||||||
if(res){
|
if(res){
|
||||||
|
|
||||||
|
|
||||||
const data = res.data;
|
const data = res.data;
|
||||||
this.documents.push(data.selected);
|
this.documents.push(data.selected);
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { AgendaDataRepositoryService } from './agenda-data-repository.service';
|
||||||
|
|
||||||
|
describe('AgendaDataRepositoryService', () => {
|
||||||
|
let service: AgendaDataRepositoryService;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
TestBed.configureTestingModule({});
|
||||||
|
service = TestBed.inject(AgendaDataRepositoryService);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(service).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { AgendaDataService } from './agenda-data.service';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
import { ListEventMapper } from './mapper/EventListMapper';
|
||||||
|
import { EventMapper } from './mapper/EventDetailsMapper';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class AgendaDataRepositoryService {
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private agendaDataService: AgendaDataService
|
||||||
|
) {}
|
||||||
|
|
||||||
|
createEvent(eventData: any) {
|
||||||
|
return this.agendaDataService.createEvent(eventData).pipe(map(EventMapper.toDomain))
|
||||||
|
}
|
||||||
|
|
||||||
|
getEventById(id: string) {
|
||||||
|
return this.agendaDataService.getEvent(id).pipe(
|
||||||
|
map((response) => {
|
||||||
|
return EventMapper.toDomain(response.data)
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
EventList({userId = null, startDate = null, endDate = null, status= 2, category= null, type= null, calendarOwnerName = ''}) {
|
||||||
|
return this.agendaDataService.getEvents(userId, startDate, endDate, status, category, type).pipe(
|
||||||
|
map((response) => {
|
||||||
|
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
|
||||||
|
}
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
eventToApprove({userId, startDate = null, endDate = null, status = 0, category= null, type= null, calendarOwnerName = ''}) {
|
||||||
|
return this.agendaDataService.getEvents(userId, startDate = null, endDate = null, status, category= null, type= null).pipe(
|
||||||
|
map((response) => {
|
||||||
|
return ListEventMapper.toDomain(response.data, calendarOwnerName, userId)
|
||||||
|
}
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,9 +1,98 @@
|
|||||||
|
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { EventOutputDTO } from './model/eventDTOOutput';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class AgendaDataService {
|
export class AgendaDataService {
|
||||||
|
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
|
||||||
|
|
||||||
constructor() { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|
||||||
|
// Contacts Endpoints
|
||||||
|
getContacts(value: string): Observable<any> {
|
||||||
|
const params = new HttpParams().set('value', value);
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Contacts`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Documents Endpoints
|
||||||
|
getAttachments(subject: string, applicationType: number): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('Subject', subject)
|
||||||
|
.set('ApplicationType', applicationType.toString());
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Documents/Attachments`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
viewDocument(userId: number, docId: number, applicationId: number): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('userId', userId.toString())
|
||||||
|
.set('docId', docId.toString())
|
||||||
|
.set('applicationId', applicationId.toString());
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Documents/view`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Events Endpoints
|
||||||
|
createEvent(eventData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events`, eventData);
|
||||||
|
}
|
||||||
|
|
||||||
|
getEvents(userId: number, startDate: string, endDate: string, status: number, category: string, type: string): Observable<any> {
|
||||||
|
const params = new HttpParams()
|
||||||
|
.set('UserId', userId)
|
||||||
|
.set('Status', status)
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEvent(id: string, eventData: any): Observable<any> {
|
||||||
|
return this.http.put<any>(`${this.baseUrl}/Events/${id}`, eventData);
|
||||||
|
}
|
||||||
|
|
||||||
|
approveEvent(id: string): Observable<any> {
|
||||||
|
return this.http.patch<any>(`${this.baseUrl}/Events/${id}/Approval`, {});
|
||||||
|
}
|
||||||
|
|
||||||
|
getEvent(id: string): Observable<any> {
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteEvent(id: string, deleteAllEvents: boolean): Observable<any> {
|
||||||
|
const params = new HttpParams().set('DeleteAllEvents', deleteAllEvents.toString());
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
updateEventStatus(id: string, statusData: any): Observable<any> {
|
||||||
|
return this.http.patch<any>(`${this.baseUrl}/Events/${id}/Status`, statusData);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventAttendee(id: string, attendeeData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Attendee`, attendeeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEventAttendee(id: string, attendeeData: any): Observable<any> {
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}/Attendee`, { body: attendeeData });
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventAttachment(id: string, attachmentData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Attachment`, attachmentData);
|
||||||
|
}
|
||||||
|
|
||||||
|
removeEventAttachment(id: string, attachmentData: any): Observable<any> {
|
||||||
|
return this.http.delete<any>(`${this.baseUrl}/Events/${id}/Attachment`, { body: attachmentData });
|
||||||
|
}
|
||||||
|
|
||||||
|
communicateEvent(id: string, communicationData: any): Observable<any> {
|
||||||
|
return this.http.post<any>(`${this.baseUrl}/Events/${id}/Communicate`, communicationData);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Users Endpoints
|
||||||
|
getUsers(value: string): Observable<any> {
|
||||||
|
const params = new HttpParams().set('value', value);
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Users`, { params });
|
||||||
|
}
|
||||||
|
|
||||||
|
getToken(): Observable<any> {
|
||||||
|
return this.http.get<any>(`${this.baseUrl}/Users/token`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,103 +1,105 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const AttachCommunicationInputModel = z.object({
|
export const AttachCommunicationInputDTOSchema = z.object({
|
||||||
attachmentId: z.string().uuid(),
|
attachmentId: z.string().uuid(),
|
||||||
description: z.string().nullable().optional(),
|
description: z.string().nullable().optional(),
|
||||||
typeSharing: z.number().int(),
|
typeSharing: z.number().int(),
|
||||||
dateViewExpire: z.string().datetime().nullable().optional(),
|
dateViewExpire: z.string().datetime().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttachmentInputModel = z.object({
|
|
||||||
sourceId: z.string().nullable().optional(),
|
export const AttachmentInputDTOSchema = z.object({
|
||||||
sourceName: z.string().nullable().optional(),
|
sourceId: z.string().nullable(),
|
||||||
description: z.string().nullable().optional(),
|
sourceName: z.string().nullable(),
|
||||||
|
description: z.string().nullable(),
|
||||||
applicationId: z.number().int(),
|
applicationId: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeCommunicationInputModel = z.object({
|
|
||||||
|
export const AttendeeCommunicationInputDTOSchema = z.object({
|
||||||
attendeeId: z.string().uuid(),
|
attendeeId: z.string().uuid(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeExternalInputModel = z.object({
|
export const AttendeeExternalInputDTOSchema = z.object({
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
emailAddress: z.string().email().nullable().optional(),
|
emailAddress: z.string().email().nullable().optional(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const AttendeeInputModel = z.object({
|
export const AttendeeInputDTOSchema = z.object({
|
||||||
name: z.string().min(1),
|
name: z.string().min(1),
|
||||||
emailAddress: z.string().nullable().optional(),
|
emailAddress: z.string().nullable().optional(),
|
||||||
attendeeType: z.enum(["0", "1", "2"]),
|
attendeeType: z.enum(["0", "1", "2"]),
|
||||||
wxUserId: z.number().int(),
|
wxUserId: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EAttendeeType = z.enum(["0", "1", "2"]);
|
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
|
||||||
|
|
||||||
const EEventCategory = z.enum(["1", "2"]);
|
const EEventCategoryDTO = z.enum(["1", "2"]);
|
||||||
|
|
||||||
const EEventFilterCategory = z.enum(["1", "2", "3"]);
|
const EEventFilterCategoryDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const EEventFilterStatus = z.enum(["0", "1", "2", "3", "4", "5"]);
|
const EEventFilterStatusDTO = z.enum(["0", "1", "2", "3", "4", "5"]);
|
||||||
|
|
||||||
const EEventFilterType = z.enum(["1", "2", "3", "4"]);
|
const EEventFilterTypeDTO = z.enum(["1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EEventOwnerType = z.enum(["1", "2", "3"]);
|
const EEventOwnerTypeDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const EEventStatus = z.enum(["0", "1", "2", "3", "4"]);
|
const EEventStatusDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EEventType = z.enum(["1", "2", "3"]);
|
const EEventTypeDTO = z.enum(["1", "2", "3"]);
|
||||||
|
|
||||||
const ERecurringType = z.enum(["0", "1", "2", "3", "4"]);
|
const ERecurringTypeDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||||
|
|
||||||
const EventAddAttachmentModel = z.object({
|
const EventAddAttachmentDTOSchema = z.object({
|
||||||
attachments: z.array(AttachmentInputModel),
|
attachments: z.array(AttachmentInputDTOSchema),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventAddAttendeeModel = z.object({
|
const EventAddAttendeeDTOSchema = z.object({
|
||||||
attendees: z.array(AttendeeInputModel),
|
attendees: z.array(AttendeeInputDTOSchema),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventCommunicationInputModel = z.object({
|
export const EventCommunicationInputDTOSchema = z.object({
|
||||||
attachs: z.array(AttachCommunicationInputModel).nullable().optional(),
|
attachs: z.array(AttachCommunicationInputDTOSchema).nullable().optional(),
|
||||||
attendees: z.array(AttendeeCommunicationInputModel).nullable().optional(),
|
attendees: z.array(AttendeeCommunicationInputDTOSchema).nullable().optional(),
|
||||||
externalAttendees: z.array(AttendeeExternalInputModel).nullable().optional(),
|
externalAttendees: z.array(AttendeeExternalInputDTOSchema).nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventInputModel = z.object({
|
export const EventInputDTOSchema = z.object({
|
||||||
userId: z.number().int(),
|
userId: z.number().int(),
|
||||||
ownerType: EEventOwnerType,
|
ownerType: EEventOwnerTypeDTO,
|
||||||
subject: z.string().min(1),
|
subject: z.string().min(1),
|
||||||
body: z.string().min(1),
|
body: z.string().min(1),
|
||||||
location: z.string().nullable().optional(),
|
location: z.string().nullable().optional(),
|
||||||
startDate: z.string().datetime(),
|
startDate: z.string().datetime(),
|
||||||
endDate: z.string().datetime(),
|
endDate: z.string().datetime(),
|
||||||
type: EEventType,
|
type: EEventTypeDTO,
|
||||||
category: EEventCategory,
|
category: EEventCategoryDTO,
|
||||||
attendees: z.array(AttendeeInputModel).nullable().optional(),
|
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
|
||||||
attachments: z.array(AttachmentInputModel).nullable().optional(),
|
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
|
||||||
recurrence: z.object({
|
recurrence: z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}),
|
}),
|
||||||
organizerId: z.number().int(),
|
organizerId: z.number().int(),
|
||||||
isAllDayEvent: z.boolean(),
|
isAllDayEvent: z.boolean(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRecurrenceInputModel = z.object({
|
export const EventRecurrenceInputDTOSchema = z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRemoveAttachmentModel = z.object({
|
export const EventRemoveAttachmentDTOSchema = z.object({
|
||||||
attachments: z.array(z.string().uuid()),
|
attachments: z.array(z.string().uuid()),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventRemoveAttendeeModel = z.object({
|
export const EventRemoveAttendeeDTOSchema = z.object({
|
||||||
attendees: z.array(z.string().uuid()),
|
attendees: z.array(z.string().uuid()),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventUpdateModel = z.object({
|
export const EventUpdateDTOSchema = z.object({
|
||||||
subject: z.string().min(1),
|
subject: z.string().min(1),
|
||||||
body: z.string().min(1),
|
body: z.string().min(1),
|
||||||
location: z.string().min(1),
|
location: z.string().min(1),
|
||||||
@@ -106,17 +108,17 @@ const EventUpdateModel = z.object({
|
|||||||
isAllDayEvent: z.boolean(),
|
isAllDayEvent: z.boolean(),
|
||||||
updateAllEvents: z.boolean(),
|
updateAllEvents: z.boolean(),
|
||||||
recurrence: z.object({
|
recurrence: z.object({
|
||||||
frequency: ERecurringType,
|
frequency: ERecurringTypeDTO,
|
||||||
occurrences: z.number().int(),
|
occurrences: z.number().int(),
|
||||||
}),
|
}),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const EventUpdateStatusModel = z.object({
|
export const EventUpdateStatusDTOSchema = z.object({
|
||||||
status: EEventStatus,
|
status: EEventStatusDTO,
|
||||||
comment: z.string().nullable().optional(),
|
comment: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const ProblemDetails = z.object({
|
export const ProblemDetailsDTOSchema = z.object({
|
||||||
type: z.string().nullable().optional(),
|
type: z.string().nullable().optional(),
|
||||||
title: z.string().nullable().optional(),
|
title: z.string().nullable().optional(),
|
||||||
status: z.number().int().nullable().optional(),
|
status: z.number().int().nullable().optional(),
|
||||||
@@ -124,43 +126,77 @@ const ProblemDetails = z.object({
|
|||||||
instance: z.string().nullable().optional(),
|
instance: z.string().nullable().optional(),
|
||||||
}).strict();
|
}).strict();
|
||||||
|
|
||||||
const ResponseSimpleModel = z.object({
|
export const ResponseSimpleDTOSchema = z.object({
|
||||||
success: z.boolean(),
|
success: z.boolean(),
|
||||||
message: z.string().nullable().optional(),
|
message: z.string().nullable().optional(),
|
||||||
data: z.any().nullable().optional(),
|
data: z.any().nullable().optional(),
|
||||||
}).strict();
|
})
|
||||||
|
|
||||||
const Bearer = z.object({
|
|
||||||
type: z.literal('http'),
|
|
||||||
description: z.string().optional(),
|
|
||||||
scheme: z.literal('bearer'),
|
|
||||||
}).strict();
|
|
||||||
|
|
||||||
export {
|
const CommentSchema = z.object({
|
||||||
AttachCommunicationInputModel,
|
message: z.string(),
|
||||||
AttachmentInputModel,
|
createdAt: z.string(),
|
||||||
AttendeeCommunicationInputModel,
|
});
|
||||||
AttendeeExternalInputModel,
|
|
||||||
AttendeeInputModel,
|
const AttendeeSchema = z.object({
|
||||||
EAttendeeType,
|
id: z.string(),
|
||||||
EEventCategory,
|
name: z.string(),
|
||||||
EEventFilterCategory,
|
attendeeType: EAttendeeTypeDTO,
|
||||||
EEventFilterStatus,
|
emailAddress: z.string(),
|
||||||
EEventFilterType,
|
wxUserId: z.number(),
|
||||||
EEventOwnerType,
|
});
|
||||||
EEventStatus,
|
|
||||||
EEventType,
|
const OwnerSchema = z.object({
|
||||||
ERecurringType,
|
wxUserId: z.number(),
|
||||||
EventAddAttachmentModel,
|
wxFullName: z.string(),
|
||||||
EventAddAttendeeModel,
|
wxeMail: z.string(),
|
||||||
EventCommunicationInputModel,
|
userPhoto: z.string(),
|
||||||
EventInputModel,
|
});
|
||||||
EventRecurrenceInputModel,
|
|
||||||
EventRemoveAttachmentModel,
|
const OrganizerSchema = z.object({
|
||||||
EventRemoveAttendeeModel,
|
wxUserId: z.number(),
|
||||||
EventUpdateModel,
|
wxFullName: z.string(),
|
||||||
EventUpdateStatusModel,
|
wxeMail: z.string(),
|
||||||
ProblemDetails,
|
userPhoto: z.string(),
|
||||||
ResponseSimpleModel,
|
});
|
||||||
Bearer,
|
|
||||||
};
|
const EventOutputDTOSchema = z.object({
|
||||||
|
id: z.string(),
|
||||||
|
owner: OwnerSchema,
|
||||||
|
ownerType: z.string(),
|
||||||
|
subject: z.string(),
|
||||||
|
body: z.string(),
|
||||||
|
location: z.string(),
|
||||||
|
startDate: z.string(),
|
||||||
|
endDate: z.string(),
|
||||||
|
type: z.string(),
|
||||||
|
category: z.string(),
|
||||||
|
attendees: z.array(AttendeeSchema),
|
||||||
|
isRecurring: z.boolean(),
|
||||||
|
eventRecurrence: z.null(),
|
||||||
|
hasAttachments: z.boolean(),
|
||||||
|
attachments:z.array(AttachmentInputDTOSchema),
|
||||||
|
comments: z.array(CommentSchema),
|
||||||
|
isPrivate: z.boolean(),
|
||||||
|
isAllDayEvent: z.boolean(),
|
||||||
|
organizer: OrganizerSchema,
|
||||||
|
status: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
|
||||||
|
export type AttachCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type AttachmentInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type AttendeeCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type AttendeeExternalInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type AttendeeInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventAddAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventAddAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventCommunicationInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventRecurrenceInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventRemoveAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventRemoveAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventUpdateDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type EventUpdateStatusDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type ProblemDetailsDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
export type ResponseSimpleDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import { EventOutputDTO } from "../model/eventDTOOutput"
|
||||||
|
|
||||||
|
export class EventMapper {
|
||||||
|
|
||||||
|
constructor() {}
|
||||||
|
static toDomain(dto: EventOutputDTO) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
"HasAttachments": dto.hasAttachments,
|
||||||
|
"EventComunicationId": 1682,
|
||||||
|
"EventId": dto.id,
|
||||||
|
"Subject": dto.subject,
|
||||||
|
"Body": {
|
||||||
|
"BodyType": 1,
|
||||||
|
"Text": dto.body
|
||||||
|
},
|
||||||
|
"Location": dto.location,
|
||||||
|
"CalendarId": "",
|
||||||
|
"CalendarName": dto.category,
|
||||||
|
"StartDate": dto.startDate,
|
||||||
|
"EndDate": dto.endDate,
|
||||||
|
"EventType": "Single",
|
||||||
|
"Attendees": dto.attendees.map((e) => ({
|
||||||
|
Id: e.id,
|
||||||
|
EmailAddress: e.emailAddress,
|
||||||
|
Name: e.name,
|
||||||
|
IsRequired: e.attendeeType == '0' ? true : false,
|
||||||
|
UserType: "GD",
|
||||||
|
// "IsPR": false,
|
||||||
|
Acknowledgment: e.attendeeType == '0' ? true : false,
|
||||||
|
// "RoleDescription": null,
|
||||||
|
// "RoleId": 0
|
||||||
|
})),
|
||||||
|
"IsMeeting": dto.category,
|
||||||
|
"IsRecurring": dto.isRecurring,
|
||||||
|
"IsAllDayEvent": dto.isAllDayEvent,
|
||||||
|
"AppointmentState": 1,
|
||||||
|
"TimeZone": "UTC",
|
||||||
|
"Organizer": {
|
||||||
|
"Id": dto.organizer.wxUserId,
|
||||||
|
"EmailAddress": dto.organizer.wxeMail,
|
||||||
|
"Name": dto.organizer.wxFullName,
|
||||||
|
"IsRequired": true,
|
||||||
|
"UserType": 'GD',
|
||||||
|
"IsPR": dto.ownerType == 'PR',
|
||||||
|
//"Entity": null,
|
||||||
|
"Acknowledgment": true,
|
||||||
|
//"RoleDescription": null,
|
||||||
|
//"RoleId": 0
|
||||||
|
},
|
||||||
|
"InstanceId": null,
|
||||||
|
"Category": dto.type,
|
||||||
|
"EventRecurrence": {
|
||||||
|
"Type": -1,
|
||||||
|
"Day": null,
|
||||||
|
"DayOfWeek": null,
|
||||||
|
"Month": null,
|
||||||
|
"LastOccurrence": null
|
||||||
|
},
|
||||||
|
"Attachments": dto.attachments.map( e => ({
|
||||||
|
"Id": e.sourceId,
|
||||||
|
// "ParentId": "AAMkADVhOGY3ZDQzLTg4ZGEtNDYxMC1iMzc5LTJkMDgwNjMxOWFlZQBGAAAAAABEDW9nKs69TKQcVqQURj8YBwBR2HR2eO7pSpNdD9cc70l+AAAAAAFKAABR2HR2eO7pSpNdD9cc70l+AACK2OeJAAA=",
|
||||||
|
// "Source": 1,
|
||||||
|
"SourceId": e.sourceId,
|
||||||
|
// "Description": "teste pp",
|
||||||
|
"SourceName": e.sourceName,
|
||||||
|
// "CreateDate": "2024-05-24 16:41",
|
||||||
|
// "Stakeholders": "",
|
||||||
|
// "Link": "",
|
||||||
|
// "Data": null,
|
||||||
|
"ApplicationId": e.applicationId,
|
||||||
|
// "FileSize": 301208
|
||||||
|
|
||||||
|
})),
|
||||||
|
"IsPrivate": dto.isPrivate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static toDTO(data: any): any {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
import { EventList } from "src/app/models/entiry/agenda/eventList"
|
||||||
|
import { EventListOutputDTO } from "../model/eventListDTOOutput"
|
||||||
|
|
||||||
|
|
||||||
|
function getTextInsideParentheses(inputString): string {
|
||||||
|
var startIndex = inputString.indexOf('(');
|
||||||
|
var endIndex = inputString.indexOf(')');
|
||||||
|
if (startIndex !== -1 && endIndex !== -1) {
|
||||||
|
return inputString.substring(startIndex + 1, endIndex);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class ListEventMapper {
|
||||||
|
static toDomain(dto: EventListOutputDTO, calendarOwnerName: string, userId: string): EventList {
|
||||||
|
return dto.map((e) => ({
|
||||||
|
"HasAttachments": e.hasAttachments,
|
||||||
|
"IsAllDayEvent": e.isAllDayEvent,
|
||||||
|
"EventId": e.id,
|
||||||
|
"Subject": e.subject,
|
||||||
|
"Location": e.location,
|
||||||
|
"CalendarId": userId,
|
||||||
|
"CalendarName": e.category,
|
||||||
|
"StartDate": new Date(e.startDate) + '',
|
||||||
|
"EndDate": new Date(e.endDate)+ '',
|
||||||
|
"Schedule": calendarOwnerName,
|
||||||
|
"RequiredAttendees": null as any,
|
||||||
|
"OptionalAttendees": null as any,
|
||||||
|
"HumanDate": "2 semanas atrás" as any,
|
||||||
|
"TimeZone": getTextInsideParentheses(new Date(e.startDate)+ ''),
|
||||||
|
"IsPrivate": false as any
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
|
static toDTO() {}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
export const AttachmentInputDTOSchema = z.object({
|
||||||
|
sourceId: z.string().nullable(),
|
||||||
|
sourceName: z.string().nullable(),
|
||||||
|
description: z.string().nullable(),
|
||||||
|
applicationId: z.number().int(),
|
||||||
|
}).strict();
|
||||||
|
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
|
||||||
|
|
||||||
|
|
||||||
|
const CommentSchema = z.object({
|
||||||
|
message: z.string(),
|
||||||
|
createdAt: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const AttendeeSchema = z.object({
|
||||||
|
id: z.string(),
|
||||||
|
name: z.string(),
|
||||||
|
attendeeType: EAttendeeTypeDTO,
|
||||||
|
emailAddress: z.string(),
|
||||||
|
wxUserId: z.number(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const OwnerSchema = z.object({
|
||||||
|
wxUserId: z.number(),
|
||||||
|
wxFullName: z.string(),
|
||||||
|
wxeMail: z.string(),
|
||||||
|
userPhoto: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
const OrganizerSchema = z.object({
|
||||||
|
wxUserId: z.number(),
|
||||||
|
wxFullName: z.string(),
|
||||||
|
wxeMail: z.string(),
|
||||||
|
userPhoto: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const EventOutputDTOSchema = z.object({
|
||||||
|
id: z.string(),
|
||||||
|
owner: OwnerSchema,
|
||||||
|
ownerType: z.string(),
|
||||||
|
subject: z.string(),
|
||||||
|
body: z.string(),
|
||||||
|
location: z.string(),
|
||||||
|
startDate: z.string(),
|
||||||
|
endDate: z.string(),
|
||||||
|
type: z.string(),
|
||||||
|
category: z.string(),
|
||||||
|
attendees: z.array(AttendeeSchema),
|
||||||
|
isRecurring: z.boolean(),
|
||||||
|
eventRecurrence: z.null(),
|
||||||
|
hasAttachments: z.boolean(),
|
||||||
|
attachments:z.array(AttachmentInputDTOSchema),
|
||||||
|
comments: z.array(CommentSchema),
|
||||||
|
isPrivate: z.boolean(),
|
||||||
|
isAllDayEvent: z.boolean(),
|
||||||
|
organizer: OrganizerSchema,
|
||||||
|
status: z.string(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export type EventOutputDTO = z.infer<typeof EventOutputDTOSchema>
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
const EventSchema = z.array(z.object({
|
||||||
|
id: z.string(),
|
||||||
|
owner: z.string().nullable(),
|
||||||
|
ownerType: z.enum(['MD','PR', 'Other']), // Assuming "MD" is the only valid option based on provided data
|
||||||
|
subject: z.string(),
|
||||||
|
body: z.string(),
|
||||||
|
location: z.string(),
|
||||||
|
startDate: z.string().datetime({ offset: true }),
|
||||||
|
endDate: z.string().datetime({ offset: true }),
|
||||||
|
type: z.enum(['Meeting', 'Travel']),
|
||||||
|
category: z.enum(['Oficial', 'Pessoal']), // Assuming "Oficial" is the only valid option based on provided data
|
||||||
|
isRecurring: z.boolean(),
|
||||||
|
eventRecurrence: z.null(),
|
||||||
|
hasAttachments: z.boolean(),
|
||||||
|
isPrivate: z.boolean(),
|
||||||
|
isAllDayEvent: z.boolean(),
|
||||||
|
status: z.enum(['Approved']), // Assuming "Approved" is the only valid option based on provided data
|
||||||
|
}))
|
||||||
|
|
||||||
|
export type EventListOutputDTO = z.infer<typeof EventSchema>;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
const EventToApproveList = z.object({
|
||||||
|
id: z.string().uuid(),
|
||||||
|
owner: z.string().nullable(),
|
||||||
|
ownerType: z.enum(["PR", "MD", "Other"]),
|
||||||
|
subject: z.string(),
|
||||||
|
body: z.string(),
|
||||||
|
location: z.string(),
|
||||||
|
startDate: z.string().datetime(),
|
||||||
|
endDate: z.string().datetime(),
|
||||||
|
type: z.enum(["Meeting"]),
|
||||||
|
category: z.enum(["Oficial", "Pessoal"]),
|
||||||
|
isRecurring: z.boolean(),
|
||||||
|
eventRecurrence: z.any().nullable(),
|
||||||
|
hasAttachments: z.boolean(),
|
||||||
|
isPrivate: z.boolean(),
|
||||||
|
isAllDayEvent: z.boolean(),
|
||||||
|
status: z.enum(["Pending"])
|
||||||
|
});
|
||||||
@@ -284,6 +284,7 @@ export class EventsService {
|
|||||||
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName+'Id'] = OwnerCalendar.CalendarId
|
this.calendarNamesType['Meu calendario'][OwnerCalendar.CalendarName+'Id'] = OwnerCalendar.CalendarId
|
||||||
this.calendarNamesType['Meu calendario']['RoleId'] = OwnerCalendar.CalendarRoleId
|
this.calendarNamesType['Meu calendario']['RoleId'] = OwnerCalendar.CalendarRoleId
|
||||||
this.calendarNamesType['Meu calendario']['OwnerId'] = OwnerCalendar.OwnerUserId || SessionStore.user.UserId
|
this.calendarNamesType['Meu calendario']['OwnerId'] = OwnerCalendar.OwnerUserId || SessionStore.user.UserId
|
||||||
|
this.calendarNamesType['Meu calendario']['FullName'] = SessionStore.user.FullName
|
||||||
}
|
}
|
||||||
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
for (let sharedCalendar of SessionStore.user.SharedCalendars) {
|
||||||
this.hasAnyCalendar = true
|
this.hasAnyCalendar = true
|
||||||
@@ -318,6 +319,7 @@ export class EventsService {
|
|||||||
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
|
this.calendarNamesType[e.FullName][sharedCalendar.CalendarName+'Id'] = sharedCalendar.CalendarId
|
||||||
this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
|
this.calendarNamesType[e.FullName]['RoleId'] = sharedCalendar.CalendarRoleId
|
||||||
this.calendarNamesType[e.FullName]['OwnerId'] = sharedCalendar.OwnerUserId
|
this.calendarNamesType[e.FullName]['OwnerId'] = sharedCalendar.OwnerUserId
|
||||||
|
this.calendarNamesType[e.FullName]['Shared'] = sharedCalendar.OwnerUserId
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
|||||||
import { EventsService } from 'src/app/services/events.service';
|
import { EventsService } from 'src/app/services/events.service';
|
||||||
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-event-list',
|
selector: 'app-event-list',
|
||||||
templateUrl: './event-list.page.html',
|
templateUrl: './event-list.page.html',
|
||||||
@@ -43,6 +43,7 @@ export class EventListPage implements OnInit {
|
|||||||
private router: Router,
|
private router: Router,
|
||||||
private sortService: SortService,
|
private sortService: SortService,
|
||||||
public eventService: EventsService,
|
public eventService: EventsService,
|
||||||
|
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||||
) {
|
) {
|
||||||
this.loggeduser = SessionStore.user;
|
this.loggeduser = SessionStore.user;
|
||||||
}
|
}
|
||||||
@@ -121,8 +122,12 @@ export class EventListPage implements OnInit {
|
|||||||
this.showLoader = false;
|
this.showLoader = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
alert('my agenda')
|
||||||
this.eventoaprovacaostore.save(segment, this.eventsList)
|
this.eventoaprovacaostore.save(segment, this.eventsList)
|
||||||
|
|
||||||
|
let a = await this.AgendaDataRepositoryService.eventToApprove({userId: this.SessionStore.user.UserId}).toPromise()
|
||||||
|
|
||||||
|
|
||||||
} else if(segment) {
|
} else if(segment) {
|
||||||
// console.log('segment', segment)
|
// console.log('segment', segment)
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ import { NavigationExtras, Router } from '@angular/router';
|
|||||||
import { EventController } from 'src/app/controller/event'
|
import { EventController } from 'src/app/controller/event'
|
||||||
import { DateService } from 'src/app/services/date.service';
|
import { DateService } from 'src/app/services/date.service';
|
||||||
import { EventList } from 'src/app/models/agenda/AgendaEventList';
|
import { EventList } from 'src/app/models/agenda/AgendaEventList';
|
||||||
|
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-view-event',
|
selector: 'app-view-event',
|
||||||
templateUrl: './view-event.page.html',
|
templateUrl: './view-event.page.html',
|
||||||
@@ -65,7 +67,8 @@ export class ViewEventPage implements OnInit {
|
|||||||
public ThemeService: ThemeService,
|
public ThemeService: ThemeService,
|
||||||
private httpErrorHandle: HttpErrorHandle,
|
private httpErrorHandle: HttpErrorHandle,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private dateService: DateService
|
private dateService: DateService,
|
||||||
|
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||||
) {
|
) {
|
||||||
this.isEventEdited = false;
|
this.isEventEdited = false;
|
||||||
this.loadedEvent = new Event();
|
this.loadedEvent = new Event();
|
||||||
@@ -123,52 +126,24 @@ export class ViewEventPage implements OnInit {
|
|||||||
setTimeZone() {
|
setTimeZone() {
|
||||||
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
this.TimeZoneString = this.loadedEvent.TimeZone.split(')')[1]
|
||||||
}
|
}
|
||||||
loadEvent() {
|
async loadEvent() {
|
||||||
|
|
||||||
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
|
try {
|
||||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
|
||||||
|
|
||||||
res = this.dateService.fixDate(res as any)
|
let res = await this.AgendaDataRepositoryService.getEventById(this.eventId).toPromise()
|
||||||
this.loadedEvent = res;
|
console.log('Loaded Event', res)
|
||||||
|
res = this.dateService.fixDate(res as any)
|
||||||
|
this.loadedEvent = res as any;
|
||||||
|
this.setTimeZone()
|
||||||
|
// this.addEventToDb(res);
|
||||||
|
|
||||||
this.setTimeZone()
|
|
||||||
|
|
||||||
this.today = new Date(res.StartDate);
|
} catch (error) {
|
||||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
this.viewEventDetailDismiss.emit({
|
||||||
}, (error)=> {
|
type: 'close'
|
||||||
|
})
|
||||||
|
|
||||||
this.viewEventDetailDismiss.emit({
|
// this.httpErrorHandle.httpStatusHandle(error)
|
||||||
type: 'close'
|
|
||||||
})
|
|
||||||
|
|
||||||
this.httpErrorHandle.httpStatusHandle(error)
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
|
|
||||||
if(this.CalendarId) {
|
|
||||||
|
|
||||||
this.eventsService.genericGetEvent(this.eventId, this.CalendarId).subscribe(res => {
|
|
||||||
|
|
||||||
res = this.dateService.fixDate(res as any)
|
|
||||||
/* const div = document.createElement("div")
|
|
||||||
div.innerHTML = res.Body.Text
|
|
||||||
res.Body.Text = div.innerText */
|
|
||||||
this.loadedEvent = res;
|
|
||||||
// console.log('Event details',res)
|
|
||||||
this.setTimeZone()
|
|
||||||
|
|
||||||
this.today = new Date(res.StartDate);
|
|
||||||
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
|
|
||||||
}, (error)=> {
|
|
||||||
|
|
||||||
this.viewEventDetailDismiss.emit({
|
|
||||||
type: 'close'
|
|
||||||
})
|
|
||||||
|
|
||||||
this.httpErrorHandle.httpStatusHandle(error)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,7 +197,7 @@
|
|||||||
{{last ? scrollToBottom() : ''}}
|
{{last ? scrollToBottom() : ''}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.t == 'ul'" class="info-text-leave">
|
<div *ngIf="msg.t == 'ul'" class="info-text-leave">
|
||||||
<div *ngFor="let user of allUsers">
|
<div *ngFor="let user of ChatSystemService.users">
|
||||||
<div *ngIf="msg.msg == user.username">
|
<div *ngIf="msg.msg == user.username">
|
||||||
<ion-label>{{user.name}} saiu do grupo</ion-label><br />
|
<ion-label>{{user.name}} saiu do grupo</ion-label><br />
|
||||||
</div>
|
</div>
|
||||||
@@ -205,7 +205,7 @@
|
|||||||
{{last ? scrollToBottom() : ''}}
|
{{last ? scrollToBottom() : ''}}
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="msg.t == 'ru'" class="info-text-leave">
|
<div *ngIf="msg.t == 'ru'" class="info-text-leave">
|
||||||
<div *ngFor="let user of allUsers">
|
<div *ngFor="let user of ChatSystemService.users">
|
||||||
<div *ngIf="msg.msg == user.username">
|
<div *ngIf="msg.msg == user.username">
|
||||||
<ion-label>{{user.name}} foi removido do grupo</ion-label><br />
|
<ion-label>{{user.name}} foi removido do grupo</ion-label><br />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -145,8 +145,10 @@ export class OptsExpedientePage implements OnInit {
|
|||||||
window['attachments-expediente-update']();
|
window['attachments-expediente-update']();
|
||||||
this.toastService._successMessage()
|
this.toastService._successMessage()
|
||||||
this.popoverController.dismiss()
|
this.popoverController.dismiss()
|
||||||
|
loader.remove()
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
this.httpErrorHanlde.httpStatusHandle(error)
|
this.httpErrorHanlde.httpStatusHandle(error)
|
||||||
|
loader.remove()
|
||||||
},()=> {
|
},()=> {
|
||||||
loader.remove()
|
loader.remove()
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { SHA1 } from 'crypto-js'
|
import { SHA1 } from 'crypto-js'
|
||||||
import { localstoreService } from './localstore.service'
|
import { localstoreService } from './localstore.service'
|
||||||
import { EventList, EventListStore } from '../models/agenda/AgendaEventList';
|
import { EventListStore } from '../models/agenda/AgendaEventList';
|
||||||
|
import { EventList } from '../models/entiry/agenda/eventList';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
@@ -9,7 +10,7 @@ import { EventList, EventListStore } from '../models/agenda/AgendaEventList';
|
|||||||
|
|
||||||
export class CalendarService {
|
export class CalendarService {
|
||||||
|
|
||||||
private _eventSource : EventListStore[] = []
|
public _eventSource : EventListStore[] = []
|
||||||
private keyName: string;
|
private keyName: string;
|
||||||
|
|
||||||
localstoreService = localstoreService
|
localstoreService = localstoreService
|
||||||
@@ -71,10 +72,11 @@ export class CalendarService {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pushEvent(eventsList: EventList[], profile: 'pr' | 'md') {
|
pushEvent(eventsList: EventList, profile: 'pr' | 'md') {
|
||||||
|
|
||||||
let news = []
|
let news = []
|
||||||
eventsList.forEach((element, eventIndex) => {
|
eventsList.forEach((element, eventIndex) => {
|
||||||
|
|
||||||
news.push({
|
news.push({
|
||||||
startTime: new Date(element.StartDate),
|
startTime: new Date(element.StartDate),
|
||||||
endTime: new Date(element.EndDate),
|
endTime: new Date(element.EndDate),
|
||||||
@@ -104,11 +106,11 @@ export class CalendarService {
|
|||||||
}, 10)
|
}, 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventsByCalendarIds(ids:any[]): EventListStore[] {
|
getEventsByCalendarIds(ids:Object[]): EventListStore[] {
|
||||||
|
|
||||||
let result = [];
|
let result = [];
|
||||||
for (const calendar of ids) {
|
for (const calendar of ids) {
|
||||||
const events = this._eventSource.filter(e => e.CalendarId == calendar.CalendarId)
|
const events = this._eventSource.filter(e => e.CalendarId == calendar['OwnerUserId'])
|
||||||
result = result.concat(events)
|
result = result.concat(events)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,12 +20,10 @@ var weekV = new Array('Do', 'Seg', 'Terç', 'Qua', 'Qui', 'Sex', 'Sáb');
|
|||||||
class momentG {
|
class momentG {
|
||||||
static run(date, formate , wgs){
|
static run(date, formate , wgs){
|
||||||
|
|
||||||
if(typeof date.getMonth != 'function') {
|
|
||||||
date = new Date(date)
|
if(! date instanceof Date){
|
||||||
if(! date instanceof Date){
|
date = new Date(date)
|
||||||
throw new UserException('Invalid date formate momentG');
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let toChange = {}
|
let toChange = {}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user