mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
merge
This commit is contained in:
@@ -4,8 +4,8 @@ export class Attachment {
|
||||
Source?: Sources;
|
||||
ApplicationId: number
|
||||
CreateDate: string
|
||||
Data: null| string
|
||||
Description:string
|
||||
Data: null | string
|
||||
Description: string
|
||||
Link: null
|
||||
SourceId: string
|
||||
SourceName: string
|
||||
@@ -13,8 +13,7 @@ export class Attachment {
|
||||
//Data: any;
|
||||
}
|
||||
|
||||
export enum Sources
|
||||
{
|
||||
export enum Sources {
|
||||
Undefined = 0,
|
||||
webTRIX = 1,
|
||||
K2 = 2,
|
||||
@@ -35,3 +34,20 @@ export class EventAttachment {
|
||||
SourceTitle: string;
|
||||
|
||||
}
|
||||
|
||||
export class EventAttachment_v2 {
|
||||
|
||||
sourceId: string;
|
||||
sourceName: string;
|
||||
description: string
|
||||
applicationId: number
|
||||
|
||||
}
|
||||
|
||||
export class Atendees_v2 {
|
||||
name: string;
|
||||
emailAddress: string;
|
||||
attendeeType: string;
|
||||
wxUserId: number;
|
||||
IsRequired: boolean;
|
||||
}
|
||||
@@ -403,7 +403,7 @@
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar class="footer-toolbar px-20">
|
||||
<ion-buttons slot="start">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
|
||||
<ion-label>Gravar</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ModalController, NavParams, Platform } from '@ionic/angular';
|
||||
import { EventAttachment } from 'src/app/models/attachment.model';
|
||||
import { EventAttachment, EventAttachment_v2 } from 'src/app/models/attachment.model';
|
||||
import { EventBody } from 'src/app/models/eventbody.model';
|
||||
import { EventPerson } from 'src/app/models/eventperson.model';
|
||||
import { SearchList } from 'src/app/models/search-document';
|
||||
@@ -27,6 +27,8 @@ import { momentG } from 'src/plugin/momentG';
|
||||
import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE, ThemePalette } from '@angular/material/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { MomentDateAdapter } from '@angular/material-moment-adapter';
|
||||
import { EventInputDTO } from '../../../services/Repositorys/Agenda/agendaDataModels';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -57,7 +59,7 @@ const MY_DATE_FORMAT = {
|
||||
providers: [
|
||||
{ provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },
|
||||
{ provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE] },
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMAT }
|
||||
{ provide: MAT_DATE_FORMATS, useValue: MY_DATE_FORMAT }
|
||||
]
|
||||
})
|
||||
|
||||
@@ -130,7 +132,8 @@ export class NewEventPage implements OnInit {
|
||||
public TaskService: TaskService,
|
||||
private contactsService: ContactsService,
|
||||
private domSanitazerService: DomSanitizerService,
|
||||
private dateAdapter: DateAdapter<Date>
|
||||
private dateAdapter: DateAdapter<Date>,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.postEvent = new Event();
|
||||
@@ -420,6 +423,29 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
save_v2() {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
|
||||
if (new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()) {
|
||||
this.toastService._badRequest("Data de inicio menor que a data de fim")
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.agendaDataRepository.createEvent(this.postEvent,this.CalendarName,this.documents);
|
||||
loader.remove()
|
||||
this.modalController.dismiss();
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
this.injectValidation()
|
||||
@@ -532,6 +558,7 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
//This method return calendar id
|
||||
selectedCalendarId() {
|
||||
|
||||
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') {
|
||||
@@ -546,6 +573,21 @@ export class NewEventPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
//This method return calendar onwner user id
|
||||
selectedCalendarUserId() {
|
||||
|
||||
if (this.eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postEvent.CalendarName == 'Oficial') {
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postEvent.CalendarName == 'Pessoal') {
|
||||
|
||||
return this.eventService.calendarNamesType[this.CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
changeAgenda() {
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -900,13 +942,13 @@ export class NewEventPage implements OnInit {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.StartDate = this.setAlldayTime(this.postEvent.StartDate)
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDate(this.postEvent.EndDate)
|
||||
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
this.postEvent.EndDate = this.setAlldayTimeEndDateNotAlday(this.postEvent.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@ import { AgendaDataService } from './agenda-data.service';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ListEventMapper } from './mapper/EventListMapper';
|
||||
import { EventMapper } from './mapper/EventDetailsMapper';
|
||||
import { Utils } from './utils';
|
||||
import { EventInputDTO } from './agendaDataModels';
|
||||
import { Event } from 'src/app/models/event.model';
|
||||
import { SessionStore } from 'src/app/store/session.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
@@ -10,12 +14,9 @@ import { EventMapper } from './mapper/EventDetailsMapper';
|
||||
export class AgendaDataRepositoryService {
|
||||
|
||||
constructor(
|
||||
private agendaDataService: AgendaDataService
|
||||
) {}
|
||||
|
||||
createEvent(eventData: any) {
|
||||
return this.agendaDataService.createEvent(eventData).pipe(map(EventMapper.toDomain))
|
||||
}
|
||||
private agendaDataService: AgendaDataService,
|
||||
private utils: Utils
|
||||
) { }
|
||||
|
||||
getEventById(id: string) {
|
||||
return this.agendaDataService.getEvent(id).pipe(
|
||||
@@ -41,4 +42,71 @@ export class AgendaDataRepositoryService {
|
||||
))
|
||||
}
|
||||
|
||||
createEvent(eventData: Event,CalendarName,documents) {
|
||||
console.log(eventData)
|
||||
|
||||
let eventInput = {
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName,eventData) as any,
|
||||
ownerType: this.utils.selectedCalendarOwner(CalendarName),
|
||||
subject: eventData.Subject,
|
||||
body: eventData.Body.Text,
|
||||
location: eventData.Location,
|
||||
startDate: eventData.StartDate.toISOString(),
|
||||
endDate: eventData.EndDate.toISOString(),
|
||||
type: this.utils.calendarTypeSeleted(eventData.Category),
|
||||
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
|
||||
attendees: this.utils.attendeesAdded(eventData.Attendees),
|
||||
attachments: this.utils.documentAdded(documents),
|
||||
recurrence: {
|
||||
frequency: 0,
|
||||
occurrences: 0,
|
||||
},
|
||||
organizerId: SessionStore.user.UserId,
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
}
|
||||
|
||||
this.agendaDataService.createEvent(eventInput).subscribe((value) => {
|
||||
console.log(value)
|
||||
},((error) => {
|
||||
console.log('create event',error)
|
||||
}));
|
||||
}
|
||||
|
||||
updateEvent(eventId,eventData: Event,CalendarName,documents) {
|
||||
console.log(this.utils.editeEventCalendarUserId(CalendarName,eventData));
|
||||
|
||||
let eventInput = {
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName,eventData),
|
||||
ownerType: this.utils.selectedCalendarOwner(CalendarName),
|
||||
subject: eventData.Subject,
|
||||
body: eventData.Body.Text,
|
||||
location: eventData.Location,
|
||||
startDate: JSON.stringify(eventData.StartDate),
|
||||
endDate: JSON.stringify(eventData.EndDate),
|
||||
type: this.utils.calendarTypeSeleted(eventData.Category),
|
||||
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
|
||||
attendees: this.utils.attendeesAdded(eventData.Attendees),
|
||||
attachments: this.utils.documentAdded(documents),
|
||||
recurrence: {
|
||||
frequency: 0,
|
||||
occurrences: 0,
|
||||
},
|
||||
organizerId: SessionStore.user.UserId,
|
||||
isAllDayEvent: eventData.IsAllDayEvent,
|
||||
}
|
||||
|
||||
this.agendaDataService.updateEvent(eventId, eventInput).subscribe((value) => {
|
||||
console.log(value)
|
||||
},((error) => {
|
||||
console.log(error)
|
||||
}));
|
||||
}
|
||||
|
||||
deleteEvent(eventId) {
|
||||
this.agendaDataService.deleteEvent(eventId,false).subscribe(() => {
|
||||
console.log()
|
||||
},((error) => {
|
||||
console.log(error)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@ import { EventOutputDTO } from './model/eventDTOOutput';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
|
||||
export class AgendaDataService {
|
||||
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
|
||||
|
||||
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 });
|
||||
@@ -45,6 +45,10 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events`, { params });
|
||||
}
|
||||
|
||||
getEvent(id: string): Observable<any> {
|
||||
return this.http.get<any>(`${this.baseUrl}/Events/${id}`);
|
||||
}
|
||||
|
||||
updateEvent(id: string, eventData: any): Observable<any> {
|
||||
return this.http.put<any>(`${this.baseUrl}/Events/${id}`, eventData);
|
||||
}
|
||||
@@ -53,10 +57,6 @@ export class AgendaDataService {
|
||||
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 });
|
||||
@@ -92,6 +92,7 @@ export class AgendaDataService {
|
||||
return this.http.get<any>(`${this.baseUrl}/Users`, { params });
|
||||
}
|
||||
|
||||
|
||||
getToken(): Observable<any> {
|
||||
return this.http.get<any>(`${this.baseUrl}/Users/token`);
|
||||
}
|
||||
|
||||
@@ -9,9 +9,9 @@ export const AttachCommunicationInputDTOSchema = z.object({
|
||||
|
||||
|
||||
export const AttachmentInputDTOSchema = z.object({
|
||||
sourceId: z.string().nullable(),
|
||||
sourceName: z.string().nullable(),
|
||||
description: z.string().nullable(),
|
||||
sourceId: z.string().nullable().optional(),
|
||||
sourceName: z.string().nullable().optional(),
|
||||
description: z.string().nullable().optional(),
|
||||
applicationId: z.number().int(),
|
||||
}).strict();
|
||||
|
||||
@@ -30,27 +30,27 @@ export const AttendeeExternalInputDTOSchema = z.object({
|
||||
export const AttendeeInputDTOSchema = z.object({
|
||||
name: z.string().min(1),
|
||||
emailAddress: z.string().nullable().optional(),
|
||||
attendeeType: z.enum(["0", "1", "2"]),
|
||||
attendeeType: z.number(),
|
||||
wxUserId: z.number().int(),
|
||||
}).strict();
|
||||
|
||||
const EAttendeeTypeDTO = z.enum(["0", "1", "2"]);
|
||||
const EAttendeeTypeDTO = z.number();
|
||||
|
||||
const EEventCategoryDTO = z.enum(["1", "2"]);
|
||||
const EEventCategoryDTO = z.number();
|
||||
|
||||
const EEventFilterCategoryDTO = z.enum(["1", "2", "3"]);
|
||||
const EEventFilterCategoryDTO = z.number();
|
||||
|
||||
const EEventFilterStatusDTO = z.enum(["0", "1", "2", "3", "4", "5"]);
|
||||
const EEventFilterStatusDTO = z.number();
|
||||
|
||||
const EEventFilterTypeDTO = z.enum(["1", "2", "3", "4"]);
|
||||
const EEventFilterTypeDTO = z.number();
|
||||
|
||||
const EEventOwnerTypeDTO = z.enum(["1", "2", "3"]);
|
||||
const EEventOwnerTypeDTO = z.number();
|
||||
|
||||
const EEventStatusDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||
const EEventStatusDTO = z.number();
|
||||
|
||||
const EEventTypeDTO = z.enum(["1", "2", "3"]);
|
||||
const EEventTypeDTO = z.number();
|
||||
|
||||
const ERecurringTypeDTO = z.enum(["0", "1", "2", "3", "4"]);
|
||||
const ERecurringTypeDTO = z.number();
|
||||
|
||||
const EventAddAttachmentDTOSchema = z.object({
|
||||
attachments: z.array(AttachmentInputDTOSchema),
|
||||
@@ -79,7 +79,7 @@ export const EventInputDTOSchema = z.object({
|
||||
attendees: z.array(AttendeeInputDTOSchema).nullable().optional(),
|
||||
attachments: z.array(AttachmentInputDTOSchema).nullable().optional(),
|
||||
recurrence: z.object({
|
||||
frequency: ERecurringTypeDTO,
|
||||
frequency: z.number().int(),
|
||||
occurrences: z.number().int(),
|
||||
}),
|
||||
organizerId: z.number().int(),
|
||||
@@ -87,7 +87,7 @@ export const EventInputDTOSchema = z.object({
|
||||
}).strict();
|
||||
|
||||
export const EventRecurrenceInputDTOSchema = z.object({
|
||||
frequency: ERecurringTypeDTO,
|
||||
frequency: z.number().int(),
|
||||
occurrences: z.number().int(),
|
||||
}).strict();
|
||||
|
||||
@@ -108,7 +108,7 @@ export const EventUpdateDTOSchema = z.object({
|
||||
isAllDayEvent: z.boolean(),
|
||||
updateAllEvents: z.boolean(),
|
||||
recurrence: z.object({
|
||||
frequency: ERecurringTypeDTO,
|
||||
frequency: z.number().int(),
|
||||
occurrences: z.number().int(),
|
||||
}),
|
||||
}).strict();
|
||||
@@ -133,57 +133,6 @@ export const ResponseSimpleDTOSchema = z.object({
|
||||
})
|
||||
|
||||
|
||||
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(),
|
||||
});
|
||||
|
||||
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>;
|
||||
@@ -192,7 +141,7 @@ 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 EventInputDTO = z.infer<typeof EventInputDTOSchema>;
|
||||
export type EventRecurrenceInputDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||
export type EventRemoveAttachmentDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||
export type EventRemoveAttendeeDTO = z.infer<typeof AttachCommunicationInputDTOSchema>;
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AgendaDataService } from './agenda-data.service';
|
||||
import { EventsService } from '../../events.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class Utils {
|
||||
constructor(
|
||||
private agendaDataService: AgendaDataService,
|
||||
public eventService: EventsService,
|
||||
) { }
|
||||
|
||||
|
||||
selectedCalendarUserId(CalendarName,postEvent) {
|
||||
|
||||
if (this.eventService.calendarNamesType[CalendarName]?.['Oficial'] && postEvent.CalendarName == 'Oficial') {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarName]?.['Pessoal'] && postEvent.CalendarName == 'Pessoal') {
|
||||
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return '11:11'
|
||||
}
|
||||
}
|
||||
|
||||
editeEventCalendarUserId(CalendarName,postEvent) {
|
||||
|
||||
let CalendarNameOwnerName = this.eventService.detectCalendarNameByCalendarId(postEvent.CalendarId)
|
||||
if(this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial'] && this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Oficial']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else if (this.eventService.calendarNamesType[CalendarNameOwnerName]?.['Pessoal']) {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
|
||||
} else {
|
||||
return this.eventService.calendarNamesType[CalendarName]['OwnerId']
|
||||
}
|
||||
}
|
||||
|
||||
selectedCalendarOwner(CalendarName) {
|
||||
let selectedCalendar = this.eventService.calendarNamesType[CalendarName]?.['RoleId'];
|
||||
|
||||
if (selectedCalendar) {
|
||||
if (selectedCalendar.Role == 100000014) {
|
||||
return 1;
|
||||
} else if (selectedCalendar.Role == 100000011) {
|
||||
return 2
|
||||
} else {
|
||||
return 3
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
calendarCategorySeleted(calendarName) {
|
||||
var selectedCalendar = {
|
||||
'Oficial': 1,
|
||||
'Pessoal': 2
|
||||
}
|
||||
return selectedCalendar[calendarName];
|
||||
}
|
||||
|
||||
calendarTypeSeleted(calendarName) {
|
||||
var selectedType = {
|
||||
'Reunião': 1,
|
||||
'Viagem': 2,
|
||||
'Conferência': 3,
|
||||
'Encontro': 1
|
||||
}
|
||||
return selectedType[calendarName];
|
||||
}
|
||||
|
||||
documentAdded(documents:any[]) {
|
||||
return documents.map((e) => {
|
||||
return {
|
||||
sourceId: e.Id,
|
||||
sourceName: e.Assunto,
|
||||
description: "",
|
||||
applicationId: parseInt(e.ApplicationType.toString())
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
atendeesSeletedType(type) {
|
||||
var selectedType = {
|
||||
'true': 1,
|
||||
'false':2,
|
||||
'other':3,
|
||||
}
|
||||
return selectedType[type];
|
||||
}
|
||||
|
||||
|
||||
attendeesAdded(taskParticipants: any[]) {
|
||||
return taskParticipants.map((e) => {
|
||||
return {
|
||||
name: e.Name,
|
||||
emailAddress: e.EmailAddress,
|
||||
attendeeType: this.atendeesSeletedType(JSON.stringify(e.IsRequired)),
|
||||
wxUserId: e.Id,
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -365,7 +365,7 @@
|
||||
<ion-footer class="ion-no-border">
|
||||
<ion-toolbar class="width-100 d-flex justify-space-between px-20">
|
||||
<ion-buttons slot="start">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
|
||||
<ion-label>Gravar</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
|
||||
@@ -16,6 +16,7 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { ContactsService } from 'src/app/services/contacts.service'
|
||||
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-edit-event',
|
||||
@@ -103,10 +104,14 @@ export class EditEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private contactsService: ContactsService,
|
||||
private domSanitizeService: DomSanitizerService
|
||||
) {}
|
||||
private domSanitizeService: DomSanitizerService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
console.log(this.postEvent)
|
||||
this._postEvent = this.postEvent
|
||||
this.allDayCheck = this.postEvent.IsAllDayEvent;
|
||||
if(!this.restoreTemporaryData()) {
|
||||
@@ -337,6 +342,19 @@ export class EditEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
save_v2() {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
return false
|
||||
}
|
||||
this.showLoader = true;
|
||||
this.agendaDataRepository.updateEvent(this._postEvent.EventId, this._postEvent,this._postEvent.CalendarName,this.loadedEventAttachments);
|
||||
this.showLoader = false;
|
||||
this.httpErrorHandle.httpsSucessMessagge('Editar evento')
|
||||
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@
|
||||
<ion-toolbar class="footer-toolbar">
|
||||
|
||||
<ion-buttons slot="start">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
|
||||
<button class="btn-ok" fill="clear" color="#fff" (click)="save_v2()">
|
||||
<ion-label>Gravar</ion-label>
|
||||
</button>
|
||||
</ion-buttons>
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ModalController } from '@ionic/angular';
|
||||
import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
|
||||
import { SearchPage } from 'src/app/pages/search/search.page';
|
||||
import { SearchList } from "src/app/models/search-document";
|
||||
import { EventAttachment } from 'src/app/models/attachment.model';
|
||||
import { EventAttachment, EventAttachment_v2 } from 'src/app/models/attachment.model';
|
||||
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
@@ -37,6 +37,8 @@ import { TaskService } from 'src/app/services/task.service'
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
|
||||
import { ChangeProfileService } from 'src/app/services/change-profile.service';
|
||||
import { EventInputDTO } from 'src/app/services/Repositorys/Agenda/agendaDataModels';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -151,6 +153,7 @@ export class NewEventPage implements OnInit {
|
||||
private contactsService: ContactsService,
|
||||
private domSanitazerService: DomSanitizerService,
|
||||
private changeProfileService: ChangeProfileService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
this.dateAdapter.setLocale('pt');
|
||||
this.loggeduser = SessionStore.user;
|
||||
@@ -507,6 +510,28 @@ export class NewEventPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
save_v2() {
|
||||
this.injectValidation()
|
||||
this.runValidation()
|
||||
|
||||
if (this.Form.invalid) {
|
||||
|
||||
if (new Date(this.postEvent.StartDate).getTime() < new Date(this.postEvent.EndDate).getTime()) {
|
||||
this.toastService._badRequest("Data de inicio menor que a data de fim")
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
let loader = this.toastService.loading();
|
||||
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
this.postEvent.IsAllDayEvent = this.allDayCheck;
|
||||
|
||||
this.agendaDataRepository.createEvent(this.postEvent,this.CalendarName,this.documents);
|
||||
loader.remove();
|
||||
this.afterSave();
|
||||
this.hhtpErrorHandle.httpsSucessMessagge('new event')
|
||||
}
|
||||
|
||||
async save() {
|
||||
|
||||
this.injectValidation()
|
||||
|
||||
@@ -18,7 +18,6 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
|
||||
import { NavigationExtras, Router } from '@angular/router';
|
||||
import { EventController } from 'src/app/controller/event'
|
||||
import { DateService } from 'src/app/services/date.service';
|
||||
import { EventList } from 'src/app/models/agenda/AgendaEventList';
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
|
||||
@Component({
|
||||
@@ -68,7 +67,7 @@ export class ViewEventPage implements OnInit {
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private router: Router,
|
||||
private dateService: DateService,
|
||||
public AgendaDataRepositoryService: AgendaDataRepositoryService
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.loadedEvent = new Event();
|
||||
@@ -130,7 +129,7 @@ export class ViewEventPage implements OnInit {
|
||||
|
||||
try {
|
||||
|
||||
let res = await this.AgendaDataRepositoryService.getEventById(this.eventId).toPromise()
|
||||
let res = await this.agendaDataRepository.getEventById(this.eventId).toPromise()
|
||||
console.log('Loaded Event', res)
|
||||
res = this.dateService.fixDate(res as any)
|
||||
this.loadedEvent = res as any;
|
||||
@@ -156,7 +155,7 @@ export class ViewEventPage implements OnInit {
|
||||
{
|
||||
text: 'Sim',
|
||||
handler: () => {
|
||||
this.deleteEvent();
|
||||
this.deleteEvent_v2();
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -170,6 +169,10 @@ export class ViewEventPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
deleteEvent_v2() {
|
||||
this.agendaDataRepository.deleteEvent(this.loadedEvent.EventId)
|
||||
}
|
||||
|
||||
async deleteEvent() {
|
||||
|
||||
if (this.loadedEvent.IsRecurring) {
|
||||
|
||||
Reference in New Issue
Block a user