improve evento to approve

This commit is contained in:
Peter Maquiran
2023-02-22 16:53:28 +01:00
parent 2e1e6be4c9
commit 7e2011b642
9 changed files with 65 additions and 30 deletions
@@ -19,7 +19,7 @@
<!-- <ion-segment-button value="MDGPR">
Minha agenda
</ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : i.OwnerUserId">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -58,7 +58,13 @@ export class EventListPage implements OnInit {
ngOnInit() {
this.segment = 'MDGPR';
if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
const location = window.location
const pathname = location.pathname + location.search
@@ -157,7 +163,7 @@ export class EventListPage implements OnInit {
const segment = this.segment
if(this.segment == 'MDGPR') {
if(this.segment == 'Meu calendario') {
// color
if(SessionStore.user.Profile == 'PR') {
this.color = 'pr'
@@ -33,6 +33,7 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { SessionStore } from 'src/app/store/session.service';
import { NotificationsService } from 'src/app/services/notifications.service'
import { environment } from 'src/environments/environment';
import { EventsService } from 'src/app/services/events.service';
@Component({
selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html',
@@ -126,7 +127,8 @@ export class GabineteDigitalPage implements OnInit {
private sortService: SortService,
private storage: Storage,
public p: PermissionService,
public NotificationsService: NotificationsService
public NotificationsService: NotificationsService,
public eventService: EventsService,
) {
// this.workerList = new Worker(new URL('./list.worker.js', import.meta.url));
@@ -732,6 +734,33 @@ export class GabineteDigitalPage implements OnInit {
this.updateAllProcess()
}
for(let calendar of this.eventService.calendarNamesAry) {
if(calendar == 'Meu calendario') {
// color
let genericEvents = await this.processesbackend.GetTasksList('Agendar Evento', false).toPromise();
let eventsList
try {
eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
eventsList = [];
}
this.eventoaprovacaostore.save(calendar, eventsList)
} else {
let allEvents = await this.processesbackend.eventsToApprove(calendar.OwnerUserId).toPromise()
let eventsList
try {
eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
eventsList = []
}
this.eventoaprovacaostore.save(calendar, eventsList)
}
}
// let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
// let eventsMDGPRList = mdEventsOficial
@@ -739,7 +768,7 @@ export class GabineteDigitalPage implements OnInit {
// this.eventoaprovacaostore.countMd = eventsMDGPRList.length
// this.eventoaprovacaostore.resetmd(eventsMDGPRList);
this.updateAllProcess()
// this.updateAllProcess()
// let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
// let eventsPRList = prEventsOficial
-2
View File
@@ -266,8 +266,6 @@ export class EventsService {
"OwnerUserId": sharedCalendar.OwnerUserId,
"RoleId": sharedCalendar.CalendarRoleId
}
console.log('objectShared', objectShared)
this.calendarNamesAry.push(objectShared)
@@ -10,7 +10,7 @@
</div>
<ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : i.OwnerUserId ">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId ">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -49,11 +49,13 @@ export class EventListPage implements OnInit {
ngOnInit() {
this.segment = this.loggeduser.Profile;
if(this.segment != "PR" && this.segment != "MDGPR") {
this.segment = "Unknown";
if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
const pathname = window.location.pathname
this.router.events.forEach((event) => {
@@ -83,7 +85,7 @@ export class EventListPage implements OnInit {
const segment = this.segment
if(this.segment == 'MDGPR') {
if(this.segment == 'Meu calendario') {
// color
if(SessionStore.user.Profile == 'PR') {
this.color = 'pr'
@@ -13,7 +13,7 @@
Minha agenda
</ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : i.OwnerUserId">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR {{ i.OwnerUserIds }}</div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -27,7 +27,6 @@ export class EventsToApprovePage implements OnInit {
eventBody: EventBody;
categories: string[];
serialnumber:string;
loggeduser: LoginUserRespose;
segment:string;
eventaprovacaostore = EventoAprovacaoStore;
@@ -44,12 +43,17 @@ export class EventsToApprovePage implements OnInit {
private storage: Storage,
public eventService: EventsService,
)
{
this.loggeduser = SessionStore.user;
}
{}
ngOnInit() {
this.segment = this.loggeduser.Profile;
if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
this.LoadToApproveEvents();
this.router.events.forEach((event) => {
@@ -73,9 +77,8 @@ export class EventsToApprovePage implements OnInit {
async LoadToApproveEvents() {
this.showLoader = true;
const segment = this.segment
console.log(this.eventService.calendarNamesAry)
if(this.segment == 'MDGPR') {
if(this.segment == 'Meu calendario') {
// color
if(SessionStore.user.Profile == 'PR') {
this.color = 'pr'
@@ -98,12 +101,9 @@ export class EventsToApprovePage implements OnInit {
} else {
this.color = 'pr'
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
console.log('allEvents', allEvents)
try {
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
+6 -6
View File
@@ -1,12 +1,12 @@
export let versionData = {
"shortSHA": "623df60ae",
"SHA": "623df60aeb62c6830a82deda35294a2fc72907a2",
"shortSHA": "2e1e6be4c",
"SHA": "2e1e6be4c9fd6c7dc220b6d49210d2989ff36439",
"branch": "no_bug_movemente",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Wed Feb 22 13:06:31 2023 +0100'",
"lastCommitMessage": "fix",
"lastCommitNumber": "4817",
"lastCommitTime": "'Wed Feb 22 13:08:14 2023 +0100'",
"lastCommitMessage": "merge",
"lastCommitNumber": "4819",
"change": "",
"changeStatus": "On branch no_bug_movemente\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/shared/agenda/event-list/event-list.page.ts\n\tmodified: version/git-version.ts",
"changeStatus": "On branch no_bug_movemente\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.html\n\tmodified: src/app/pages/gabinete-digital/event-list/event-list.page.ts\n\tmodified: src/app/pages/gabinete-digital/gabinete-digital.page.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/shared/agenda/event-list/event-list.page.html\n\tmodified: src/app/shared/agenda/event-list/event-list.page.ts\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.html\n\tmodified: src/app/shared/gabinete-digital/events-to-approve/events-to-approve.page.ts",
"changeAuthor": "peter.maquiran"
}