criar evento com recorrencia

This commit is contained in:
tiago.kayaya
2021-07-12 14:32:43 +01:00
parent d68a89e7c9
commit aa3a2e0420
4 changed files with 185 additions and 131 deletions
@@ -13,7 +13,7 @@
<ion-content> <ion-content>
<div class="main-content"> <div class="main-content">
<!-- <input type="text" ngbDatepicker #d="ngbDatepicker"/> --> <!-- <input type="text" ngbDatepicker #d="ngbDatepicker"/> -->
<div class="ion-item-container" [class.input-error]="Form?.get('Subject')?.invalid && validateFrom "> <div class="ion-item-container" [class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
<ion-input placeholder="Assunto*" [(ngModel)]="postEvent.Subject"></ion-input> <ion-input placeholder="Assunto*" [(ngModel)]="postEvent.Subject"></ion-input>
</div> </div>
@@ -43,7 +43,7 @@
<!-- <span class="error ion-padding" > <!-- <span class="error ion-padding" >
Campo obrigatório Campo obrigatório
</span> --> </span> -->
</div> </div>
<!-- <div *ngIf="Form && validateFrom" > <!-- <div *ngIf="Form && validateFrom" >
@@ -56,7 +56,7 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -64,9 +64,9 @@
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
<ion-select placeholder="Selecione agenda*" <ion-select placeholder="Selecione agenda*"
selectedText="{{postEvent.CalendarName}}" selectedText="{{postEvent.CalendarName}}"
[(ngModel)]="postEvent.CalendarName" [(ngModel)]="postEvent.CalendarName"
interface="action-sheet" Cancel-text="Cancelar" interface="action-sheet" Cancel-text="Cancelar"
required> required>
<ion-select-option value="Oficial">Oficial</ion-select-option> <ion-select-option value="Oficial">Oficial</ion-select-option>
<ion-select-option value="Pessoal">Pessoal</ion-select-option> <ion-select-option value="Pessoal">Pessoal</ion-select-option>
@@ -89,9 +89,9 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
<ion-select placeholder="Selecione tipo de evento*" <ion-select placeholder="Selecione tipo de evento*"
[(ngModel)]="postEvent.Categories[0]" [(ngModel)]="postEvent.Categories[0]"
interface="action-sheet" interface="action-sheet"
Cancel-text="Cancelar" required> Cancel-text="Cancelar" required>
<ion-select-option value="Reunião">Reunião</ion-select-option> <ion-select-option value="Reunião">Reunião</ion-select-option>
<ion-select-option value="Viagem">Viagem</ion-select-option> <ion-select-option value="Viagem">Viagem</ion-select-option>
@@ -110,20 +110,20 @@
</div> </div>
</div> </div>
</div> --> </div> -->
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<ion-datetime <ion-datetime
placeholder="Início*" placeholder="Início*"
[(ngModel)]="postEvent.StartDate" [(ngModel)]="postEvent.StartDate"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
minuteValues="0,15,30,45" minuteValues="0,15,30,45"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
min="{{minDate}}" min="{{minDate}}"
max="2025" max="2025"
> >
</ion-datetime> </ion-datetime>
@@ -131,14 +131,14 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Date')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<ion-datetime <ion-datetime
placeholder="Fim*" placeholder="Fim*"
[(ngModel)]="postEvent.EndDate" [(ngModel)]="postEvent.EndDate"
displayFormat="D MMM YYYY H:mm" displayFormat="D MMM YYYY H:mm"
@@ -146,51 +146,51 @@
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
min="{{minDate}}" min="{{minDate}}"
max="2025" max="2025"
> >
</ion-datetime> </ion-datetime>
<!-- <ion-input placeholder="Data fim" [(ngModel)]="postData.EndDate"></ion-input> --> <!-- <ion-input placeholder="Data fim" [(ngModel)]="postData.EndDate"></ion-input> -->
</div> </div>
</div> </div>
</div> </div>
<div class="container-div width-100"> <div class="container-div width-100">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
<ion-select placeholder="Selecione a repetição*" <ion-select placeholder="Selecione a repetição*"
[(ngModel)]="selectedRecurringType" [(ngModel)]="selectedRecurringType"
(ngModelChange)="onSelectedRecurringChanged($event)" (ngModelChange)="onSelectedRecurringChanged($event)"
interface="action-sheet" interface="action-sheet"
Cancel-text="Cancelar" required> Cancel-text="Cancelar" required>
<ion-select-option *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}">{{recurring.Description}}</ion-select-option> <ion-select-option *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}">{{recurring.Description}}</ion-select-option>
</ion-select> </ion-select>
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="selectedRecurringType != '-1'" class="container-div width-100"> <div *ngIf="selectedRecurringType != '-1'" class="container-div width-100">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class"> <div class="ion-input-class">
<ion-datetime <ion-datetime
placeholder="Última ocorrência" placeholder="Última ocorrência"
[(ngModel)]="postEvent.EventRecurrence.LastOccurrence" [(ngModel)]="postEvent.EventRecurrence.LastOccurrence"
displayFormat="DD MMM YYYY" displayFormat="DD MMM YYYY"
monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez" monthShortNames="Jan, Fev, Mar, Abr, Mai, Jun, Jul, Aug, Sep, Out, Nov, Dez"
min="2021" min="2021"
max="2045" max="2045"
> >
</ion-datetime> </ion-datetime>
<!-- <ion-input placeholder="Data fim" [(ngModel)]="postData.EndDate"></ion-input> --> <!-- <ion-input placeholder="Data fim" [(ngModel)]="postData.EndDate"></ion-input> -->
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -217,7 +217,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -245,20 +245,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2"> <div class="ion-item-class-2">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class-no-height flex-grow-1"> <div class="ion-input-class-no-height flex-grow-1">
<ion-textarea [(ngModel)]="postEvent.Body.Text" placeholder="Detalhes" ></ion-textarea> <ion-textarea [(ngModel)]="postEvent.Body.Text" placeholder="Detalhes" ></ion-textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="ion-item-container-no-border cursor-pointer" (click)="getDoc()"> <div class="ion-item-container-no-border cursor-pointer" (click)="getDoc()">
<ion-label> <ion-label>
<div class="attach-icon"> <div class="attach-icon">
@@ -266,27 +266,27 @@
</div> </div>
<div class="attach-document"> <div class="attach-document">
<ion-label>Adicionar documentos</ion-label> <ion-label>Adicionar documentos</ion-label>
</div> </div>
</ion-label> </ion-label>
</div> </div>
<div *ngFor="let document of documents; let i = index" > <div *ngFor="let document of documents; let i = index" >
<ion-list class="list"> <ion-list class="list">
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span> <span class="attach-title-item">{{document.Assunto}}</span>
<span class="app-name">{{document.appName}}</span> <span class="app-name">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" > <span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </p>
<p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yy'}} </span></p> <p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yy'}} </span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
</div> </div>
</div> </div>
</ion-content> </ion-content>
<ion-footer class="ion-no-border d-flex justify-center px-20"> <ion-footer class="ion-no-border d-flex justify-center px-20">
<ion-toolbar class=" "> <ion-toolbar class=" ">
@@ -302,4 +302,4 @@
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-footer> </ion-footer>
@@ -63,12 +63,12 @@ export class NewEventPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private navParams: NavParams, private navParams: NavParams,
private eventService: EventsService, private eventService: EventsService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
userService: AuthService, userService: AuthService,
) { ) {
this.loggeduser = userService.ValidatedUser; this.loggeduser = userService.ValidatedUser;
this.postEvent = new Event(); this.postEvent = new Event();
this.postEvent.EventRecurrence = {Type:'-1'}; this.postEvent.EventRecurrence = {Type:'-1'};
@@ -87,16 +87,16 @@ export class NewEventPage implements OnInit {
ngOnInit() { ngOnInit() {
this.selectedRecurringType = "-1"; this.selectedRecurringType = "-1";
console.log(this.postEvent); console.log(this.postEvent);
this.getRecurrenceTypes(); this.getRecurrenceTypes();
/* console.log(this.profile); */ /* console.log(this.profile); */
let selectedStartdDate = this.selectedDate; let selectedStartdDate = this.selectedDate;
let selectedEndDate = new Date(this.selectedDate); let selectedEndDate = new Date(this.selectedDate);
/* Set + 30minutes to seleted datetime */ /* Set + 30minutes to seleted datetime */
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ; selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
if(this.selectedSegment != "Combinada"){ if(this.selectedSegment != "Combinada"){
this.postEvent ={ this.postEvent ={
EventId: '', EventId: '',
@@ -148,9 +148,12 @@ export class NewEventPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
}; };
console.log(this.postEvent);
} }
close(){ close(){
this.modalController.dismiss(); this.modalController.dismiss();
} }
@@ -173,7 +176,7 @@ export class NewEventPage implements OnInit {
this.selectedRecurringType = "-1"; this.selectedRecurringType = "-1";
} }
} }
runValidation() { runValidation() {
this.validateFrom = true this.validateFrom = true
@@ -216,22 +219,22 @@ export class NewEventPage implements OnInit {
}) })
} }
async save() { async save() {
this.injectValidation() this.injectValidation()
this.runValidation() this.runValidation()
if(this.Form.invalid) return false if(this.Form.invalid) return false
if(this.documents.length >= 0) { if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true; this.postEvent.HasAttachments = true;
} }
if(this.selectedRecurringType != '-1'){ if(this.selectedRecurringType != '-1'){
this.postEvent.EventRecurrence.Type = this.selectedRecurringType; this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
} }
let eventId: any; let eventId: any;
try { try {
const loader = this.toastService.loading() const loader = this.toastService.loading()
@@ -240,15 +243,15 @@ export class NewEventPage implements OnInit {
console.log(this.loggeduser.Profile); console.log(this.loggeduser.Profile);
console.log(this.postEvent); console.log(this.postEvent);
eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise(); eventId = await this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).toPromise();
console.log(eventId); console.log(eventId);
loader.remove() loader.remove()
} }
else if(this.loggeduser.Profile == 'PR'){ else if(this.loggeduser.Profile == 'PR'){
console.log(this.loggeduser.Profile); console.log(this.loggeduser.Profile);
eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise(); eventId = await this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).toPromise();
loader.remove() loader.remove()
} }
@@ -272,14 +275,14 @@ export class NewEventPage implements OnInit {
} catch(error) { } catch(error) {
console.log('document not save') console.log('document not save')
} }
}); });
this.toastService.successMessage() this.toastService.successMessage()
this.modalController.dismiss(this.postEvent); this.modalController.dismiss(this.postEvent);
} catch (error) { } catch (error) {
this.toastService.badRequest() this.toastService.badRequest()
} }
@@ -287,7 +290,7 @@ export class NewEventPage implements OnInit {
} }
async openAttendees() { async openAttendees() {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
component: AttendeesPageModal, component: AttendeesPageModal,
componentProps: { componentProps: {
@@ -302,7 +305,7 @@ export class NewEventPage implements OnInit {
await modal.present(); await modal.present();
modal.onDidDismiss().then((data) => { modal.onDidDismiss().then((data) => {
if(data){ if(data){
data = data['data']; data = data['data'];
@@ -319,7 +322,7 @@ export class NewEventPage implements OnInit {
this.taskParticipants = data; this.taskParticipants = data;
this.postEvent.Attendees = data; this.postEvent.Attendees = data;
} }
setIntervenientCC(data){ setIntervenientCC(data){
this.taskParticipantsCc = data; this.taskParticipantsCc = data;
} }
@@ -359,4 +362,4 @@ export class NewEventPage implements OnInit {
this.documents = this.documents.filter( (e, i) => index != i); this.documents = this.documents.filter( (e, i) => index != i);
} }
} }
@@ -28,7 +28,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -39,9 +39,9 @@
<ion-input type="text" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input> <ion-input type="text" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input>
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="Form && validateFrom" > <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Location').invalid " class="input-errror-message"> <div *ngIf="Form.get('Location').invalid " class="input-errror-message">
<div *ngIf="Form.get('Location').errors?.required"> <div *ngIf="Form.get('Location').errors?.required">
@@ -52,13 +52,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1 d-flex justify-center align-center material-inputs materia-top "> <div class="ion-input-class flex-grow-1 justify-center align-center material-inputs ">
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda"> <mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="postEvent.CalendarName" > <mat-select [(value)]="postEvent.CalendarName" >
@@ -80,7 +80,7 @@
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1 d-flex justify-center align-center material-inputs materia-top"> <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> <mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
<!-- <input matInput type="text" > --> <!-- <input matInput type="text" > -->
@@ -109,23 +109,23 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<!-- <!--
[className]="Form?.get('Subject')?.invalid ? 'input-error ion-input-class flex-grow-1' : 'ion-input-class ion-input-class flex-grow-1' " [className]="Form?.get('Subject')?.invalid ? 'input-error ion-input-class flex-grow-1' : 'ion-input-class ion-input-class flex-grow-1' "
--> -->
<div class="ion-input-class flex-grow-1" > <div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top">
<mat-form-field class="date-hour-picker"> <mat-form-field class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1" <input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date" placeholder="Choose a date"
[formControl]="dateControlStart" [formControl]="dateControlStart"
[min]="minDate" [min]="minDate"
[disabled]="disabled" [disabled]="disabled"
> >
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle> <mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1 <ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners" [showSpinners]="showSpinners"
[showSeconds]="showSeconds" [showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute" [stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond" [stepSecond]="stepSecond"
[touchUi]="touchUi" [touchUi]="touchUi"
> >
@@ -135,29 +135,29 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div> </div>
<!-- <!--
[className]="Form?.get('Subject')?.invalid ? 'input-error ion-input-class flex-grow-1' : 'ion-input-class ion-input-class flex-grow-1' " [className]="Form?.get('Subject')?.invalid ? 'input-error ion-input-class flex-grow-1' : 'ion-input-class ion-input-class flex-grow-1' "
--> -->
<div (click)="openFim()" class="ion-input-class flex-grow-1" > <div (click)="openFim()" class="ion-input-class flex-grow-1 justify-center align-center materia-top">
<mat-form-field class="date-hour-picker"> <mat-form-field class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="fim" <input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date" placeholder="Choose a date"
[formControl]="dateControlEnd" [formControl]="dateControlEnd"
[min]="endMinDate" [min]="endMinDate"
[disabled]="disabled" [disabled]="disabled"
> >
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle> <mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim <ngx-mat-datetime-picker #fim
[showSpinners]="showSpinners" [showSpinners]="showSpinners"
[showSeconds]="showSeconds" [showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute" [stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond" [stepSecond]="stepSecond"
[touchUi]="touchUi" [touchUi]="touchUi"
> >
@@ -167,21 +167,44 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div">
<!-- <div class="container-div width-100">
<div class="ion-item-class-2">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div>
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
<ion-select placeholder="Selecione a repetição*"
[(ngModel)]="selectedRecurringType"
(ngModelChange)="onSelectedRecurringChanged($event)"
interface="action-sheet"
Cancel-text="Cancelar" required>
<ion-select-option *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}">{{recurring.Description}}</ion-select-option>
</ion-select>
</div>
</div>
</div> -->
<div class="container-div width-100">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1 d-flex justify-center align-center material-inputs materia-top"> <div class="ion-input-class flex-grow-1">
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required> <mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
<mat-select placeholder="Selecione repetição*" [(ngModel)]="postEvent.IsRecurring"> <mat-select placeholder="Selecione repetição*"
<mat-option value="false"> [(ngModel)]="postEvent.EventRecurrence.Type"
Não se repete (ngModelChange)="onSelectedRecurringChanged($event)">
</mat-option> <mat-option
<mat-option value="true"> *ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
Repete >
{{recurring.Description}}
</mat-option> </mat-option>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
@@ -189,7 +212,7 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngIf="Form && validateFrom" > <div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('participantes').invalid " class="input-errror-message"> <div *ngIf="Form.get('participantes').invalid " class="input-errror-message">
<div *ngIf="Form.get('participantes').errors?.required"> <div *ngIf="Form.get('participantes').errors?.required">
@@ -204,7 +227,7 @@
<ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-person.svg"></ion-icon>
</div> </div>
<div class="ion-input-class-no-height flex-grow-1" [class.input-error]="Form?.get('participantes')?.invalid && validateFrom"> <div class="ion-input-class-no-height flex-grow-1" [class.input-error]="Form?.get('participantes')?.invalid && validateFrom">
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
@@ -220,7 +243,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
@@ -228,7 +251,7 @@
</div> </div>
<div class="ion-input-class-no-height flex-grow-1" [class.input-error]="Form?.get('participantes')?.invalid && validateFrom"> <div class="ion-input-class-no-height flex-grow-1" [class.input-error]="Form?.get('participantes')?.invalid && validateFrom">
<div class="list-people"> <div class="list-people">
<ion-item lines="none"> <ion-item lines="none">
<ion-list> <ion-list>
<ion-label *ngIf="taskParticipantsCc.length ==0" class="list-people-title">Com conhecimento</ion-label> <ion-label *ngIf="taskParticipantsCc.length ==0" class="list-people-title">Com conhecimento</ion-label>
@@ -243,20 +266,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="container-div"> <div class="container-div">
<div class="ion-item-class-2 d-flex"> <div class="ion-item-class-2 d-flex">
<div class="ion-icon-class"> <div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-input-class-no-height flex-grow-1"> <div class="ion-input-class-no-height flex-grow-1">
<ion-textarea [(ngModel)]="postEvent.Body.Text" placeholder="Detalhes" ></ion-textarea> <ion-textarea [(ngModel)]="postEvent.Body.Text" placeholder="Detalhes" ></ion-textarea>
</div> </div>
</div> </div>
</div> </div>
<div class="ion-item-container-no-border cursor-pointer" (click)="getDoc()"> <div class="ion-item-container-no-border cursor-pointer" (click)="getDoc()">
<ion-label> <ion-label>
<div class="attach-icon"> <div class="attach-icon">
@@ -264,28 +287,28 @@
</div> </div>
<div class="attach-document"> <div class="attach-document">
<ion-label>Adicionar documentos</ion-label> <ion-label>Adicionar documentos</ion-label>
</div> </div>
</ion-label> </ion-label>
</div> </div>
<div class="list " *ngFor="let document of documents; let i = index" > <div class="list " *ngFor="let document of documents; let i = index" >
<ion-list> <ion-list>
<ion-item> <ion-item>
<ion-label> <ion-label>
<p class="d-flex ion-justify-content-between"> <p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.Assunto}}</span> <span class="attach-title-item">{{document.Assunto}}</span>
<span class="app-name">{{document.appName}}</span> <span class="app-name">{{document.appName}}</span>
<span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" > <span class="close-button text-black cursor-pointer" (click)="removeAttachment(i)" >
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon> <ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span> </span>
</p> </p>
<p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yy'}} </span></p> <p><span class="span-left">{{document.EntidadeOrganicaNome}}</span><span class="span-right"> {{document.Data | date: 'dd-MM-yy'}} </span></p>
</ion-label> </ion-label>
</ion-item> </ion-item>
</ion-list> </ion-list>
</div> </div>
</div> </div>
</ion-content> </ion-content>
<ion-footer class="ion-no-border px-20"> <ion-footer class="ion-no-border px-20">
<ion-toolbar class="d-flex justify-space-between"> <ion-toolbar class="d-flex justify-space-between">
@@ -301,4 +324,4 @@
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
</ion-footer> </ion-footer>
@@ -66,13 +66,15 @@ export class NewEventPage implements OnInit {
public stepMinute = 5; public stepMinute = 5;
public stepSecond = 5; public stepSecond = 5;
public color: ThemePalette = 'primary'; public color: ThemePalette = 'primary';
recurringTypes: any;
selectedRecurringType: any;
@Input() profile:string; @Input() profile:string;
@Input() selectedSegment: string; @Input() selectedSegment: string;
@Input() selectedDate: Date; @Input() selectedDate: Date;
@Input() taskParticipants: EventPerson[] = []; @Input() taskParticipants: EventPerson[] = [];
@Input() taskParticipantsCc: any = []; @Input() taskParticipantsCc: any = [];
@Output() setIntervenient = new EventEmitter<any>(); @Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>(); @Output() setIntervenientCC = new EventEmitter<any>();
@@ -122,7 +124,7 @@ export class NewEventPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private eventService: EventsService, private eventService: EventsService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private toastService: ToastService, private toastService: ToastService,
private userService: AuthService, private userService: AuthService,
@@ -137,23 +139,23 @@ export class NewEventPage implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.getRecurrenceTypes();
if(!this.restoreTemporaryData()){ if(!this.restoreTemporaryData()){
// clear // clear
this.postEvent = new Event(); this.postEvent = new Event();
this.eventBody = { BodyType : "1", Text : ""}; this.eventBody = { BodyType : "1", Text : ""};
this.postEvent.Body = this.eventBody; this.postEvent.Body = this.eventBody;
/* console.log(this.profile); */ /* console.log(this.profile); */
let selectedStartdDate = this.selectedDate; let selectedStartdDate = this.selectedDate;
let selectedEndDate = new Date(this.selectedDate); let selectedEndDate = new Date(this.selectedDate);
/* Set + 30minutes to seleted datetime */ /* Set + 30minutes to seleted datetime */
selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ; selectedEndDate.setMinutes(this.selectedDate.getMinutes() + 30) ;
if(this.selectedSegment != "Combinada"){ if(this.selectedSegment != "Combinada"){
this.postEvent ={ this.postEvent ={
EventId: '', EventId: '',
@@ -173,7 +175,7 @@ export class NewEventPage implements OnInit {
Organizer: '', Organizer: '',
Categories: ['Reunião'], Categories: ['Reunião'],
HasAttachments: false, HasAttachments: false,
EventRecurrence: null, EventRecurrence: {Type:'-1'},
}; };
} }
else{ else{
@@ -195,7 +197,7 @@ export class NewEventPage implements OnInit {
Organizer: '', Organizer: '',
Categories: ['Reunião'], Categories: ['Reunião'],
HasAttachments: false, HasAttachments: false,
EventRecurrence: null, EventRecurrence: {Type:'-1'},
}; };
} }
@@ -206,7 +208,7 @@ export class NewEventPage implements OnInit {
} else { } else {
this.taskParticipantsCc.push(e); this.taskParticipantsCc.push(e);
} }
}) })
} }
this.taskParticipants = removeDuplicate(this.taskParticipants); this.taskParticipants = removeDuplicate(this.taskParticipants);
@@ -221,7 +223,8 @@ export class NewEventPage implements OnInit {
this.date = new Date(2021,9,4,5,6,7); this.date = new Date(2021,9,4,5,6,7);
this.getDatepickerData() this.getDatepickerData()
this.injectValidation() this.injectValidation();
} }
runValidation() { runValidation() {
@@ -292,7 +295,7 @@ export class NewEventPage implements OnInit {
} }
}); });
} }
close(){ close(){
this.deleteTemporaryData(); this.deleteTemporaryData();
@@ -303,6 +306,24 @@ export class NewEventPage implements OnInit {
this.setIntervenientCC.emit([]); this.setIntervenientCC.emit([]);
} }
getRecurrenceTypes() {
this.eventService.getRecurrenceTypes().subscribe(res=>{
console.log(res);
this.recurringTypes = res;
});
}
onSelectedRecurringChanged(ev:any){
console.log(ev);
if(ev.length > 1){
console.log(ev.filter(data => data != '-1'));
this.postEvent.EventRecurrence.Type = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.postEvent.EventRecurrence.Type = "-1";
}
}
getDatepickerData() { getDatepickerData() {
if (this.postEvent) { if (this.postEvent) {
this.postEvent.StartDate = this.dateStart this.postEvent.StartDate = this.dateStart
@@ -332,6 +353,9 @@ export class NewEventPage implements OnInit {
if(this.documents.length >= 0) { if(this.documents.length >= 0) {
this.postEvent.HasAttachments = true; this.postEvent.HasAttachments = true;
} }
if(this.selectedRecurringType != '-1'){
/* this.postEvent.EventRecurrence.Type = this.selectedRecurringType; */
}
if(this.loggeduser.Profile == 'MDGPR') { if(this.loggeduser.Profile == 'MDGPR') {
// console.log('MD - Aqui'); // console.log('MD - Aqui');
@@ -340,9 +364,12 @@ export class NewEventPage implements OnInit {
this.showLoader = true; this.showLoader = true;
console.log(this.postEvent); console.log(this.postEvent);
let loader = this.toastService.loading()
let loader = this.toastService.loading();
console.log(this.postEvent);
this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe( this.eventService.postEventMd(this.postEvent, this.postEvent.CalendarName).subscribe(
async (id) => { async (id) => {
@@ -365,10 +392,10 @@ export class NewEventPage implements OnInit {
SerialNumber: '' SerialNumber: ''
}; };
}); });
await DocumentToSave.forEach((attachments, i) => { await DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{ this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){ if(DocumentToSave.length == (i+1)){
this.afterSave(); this.afterSave();
} }
@@ -376,7 +403,7 @@ export class NewEventPage implements OnInit {
}); });
if(DocumentToSave.length == 0){ if(DocumentToSave.length == 0){
this.afterSave(); this.afterSave();
@@ -386,11 +413,12 @@ export class NewEventPage implements OnInit {
}, },
error => { error => {
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
this.toastService.badRequest('Evento não criado') this.toastService.badRequest('Evento não criado')
}); });
loader.remove();
} }
else if(this.loggeduser.Profile == 'PR') { else if(this.loggeduser.Profile == 'PR') {
console.log('PR - Aqui'); console.log('PR - Aqui');
@@ -398,7 +426,7 @@ export class NewEventPage implements OnInit {
this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe( this.eventService.postEventPr(this.postEvent, this.postEvent.CalendarName).subscribe(
(id) => { (id) => {
console.log(id); console.log(id);
const eventId: any = id; const eventId: any = id;
@@ -417,7 +445,7 @@ export class NewEventPage implements OnInit {
DocumentToSave.forEach((attachments, i) => { DocumentToSave.forEach((attachments, i) => {
this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{ this.attachmentsService.setEventAttachmentById(attachments).subscribe((res) =>{
if(DocumentToSave.length == (i+1)){ if(DocumentToSave.length == (i+1)){
this.afterSave(); this.afterSave();
} }
@@ -465,7 +493,7 @@ export class NewEventPage implements OnInit {
async addParticipantsCc() { async addParticipantsCc() {
this.saveTemporaryData(); this.saveTemporaryData();
this.openAttendeesComponent.emit({ this.openAttendeesComponent.emit({
type: "CC" type: "CC"
}); });
@@ -483,7 +511,7 @@ export class NewEventPage implements OnInit {
} }
/** /**
* *
* @description o pipeline já esta a funcionar tuda vez que nos fazer push na branch master e test o pipeline executa os teste, mas agora os teste temos que melhora para testar a app em tudos os pontos * @description o pipeline já esta a funcionar tuda vez que nos fazer push na branch master e test o pipeline executa os teste, mas agora os teste temos que melhora para testar a app em tudos os pontos
* o pipeline já está a funcionar toda vez que nos fazer um push na branch master ou teste o pipeline executa os testes, mas agora os testes temos que melhorar para testar a app em todos os pontos * o pipeline já está a funcionar toda vez que nos fazer um push na branch master ou teste o pipeline executa os testes, mas agora os testes temos que melhorar para testar a app em todos os pontos
*/ */