Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer

This commit is contained in:
Peter Maquiran
2021-07-13 09:58:08 +01:00
4 changed files with 153 additions and 86 deletions
@@ -13,7 +13,7 @@
<ion-content>
<div class="main-content">
<div class="ion-item-container" [class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
<ion-input placeholder="Assunto*" [(ngModel)]="postEvent.Subject"></ion-input>
</div>
@@ -27,7 +27,7 @@
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 width-100 d-flex">
<div class="ion-icon-class">
@@ -41,7 +41,7 @@
<!-- <span class="error ion-padding" >
Campo obrigatório
</span> -->
</div>
<div *ngIf="Form && validateFrom" >
@@ -54,8 +54,8 @@
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 width-100 d-flex">
<div class="ion-icon-class">
@@ -106,7 +106,7 @@
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 width-100 d-flex">
<div class="ion-icon-class">
@@ -114,18 +114,18 @@
</div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field appearance="none" floatLabel="never" floatLabel="never" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date"
<mat-form-field appearance="none" floatLabel="never" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date"
[formControl]="dateControlStart"
[min]="minDate" [max]="maxDate"
[min]="minDate" [max]="maxDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[min]="endMinDate"
[touchUi]="touchUi">
@@ -135,7 +135,7 @@
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 width-100 d-flex">
<div class="ion-icon-class">
@@ -144,17 +144,17 @@
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Date')?.invalid && validateFrom ">
<mat-form-field appearance="none" floatLabel="never" floatLabel="never" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Choose a date"
[formControl]="dateControlEnd"
[min]="minDate" [max]="maxDate"
[min]="minDate" [max]="maxDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim"></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
[showSpinners]="showSpinners"
<ngx-mat-datetime-picker #fim
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi">
</ngx-mat-datetime-picker>
@@ -169,15 +169,16 @@
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-refresh.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('IsRecurring')?.invalid && validateFrom " >
<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-select placeholder="Selecione repetição*" [(ngModel)]="postEvent.IsRecurring">
<mat-option value="false">
Não se repete
</mat-option>
<mat-option value="true">
Repete
<mat-form-field appearance="none" floatLabel="never" class="width-100" value="false" interface="action-sheet" required>
<mat-select placeholder="Selecione repetição*"
[(ngModel)]="selectedRecurringType"
(ngModelChange)="onSelectedRecurringChanged($event)">
<mat-option
*ngFor="let recurring of recurringTypes" value="{{recurring.Code}}"
>
{{recurring.Description}}
</mat-option>
</mat-select>
</mat-form-field>
@@ -186,6 +187,35 @@
</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"
[formControl]="dateControlOccurrence"
[min]="endMinDate"
[disabled]="disabled"
>
<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 *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('participantes').invalid " class="input-errror-message">
<div *ngIf="Form.get('participantes').errors?.required">
@@ -193,7 +223,7 @@
</div>
</div>
</div>
<div class=" d-flex width-100">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
@@ -216,7 +246,7 @@
</div>
</div>
</div>
<div class=" d-flex width-100">
<div class="ion-item-class-2 width-100">
<div class="ion-icon-class">
@@ -239,7 +269,7 @@
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
@@ -250,7 +280,7 @@
</div>
</div>
</div>
<div (click)="getDoc()" class="d-flex container-div width-100 ion-item-container-no-border cursor-pointer" >
<ion-label>
<div class="attach-icon">
@@ -258,16 +288,16 @@
</div>
<div class="attach-document">
<ion-label>Adicionar documentos</ion-label>
</div>
</div>
</ion-label>
</div>
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
<div class="d-flex container-div width-100" *ngFor="let document of loadedEventAttachments; let i = index" >
<ion-list class="width-100 list" *ngIf="!document.remove">
<ion-item class="width-100">
<ion-label class="width-100">
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.SourceName}}</span>
<span class="app-name" *ngIf="document.ApplicationId == '8'"> Correspondencia </span>
<span class="app-name" *ngIf="document.ApplicationId == '386'"> AccoesPresidenciais </span>
<span class="app-name" *ngIf="document.ApplicationId == '361' "> ArquivoDespachoElect </span>
@@ -275,14 +305,14 @@
<ion-icon class="font-20" src="assets/images/icons-delete-25.svg"></ion-icon>
</span>
</p>
</p>
<p><span class="span-left">{{document.Stakeholders}}</span><span class="span-right"> {{document.CreateDate | date: 'dd-MM-yy'}} </span></p>
</ion-label>
</ion-item>
</ion-list>
</div>
</div>
</div>
</div>
</ion-content>
<ion-footer class="ion-no-border">
<ion-toolbar class="width-100 d-flex justify-space-between px-20">
@@ -298,4 +328,4 @@
</button>
</ion-buttons>
</ion-toolbar>
</ion-footer>
</ion-footer>
@@ -31,6 +31,9 @@ export class EditEventPage implements OnInit {
eventAttendees: EventPerson[];
// minDate: string;
loadedEventAttachments: Attachment[]=[];
recurringTypes: any;
selectedRecurringType: any;
public dateControlOccurrence = new FormControl(moment("DD MM YYYY hh"));
public date: any;
public disabled = false;
@@ -57,7 +60,7 @@ export class EditEventPage implements OnInit {
@Output() openAttendeesComponent = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() clearPostEvent = new EventEmitter<any>();
@@ -85,6 +88,9 @@ export class EditEventPage implements OnInit {
{ value: false, label: 'False' }
];
get dateOccurrence () {
return this.dateControlOccurrence.value
}
public listColors = ['primary', 'accent', 'warn'];
public stepHours = [1, 2, 3, 4, 5];
public stepMinutes = [1, 5, 10, 15, 20, 25];
@@ -96,13 +102,16 @@ export class EditEventPage implements OnInit {
public alertController: AlertController,
private attachmentsService: AttachmentsService,
private toastService: ToastService ) {
}
ngOnInit() {
console.log(this.postEvent);
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence));
if(!this.restoreTemporaryData()) {
// clear
if(this.postEvent) {
if( this.postEvent.Body){
if(typeof(this.postEvent.Body.Text) == 'string'){
@@ -110,7 +119,7 @@ export class EditEventPage implements OnInit {
}
}
}
// attendees list
if(this.postEvent.Attendees != null) {
this.postEvent.Attendees.forEach(e =>{
@@ -119,17 +128,17 @@ export class EditEventPage implements OnInit {
} else {
this.taskParticipantsCc.push(e);
}
})
})
}
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
this.setIntervenient.emit(this.taskParticipants);
this.setIntervenientCC.emit(this.taskParticipantsCc);
this.isEventEdited = false;
if(this.postEvent.IsRecurring == false) {
this.isRecurring = "Não se repete";
}
@@ -140,9 +149,18 @@ export class EditEventPage implements OnInit {
this.getAttachments(this.postEvent.EventId);
this.restoreDatepickerData()
this.restoreDatepickerData();
this.getRecurrenceTypes();
this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();
setTimeout(() => {
this.selectedRecurringType = this.postEvent.EventRecurrence.Type.toString();
console.log(this.selectedRecurringType);
}, 1000);
}
close() {
this.closeComponent.emit();
this.setIntervenient.emit([]);
@@ -152,6 +170,24 @@ export class EditEventPage implements OnInit {
this.deleteTemporaryData();
}
getRecurrenceTypes() {
this.eventsService.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.selectedRecurringType = ev.filter(data => data != '-1');
}
if(ev.length == 0){
this.selectedRecurringType = "-1";
}
}
runValidation() {
this.validateFrom = true
@@ -177,9 +213,9 @@ export class EditEventPage implements OnInit {
dateEnd: new FormControl(this.dateEnd, [
Validators.required
]),
IsRecurring: new FormControl(this.postEvent.IsRecurring, [
/* IsRecurring: new FormControl(this.postEvent.IsRecurring, [
Validators.required
]),
]), */
participantes: new FormControl(this.taskParticipants, [
Validators.required
]),
@@ -224,7 +260,7 @@ export class EditEventPage implements OnInit {
this.clearPostEvent.emit();
this.deleteTemporaryData();
this.close();
this.saveDocument()
}
@@ -232,10 +268,10 @@ export class EditEventPage implements OnInit {
saveDocument() {
this.loadedEventAttachments.forEach((e)=>{
const id: any = e.Id
const remove = e['remove']
if ( id == 'add') {
//data.selected
const DocumentToSave = {
@@ -288,6 +324,7 @@ export class EditEventPage implements OnInit {
if (this.postEvent) {
this.postEvent.StartDate = this.dateStart
this.postEvent.EndDate = this.dateEnd
this.postEvent.EventRecurrence.LastOccurrence = this.dateOccurrence
}
}
@@ -299,7 +336,7 @@ export class EditEventPage implements OnInit {
}
saveTemporaryData() {
this.getDatepickerData()
window['temp.path:/home/agenda/edit-event.component.ts'] = {
@@ -310,7 +347,7 @@ export class EditEventPage implements OnInit {
}
restoreTemporaryData(): boolean {
const restoredData = window['temp.path:/home/agenda/edit-event.component.ts']
if(JSON.stringify(restoredData) != "{}" && undefined != restoredData){
@@ -320,11 +357,11 @@ export class EditEventPage implements OnInit {
this.restoreDatepickerData()
return true;
return true;
} else {
return false;
}
}
deleteTemporaryData(){
@@ -334,24 +371,24 @@ export class EditEventPage implements OnInit {
getAttachments(eventId: string){
this.attachmentsService.getAttachmentsById(eventId).subscribe(res=>{
this.loadedEventAttachments = res;
console.log('res', res);
console.log('res', res);
});
}
deleteAttachment(attachmentID: string, index) {
const id: any = this.loadedEventAttachments[index].Id
if(id == 'add') {
this.loadedEventAttachments = this.loadedEventAttachments.filter((e,i)=> i!=index)
} else {
this.loadedEventAttachments[index]['remove'] = true
}
}
async getDoc() {
const modal = await this.modalController.create({
component: SearchPage,
@@ -355,8 +355,8 @@ export class NewEventPage implements OnInit {
if (this.postEvent) {
this.dateControlStart = new FormControl(moment(this.postEvent.StartDate, "DD MM YYYY hh:mm"));
this.dateControlEnd = new FormControl(moment(this.postEvent.EndDate, "DD MM YYYY hh:mm"));
this.dateControlOccurrence = new FormControl(moment(this.postEvent.EventRecurrence.LastOccurrence, "DD MM YYYY hh:mm"))
}
}
async save() {
@@ -33,10 +33,10 @@ export class ViewEventPage implements OnInit {
customDate:any;
today:any;
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
documents: Attachment[] = [];
dicIndex = 0;
@@ -54,7 +54,7 @@ export class ViewEventPage implements OnInit {
private modalController: ModalController,
public popoverController: PopoverController,
private toastService: ToastService,
)
)
{
this.isEventEdited = false;
this.loadedEvent = new Event();
@@ -63,19 +63,19 @@ export class ViewEventPage implements OnInit {
}
ngOnInit() {
/* console.log(this.eventId); */
this.loadEvent();
//this.getAttachments();
}
ngOnChanges(changes: any): void {
this.loadedAttachments = null;
this.loadEvent();
}
openOptions(){
}
docIndex(index: number) {
@@ -84,7 +84,7 @@ export class ViewEventPage implements OnInit {
close(){
console.log(this.isEventEdited);
this.viewEventDetailDismiss.emit({
type: 'close'
})
@@ -93,7 +93,7 @@ export class ViewEventPage implements OnInit {
loadEvent(){
this.eventsService.getEvent(this.eventId).subscribe(res => {
this.loadedEvent = res;
// console.log(res);
console.log(res);
this.today = new Date(res.StartDate);
// console.log(new Date(this.today));
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]);
@@ -102,11 +102,11 @@ export class ViewEventPage implements OnInit {
}
deleteEvent(){
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () =>
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0).subscribe(async () =>
{
this.toastService.successMessage('Evento apagado');
this.close();
});
});
}
getAttachments(eventId){
@@ -122,14 +122,14 @@ export class ViewEventPage implements OnInit {
event: this.loadedEvent
})
}
viewDocument(sourceId){
this.processes.GetDocumentUrl(sourceId, '8').subscribe(res=>{
console.log(res);
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
const browser = this.iab.create(url,"_blank");
browser.show();
});
}
@@ -149,9 +149,9 @@ export class ViewEventPage implements OnInit {
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
@@ -170,7 +170,7 @@ export class ViewEventPage implements OnInit {
console.log(res['data']);
if(res['data']=='openDiscart'){
console.log('open discart');
// this.distartExpedientModal();
}
@@ -187,13 +187,13 @@ export class ViewEventPage implements OnInit {
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
let classs;
if( window.innerWidth <= 800){
classs = 'book-meeting-modal modal modal-desktop'
@@ -213,7 +213,7 @@ export class ViewEventPage implements OnInit {
}
async openTaskOptions() {
const doc = this.loadedAttachments[ this.dicIndex];
@@ -223,9 +223,9 @@ export class ViewEventPage implements OnInit {
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
@@ -242,4 +242,4 @@ export class ViewEventPage implements OnInit {
return await popover.present();
}
}
}