mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
create event from attachment
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<!-- *ngIf="p.userRole('PR')" -->
|
||||
<!-- *ngIf="p.role(['PR','MD']).permissionAnyOf(['view','edit'])" -->
|
||||
|
||||
<label >Convocar Reunião</label><br>
|
||||
<label >Convocar Reunião ..</label><br>
|
||||
<i style="margin-top: -3px; font-size: 15px;" > Campos marcados com * são obrigatórios</i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -21,7 +21,7 @@
|
||||
<div *ngIf="Form && validateFrom" >
|
||||
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
|
||||
<!-- <div *ngIf="Form.get('Subject').errors?.required">
|
||||
|
||||
|
||||
</div> -->
|
||||
<div *ngIf="Form.get('Subject').errors?.minlength">
|
||||
O campo deve ter pelo menos 4 caracteres.
|
||||
@@ -35,15 +35,15 @@
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
|
||||
|
||||
|
||||
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
|
||||
|
||||
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
|
||||
<mat-option *ngFor="let calendars of _eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
|
||||
@@ -51,14 +51,34 @@
|
||||
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
|
||||
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
|
||||
</mat-option>
|
||||
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<mat-select [(value)]="postData.CalendarName" >
|
||||
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
|
||||
Agenda {{ calendars }}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100">
|
||||
<div class="ion-icon-class">
|
||||
@@ -73,7 +93,7 @@
|
||||
<!-- <div *ngIf="Form && validateFrom" >
|
||||
<div *ngIf="Form.get('Location').invalid " class="input-errror-message">
|
||||
<div *ngIf="Form.get('Location').errors?.required">
|
||||
|
||||
|
||||
</div>
|
||||
<div *ngIf="Form.get('Location').errors?.minlength">
|
||||
O campo deve ter pelo menos 4 caracteres.
|
||||
@@ -83,18 +103,32 @@
|
||||
|
||||
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div" >
|
||||
<div class="ion-item-class-2 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class" >
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
|
||||
<div *ngIf="utils.hasPrCalendar(calendarData) && !hasChangeCalendar " style="margin-bottom: -20px;">PR</div>
|
||||
<div *ngIf="selectedUserCalendar == sessionStore.user.UserId && !hasChangeCalendar && sessionStore.user.Profile != 'PR' " style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
|
||||
|
||||
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
|
||||
|
||||
<div *ngIf="calendars.roleId == RoleIdService.PRES">PR </div>
|
||||
<div *ngIf="calendars.roleId == RoleIdService.MD && calendars.roleId != sessionStore.user.RoleID">AGENDA DO MDGPR</div>
|
||||
<div *ngIf="calendars.roleId != RoleIdService.MD && calendars.roleId != RoleIdService.PRES && calendars.wxFullName && calendars.wxUserId != sessionStore.user.UserId"> Agenda do {{calendars.wxFullName}} </div>
|
||||
<div *ngIf="calendars.wxUserId == sessionStore.user.UserId && sessionStore.user.Profile != 'PR'">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
<mat-form-field floatLabel="never" appearance="none" class="d-md-block width-100">
|
||||
<mat-select placeholder="Selecione agenda" [(ngModel)]="postData.CalendarName" >
|
||||
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
|
||||
Agenda {{ calendars }}
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -133,6 +167,78 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div>
|
||||
<ion-item>
|
||||
<ion-label>Todo dia</ion-label>
|
||||
<ion-checkbox [(ngModel)]="postData.IsAllDayEvent" (ionChange)="onCheckboxChange($event)"></ion-checkbox>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs">
|
||||
|
||||
<mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
|
||||
<!-- <input matInput type="text" > -->
|
||||
<mat-select [(value)]="postData.EventRecurrence.frequency" >
|
||||
<mat-option value="never">
|
||||
Nunca
|
||||
</mat-option>
|
||||
<mat-option value="daily">
|
||||
Diário
|
||||
</mat-option>
|
||||
<mat-option value="weekly">
|
||||
Semanalmente
|
||||
</mat-option>
|
||||
<mat-option value="monthly">
|
||||
Mensal
|
||||
</mat-option>
|
||||
<mat-option value="yearly">
|
||||
Anual
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div *ngIf="postData.EventRecurrence.frequency != 'never'" class="container-div">
|
||||
<div class="ion-item-class-2 d-flex" >
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
|
||||
</div>
|
||||
|
||||
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" >
|
||||
|
||||
<mat-form-field appearance="none" class="date-hour-picker">
|
||||
<input matInput [ngxMatDatetimePicker]="picker1"
|
||||
placeholder="Data Fim de Recorrência*"
|
||||
[(ngModel)]="postData.EventRecurrence.until"
|
||||
[disabled]="disabled"
|
||||
>
|
||||
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #picker1
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond"
|
||||
[touchUi]="touchUi"
|
||||
[hideTime]="true"
|
||||
>
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
@@ -194,7 +300,7 @@
|
||||
</div>
|
||||
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('dateOccurrence')?.invalid && validateFrom ">
|
||||
|
||||
|
||||
|
||||
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
|
||||
<mat-select placeholder="Selecione repetição*"
|
||||
[(ngModel)]="EventRecurrenceType"
|
||||
@@ -316,7 +422,7 @@
|
||||
<ion-item>
|
||||
<ion-label>
|
||||
<p class="d-flex ion-justify-content-between">
|
||||
<span class="attach-title-item">{{document.Assunto}}</span>
|
||||
<span class="attach-title-item">{{document.Assunto || document.SourceName}}</span>
|
||||
<span class="app-name" *ngIf="!document.appName">{{ TaskService.attachmentAppName(document)}}</span>
|
||||
<span class="app-name" *ngIf="document.appName">{{document.appName}}</span>
|
||||
<span class="close-button text-black" (click)="removeAttachment(i)" >
|
||||
@@ -353,7 +459,7 @@
|
||||
<div class="buttons">
|
||||
<button class="btn-ok" shape="round" (click)="saveTask()">Gravar</button>
|
||||
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
|
||||
|
||||
|
||||
</div>
|
||||
</ion-footer>
|
||||
|
||||
|
||||
@@ -23,7 +23,13 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
|
||||
import { environment } from 'src/environments/environment';
|
||||
import { TaskService } from 'src/app/services/task.service'
|
||||
import { ContactsService } from 'src/app/services/contacts.service';
|
||||
|
||||
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
|
||||
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
|
||||
import { Observable } from 'rxjs';
|
||||
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
|
||||
import { isHttpError } from 'src/app/services/http.service';
|
||||
import { RoleIdService } from 'src/app/services/role-id.service';
|
||||
import { Utils } from 'src/app/services/Repositorys/Agenda/utils';
|
||||
|
||||
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
|
||||
parse: {
|
||||
@@ -97,25 +103,32 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
eventPipe = new EventPipe()
|
||||
CalendarName;
|
||||
CalendarNameShow = true
|
||||
CalendarNamesOptions
|
||||
testeFormDefaul = "Eudes"
|
||||
environment = environment
|
||||
eventPersons: EventPerson[];
|
||||
contacts: EventPerson[];
|
||||
sharedCalendar: Observable<TableSharedCalendar[]>
|
||||
selectedUserCalendar:any;
|
||||
sessionStore = SessionStore;
|
||||
hasChangeCalendar = false
|
||||
eventRecurence = 'never';
|
||||
|
||||
CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
private router: Router,
|
||||
private navParams: NavParams,
|
||||
authService: AuthService,
|
||||
private toastService: ToastService,
|
||||
private calendarService: EventsService,
|
||||
private eventService: EventService,
|
||||
public ThemeService: ThemeService,
|
||||
public _eventService: EventsService,
|
||||
private httpErroHandle: HttpErrorHandle,
|
||||
public TaskService: TaskService,
|
||||
private contactsService: ContactsService,
|
||||
private agendaDataRepository: AgendaDataRepositoryService,
|
||||
public RoleIdService: RoleIdService,
|
||||
public utils: Utils,
|
||||
) {
|
||||
this.loggeduser = SessionStore.user;
|
||||
this.document = this.navParams.get('document')
|
||||
@@ -192,6 +205,14 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
|
||||
this.changeAgenda()
|
||||
|
||||
this.postData.EventRecurrence = {
|
||||
frequency: this.eventRecurence,
|
||||
until: "",
|
||||
Type: '' ,
|
||||
}
|
||||
|
||||
this.postData.IsAllDayEvent = false;
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -199,14 +220,36 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
this.setDefaultTime()
|
||||
this.getRecurrenceTypes();
|
||||
this.fetchContacts("")
|
||||
|
||||
|
||||
this.setCalendarByDefault(true)
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
clearInterval(this.myInterval)
|
||||
}
|
||||
|
||||
changeSegmentCalendar() {
|
||||
this.hasChangeCalendar = true
|
||||
}
|
||||
|
||||
|
||||
async changeAgenda() {
|
||||
|
||||
const result = await this.agendaDataRepository.geCalendars()
|
||||
|
||||
const selectedCalendar = result.find(e => e.wxUserId == this.selectedUserCalendar)
|
||||
|
||||
if(selectedCalendar) {
|
||||
if(selectedCalendar.shareType == 1) {
|
||||
this.CalendarNamesOptions = ['Oficial']
|
||||
} else if(selectedCalendar.shareType == 2) {
|
||||
this.CalendarNamesOptions = ['Pessoal']
|
||||
} else if (selectedCalendar.shareType == 3) {
|
||||
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
myInterval = setInterval(() => {
|
||||
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
|
||||
if (e) {
|
||||
@@ -279,34 +322,25 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
})
|
||||
}
|
||||
|
||||
changeAgenda() {
|
||||
async setCalendarByDefault(force) {
|
||||
if (!this.selectedUserCalendar || force) {
|
||||
|
||||
this.CalendarNameShow = false
|
||||
|
||||
setTimeout(() => {
|
||||
|
||||
this.CalendarNameShow = true
|
||||
|
||||
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
||||
|
||||
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
|
||||
} else if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial']) {
|
||||
this.CalendarNamesOptions = ['Oficial']
|
||||
this.postData.CalendarName = 'Oficial'
|
||||
|
||||
} else if (this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
|
||||
this.CalendarNamesOptions = ['Pessoal']
|
||||
this.postData.CalendarName = 'Pessoal'
|
||||
const data = await this.agendaDataRepository.geCalendars()
|
||||
|
||||
const prObject = data.find(e => e?.roleId == 100000014)
|
||||
if(prObject) {
|
||||
this.selectedUserCalendar = prObject.wxUserId
|
||||
} else {
|
||||
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
|
||||
this.selectedUserCalendar = SessionStore.user.UserId
|
||||
}
|
||||
}, 50)
|
||||
|
||||
this.changeAgenda()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
async saveTask() {
|
||||
@XTracerAsync({name:'document-setup-metting', bugPrint: true})
|
||||
async saveTask(tracing?: TracingType) {
|
||||
|
||||
if (this.loggeduser.Profile != 'PR') {
|
||||
this.injectValidation()
|
||||
@@ -314,49 +348,95 @@ export class DocumentSetUpMeetingPage implements OnInit {
|
||||
if (this.Form.invalid) return false
|
||||
}
|
||||
|
||||
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
|
||||
let postEvent = {
|
||||
EventId: '',
|
||||
Subject: this.postData.Subject,
|
||||
Body: this.postData.Body.Text,
|
||||
Location: this.postData.Location,
|
||||
CalendarId: this.selectedCalendarId(),
|
||||
CalendarName: this.postData.CalendarName,
|
||||
StartDate: this.postData.StartDate,
|
||||
EndDate: this.postData.EndDate,
|
||||
EventType: 'Reunião',
|
||||
Attendees: Attendees,
|
||||
IsMeeting: false, //
|
||||
IsRecurring: this.postData.IsRecurring,
|
||||
AppointmentState: 0, //
|
||||
TimeZone: '', //
|
||||
Organizer: '', //
|
||||
Category: 'Reunião',
|
||||
HasAttachments: false,
|
||||
EventRecurrence: {
|
||||
Type: this.EventRecurrenceType,
|
||||
LastOccurrence: this.Occurrence,
|
||||
},
|
||||
Attachments: this.attachments,
|
||||
}
|
||||
this.postData.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
|
||||
|
||||
const laoder = this.toastService.loading();
|
||||
|
||||
const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
|
||||
if(calendar.isOk()) {
|
||||
|
||||
const value = await this.agendaDataRepository.createEvent(this.postData, this.attachments, calendar.value, tracing, true)
|
||||
if(value.isOk()) {
|
||||
|
||||
this.eventService.create({ body: postEvent, calendar: this.postData.CalendarName }).subscribe(async (respose) => {
|
||||
laoder.remove();
|
||||
this.httpErroHandle.httpsSucessMessagge('new event');
|
||||
this.modalController.dismiss()
|
||||
}, (error) => {
|
||||
laoder.remove();
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
}, () => {
|
||||
laoder.remove();
|
||||
});
|
||||
} else {
|
||||
|
||||
if(!isHttpError(value.error)) {
|
||||
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #1')
|
||||
console.log(value.error)
|
||||
tracing.bugFlag()
|
||||
} else {
|
||||
this.httpErroHandle.httpStatusHandle(value.error.status)
|
||||
}
|
||||
console.log('create event error: ', value.error)
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
tracing.setAttribute('outcome', 'failed')
|
||||
tracing.setAttribute('no', 'this.selectedUserCalendar')
|
||||
tracing.bugFlag()
|
||||
}
|
||||
|
||||
laoder.remove();
|
||||
|
||||
}
|
||||
|
||||
onCheckboxChange(event: any) {
|
||||
if (this.postData.IsAllDayEvent) {
|
||||
this.postData.IsAllDayEvent = this.postData.IsAllDayEvent;
|
||||
this.postData.StartDate = this.setAlldayTime(this.postData.StartDate)
|
||||
this.postData.EndDate = this.setAlldayTimeEndDate(this.postData.EndDate)
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.postData.IsAllDayEvent = this.postData.IsAllDayEvent;
|
||||
this.postData.EndDate = this.setAlldayTimeEndDateNotAlday(this.postData.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
|
||||
async addParticipants() {
|
||||
|
||||
this.adding = "intervenient";
|
||||
|
||||
@@ -298,35 +298,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- <div *ngIf="postEvent.EventRecurrence.Type != '-1'" class="container-div width-100">
|
||||
<div class="ion-item-class-2 d-flex">
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
|
||||
</div>
|
||||
<div (click)="openLastOccurrence()" class="ion-input-class flex-grow-1">
|
||||
<mat-form-field class="date-hour-picker">
|
||||
<input matInput [ngxMatDatetimePicker]="occurrrence"
|
||||
placeholder="Choose a date"
|
||||
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
|
||||
[disabled]="disabled"
|
||||
[min]="postEvent.EndDate"
|
||||
>
|
||||
<mat-datepicker-toggle id="last-occurrence" matSuffix [for]="occurrrence"></mat-datepicker-toggle>
|
||||
<ngx-mat-datetime-picker #occurrrence
|
||||
[showSpinners]="showSpinners"
|
||||
[showSeconds]="showSeconds"
|
||||
[stepHour]="stepHour" [stepMinute]="stepMinute"
|
||||
[stepSecond]="stepSecond"
|
||||
[touchUi]="touchUi"
|
||||
>
|
||||
</ngx-mat-datetime-picker>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="container-div">
|
||||
<div class="ion-item-class-2">
|
||||
<div class="ion-icon-class">
|
||||
|
||||
+13
-3
@@ -118,6 +118,7 @@ export class BookMeetingModalPage implements OnInit {
|
||||
sharedCalendar: Observable<TableSharedCalendar[]>
|
||||
allDayCheck: boolean = false;
|
||||
CalendarNameShow = true
|
||||
eventRecurence = 'never';
|
||||
|
||||
constructor(
|
||||
private modalController: ModalController,
|
||||
@@ -159,6 +160,12 @@ export class BookMeetingModalPage implements OnInit {
|
||||
this.postData.Category = 'Reunião'
|
||||
this.postData.IsAllDayEvent = false
|
||||
|
||||
this.postData.EventRecurrence = {
|
||||
frequency: this.eventRecurence,
|
||||
until: "",
|
||||
Type: '' ,
|
||||
};
|
||||
|
||||
if (this.taskParticipants.length == 0) {
|
||||
this.taskParticipants = [
|
||||
// {
|
||||
@@ -348,7 +355,10 @@ export class BookMeetingModalPage implements OnInit {
|
||||
Category: 'Meeting',
|
||||
HasAttachments: true,
|
||||
IsAllDayEvent: this.postData.IsAllDayEvent,
|
||||
EventRecurrence: this.postData.EventRecurrence,
|
||||
EventRecurrence: {
|
||||
frequency: this.eventRecurence,
|
||||
until: "",
|
||||
Type: '' },
|
||||
Attachments: []
|
||||
}
|
||||
|
||||
@@ -363,13 +373,13 @@ export class BookMeetingModalPage implements OnInit {
|
||||
}
|
||||
});
|
||||
|
||||
postData.Attachments = DocumentToSave;
|
||||
this.postData.Attachments = DocumentToSave as any;
|
||||
let loader = this.toastService.loading();
|
||||
|
||||
const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
|
||||
if(calendar.isOk()) {
|
||||
|
||||
const value = await this.agendaDataRepository.createEvent(postData, this.documents, calendar.value, tracing)
|
||||
const value = await this.agendaDataRepository.createEvent(this.postData, this.documents, calendar.value, tracing)
|
||||
if(value.isOk()) {
|
||||
|
||||
console.log(value.value)
|
||||
|
||||
@@ -162,7 +162,7 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
createEvent(eventData: Event, documents, calendar: TableSharedCalendar, tracing: TracingType) {
|
||||
createEvent(eventData: Event, documents, calendar: TableSharedCalendar, tracing: TracingType, addAll =false) {
|
||||
|
||||
console.log('eventData', eventData);
|
||||
|
||||
@@ -177,7 +177,7 @@ export class AgendaDataRepositoryService {
|
||||
type: this.utils.calendarTypeSeleted(eventData.Category),
|
||||
category: this.utils.calendarCategorySeleted(eventData.CalendarName),
|
||||
attendees: this.utils.attendeesAdded(eventData.Attendees),
|
||||
attachments: this.utils.documentAdded(documents),
|
||||
attachments: this.utils.documentAdded(documents, addAll),
|
||||
recurrence: {
|
||||
frequency: this.utils.eventRecurence(eventData.EventRecurrence.frequency),
|
||||
until:((eventData.EventRecurrence.until === "") ? this.utils.addOneHourToIsoString(eventData.EndDate.toISOString()) : eventData.EventRecurrence.until),
|
||||
@@ -243,7 +243,7 @@ export class AgendaDataRepositoryService {
|
||||
addEventAttachment(id, attachmentData, tracing: TracingType) {
|
||||
console.log(attachmentData)
|
||||
|
||||
const attachments = { attachments: this.utils.documentAdded(attachmentData) }
|
||||
const attachments = { attachments: this.utils.documentAdded(attachmentData, false) }
|
||||
APINODReturn(AttachInputDTOSchema, attachments, `POST/${id}/Attendee`, tracing)
|
||||
return this.agendaDataService.addEventAttachment(id, attachments);
|
||||
}
|
||||
|
||||
@@ -73,17 +73,19 @@ export class Utils {
|
||||
'Meeting': 1,
|
||||
'Travel': 2,
|
||||
'Conference': 3,
|
||||
'Encontro': 1
|
||||
'Encontro': 1,
|
||||
'Reunião': 1,
|
||||
'Conferência': 3
|
||||
}
|
||||
return selectedType[calendarName];
|
||||
}
|
||||
|
||||
documentAdded(documents: any[]) {
|
||||
documentAdded(documents: any[], addAll: Boolean) {
|
||||
console.log('added doc create event', documents)
|
||||
let listupdate = []
|
||||
documents.forEach(element => {
|
||||
let object = {
|
||||
docId: element.docId || element.DocId || element.Id,
|
||||
docId: element.SourceId || element.docId || element.DocId || element.Id,
|
||||
sourceName: element.subject || element.sourceNames || element.Description || element.SourceName || element.Assunto,
|
||||
description: "",
|
||||
applicationId: element.applicationId || element.ApplicationId
|
||||
@@ -92,7 +94,10 @@ export class Utils {
|
||||
listupdate.push(object)
|
||||
});
|
||||
|
||||
return listupdate.filter( e=> typeof e.docId == 'number')
|
||||
|
||||
console.log({listupdate})
|
||||
|
||||
return listupdate.filter( e=> typeof e.docId == 'number' || addAll)
|
||||
|
||||
/* return documents.map((e) => {
|
||||
return {
|
||||
|
||||
@@ -131,6 +131,16 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div>
|
||||
<ion-item>
|
||||
<ion-label>Todo dia</ion-label>
|
||||
<ion-checkbox [(ngModel)]="eventProcess.workflowInstanceDataFields.IsAllDayEvent" (ionChange)="onCheckboxChange($event)"></ion-checkbox>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="Form && validateFrom" >
|
||||
<div *ngIf="Form.get('participantes').invalid " class="input-errror-message">
|
||||
<div *ngIf="Form.get('participantes').errors?.required">
|
||||
|
||||
@@ -54,7 +54,7 @@ export class EditEventToApprovePage implements OnInit {
|
||||
recurringTypes: any;
|
||||
selectedRecurringType: any;
|
||||
|
||||
showLoader = false
|
||||
showLoader = false;
|
||||
|
||||
get dateStart() {
|
||||
return this.dateControlStart.value
|
||||
@@ -570,6 +570,55 @@ export class EditEventToApprovePage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
onCheckboxChange(event: any) {
|
||||
|
||||
if (this.eventProcess.workflowInstanceDataFields.IsAllDayEvent) {
|
||||
this.eventProcess.workflowInstanceDataFields.StartDate = this.setAlldayTime(this.eventProcess.workflowInstanceDataFields.StartDate)
|
||||
this.eventProcess.workflowInstanceDataFields.EndDate = this.setAlldayTimeEndDate(this.eventProcess.workflowInstanceDataFields.EndDate)
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.eventProcess.workflowInstanceDataFields.IsAllDayEvent = this.eventProcess.workflowInstanceDataFields.IsAllDayEvent;
|
||||
this.eventProcess.workflowInstanceDataFields.EndDate = this.setAlldayTimeEndDateNotAlday(this.eventProcess.workflowInstanceDataFields.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
async addParticipants() {
|
||||
|
||||
//this.saveTemporaryData();
|
||||
|
||||
@@ -49,6 +49,7 @@ export class AttendeePage implements OnInit {
|
||||
LtaskParticipantsCc: EventPerson[] = [];
|
||||
loggeduser: LoginUserRespose;
|
||||
listOfNotAllowdRoute = ['/home/gabinete-digital/despachos/', ]
|
||||
selectedUserCalendar:any;
|
||||
|
||||
constructor(
|
||||
public ThemeService: ThemeService,
|
||||
@@ -242,7 +243,7 @@ export class AttendeePage implements OnInit {
|
||||
|
||||
let result
|
||||
if(this.hideExternalDomain) {
|
||||
result = _result.filter( e => e.UserType == 'GD')
|
||||
result = _result.filter( e => e.UserType == 'GD' && e.Name.includes(filter))
|
||||
} else {
|
||||
result = _result
|
||||
}
|
||||
|
||||
@@ -100,6 +100,15 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div>
|
||||
<ion-item>
|
||||
<ion-label>Todo dia</ion-label>
|
||||
<ion-checkbox [(ngModel)]="eventProcess.workflowInstanceDataFields.IsAllDayEvent" (ionChange)="onCheckboxChange($event)"></ion-checkbox>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-div width-100">
|
||||
<div class="ion-item-class-2 width-100">
|
||||
<div class="ion-icon-class">
|
||||
|
||||
@@ -393,6 +393,58 @@ export class EditEventToApproveComponent implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
onCheckboxChange(event: any) {
|
||||
|
||||
if (this.eventProcess.workflowInstanceDataFields.IsAllDayEvent) {
|
||||
this.eventProcess.workflowInstanceDataFields.StartDate = this.setAlldayTime(this.eventProcess.workflowInstanceDataFields.StartDate)
|
||||
this.eventProcess.workflowInstanceDataFields.EndDate = this.setAlldayTimeEndDate(this.eventProcess.workflowInstanceDataFields.EndDate)
|
||||
|
||||
console.log('Recurso ativado!!');
|
||||
} else {
|
||||
this.eventProcess.workflowInstanceDataFields.IsAllDayEvent = this.eventProcess.workflowInstanceDataFields.IsAllDayEvent;
|
||||
this.eventProcess.workflowInstanceDataFields.EndDate = this.setAlldayTimeEndDateNotAlday(this.eventProcess.workflowInstanceDataFields.EndDate)
|
||||
console.log('Recurso desativado');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
setAlldayTime(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(0)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
|
||||
setAlldayTimeEndDate(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(59)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
setAlldayTimeEndDateNotAlday(timeToReturn) {
|
||||
let date: any = new Date(timeToReturn) || new Date();
|
||||
let newdate = new Date();
|
||||
date.setHours(23)
|
||||
date.setMinutes(0)
|
||||
date.setSeconds(0);
|
||||
|
||||
|
||||
return date
|
||||
}
|
||||
|
||||
|
||||
async openAttendees() {
|
||||
|
||||
if (window.innerWidth <= 1024) {
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<div *ngIf="task.Note">
|
||||
<h5 class="font-17-rem">Detalhes</h5>
|
||||
<ion-item class="ion-no-margin ion-no-padding">
|
||||
<pre class="width-100 text">{{ task.Note || fulltask?.workflowInstanceDataFields?.TaskMessage}} </pre>
|
||||
<div #text class="width-100 text"></div>
|
||||
</ion-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
|
||||
import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core';
|
||||
import { customTask } from 'src/app/models/dailyworktask.model';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { DeviceService } from "src/app/services/device.service"
|
||||
@@ -12,6 +12,9 @@ import { SessionStore } from 'src/app/store/session.service';
|
||||
import { LoginUserRespose } from 'src/app/models/user.model';
|
||||
import { object } from 'zod';
|
||||
import { element } from 'protractor';
|
||||
import { task } from '../../../../models/ExpedientTaskModalPage';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-task-details',
|
||||
@@ -34,17 +37,103 @@ export class TaskDetailsPage implements OnInit {
|
||||
selectedIndex = 0
|
||||
dropButton = true
|
||||
loggeduser: LoginUserRespose;
|
||||
@ViewChild('text', { static: false }) text: ElementRef;
|
||||
|
||||
constructor(
|
||||
public ThemeService: ThemeService,
|
||||
public DeviceService: DeviceService,
|
||||
private DocumentViewerOptionService: DocumentViewerOptionService,
|
||||
public p: PermissionService,
|
||||
private modalController: ModalController,
|
||||
private HeaderSettingsService: HeaderSettingsService
|
||||
private HeaderSettingsService: HeaderSettingsService,
|
||||
private sanitizer: DomSanitizer
|
||||
) {
|
||||
this.DeviceService.isDesktop();
|
||||
this.loggeduser = SessionStore.user
|
||||
|
||||
|
||||
// if(this.task.Note) {
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
// }
|
||||
|
||||
// if(this.fulltask?.workflowInstanceDataFields?.TaskMessage) {
|
||||
// this.fulltask.workflowInstanceDataFields.TaskMessage = this.sanitizeHtml(this.fulltask.workflowInstanceDataFields.TaskMessage);
|
||||
// }
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 10)
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 100)
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 500)
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 1000)
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 2000)
|
||||
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('change', this.task.Note);
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
(this.text.nativeElement as HTMLDivElement).innerHTML = this.decode(this.task.Note)
|
||||
|
||||
}, 4000)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngChange( ) {
|
||||
console.log('change', this.task.Note)
|
||||
// this.task.Note = this.sanitizeHtml(this.task.Note) as any
|
||||
|
||||
}
|
||||
|
||||
decode(encodedString) {
|
||||
// Create a temporary element to decode HTML entities
|
||||
let tempElement = document.createElement('div');
|
||||
tempElement.innerHTML = encodedString;
|
||||
|
||||
// Return the decoded string
|
||||
return tempElement.textContent || tempElement.innerText || '';
|
||||
}
|
||||
|
||||
|
||||
sanitizeHtml(html: string): SafeHtml {
|
||||
return this.sanitizer.bypassSecurityTrustHtml(html)
|
||||
const decodedHtml = this.decodeHtml(html);
|
||||
return this.sanitizer.bypassSecurityTrustHtml(decodedHtml);
|
||||
}
|
||||
|
||||
decodeHtml(html: string): string {
|
||||
const txt = document.createElement('textarea');
|
||||
txt.innerHTML = html;
|
||||
return txt.value;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
Reference in New Issue
Block a user