mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
merge
This commit is contained in:
@@ -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