mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Merge branch 'feature/agenda-new-api-peter' into feature/agenda-new-api-eudes
This commit is contained in:
@@ -56,8 +56,8 @@
|
||||
|
||||
|
||||
<!-- Debug line to print data -->
|
||||
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda" *ngIf="calendarData?.length && showCalendarField" (click)="hasChangeCalendar=true">
|
||||
<div *ngIf="selectedUserCalendar != SessionStore.user.UserId && !hasChangeCalendar " style="margin-bottom: -20px;">PR </div>
|
||||
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda" *ngIf="calendarData?.length && showCalendarField">
|
||||
<div *ngIf="hasPrCalendar(calendarData) && !hasChangeCalendar " style="margin-bottom: -20px;">PR </div>
|
||||
<div *ngIf="selectedUserCalendar == SessionStore.user.UserId && !hasChangeCalendar " style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
</div>
|
||||
@@ -69,16 +69,16 @@
|
||||
|
||||
<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"> Agenda do {{calendars.wxFullName}} </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 ">
|
||||
Minha agenda
|
||||
</div>
|
||||
|
||||
</mat-option>
|
||||
|
||||
<!-- <mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
||||
<mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
|
||||
PR+MDGPR
|
||||
</mat-option> -->
|
||||
</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -282,6 +282,18 @@ export class AgendaPage implements OnInit {
|
||||
this.weekToShow()
|
||||
}
|
||||
|
||||
|
||||
hasPrCalendar(data: TableSharedCalendar[]) {
|
||||
for(const e of data) {
|
||||
if(e.roleId == this.RoleIdService.PRES) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
segmentChanged() {
|
||||
this.showCalendarField = true
|
||||
}
|
||||
@@ -299,7 +311,6 @@ export class AgendaPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.setCalendarByDefault(false)
|
||||
@@ -680,6 +691,9 @@ export class AgendaPage implements OnInit {
|
||||
this.myCal.loadEvents();
|
||||
} catch (error) {}
|
||||
|
||||
|
||||
console.log('selectedCalendarIds', selectedCalendarIds)
|
||||
|
||||
let load = 0;
|
||||
for (const selectedCalendar of selectedCalendarIds) {
|
||||
|
||||
@@ -748,11 +762,9 @@ export class AgendaPage implements OnInit {
|
||||
const data = await this.AgendaDataRepositoryService.geCalendars()
|
||||
|
||||
const prObject = data.find(e => e?.roleId == 100000014)
|
||||
const myCalendar = data.find(e => e?.wxUserId == SessionStore.user.UserId)
|
||||
|
||||
return[{
|
||||
...this.eventService.calendarNamesType['Meu calendario'],
|
||||
wxUserId: this.SessionStore.user.UserId
|
||||
}, {
|
||||
return[{...myCalendar}, {
|
||||
...prObject
|
||||
}]
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ export class LoginPage implements OnInit {
|
||||
if (attempt.ChatData) {
|
||||
|
||||
try {
|
||||
|
||||
await this.AgendaDataRepositoryService.getSharedCalendar()
|
||||
await MessageModel.deleteAll();
|
||||
await DeleteMessageModel.deleteAll();
|
||||
@@ -177,6 +178,8 @@ export class LoginPage implements OnInit {
|
||||
} else {
|
||||
|
||||
|
||||
await this.AgendaDataRepositoryService.clearSharedCalendar()
|
||||
await this.AgendaDataRepositoryService.createOwnCalendar()
|
||||
this.RochetChatConnectorService.logout();
|
||||
this.clearStoreService.clear();
|
||||
this.ChatSystemService.clearChat();
|
||||
|
||||
@@ -21,7 +21,21 @@ export class AgendaDataRepositoryService {
|
||||
private agendaDataService: AgendaDataService,
|
||||
private utils: Utils,
|
||||
private agendaLocalDataSourceService: AgendaLocalDataSourceService
|
||||
) { }
|
||||
) {}
|
||||
|
||||
createOwnCalendar() {
|
||||
const currentUserCalendar = {
|
||||
wxUserId: SessionStore.user.UserId,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxeMail: SessionStore.user.Email,
|
||||
role: SessionStore.user.RoleDescription,
|
||||
roleId: SessionStore.user.RoleID,
|
||||
shareType: 0,
|
||||
date: '',
|
||||
}
|
||||
|
||||
return this.agendaLocalDataSourceService.createCalendar(currentUserCalendar)
|
||||
}
|
||||
|
||||
async getEventById(id: string) {
|
||||
try {
|
||||
@@ -176,23 +190,14 @@ export class AgendaDataRepositoryService {
|
||||
const result = await this.agendaDataService.getSharedCalendar()
|
||||
|
||||
if(result.isOk()) {
|
||||
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
|
||||
if(result.value?.data) {
|
||||
|
||||
const currentUserCalendar = {
|
||||
wxUserId: SessionStore.user.UserId,
|
||||
wxFullName: SessionStore.user.FullName,
|
||||
wxeMail: SessionStore.user.Email,
|
||||
role: SessionStore.user.RoleDescription,
|
||||
roleId: SessionStore.user.RoleID,
|
||||
shareType: 0,
|
||||
date: '',
|
||||
}
|
||||
|
||||
result.value.data.push(currentUserCalendar)
|
||||
|
||||
await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
await this.createOwnCalendar()
|
||||
return await this.agendaLocalDataSourceService.bulkCreate(result.value.data)
|
||||
} else {
|
||||
await this.createOwnCalendar()
|
||||
return result
|
||||
}
|
||||
} else {
|
||||
@@ -201,6 +206,10 @@ export class AgendaDataRepositoryService {
|
||||
|
||||
}
|
||||
|
||||
async clearSharedCalendar() {
|
||||
return await this.agendaLocalDataSourceService.clearSharedCalendar()
|
||||
}
|
||||
|
||||
getShareCalendarItemsLive() {
|
||||
return this.agendaLocalDataSourceService.getShareCalendarItemsLive()
|
||||
}
|
||||
|
||||
@@ -45,6 +45,16 @@ export class AgendaLocalDataSourceService {
|
||||
}
|
||||
}
|
||||
|
||||
async createCalendar(data: SharedCalendarListItemOutputDTO) {
|
||||
// db.eve
|
||||
try {
|
||||
const result = await AgendaDataSource.shareCalendar.add(data)
|
||||
return ok(result)
|
||||
} catch (e) {
|
||||
return err(false)
|
||||
}
|
||||
}
|
||||
|
||||
clearSharedCalendar() {
|
||||
// db.eve
|
||||
try {
|
||||
|
||||
@@ -71,9 +71,7 @@ export class EventListPage implements OnInit {
|
||||
}))
|
||||
)
|
||||
|
||||
this.eventService.onCalendarFinishLoad.subscribe(async() => {
|
||||
this.setCalendarByDefault()
|
||||
})
|
||||
this.setCalendarByDefault()
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -51,28 +51,16 @@ export class CalendarService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
removeRange(rangeStartDate, rangeEndDate, profile) {
|
||||
this._eventSource = this._eventSource.filter((e)=> {
|
||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.profile == profile) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
}
|
||||
|
||||
removeRangeForCalendar(rangeStartDate, rangeEndDate, profile, calendarId) {
|
||||
|
||||
this._eventSource = this._eventSource.filter((e)=> {
|
||||
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
|
||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId != calendarId) {
|
||||
new Date(rangeEndDate).getTime() >= new Date(e.endTime).getTime() && e.CalendarId == calendarId) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
pushEvent(eventsList: EventList, profile: 'pr' | 'md', CalendarId: string) {
|
||||
|
||||
Reference in New Issue
Block a user