mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
new api implementation
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');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { AgendaDataService } from './agenda-data.service';
|
||||
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'
|
||||
@@ -7,10 +11,75 @@ import { AgendaDataService } from './agenda-data.service';
|
||||
export class AgendaDataRepositoryService {
|
||||
|
||||
constructor(
|
||||
private agendaDataService: AgendaDataService
|
||||
private agendaDataService: AgendaDataService,
|
||||
private utils: Utils
|
||||
) { }
|
||||
|
||||
createEvent(eventData) {
|
||||
this.agendaDataService.createEvent(eventData);
|
||||
createEvent(eventData: Event,CalendarName,documents) {
|
||||
console.log(eventData)
|
||||
|
||||
let eventInput: EventInputDTO = {
|
||||
userId: this.utils.selectedCalendarUserId(CalendarName,eventData),
|
||||
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: EventInputDTO = {
|
||||
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)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import { Observable } from 'rxjs';
|
||||
})
|
||||
|
||||
export class AgendaDataService {
|
||||
private baseUrl = '/stage/api/v2'; // Your base URL
|
||||
private baseUrl = 'https://gdapi-dev.dyndns.info/stage/api/v2'; // Your base URL
|
||||
|
||||
constructor(private http: HttpClient) { }
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -19,6 +19,7 @@ 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({
|
||||
selector: 'app-view-event',
|
||||
templateUrl: './view-event.page.html',
|
||||
@@ -65,7 +66,8 @@ export class ViewEventPage implements OnInit {
|
||||
public ThemeService: ThemeService,
|
||||
private httpErrorHandle: HttpErrorHandle,
|
||||
private router: Router,
|
||||
private dateService: DateService
|
||||
private dateService: DateService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService
|
||||
) {
|
||||
this.isEventEdited = false;
|
||||
this.loadedEvent = new Event();
|
||||
@@ -129,6 +131,7 @@ export class ViewEventPage implements OnInit {
|
||||
this.eventsService.getEvent(this.eventId).subscribe(res => {
|
||||
|
||||
res = this.dateService.fixDate(res as any)
|
||||
console.log('loaded event', res)
|
||||
this.loadedEvent = res;
|
||||
|
||||
this.setTimeZone()
|
||||
@@ -181,7 +184,7 @@ export class ViewEventPage implements OnInit {
|
||||
{
|
||||
text: 'Sim',
|
||||
handler: () => {
|
||||
this.deleteEvent();
|
||||
this.deleteEvent_v2();
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -195,6 +198,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