mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
1 line
46 KiB
JSON
1 line
46 KiB
JSON
{"ast":null,"code":"import _asyncToGenerator from \"C:/Users/eudes.inacio/GabineteDigital/gabinete-digital-fo/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./edit-event.page.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./edit-event.page.scss?ngResource\";\nimport { Component } from '@angular/core';\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\nimport { Router } from '@angular/router';\nimport { AlertController, ModalController, NavParams } from '@ionic/angular';\nimport { AttachmentsService } from 'src/app/services/attachments.service';\nimport { EventsService } from 'src/app/services/events.service';\nimport { ToastService } from 'src/app/services/toast.service';\nimport { AttendeesPageModal } from '../../events/attendees/attendees.page';\nimport { SearchPage } from '../../search/search.page';\nimport { ThemeService } from 'src/app/services/theme.service';\nimport { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';\nimport { SessionStore } from 'src/app/store/session.service';\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service';\nconst CUSTOM_DATE_FORMATS = {\n parse: {\n dateInput: \"YYYY-MMMM-DD HH:mm\"\n },\n display: {\n dateInput: \"DD MMM YYYY H:mm\",\n monthYearLabel: \"MMM YYYY\",\n dateA11yLabel: \"LL\",\n monthYearA11yLabel: \"MMMM YYYY\"\n }\n};\nlet EditEventPage = class EditEventPage {\n constructor(modalController, navParams, eventsService, alertController, attachmentsService, toastService, router, ThemeService, httpErrorHandle) {\n this.modalController = modalController;\n this.navParams = navParams;\n this.eventsService = eventsService;\n this.alertController = alertController;\n this.attachmentsService = attachmentsService;\n this.toastService = toastService;\n this.router = router;\n this.ThemeService = ThemeService;\n this.httpErrorHandle = httpErrorHandle;\n this.validateFrom = false;\n this.segment = \"true\";\n this.disabled = false;\n this.showSpinners = true;\n this.showSeconds = false;\n this.touchUi = false;\n this.enableMeridian = false;\n this.endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0, 10);\n this.stepHour = 1;\n this.stepMinute = 15;\n this.stepSecond = 15;\n this.loadedEventAttachments = [];\n this.taskParticipants = [];\n this.taskParticipantsCc = [];\n this.adding = \"intervenient\";\n this.showAttendees = false;\n this.listColors = ['primary', 'accent', 'warn'];\n this.stepHours = [1, 2, 3, 4, 5];\n this.stepMinutes = [1, 5, 10, 15, 20, 25];\n this.stepSeconds = [1, 5, 10, 15, 20, 25];\n this.sesseionStora = SessionStore;\n /* this.postEvent = new Event(); */\n this.isEventEdited = false;\n /* this.postEvent.EventRecurrence = { Type:'-1', LastOccurrence:''}; */\n this.postEvent = this.navParams.get('event');\n // console.log(this.postEvent);\n this.caller = this.navParams.get('caller');\n this.initCalendarName = this.postEvent.CalendarName;\n if (this.postEvent) {\n if (this.postEvent.Body) {\n if (typeof this.postEvent.Body.Text == 'string') {\n this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');\n }\n }\n }\n if (this.postEvent.Attendees == null) {\n this.taskParticipants = [];\n } else {\n this.postEvent.Attendees.forEach(e => {\n if (e.IsRequired) {\n this.taskParticipants.push(e);\n } else {\n this.taskParticipantsCc.push(e);\n }\n });\n }\n if (this.postEvent.IsRecurring == false) {\n this.isRecurring = \"Não se repete\";\n } else {\n this.isRecurring = \"Repete\";\n }\n this.getAttachments(this.postEvent.EventId);\n }\n ngOnInit() {\n window.onresize = event => {\n // if not mobile remove all component\n if (window.innerWidth >= 1024) {\n this.modalController.dismiss();\n }\n };\n if (window.innerWidth > 800) {\n this.showAttendees = true;\n }\n this.getRecurrenceTypes();\n setTimeout(() => {\n this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();\n }, 500);\n }\n close() {\n this.modalController.dismiss();\n }\n goBack() {\n this.router.navigate(['/home', this.caller]);\n }\n getRecurrenceTypes() {\n this.eventsService.getRecurrenceTypes().subscribe(res => {\n this.recurringTypes = res;\n });\n }\n roundTimeQuarterHour(timeToReturn = new Date()) {\n let date = timeToReturn || new Date();\n const minutes = date.getMinutes();\n date.setSeconds(0);\n if (minutes % 15 != 0) {\n if (minutes > 45) {\n date.setMinutes(60);\n } else if (minutes > 30) {\n date.setMinutes(45);\n } else if (minutes > 15) {\n date.setMinutes(30);\n } else if (minutes > 0) {\n date.setMinutes(15);\n }\n }\n return date;\n }\n roundTimeQuarterHourPlus15(date) {\n const _date = new Date(date);\n const minutes = _date.getMinutes();\n _date.setMinutes(minutes + 15);\n return _date;\n }\n onSelectedRecurringChanged(ev) {\n this.calculetedLastOccurrence(ev);\n if (ev.length > 1) {\n this.selectedRecurringType = ev.filter(data => data != '-1');\n }\n if (ev.length == 0) {\n this.selectedRecurringType = \"-1\";\n }\n }\n calculetedLastOccurrence(type) {\n // console.log(type);\n var valor;\n var opcao;\n if (type == 0) {\n valor = 7;\n opcao = true;\n } else if (type == 1) {\n valor = 30;\n opcao = true;\n } else if (type == 2) {\n valor = 1;\n opcao = false;\n } else if (type == 3) {\n valor = 5;\n opcao = false;\n }\n this.defineLastOccurrence(valor, opcao);\n }\n defineLastOccurrence(valor, opcao) {\n var time = new Date(this.postEvent.EndDate);\n if (opcao == true) {\n time.setDate(time.getDate() + valor);\n this.postEvent.EventRecurrence.LastOccurrence = time;\n } else {\n time = new Date(time.getFullYear() + valor, time.getMonth(), time.getDate(), time.getHours(), time.getMinutes());\n this.postEvent.EventRecurrence.LastOccurrence = time;\n }\n }\n runValidation() {\n this.validateFrom = true;\n }\n injectValidation() {\n this.Form = new UntypedFormGroup({\n Subject: new UntypedFormControl(this.postEvent.Subject, [Validators.required\n // Validators.minLength(4)\n ]),\n\n Location: new UntypedFormControl(this.postEvent.Location, [Validators.required]),\n CalendarName: new UntypedFormControl(this.postEvent.CalendarName, [Validators.required]),\n Categories: new UntypedFormControl(this.postEvent.Category, [Validators.required]),\n IsRecurring: new UntypedFormControl(this.postEvent.IsRecurring, [Validators.required]),\n dateOccurrence: new UntypedFormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok'] : this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [Validators.required]),\n Date: new UntypedFormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime() ? 'ok' : null, [Validators.required]),\n participantes: new UntypedFormControl(this.taskParticipants, [Validators.required])\n });\n }\n openInicio() {\n let input = document.querySelector('#new-inicio');\n if (input) {\n input.click();\n }\n }\n openFim() {\n let input = document.querySelector('#new-fim');\n if (input) {\n input.click();\n }\n }\n openLastOccurrence() {\n let input = document.querySelector('#last-occurrence');\n if (input) {\n input.click();\n }\n }\n save() {\n var _this = this;\n return _asyncToGenerator(function* () {\n _this.injectValidation();\n _this.runValidation();\n if (_this.Form.invalid) return false;\n if (_this.selectedRecurringType != '-1') {\n _this.postEvent.EventRecurrence.Type = _this.selectedRecurringType;\n }\n _this.postEvent.Attendees = _this.taskParticipants.concat(_this.taskParticipantsCc);\n _this.postEvent.EventRecurrence.Type = _this.selectedRecurringType;\n if (_this.sesseionStora.user.Profile == 'MDGPR' || _this.sesseionStora.user.Profile == 'PR') {\n _this.eventsService.editEvent(_this.postEvent, 2, 3).subscribe( /*#__PURE__*/_asyncToGenerator(function* () {\n if (_this.initCalendarName != _this.postEvent.CalendarName) {\n let body = {\n \"EventId\": _this.postEvent.EventId,\n \"CalendarDestinationName\": _this.postEvent.CalendarName\n };\n try {\n yield _this.eventsService.changeAgenda(body).toPromise();\n } catch (error) {} finally {}\n }\n _this.httpErrorHandle.httpsSucessMessagge('Editar evento');\n }), error => {\n _this.httpErrorHandle.httpStatusHandle(error);\n });\n } else {\n _this.eventsService.editEvent(_this.postEvent, 2, 3, _this.postEvent.CalendarId).subscribe( /*#__PURE__*/_asyncToGenerator(function* () {\n if (_this.initCalendarName != _this.postEvent.CalendarName) {\n let body = {\n \"EventId\": _this.postEvent.EventId,\n \"CalendarDestinationName\": _this.postEvent.CalendarName\n };\n try {\n yield _this.eventsService.changeAgenda(body).toPromise();\n } catch (error) {} finally {}\n }\n _this.httpErrorHandle.httpsSucessMessagge('Editar evento');\n }), error => {\n _this.httpErrorHandle.httpStatusHandle(error);\n });\n }\n _this.isEventEdited = true;\n yield _this.saveDocument();\n _this.goBack();\n })();\n }\n saveDocument() {\n var _this2 = this;\n return _asyncToGenerator(function* () {\n try {\n for (let e of _this2.loadedEventAttachments) {\n const id = e.Id;\n const remove = e['remove'];\n if (id == 'add') {\n //data.selected\n const DocumentToSave = {\n SourceTitle: e.SourceName,\n ParentId: _this2.postEvent.EventId,\n Source: '1',\n SourceId: e.SourceId,\n ApplicationId: e.ApplicationId.toString(),\n Id: '0',\n Link: '',\n SerialNumber: ''\n };\n yield _this2.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();\n } else if (remove) {\n yield _this2.attachmentsService.deleteEventAttachmentById(e.Id).toPromise();\n }\n }\n } catch (error) {} finally {}\n _this2.modalController.dismiss({\n isEventEdited: _this2.isEventEdited,\n postEvent: _this2.postEvent\n });\n })();\n }\n openAttendees() {\n var _this3 = this;\n return _asyncToGenerator(function* () {\n if (window.innerWidth > 801) {\n _this3.showAttendees = true;\n } else {\n const modal = yield _this3.modalController.create({\n component: AttendeesPageModal,\n componentProps: {\n adding: _this3.adding,\n taskParticipants: _this3.taskParticipants,\n taskParticipantsCc: _this3.taskParticipantsCc\n },\n cssClass: 'modal attendee modal-desktop',\n backdropDismiss: false\n });\n yield modal.present();\n modal.onDidDismiss().then(data => {\n if (data) {\n data = data['data'];\n const newAttendees = data['taskParticipants'];\n const newAttendeesCC = data['taskParticipantsCc'];\n if (newAttendees.length) {\n _this3.setIntervenient(newAttendees);\n } else {\n _this3.setIntervenient([]);\n }\n if (newAttendeesCC) {\n _this3.setIntervenientCC(newAttendeesCC);\n } else {\n _this3.setIntervenientCC([]);\n }\n }\n });\n }\n })();\n }\n setIntervenient(data) {\n this.taskParticipants = data;\n this.postEvent.Attendees = data;\n }\n setIntervenientCC(data) {\n this.taskParticipantsCc = data;\n }\n addParticipants() {\n this.adding = 'intervenient';\n this.openAttendees();\n }\n addParticipantsCC() {\n this.adding = 'CC';\n this.openAttendees();\n }\n dynamicSetIntervenient({\n taskParticipants,\n taskParticipantsCc\n }) {\n this.taskParticipants = taskParticipants;\n this.taskParticipantsCc = taskParticipantsCc;\n }\n getAttachments(eventId) {\n if (this.postEvent.HasAttachments) {\n this.attachmentsService.getAttachmentsById(eventId).subscribe(res => {\n this.loadedEventAttachments = res;\n }, erro => {\n console.error('editgetAttchament', erro);\n });\n }\n }\n deleteAttachment(attachmentID, index) {\n const id = this.loadedEventAttachments[index].Id;\n if (id == 'add') {\n this.loadedEventAttachments = this.loadedEventAttachments.filter((e, i) => i != index);\n } else {\n this.loadedEventAttachments[index]['remove'] = true;\n }\n }\n getDoc() {\n var _this4 = this;\n return _asyncToGenerator(function* () {\n const modal = yield _this4.modalController.create({\n component: SearchPage,\n cssClass: 'modal-width-100-width-background modal',\n componentProps: {\n type: 'AccoesPresidenciais & ArquivoDespachoElect',\n showSearchInput: true,\n select: true\n }\n });\n yield modal.present();\n modal.onDidDismiss().then( /*#__PURE__*/function () {\n var _ref3 = _asyncToGenerator(function* (res) {\n if (res) {\n const data = res.data;\n const ApplicationIdDocumentToSave = {\n SourceName: data.selected.Assunto,\n ParentId: _this4.postEvent.EventId,\n SourceId: data.selected.Id,\n Stakeholders: false,\n ApplicationId: data.selected.ApplicationType.toString(),\n CreateDate: false,\n // needed to attach this document\n Id: 'add',\n SourceTitle: data.selected.Assunto,\n Source: '1',\n Link: '',\n SerialNumber: ''\n };\n _this4.loadedEventAttachments.push(ApplicationIdDocumentToSave);\n }\n });\n return function (_x) {\n return _ref3.apply(this, arguments);\n };\n }());\n })();\n }\n};\nEditEventPage.ctorParameters = () => [{\n type: ModalController\n}, {\n type: NavParams\n}, {\n type: EventsService\n}, {\n type: AlertController\n}, {\n type: AttachmentsService\n}, {\n type: ToastService\n}, {\n type: Router\n}, {\n type: ThemeService\n}, {\n type: HttpErrorHandle\n}];\nEditEventPage = __decorate([Component({\n selector: 'app-edit-event',\n template: __NG_CLI_RESOURCE__0,\n providers: [{\n provide: NGX_MAT_DATE_FORMATS,\n useValue: CUSTOM_DATE_FORMATS\n }],\n styles: [__NG_CLI_RESOURCE__1]\n})], EditEventPage);\nexport { EditEventPage };","map":{"version":3,"mappings":";;;;AAAA,SAASA,SAAS,QAAgB,eAAe;AACjD,SAASC,kBAAkB,EAAEC,gBAAgB,EAAEC,UAAU,QAAQ,gBAAgB;AACjF,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,eAAe,EAAEC,eAAe,EAAEC,SAAS,QAAQ,gBAAgB;AAI5E,SAASC,kBAAkB,QAAQ,sCAAsC;AACzE,SAASC,aAAa,QAAQ,iCAAiC;AAC/D,SAASC,YAAY,QAAQ,gCAAgC;AAE7D,SAASC,kBAAkB,QAAQ,uCAAuC;AAC1E,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,YAAY,QAAQ,gCAAgC;AAE7D,SAASC,oBAAoB,QAAQ,8CAA8C;AACnF,SAASC,YAAY,QAAQ,+BAA+B;AAC5D,SAASC,eAAe,QAAQ,4CAA4C;AAG5E,MAAMC,mBAAmB,GAAsB;EAC7CC,KAAK,EAAE;IACLC,SAAS,EAAE;GACZ;EACDC,OAAO,EAAE;IACPD,SAAS,EAAE,kBAAkB;IAC7BE,cAAc,EAAE,UAAU;IAC1BC,aAAa,EAAE,IAAI;IACnBC,kBAAkB,EAAE;;CAEvB;AASM,IAAMC,aAAa,GAAnB,MAAMA,aAAa;EA8CxBC,YACUC,eAAgC,EAChCC,SAAoB,EACpBC,aAA4B,EAC7BC,eAAgC,EAC/BC,kBAAsC,EACtCC,YAA0B,EAC1BC,MAAc,EACfnB,YAA0B,EACzBoB,eAAgC;IARhC,oBAAe,GAAfP,eAAe;IACf,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,QAAQ,EAAE;cACvD0H,UAAU,EAAE,KAAK;cACjB;cACAlD,EAAE,EAAE,KAAK;cACTG,WAAW,EAAEtD,IAAI,CAACiG,QAAQ,CAACC,OAAO;cAClCzC,MAAM,EAAE,GAAG;cACXG,IAAI,EAAE,EAAE;cACRC,YAAY,EAAE;aACf;YAGDgC,MAAI,CAAC5C,sBAAsB,CAACxF,IAAI,CAACuI,2BAA2B,CAAC;;QAGjE,CAAC;QAAA;UAAA;QAAA;MAAA,IAAC;IAAA;EACJ;;;;;;;;;;;;;;;;;;;;;AAtgBWnK,aAAa,eARzBxB,SAAS,CAAC;EACTiM,QAAQ,EAAE,gBAAgB;EAC1BC,8BAAqC;EAErCC,SAAS,EAAE,CACT;IAAEC,OAAO,EAAEtL,oBAAoB;IAAEuL,QAAQ,EAAEpL;EAAmB,CAAE,CACjE;;CACF,CAAC,GACWO,aAAa;SAAbA,aAAa","names":["Component","UntypedFormControl","UntypedFormGroup","Validators","Router","AlertController","ModalController","NavParams","AttachmentsService","EventsService","ToastService","AttendeesPageModal","SearchPage","ThemeService","NGX_MAT_DATE_FORMATS","SessionStore","HttpErrorHandle","CUSTOM_DATE_FORMATS","parse","dateInput","display","monthYearLabel","dateA11yLabel","monthYearA11yLabel","EditEventPage","constructor","modalController","navParams","eventsService","alertController","attachmentsService","toastService","router","httpErrorHandle","Date","getTime","toISOString","slice","isEventEdited","postEvent","get","caller","initCalendarName","CalendarName","Body","Text","replace","Attendees","taskParticipants","forEach","e","IsRequired","push","taskParticipantsCc","IsRecurring","isRecurring","getAttachments","EventId","ngOnInit","window","onresize","event","innerWidth","dismiss","showAttendees","getRecurrenceTypes","setTimeout","selectedRecurringType","EventRecurrence","Type","toString","close","goBack","navigate","subscribe","res","recurringTypes","roundTimeQuarterHour","timeToReturn","date","minutes","getMinutes","setSeconds","setMinutes","roundTimeQuarterHourPlus15","_date","onSelectedRecurringChanged","ev","calculetedLastOccurrence","length","filter","data","type","valor","opcao","defineLastOccurrence","time","EndDate","setDate","getDate","LastOccurrence","getFullYear","getMonth","getHours","runValidation","validateFrom","injectValidation","Form","Subject","required","Location","Categories","Category","dateOccurrence","StartDate","participantes","openInicio","input","document","querySelector","click","openFim","openLastOccurrence","save","_this","invalid","concat","sesseionStora","user","Profile","editEvent","body","changeAgenda","toPromise","error","httpsSucessMessagge","httpStatusHandle","CalendarId","saveDocument","_this2","loadedEventAttachments","id","Id","remove","DocumentToSave","SourceTitle","SourceName","ParentId","Source","SourceId","ApplicationId","Link","SerialNumber","setEventAttachmentById","deleteEventAttachmentById","openAttendees","_this3","modal","create","component","componentProps","adding","cssClass","backdropDismiss","present","onDidDismiss","then","newAttendees","newAttendeesCC","setIntervenient","setIntervenientCC","addParticipants","addParticipantsCC","dynamicSetIntervenient","eventId","HasAttachments","getAttachmentsById","erro","console","deleteAttachment","attachmentID","index","i","getDoc","_this4","showSearchInput","select","ApplicationIdDocumentToSave","selected","Assunto","Stakeholders","ApplicationType","CreateDate","selector","template","providers","provide","useValue"],"sourceRoot":"","sources":["C:\\Users\\eudes.inacio\\GabineteDigital\\gabinete-digital-fo\\src\\app\\pages\\agenda\\edit-event\\edit-event.page.ts"],"sourcesContent":["import { Component, OnInit } from '@angular/core';\r\nimport { UntypedFormControl, UntypedFormGroup, Validators } from '@angular/forms';\r\nimport { Router } from '@angular/router';\r\nimport { AlertController, ModalController, NavParams } from '@ionic/angular';\r\nimport { Attachment } from 'src/app/models/attachment.model';\r\nimport { EventBody } from 'src/app/models/eventbody.model';\r\nimport { EventPerson } from 'src/app/models/eventperson.model';\r\nimport { AttachmentsService } from 'src/app/services/attachments.service';\r\nimport { EventsService } from 'src/app/services/events.service';\r\nimport { ToastService } from 'src/app/services/toast.service';\r\nimport { Event } from '../../../models/event.model';\r\nimport { AttendeesPageModal } from '../../events/attendees/attendees.page';\r\nimport { SearchPage } from '../../search/search.page';\r\nimport { ThemeService } from 'src/app/services/theme.service';\r\nimport { NgxMatDateFormats } from '@angular-material-components/datetime-picker';\r\nimport { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';\r\nimport { SessionStore } from 'src/app/store/session.service';\r\nimport { HttpErrorHandle } from 'src/app/services/http-error-handle.service'\r\n\r\n\r\nconst CUSTOM_DATE_FORMATS: NgxMatDateFormats = {\r\n parse: {\r\n dateInput: \"YYYY-MMMM-DD HH:mm\"\r\n },\r\n display: {\r\n dateInput: \"DD MMM YYYY H:mm\",\r\n monthYearLabel: \"MMM YYYY\",\r\n dateA11yLabel: \"LL\",\r\n monthYearA11yLabel: \"MMMM YYYY\"\r\n }\r\n}\r\n@Component({\r\n selector: 'app-edit-event',\r\n templateUrl: './edit-event.page.html',\r\n styleUrls: ['./edit-event.page.scss'],\r\n providers: [\r\n { provide: NGX_MAT_DATE_FORMATS, useValue: CUSTOM_DATE_FORMATS },\r\n ]\r\n})\r\nexport class EditEventPage implements OnInit {\r\n\r\n Form: UntypedFormGroup;\r\n validateFrom = false\r\n\r\n postEvent: Event;\r\n isRecurring:string;\r\n isEventEdited: boolean;\r\n loadedEvent: Event;\r\n eventBody: EventBody;\r\n segment:string = \"true\";\r\n profile:string;\r\n eventAttendees: EventPerson[];\r\n selectedSegment: string;\r\n selectedDate: Date;\r\n initCalendarName: string;\r\n caller:string;\r\n recurringTypes: any;\r\n selectedRecurringType: any;\r\n\r\n public date: any;\r\n public disabled = false;\r\n public showSpinners = true;\r\n public showSeconds = false;\r\n public touchUi = false;\r\n public enableMeridian = false;\r\n public endMinDate = new Date(new Date().getTime() + 15 * 60000).toISOString().slice(0,10)\r\n public maxDate: any;\r\n public stepHour = 1;\r\n public stepMinute = 15;\r\n public stepSecond = 15;\r\n\r\n loadedEventAttachments: Attachment[] = [];\r\n taskParticipants: any = [];\r\n taskParticipantsCc: any = [];\r\n adding: \"intervenient\" | \"CC\" = \"intervenient\";\r\n\r\n showAttendees = false;\r\n\r\n public listColors = ['primary', 'accent', 'warn'];\r\n public stepHours = [1, 2, 3, 4, 5];\r\n public stepMinutes = [1, 5, 10, 15, 20, 25];\r\n public stepSeconds = [1, 5, 10, 15, 20, 25];\r\n\r\n sesseionStora = SessionStore\r\n\r\n constructor(\r\n private modalController: ModalController,\r\n private navParams: NavParams,\r\n private eventsService: EventsService,\r\n public alertController: AlertController,\r\n private attachmentsService: AttachmentsService,\r\n private toastService: ToastService,\r\n private router: Router,\r\n public ThemeService: ThemeService,\r\n private httpErrorHandle: HttpErrorHandle\r\n ) {\r\n\r\n /* this.postEvent = new Event(); */\r\n this.isEventEdited = false;\r\n /* this.postEvent.EventRecurrence = { Type:'-1', LastOccurrence:''}; */\r\n this.postEvent = this.navParams.get('event');\r\n // console.log(this.postEvent);\r\n\r\n this.caller = this.navParams.get('caller');\r\n this.initCalendarName = this.postEvent.CalendarName;\r\n\r\n if(this.postEvent){\r\n if( this.postEvent.Body){\r\n if(typeof(this.postEvent.Body.Text) == 'string'){\r\n this.postEvent.Body.Text = this.postEvent.Body.Text.replace(/<[^>]+>/g, '');\r\n }\r\n }\r\n }\r\n\r\n if(this.postEvent.Attendees == null) {\r\n this.taskParticipants = []\r\n } else {\r\n\r\n this.postEvent.Attendees.forEach(e =>{\r\n if(e.IsRequired){\r\n this.taskParticipants.push(e);\r\n } else {\r\n this.taskParticipantsCc.push(e);\r\n }\r\n })\r\n }\r\n\r\n if(this.postEvent.IsRecurring == false) {\r\n this.isRecurring = \"Não se repete\";\r\n }\r\n else {\r\n this.isRecurring = \"Repete\";\r\n }\r\n\r\n this.getAttachments(this.postEvent.EventId);\r\n\r\n }\r\n\r\n ngOnInit() {\r\n\r\n window.onresize = (event) => {\r\n // if not mobile remove all component\r\n if( window.innerWidth >= 1024) {\r\n this.modalController.dismiss();\r\n }\r\n }\r\n if(window.innerWidth > 800){\r\n this.showAttendees=true;\r\n }\r\n\r\n this.getRecurrenceTypes();\r\n setTimeout(() => {\r\n this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();\r\n }, 500);\r\n\r\n }\r\n\r\n close() {\r\n this.modalController.dismiss();\r\n }\r\n\r\n goBack() {\r\n \r\n this.router.navigate(['/home',this.caller]);\r\n }\r\n\r\n getRecurrenceTypes() {\r\n this.eventsService.getRecurrenceTypes().subscribe(res=>{\r\n \r\n this.recurringTypes = res;\r\n });\r\n }\r\n\r\n roundTimeQuarterHour(timeToReturn = new Date()) {\r\n let date = timeToReturn || new Date();\r\n const minutes = date.getMinutes();\r\n date.setSeconds(0);\r\n\r\n if(minutes % 15 != 0) {\r\n \r\n if (minutes > 45) {\r\n date.setMinutes(60)\r\n } else if (minutes > 30) {\r\n date.setMinutes(45)\r\n } else if (minutes > 15) {\r\n date.setMinutes(30)\r\n } else if (minutes > 0) {\r\n date.setMinutes(15)\r\n }\r\n\r\n } \r\n\r\n return date\r\n }\r\n\r\n roundTimeQuarterHourPlus15(date:Date) {\r\n const _date = new Date(date);\r\n const minutes = _date .getMinutes();\r\n _date .setMinutes(minutes + 15)\r\n return _date \r\n }\r\n\r\n onSelectedRecurringChanged(ev?:any) {\r\n\r\n this.calculetedLastOccurrence(ev);\r\n \r\n if(ev.length > 1){\r\n \r\n this.selectedRecurringType = ev.filter(data => data != '-1');\r\n }\r\n if(ev.length == 0){\r\n this.selectedRecurringType = \"-1\";\r\n }\r\n }\r\n\r\n calculetedLastOccurrence(type:number){\r\n // console.log(type);\r\n var valor; \r\n var opcao: boolean;\r\n if (type == 0) {\r\n valor = 7;\r\n opcao = true;\r\n } else if(type == 1){\r\n valor = 30;\r\n opcao = true;\r\n } else if(type == 2){\r\n valor = 1;\r\n opcao = false;\r\n }else if(type == 3){\r\n valor = 5;\r\n opcao = false;\r\n }\r\n this.defineLastOccurrence(valor, opcao);\r\n }\r\n\r\n\r\n defineLastOccurrence(valor:number, opcao:boolean){\r\n var time = new Date(this.postEvent.EndDate);\r\n if (opcao == true) {\r\n time.setDate(time.getDate() + valor);\r\n this.postEvent.EventRecurrence.LastOccurrence = time;\r\n } else {\r\n time = new Date(\r\n time.getFullYear() + valor, \r\n time.getMonth(), \r\n time.getDate(), \r\n time.getHours(), \r\n time.getMinutes()\r\n );\r\n this.postEvent.EventRecurrence.LastOccurrence = time;\r\n }\r\n \r\n }\r\n\r\n\r\n runValidation() {\r\n this.validateFrom = true\r\n }\r\n\r\n injectValidation() {\r\n\r\n this.Form = new UntypedFormGroup({\r\n Subject: new UntypedFormControl(this.postEvent.Subject, [\r\n Validators.required,\r\n // Validators.minLength(4)\r\n ]),\r\n Location: new UntypedFormControl(this.postEvent.Location, [\r\n Validators.required,\r\n ]),\r\n CalendarName: new UntypedFormControl(this.postEvent.CalendarName, [\r\n Validators.required\r\n ]),\r\n Categories: new UntypedFormControl(this.postEvent.Category, [\r\n Validators.required\r\n ]),\r\n IsRecurring: new UntypedFormControl(this.postEvent.IsRecurring, [\r\n Validators.required\r\n ]),\r\n dateOccurrence: new UntypedFormControl(this.postEvent.EventRecurrence.Type.toString() == '-1' ? ['ok']: this.postEvent.EventRecurrence.LastOccurrence && new Date(this.postEvent.EventRecurrence.LastOccurrence).getTime() > new Date(this.postEvent.EndDate).getTime() ? 'ok': null, [\r\n Validators.required\r\n ]),\r\n Date: new UntypedFormControl(new Date(this.postEvent.StartDate).getTime() <= new Date(this.postEvent.EndDate).getTime()? 'ok': null,[\r\n Validators.required\r\n ]),\r\n\r\n participantes: new UntypedFormControl(this.taskParticipants, [\r\n Validators.required\r\n ]),\r\n\r\n })\r\n }\r\n\r\n openInicio() {\r\n let input: any = document.querySelector('#new-inicio')\r\n if(input) {\r\n \r\n input.click()\r\n }\r\n }\r\n\r\n openFim() {\r\n let input: any = document.querySelector('#new-fim')\r\n if(input) {\r\n input.click()\r\n }\r\n }\r\n\r\n openLastOccurrence() {\r\n let input: any = document.querySelector('#last-occurrence')\r\n if(input) {\r\n input.click()\r\n }\r\n }\r\n\r\n\r\n async save() {\r\n\r\n this.injectValidation()\r\n this.runValidation()\r\n\r\n if(this.Form.invalid) return false;\r\n if(this.selectedRecurringType != '-1'){\r\n this.postEvent.EventRecurrence.Type = this.selectedRecurringType;\r\n }\r\n\r\n this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)\r\n\r\n this.postEvent.EventRecurrence.Type = this.selectedRecurringType;\r\n\r\n if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { \r\n this.eventsService.editEvent(this.postEvent, 2, 3).subscribe(async () => {\r\n\r\n if(this.initCalendarName != this.postEvent.CalendarName) {\r\n \r\n let body = {\r\n \"EventId\": this.postEvent.EventId,\r\n \"CalendarDestinationName\": this.postEvent.CalendarName,\r\n }\r\n try {\r\n await this.eventsService.changeAgenda(body).toPromise();\r\n } catch (error) {}\r\n finally {\r\n }\r\n \r\n }\r\n \r\n this.httpErrorHandle.httpsSucessMessagge('Editar evento')\r\n \r\n }, error => {\r\n this.httpErrorHandle.httpStatusHandle(error)\r\n });\r\n } else {\r\n this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {\r\n\r\n if(this.initCalendarName != this.postEvent.CalendarName) {\r\n \r\n let body = {\r\n \"EventId\": this.postEvent.EventId,\r\n \"CalendarDestinationName\": this.postEvent.CalendarName,\r\n }\r\n try {\r\n await this.eventsService.changeAgenda(body).toPromise();\r\n } catch (error) {}\r\n finally {\r\n }\r\n \r\n }\r\n \r\n this.httpErrorHandle.httpsSucessMessagge('Editar evento')\r\n \r\n }, error => {\r\n this.httpErrorHandle.httpStatusHandle(error)\r\n });\r\n }\r\n\r\n \r\n\r\n this.isEventEdited = true;\r\n\r\n\r\n await this.saveDocument()\r\n\r\n this.goBack();\r\n }\r\n\r\n\r\n async saveDocument() {\r\n\r\n try {\r\n \r\n for( let e of this.loadedEventAttachments) {\r\n const id: any = e.Id\r\n const remove = e['remove']\r\n\r\n if ( id == 'add') {\r\n //data.selected\r\n const DocumentToSave = {\r\n SourceTitle: e.SourceName,\r\n ParentId: this.postEvent.EventId,\r\n Source: '1',\r\n SourceId: e.SourceId,\r\n ApplicationId: e.ApplicationId.toString(),\r\n Id: '0',\r\n Link: '',\r\n SerialNumber: '',\r\n };\r\n\r\n await this.attachmentsService.setEventAttachmentById(DocumentToSave).toPromise();\r\n\r\n } else if(remove) {\r\n await this.attachmentsService.deleteEventAttachmentById(e.Id).toPromise()\r\n }\r\n }\r\n } catch (error) {\r\n\r\n } finally {\r\n \r\n }\r\n\r\n this.modalController.dismiss({\r\n isEventEdited: this.isEventEdited,\r\n postEvent: this.postEvent\r\n });\r\n\r\n }\r\n\r\n async openAttendees() {\r\n if(window.innerWidth > 801) {\r\n this.showAttendees=true;\r\n }\r\n else {\r\n const modal = await this.modalController.create({\r\n component: AttendeesPageModal,\r\n componentProps: {\r\n adding: this.adding,\r\n taskParticipants: this.taskParticipants,\r\n taskParticipantsCc: this.taskParticipantsCc\r\n },\r\n cssClass: 'modal attendee modal-desktop',\r\n backdropDismiss: false\r\n });\r\n\r\n await modal.present();\r\n\r\n modal.onDidDismiss().then((data) => {\r\n\r\n if(data){\r\n data = data['data'];\r\n\r\n const newAttendees: EventPerson[] = data['taskParticipants'];\r\n const newAttendeesCC: EventPerson[] = data['taskParticipantsCc'];\r\n\r\n if(newAttendees.length) {\r\n this.setIntervenient(newAttendees);\r\n } else {\r\n this.setIntervenient([]);\r\n }\r\n if(newAttendeesCC) {\r\n this.setIntervenientCC(newAttendeesCC);\r\n } else {\r\n this.setIntervenientCC([]);\r\n }\r\n\r\n }\r\n });\r\n }\r\n\r\n\r\n }\r\n\r\n setIntervenient(data) {\r\n this.taskParticipants = data;\r\n this.postEvent.Attendees = data;\r\n }\r\n\r\n setIntervenientCC(data) {\r\n this.taskParticipantsCc = data;\r\n }\r\n\r\n addParticipants() {\r\n this.adding = 'intervenient'\r\n this.openAttendees();\r\n }\r\n\r\n addParticipantsCC() {\r\n this.adding = 'CC';\r\n this.openAttendees();\r\n }\r\n\r\n dynamicSetIntervenient({taskParticipants, taskParticipantsCc}){\r\n this.taskParticipants = taskParticipants;\r\n this.taskParticipantsCc = taskParticipantsCc;\r\n }\r\n\r\n\r\n getAttachments(eventId: string) {\r\n\r\n if(this.postEvent.HasAttachments) {\r\n this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{\r\n this.loadedEventAttachments = res;\r\n \r\n },((erro) => {\r\n console.error('editgetAttchament', erro)\r\n })); \r\n }\r\n\r\n \r\n }\r\n\r\n deleteAttachment(attachmentID: string, index) {\r\n\r\n const id: any = this.loadedEventAttachments[index].Id\r\n\r\n if(id == 'add') {\r\n this.loadedEventAttachments = this.loadedEventAttachments.filter((e,i)=> i!=index)\r\n } else {\r\n this.loadedEventAttachments[index]['remove'] = true\r\n }\r\n\r\n\r\n }\r\n\r\n async getDoc() {\r\n const modal = await this.modalController.create({\r\n component: SearchPage,\r\n cssClass: 'modal-width-100-width-background modal',\r\n componentProps: {\r\n type: 'AccoesPresidenciais & ArquivoDespachoElect',\r\n showSearchInput: true,\r\n select: true,\r\n }\r\n });\r\n await modal.present();\r\n modal.onDidDismiss().then( async (res)=> {\r\n if(res) {\r\n const data = res.data;\r\n\r\n const ApplicationIdDocumentToSave: any = {\r\n SourceName: data.selected.Assunto,\r\n ParentId: this.postEvent.EventId,\r\n SourceId: data.selected.Id,\r\n Stakeholders: false,\r\n ApplicationId: data.selected.ApplicationType.toString(),\r\n CreateDate: false,\r\n // needed to attach this document\r\n Id: 'add',\r\n SourceTitle: data.selected.Assunto,\r\n Source: '1',\r\n Link: '',\r\n SerialNumber: '',\r\n }\r\n\r\n \r\n this.loadedEventAttachments.push(ApplicationIdDocumentToSave)\r\n\r\n }\r\n })\r\n }\r\n\r\n}\r\n"]},"metadata":{},"sourceType":"module"} |