mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-21 05:45:50 +00:00
default calendar
This commit is contained in:
@@ -56,7 +56,7 @@
|
||||
|
||||
|
||||
<!-- 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">
|
||||
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda" *ngIf="calendarData?.length && showCalendarField">
|
||||
<div *ngIf="selectedUserCalendar != SessionStore.user.UserId && !hasChangeCalendar " style="margin-bottom: -20px;">PR </div>
|
||||
<div *ngIf="selectedUserCalendar == SessionStore.user.UserId && !hasChangeCalendar " style="margin-bottom: -20px;">
|
||||
Minha agenda
|
||||
@@ -69,7 +69,7 @@
|
||||
|
||||
<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>
|
||||
|
||||
@@ -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,21 +190,11 @@ 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 {
|
||||
return result
|
||||
@@ -201,6 +205,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()
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user