create event from gabinete

This commit is contained in:
Peter Maquiran
2024-07-04 16:33:45 +01:00
parent 0e12b5de5e
commit 06417ead0f
22 changed files with 881 additions and 311 deletions
+36
View File
@@ -45,6 +45,7 @@
"@capacitor/haptics": "^4.1.0",
"@capacitor/ios": "^5.4.2",
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^6.0.0",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^5.1.0",
"@capacitor/share": "^4.1.0",
@@ -94,6 +95,7 @@
"@logisticinfotech/ionic4-datepicker": "^1.4.4",
"@microsoft/signalr": "^8.0.0",
"@ng-bootstrap/ng-bootstrap": "^9.1.2",
"@ngrx/store": "^10.1.2",
"@ngx-translate/core": "^13.0.0",
"@ngxs/store": "^3.8.2",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.1",
@@ -4076,6 +4078,14 @@
"@capacitor/core": "^4.0.0"
}
},
"node_modules/@capacitor/local-notifications": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-6.0.0.tgz",
"integrity": "sha512-a/g/ZlPgaBXue374oNzGvvNZWNpnclfcLzfE/P/PjhHxdHsM7J3OK0IfmjrEsRiON4AEIga+dkHi5yBjNAHCFw==",
"peerDependencies": {
"@capacitor/core": "^6.0.0"
}
},
"node_modules/@capacitor/network": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@capacitor/network/-/network-4.1.0.tgz",
@@ -7577,6 +7587,18 @@
"rxjs": "^6.5.5"
}
},
"node_modules/@ngrx/store": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-10.1.2.tgz",
"integrity": "sha512-FUjN786ch4Qt9WgJ78ef7Yquq3mPCekgcWgZrs4ycZw1f+KdfTHLTk1bGDtO8A8CzOya5yTT7KhxbdVjbOS5ng==",
"dependencies": {
"tslib": "^2.0.0"
},
"peerDependencies": {
"@angular/core": "^10.0.0",
"rxjs": "^6.5.3"
}
},
"node_modules/@ngtools/webpack": {
"version": "12.2.18",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-12.2.18.tgz",
@@ -47077,6 +47099,12 @@
"integrity": "sha512-5fanmJLdkXLEaro0oezkmpC15tBGlsLW4cp1jQTMPwyX6NLlPUFHdWUhMERzxL2QXHmHvtoFMJ4m15Eymgefuw==",
"requires": {}
},
"@capacitor/local-notifications": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@capacitor/local-notifications/-/local-notifications-6.0.0.tgz",
"integrity": "sha512-a/g/ZlPgaBXue374oNzGvvNZWNpnclfcLzfE/P/PjhHxdHsM7J3OK0IfmjrEsRiON4AEIga+dkHi5yBjNAHCFw==",
"requires": {}
},
"@capacitor/network": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/@capacitor/network/-/network-4.1.0.tgz",
@@ -49827,6 +49855,14 @@
"tslib": "^2.0.0"
}
},
"@ngrx/store": {
"version": "10.1.2",
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-10.1.2.tgz",
"integrity": "sha512-FUjN786ch4Qt9WgJ78ef7Yquq3mPCekgcWgZrs4ycZw1f+KdfTHLTk1bGDtO8A8CzOya5yTT7KhxbdVjbOS5ng==",
"requires": {
"tslib": "^2.0.0"
}
},
"@ngtools/webpack": {
"version": "12.2.18",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-12.2.18.tgz",
+2
View File
@@ -61,6 +61,7 @@
"@capacitor/haptics": "^4.1.0",
"@capacitor/ios": "^5.4.2",
"@capacitor/keyboard": "^4.1.0",
"@capacitor/local-notifications": "^6.0.0",
"@capacitor/network": "^4.1.0",
"@capacitor/push-notifications": "^5.1.0",
"@capacitor/share": "^4.1.0",
@@ -110,6 +111,7 @@
"@logisticinfotech/ionic4-datepicker": "^1.4.4",
"@microsoft/signalr": "^8.0.0",
"@ng-bootstrap/ng-bootstrap": "^9.1.2",
"@ngrx/store": "^10.1.2",
"@ngx-translate/core": "^13.0.0",
"@ngxs/store": "^3.8.2",
"@opentelemetry/exporter-metrics-otlp-http": "^0.52.1",
+3
View File
@@ -97,6 +97,8 @@ import { DiplomaOptionsPage } from './shared/popover/deploma-options/deploma-opt
import { ImageCropperModule } from 'ngx-image-cropper';
import { metricsInterceptor, MetricsInterceptor } from './interceptors/metter.interceptor';
import { environment } from 'src/environments/environment';
import { StoreModule } from '@ngrx/store';
import { calendarReducer } from './services/Repositorys/Agenda/agenda-memory-source.service';
// import { ServiceWorkerModule } from '@angular/service-worker';
// import { AngularFireModule } from '@angular/fire';
@@ -128,6 +130,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
@NgModule({
declarations: [AppComponent, PopupQuestionPipe, InputFilterDirective],
imports: [BrowserModule,
StoreModule.forRoot({ calendar: calendarReducer }),
CommonModule,
FormsModule,
CalendarModule.forRoot({
+3 -13
View File
@@ -1,7 +1,6 @@
import { Component, NgZone, OnInit } from '@angular/core';
import { Event } from '../models/event.model';
import { NotificationsService } from '../services/notifications.service';
import { AlertController, ModalController, Platform } from '@ionic/angular';
import { AlertController, Platform } from '@ionic/angular';
import { Router } from '@angular/router';
import { ToDayEventStorage } from '../store/to-day-event-storage.service';
import { TotalDocumentStore } from '../store/total-document.service';
@@ -17,21 +16,15 @@ import { RoleIdService } from 'src/app/services/role-id.service';
import { ActiveTabService } from 'src/app/services/active-tab.service';
import { Device } from '@capacitor/device';
import { RouteService } from 'src/app/services/route.service';
// import { LoggingService } from 'src/app/services/logger/log4js/logging.service';
import { CaptureLogService } from 'src/app/services/monitoring/capture-log/capture-log.service';
import { NetworkServiceService, ConnectionStatus } from 'src/app/services/network-service.service';
import { UserSession } from '../models/user.model';
import { PermissionList } from '../models/permission/permissionList';
import { SendIntent } from "send-intent";
// import { ChunkService } from "src/app/services/stream/chunk.service"
// import { StreamService } from "src/app/services/stream/stream.service"
import { Plugins } from '@capacitor/core';
import { NewActionPage } from '../pages/publications/new-action/new-action.page';
import { PublicationsPage } from '../pages/publications/publications.page';
// import { fetchData } from 'plugins/Echo';
import { Encoding, Filesystem, FilesystemDirectory } from '@capacitor/filesystem';
import { sendIntent } from 'src/app/services/shareIntent'
import { NativeNotificationService } from 'src/app/services/native-notification.service'
const { App } = Plugins;
@@ -106,10 +99,7 @@ export class HomePage implements OnInit {
private zone: NgZone,
public alertController: AlertController,
public CaptureLogService: CaptureLogService,
// private LoggingService: LoggingService
// private ChunkService: ChunkService,
// private StreamService: StreamService
private NativeNotificationService: NativeNotificationService
) {
if (SessionStore.exist) {
this.user = SessionStore.user;
+7 -2
View File
@@ -1,7 +1,7 @@
import { z } from 'zod';
// Define the schema for a single event
const eventListSchema = z.array(z.object({
const eventListItemSchema = z.object({
HasAttachments: z.boolean(),
IsAllDayEvent: z.boolean(),
EventId: z.any(),
@@ -18,6 +18,11 @@ const eventListSchema = z.array(z.object({
TimeZone: z.string(),
IsPrivate: z.boolean(),
createdAt: z.string()
}));
});
// Define the schema for a single event
const eventListSchema = z.array(eventListItemSchema);
export type EventListItem = z.infer<typeof eventListItemSchema>
export type EventList = z.infer<typeof eventListSchema>
+1
View File
@@ -192,6 +192,7 @@
<div class="calendar-border"></div>
<!-- {{ eventSource$ | async | json }} -->
<div class="calendar-title-container px-20 d-flex">
+5
View File
@@ -42,6 +42,8 @@ import { EEventFilterStatus } from 'src/app/services/Repositorys/Agenda/model/en
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
import { ToastService } from 'src/app/services/toast.service';
import { CalendarState, selectEventSource } from 'src/app/services/Repositorys/Agenda/agenda-memory-source.service';
import { Store } from '@ngrx/store';
@Component({
selector: 'app-agenda',
templateUrl: './agenda.page.html',
@@ -185,6 +187,8 @@ export class AgendaPage implements OnInit {
showCalendarField = false
hasChangeCalendar = false
eventSource$ = this.store.select(selectEventSource);
constructor(
@Inject(LOCALE_ID) private locale: string,
private modalCtrl: ModalController,
@@ -199,6 +203,7 @@ export class AgendaPage implements OnInit {
public RoleIdService: RoleIdService,
public AgendaDataRepositoryService: AgendaDataRepositoryService,
private toastService: ToastService,
private store: Store<CalendarState>
) {
this.selectedUserCalendar = SessionStore.user.UserId
@@ -410,7 +410,11 @@
<ion-label>
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.subject}}</span>
<span class="app-name">{{document.appName}}</span>
<span class="app-name">
<span class="app-name" *ngIf="document.applicationId == 8 || document.ApplicationId == 8"> Correspondência </span>
<span class="app-name" *ngIf="document.applicationId == 386 || document.ApplicationId == 386"> Acções Presidenciais </span>
<span class="app-name" *ngIf="document.applicationId == 361 || document.ApplicationId == 361 "> Arquivo Despacho Electrónico </span>
</span>
<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>
</span>
@@ -25,7 +25,7 @@
</div>
</div>
<div class="container-div" >
<div *ngIf="(sharedCalendar | async) as calendarData" class="container-div" >
<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>
@@ -33,19 +33,22 @@
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
<div *ngIf="utils.hasPrCalendar(calendarData) && !hasChangeCalendar " style="margin-bottom: -20px;">PR</div>
<div *ngIf="selectedUserCalendar == sessionStore.user.UserId && !hasChangeCalendar && sessionStore.user.Profile != 'PR' " style="margin-bottom: -20px;">
Minha agenda
</div>
<!-- <mat-option *ngFor="let calendars of _eventService.calendarNamesAry; let i = index" value="{{calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars != 'Ministro e Director do Gabinete do PR' && calendars != 'Presidente da República'"> Agenda do {{calendars}} </div>
<mat-select [(value)]="selectedUserCalendar" (selectionChange)="changeAgenda();changeSegmentCalendar()">
<mat-option *ngFor="let calendars of calendarData" value="{{calendars.wxUserId}}">
<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 && calendars.wxUserId != sessionStore.user.UserId"> Agenda do {{calendars.wxFullName}} </div>
<div *ngIf="calendars.wxUserId == sessionStore.user.UserId && sessionStore.user.Profile != 'PR'">
Minha agenda
</div>
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> -->
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{ calendars.Fullname || calendars}}">
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> {{ environment.agendaPR}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> {{ environment.agendaVP}} </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div>
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
</mat-option>
</mat-select>
@@ -72,7 +75,6 @@
<ion-icon slot="start" src="assets/images/icons-calendar.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs " [class.input-error]="Form?.get('CalendarName')?.invalid && validateFrom ">
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="postData.CalendarName" >
<mat-option *ngFor="let calendars of CalendarNamesOptions" value="{{calendars}}">
@@ -81,13 +83,10 @@
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2">
<div class="ion-icon-class">
@@ -95,7 +94,6 @@
</div>
<div class="ion-input-class" [class.input-error]="Form?.get('Categories')?.invalid && validateFrom ">
<mat-form-field appearance="none" class="width-100" placeholder="Sample Type" required>
<!-- <input matInput type="text" > -->
<mat-select [(ngModel)]="postData.Category" >
@@ -114,10 +112,84 @@
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div class="container-div">
<div>
<ion-item>
<ion-label>Todo dia</ion-label>
<ion-checkbox [(ngModel)]="allDayCheck" (ionChange)="onCheckboxChange($event)"></ion-checkbox>
</ion-item>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
</div>
<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>
<!-- <input matInput type="text" > -->
<mat-select [(value)]="postData.EventRecurrence.frequency" >
<mat-option value="never">
Nunca
</mat-option>
<mat-option value="daily">
Diário
</mat-option>
<mat-option value="weekly">
Semanalmente
</mat-option>
<mat-option value="monthly">
Mensal
</mat-option>
<mat-option value="yearly">
Anual
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
<div *ngIf="postData.EventRecurrence.frequency != 'never'" class="container-div">
<div class="ion-item-class-2 d-flex" >
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-reapet.svg"></ion-icon>
</div>
<div class="ion-input-class flex-grow-1 justify-center align-center material-inputs materia-top" >
<mat-form-field appearance="none" class="date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Data Fim de Recorrência*"
[(ngModel)]="postData.EventRecurrence.until"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
[hideTime]="true"
>
</ngx-mat-datetime-picker>
</mat-form-field>
</div>
</div>
</div>
<div class="container-div">
<div class="ion-item-class-2">
@@ -129,7 +201,7 @@
<mat-form-field appearance="none" class="width-100 date-hour-picker">
<input matInput [ngxMatDatetimePicker]="picker1"
placeholder="Choose a date*"
[formControl]="dateControlStart"
[(ngModel)]="postData.StartDate"
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
@@ -156,9 +228,8 @@
<mat-form-field appearance="none" class="date-hour-picker width-100 ">
<input matInput [ngxMatDatetimePicker]="fim"
placeholder="Fim*"
[formControl]="dateControlEnd"
[(ngModel)]="postData.EndDate"
[disabled]="disabled"
[min] = "dateControlStart.value"
>
<mat-datepicker-toggle id="new-fim" matSuffix [for]="fim" ></mat-datepicker-toggle>
<ngx-mat-datetime-picker #fim
@@ -173,37 +244,6 @@
</div>
</div>
<div *ngIf="EventRecurrenceType != '-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"
[(ngModel)]="Occurrence"
[disabled]="disabled"
[min]="dateStart"
>
<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 class="container-div">
<div class="ion-item-class-2">
<div class="ion-icon-class">
@@ -318,4 +358,3 @@
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
</ion-footer>
@@ -9,7 +9,6 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { SearchPage } from 'src/app/pages/search/search.page';
import { SearchList } from 'src/app/models/search-document';
import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service';
import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms';
@@ -24,6 +23,12 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
import { Utils } from 'src/app/services/Repositorys/Agenda/utils';
import { Observable } from 'rxjs';
import { TableSharedCalendar } from 'src/app/services/Repositorys/Agenda/agenda-local-data-source.service';
import { AgendaDataRepositoryService } from 'src/app/services/Repositorys/Agenda/agenda-data-repository.service';
import { TracingType, XTracerAsync } from 'src/app/services/monitoring/opentelemetry/tracer';
import { isHttpError } from 'src/app/services/http.service';
const moment = _rollupMoment || _moment;
@@ -66,8 +71,6 @@ export class BookMeetingModalPage implements OnInit {
public stepMinute = 15;
public stepSecond = 5;
public dateControlStart = new FormControl(moment("DD MM YYYY hh"));
public dateControlEnd = new FormControl(moment("DD MM YYYY hh"));
CalendarNamesOptions = ['Oficial', 'Pessoal']
Form: FormGroup;
@@ -78,13 +81,6 @@ export class BookMeetingModalPage implements OnInit {
showLoader = false
get dateStart() {
return this.dateControlStart.value;
}
get dateEnd() {
return this.dateControlEnd.value;
}
@ViewChild('picker') picker: any;
@ViewChild('fim') fim: any;
@@ -94,7 +90,7 @@ export class BookMeetingModalPage implements OnInit {
task: any;
fulltask: any;
taskParticipants: EventPerson[];
taskParticipants: EventPerson[] = [];
taskParticipantsCc: EventPerson[] = [];
taskDocId: string;
@@ -111,14 +107,18 @@ export class BookMeetingModalPage implements OnInit {
showAttendees = false;
emptyTextDescription = "Selecionar intervenientes";
CalendarName
sessionStore = SessionStore;
environment = environment
loggeduser: LoginUserRespose;
eventPersons: EventPerson[];
contacts: EventPerson[];
hasChangeCalendar = false
selectedUserCalendar:any;
sharedCalendar: Observable<TableSharedCalendar[]>
allDayCheck: boolean = false;
CalendarNameShow = true
constructor(
private modalController: ModalController,
private navParams: NavParams,
@@ -131,8 +131,8 @@ export class BookMeetingModalPage implements OnInit {
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService,
private contactsService: ContactsService,
public utils: Utils,
private agendaDataRepository: AgendaDataRepositoryService,
) {
this.taskParticipants = [];
@@ -153,19 +153,11 @@ export class BookMeetingModalPage implements OnInit {
this.postData.CalendarName = "Oficial";
let startDate = this.roundTimeQuarterHour()
this.dateControlStart = new FormControl(moment(startDate));
this.dateControlEnd = new FormControl(moment(this.roundTimeQuarterHourPlus15(startDate)));
this.postData.StartDate = startDate;
this.postData.EndDate = this.roundTimeQuarterHourPlus15(startDate);
this.postData.Category = 'Reunião'
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
// console.log(this.eventService.calendarNamesAry)
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
}
}
this.postData.IsAllDayEvent = false
if (this.taskParticipants.length == 0) {
this.taskParticipants = [
@@ -180,11 +172,19 @@ export class BookMeetingModalPage implements OnInit {
this.changeAgenda();
this.loggeduser = SessionStore.user;
this.sharedCalendar = this.agendaDataRepository.getShareCalendarItemsLiveWithOrder()
this.postData.EventRecurrence = {
frequency: 'never',
until: "",
Type: ''
}
}
ngOnInit() {
// console.log('TEsTEROLE',this.eventService.calendarNamesAry)
this.adding = "intervenient";
this.setCalendarByDefault(true)
this.getAttachments();
this.setDefaultTime()
this.getRecurrenceTypes();
@@ -193,6 +193,24 @@ export class BookMeetingModalPage implements OnInit {
}
async setCalendarByDefault(force) {
if (!this.selectedUserCalendar || force) {
const data = await this.agendaDataRepository.geCalendars()
const prObject = data.find(e => e?.roleId == 100000014)
if(prObject) {
this.selectedUserCalendar = prObject.wxUserId
} else {
this.selectedUserCalendar = SessionStore.user.UserId
}
this.changeAgenda()
}
}
ngOnDestroy() {
clearInterval(this.myInterval)
}
@@ -205,33 +223,34 @@ export class BookMeetingModalPage implements OnInit {
})
}, 1000);
getRecurrenceTypes() {
this.calendarService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
}
changeSegmentCalendar() {
this.hasChangeCalendar = true
}
changeAgenda() {
async changeAgenda() {
setTimeout(() => {
this.CalendarNameShow = false
if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.calendarService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
const result = await this.agendaDataRepository.geCalendars()
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
} else if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial']) {
const selectedCalendar = result.find(e => e.wxUserId == this.selectedUserCalendar)
if(selectedCalendar) {
if(selectedCalendar.shareType == 1) {
this.CalendarNamesOptions = ['Oficial']
this.postData.CalendarName = 'Oficial'
} else if (this.calendarService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
} else if(selectedCalendar.shareType == 2) {
this.CalendarNamesOptions = ['Pessoal']
this.postData.CalendarName = 'Pessoal'
} else {
} else if (selectedCalendar.shareType == 3) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
}
}, 50)
}
}
@@ -258,13 +277,13 @@ export class BookMeetingModalPage implements OnInit {
runValidation() {
this.validateFrom = true
if (new Date(this.dateStart).getTime() > new Date(this.dateEnd).getTime()) {
if (new Date(this.postData.StartDate).getTime() > new Date(this.postData.EndDate).getTime()) {
this.toastService._badRequest("A data de fim não pode ser inferior a data de início do evento")
}
}
get dateValid() {
return new Date(this.dateControlStart.value).getTime() < new Date(this.dateControlEnd.value).getTime() ? 'ok' : null
return new Date(this.postData.StartDate).getTime() < new Date(this.postData.EndDate).getTime() ? 'ok' : null
}
injectValidation() {
@@ -293,7 +312,8 @@ export class BookMeetingModalPage implements OnInit {
})
}
async saveTask() {
@XTracerAsync({name:'convocar-reunia', bugPrint: true})
async saveTask(tracing?: TracingType) {
if (SessionStore.user.Profile != 'PR') {
this.injectValidation()
@@ -303,6 +323,8 @@ export class BookMeetingModalPage implements OnInit {
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
console.log({Attendees})
this.eventBody = {
BodyType: '1',
Text: this.postData.Body.Text,
@@ -314,26 +336,23 @@ export class BookMeetingModalPage implements OnInit {
Location: this.postData.Location,
CalendarId: '',
CalendarName: this.postData.CalendarName,
StartDate: this.dateStart,
EndDate: this.dateEnd,
EventType: 'Reunião',
StartDate: this.postData.StartDate,
EndDate: this.postData.EndDate,
EventType: 'Meeting',
Attendees: Attendees,
IsMeeting: false,
IsRecurring: false,
AppointmentState: 0,
TimeZone: 'UTC',
Organizer: null,
Category: 'Reunião',
Category: 'Meeting',
HasAttachments: true,
EventRecurrence: {
Type: this.EventRecurrenceType,
LastOccurrence: this.Occurrence
},
IsAllDayEvent: this.postData.IsAllDayEvent,
EventRecurrence: this.postData.EventRecurrence,
Attachments: []
}
const DocumentToSave = this.documents.map((e: any) => {
console.log('ASSUNTO', e.Assunto)
return {
ApplicationId: e.ApplicationType || e.ApplicationId,
Source: 1,
@@ -345,69 +364,105 @@ export class BookMeetingModalPage implements OnInit {
});
postData.Attachments = DocumentToSave;
let loader = this.toastService.loading();
if (this.task.FsId == '8') {
const loader = this.toastService.loading()
const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
if(calendar.isOk()) {
try {
const CalendarId = this.selectedCalendarId()
await this.calendarService.genericPostExpedientEvent(this.task.DocId, postData, "", this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.modalController.dismiss();
this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
const value = await this.agendaDataRepository.createEvent(postData, this.documents, calendar.value, tracing).toPromise()
console.log(value)
this.httpErroHandle.httpsSucessMessagge('new event')
loader.remove();
tracing.setAttribute('outcome', 'success')
this.close();
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
}
finally {
loader.remove()
if(!isHttpError(error)) {
this.toastService._badRequest('Pedimos desculpa mas não foi possível executar a acção. Por favor, contacte o apoio técnico. #1')
console.log(error)
tracing.bugFlag()
} else {
this.httpErroHandle.httpStatusHandle(error.status)
}
console.log('create event error: ', error)
tracing.setAttribute('outcome', 'failed')
}
} else {
tracing.setAttribute('outcome', 'failed')
tracing.setAttribute('no', 'this.selectedUserCalendar')
tracing.bugFlag()
}
if (this.task.FsId == '8') {
// const calendar = await this.agendaDataRepository.getCalendarByUserId(this.selectedUserCalendar)
// if(calendar.isOk()) {
// try {
// const value = await this.agendaDataRepository.createEvent(this.postData, this.documents, calendar.value, tracing).toPromise()
// console.log(value)
// this.httpErroHandle.httpsSucessMessagge('new event')
// loader.remove();
// tracing.setAttribute('outcome', 'success')
// } catch (error) {
// console.log('create event error: ', error)
// tracing.setAttribute('outcome', 'failed')
// this.httpErroHandle.httpStatusHandle(error.status)
// }
// } else {
// }
}
else if (this.task.FsId == '361') {
console.log('361')
const loader = this.toastService.loading()
try {
// console.log('361')
// const loader = this.toastService.loading()
// try {
const CalendarId = this.selectedCalendarId()
console.log({ CalendarId })
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, postData, "", this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
// const CalendarId = this.selectedCalendarId()
// console.log({ CalendarId })
// await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, postData, "", this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.close();
this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
// this.close();
// this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
loader.remove()
}
// } catch (error) {
// this.httpErroHandle.httpStatusHandle(error)
// } finally {
// loader.remove()
// }
}
else {
this.toastService._successMessage('Não é possível marcar a reunião de momento');
}
loader.remove();
}
onCheckboxChange(event: any) {
if (this.allDayCheck) {
this.postData.IsAllDayEvent = this.allDayCheck;
this.postData.StartDate = this.setAlldayTime(this.postData.StartDate)
this.postData.EndDate = this.setAlldayTimeEndDate(this.postData.EndDate)
selectedCalendarId() {
if (this.calendarService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postData.CalendarName == 'Oficial') {
return this.calendarService.calendarNamesType[this.CalendarName]['OficialId']
} else if (this.calendarService.calendarNamesType[this.CalendarName]?.['Pessoal'] && this.postData.CalendarName == 'Pessoal') {
return this.calendarService.calendarNamesType[this.CalendarName]['PessoalId']
console.log('Recurso ativado!!');
} else {
return '11:11'
this.postData.IsAllDayEvent = this.allDayCheck;
this.postData.EndDate = this.setAlldayTimeEndDateNotAlday(this.postData.EndDate)
console.log('Recurso desativado');
}
}
async addParticipants() {
this.adding = "intervenient";
@@ -626,4 +681,37 @@ export class BookMeetingModalPage implements OnInit {
}
}
setAlldayTime(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(0)
date.setMinutes(0)
date.setSeconds(0);
return date
}
setAlldayTimeEndDate(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(59)
date.setSeconds(0);
return date
}
setAlldayTimeEndDateNotAlday(timeToReturn) {
let date: any = new Date(timeToReturn) || new Date();
let newdate = new Date();
date.setHours(23)
date.setMinutes(0)
date.setSeconds(0);
return date
}
}
@@ -24,7 +24,11 @@ import { EventUpdateInputDTOSchema } from './model/eventUpdateInputDtO';
import { AttachInputDTOSchema } from './model/addAttachmentDTOInput';
import { EventListDataOutputDTOSchema } from './model/eventListDTOOutput';
import { EventSearchMapper } from './mapper/EventSearchMapper';
import { select, Store } from '@ngrx/store';
import { CalendarState, pushEvent, removeRangeForCalendar, selectEventsInRange } from './agenda-memory-source.service';
import { NativeNotificationService } from 'src/app/services/native-notification.service';
import { ListBoxService } from 'src/app/services/agenda/list-box.service';
import { EventListStore } from 'src/app/models/agenda/AgendaEventList';
@Injectable({
providedIn: 'root'
})
@@ -33,7 +37,11 @@ export class AgendaDataRepositoryService {
constructor(
private agendaDataService: AgendaDataService,
private utils: Utils,
private agendaLocalDataSourceService: AgendaLocalDataSourceService
private agendaLocalDataSourceService: AgendaLocalDataSourceService,
private memoryStore: Store<CalendarState>,
private NativeNotificationService: NativeNotificationService,
public listBoxService: ListBoxService,
) { }
createOwnCalendar(): SharedCalendarListItemOutputDTO {
@@ -122,7 +130,47 @@ export class AgendaDataRepositoryService {
const result = await this.agendaDataService.getEvents(userId, startDate, endDate, status, category, type).pipe(
map((response) => {
APINODReturn(EventListDataOutputDTOSchema, response, 'get/Events', tracing)
return ListEventMapper.toDomain(response, calendarOwnerName, userId)
let profile;
if (SessionStore.user.Profile == 'PR') {
profile = "pr"
} else if (userId == SessionStore.user.UserId as any) {
profile = 'md'
} else {
profile = "pr"
}
const listToPresent = ListEventMapper.toDomain(response, calendarOwnerName, userId)
const map : EventListStore[] = listToPresent.map( element => {
return {
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: profile,
id: element.EventId,
CalendarId: userId
}
}) as any
const year = this.listBoxService.list(map, 'md', startDate, endDate, { selectedDate: new Date() })
const events = this.utils.getAllEvents(year)
this.NativeNotificationService.scheduleNotifications(events)
this.memoryStore.pipe(
select(selectEventsInRange(startDate, endDate, userId))
).subscribe((localList)=> {
// console.log({localList})
});
// this.memoryStore.dispatch(removeRangeForCalendar({ startDate, endDate, userId }));
// this.memoryStore.dispatch(pushEvent({ eventsList:eventsList as any, userId, profile }));
return listToPresent
}
)).toPromise()
return ok(result)
@@ -170,6 +218,8 @@ export class AgendaDataRepositoryService {
createEvent(eventData: Event, documents, calendar: TableSharedCalendar, tracing: TracingType) {
console.log('eventData', eventData);
let eventInput = {
userId: calendar.wxUserId,
ownerType: this.utils.selectedCalendarOwner(calendar.role),
@@ -0,0 +1,110 @@
// calendar.actions.ts
import { createAction, props } from '@ngrx/store';
import { createReducer, on } from '@ngrx/store';
import { EventList, EventListStore } from 'src/app/models/agenda/AgendaEventList';
import { createFeatureSelector, createSelector } from '@ngrx/store';
export const loadEvents = createAction('[Calendar] Load Events');
export const loadEventsSuccess = createAction(
'[Calendar] Load Events Success',
props<{ events: EventListStore[] }>()
);
export const resetList = createAction(
'[Calendar] Reset List',
props<{ eventSource: EventListStore[] }>()
);
export const pushEvent = createAction(
'[Calendar] Push Event',
props<{ eventsList: EventList[], profile: 'pr' | 'md', userId: string }>()
);
export const removeRangeForCalendar = createAction(
'[Calendar] Remove Range For Calendar',
props<{ startDate: Date, endDate: Date, userId: string }>()
);
export const getRangeForCalendar = createAction(
'[Calendar] Remove Range For Calendar',
props<{ startDate: Date, endDate: Date, userId: string }>()
);
export const deleteAllEvents = createAction('[Calendar] Delete All Events');
// =========================================================================
export interface CalendarState {
eventSource: EventListStore[];
}
export const initialState: CalendarState = {
eventSource: []
};
export const calendarReducer = createReducer(
initialState,
on(loadEventsSuccess, (state, { events }) => ({
...state,
eventSource: events
})),
on(resetList, (state, { eventSource }) => ({
...state,
eventSource
})),
on(pushEvent, (state, { eventsList, profile, userId }) => {
let news = eventsList.map(element => ({
startTime: new Date(element.StartDate),
endTime: new Date(element.EndDate),
allDay: false,
event: element,
calendarName: element.CalendarName,
profile: profile,
id: element.EventId,
CalendarId: userId
}));
let instance = state.eventSource.concat(news as any);
const ids = instance.map(o => o.id);
const filtered = instance.filter(({ id }, index) => !ids.includes(id, index + 1));
return {
...state,
eventSource: filtered
};
}),
on(removeRangeForCalendar, (state, { startDate, endDate, userId }) => ({
...state,
eventSource: state.eventSource.filter(e =>
!(new Date(e.endTime).getTime() >= new Date(startDate).getTime() &&
new Date(endDate).getTime() >= new Date(e.startTime).getTime() && e.CalendarId == userId)
)
})),
on(deleteAllEvents, state => ({
...state,
eventSource: []
}))
);
// =========================================================================
export const selectCalendarState = createFeatureSelector<CalendarState>('calendar');
export const selectEventSource = createSelector(
selectCalendarState,
(state: CalendarState) => state.eventSource
);
// Create selector to get range of events
export const selectEventsInRange = (startDate: Date, endDate: Date, userId: string) => createSelector(
selectEventSource,
(events) => events.filter(event =>
new Date(event.startTime).getTime() >= new Date(startDate).getTime() &&
new Date(event.endTime).getTime() <= new Date(endDate).getTime() &&
event.CalendarId === userId
)
);
+58 -4
View File
@@ -1,14 +1,15 @@
import { Injectable } from '@angular/core';
import { AgendaDataService } from './agenda-data.service';
import { EventsService } from '../../events.service';
import { RoleIdService } from 'src/app/services/role-id.service'
import { TableSharedCalendar } from './agenda-local-data-source.service';
@Injectable({
providedIn: 'root'
})
export class Utils {
constructor(
private agendaDataService: AgendaDataService,
public eventService: EventsService,
public RoleIdService: RoleIdService,
) { }
@@ -84,7 +85,7 @@ export class Utils {
documents.forEach(element => {
let object = {
docId: element.docId || element.DocId || element.Id,
sourceName: element.subject || element.sourceNames || element.Description || element.SourceName,
sourceName: element.subject || element.sourceNames || element.Description || element.SourceName || element.Assunto,
description: "",
applicationId: element.applicationId || element.ApplicationId
}
@@ -93,7 +94,7 @@ export class Utils {
});
return listupdate.filter( e=> typeof e.docId == 'number')
/* return documents.map((e) => {
return {
docId: e.docId,
@@ -201,4 +202,57 @@ export class Utils {
diff + pad(Math.floor(Math.abs(tzOffset) / 60)) +
':' + pad(Math.abs(tzOffset) % 60);
}
didEventHappenToday(eventTime) {
const eventDate = new Date(eventTime);
const today = new Date();
return eventDate.toDateString() === today.toDateString();
}
duration(date1Str, date2Str) {
// Convert string dates to Date objects
const date1: any = new Date(date1Str);
const date2: any = new Date(date2Str);
// Calculate the difference in milliseconds
const timeDifferenceMs = date2 - date1;
// Convert difference to days, hours, and minutes
const totalMinutes = Math.floor(timeDifferenceMs / (1000 * 60));
const days = Math.floor(totalMinutes / (60 * 24));
const hours = Math.floor((totalMinutes % (60 * 24)) / 60);
const minutes = totalMinutes % 60;
return `${days}d ${hours}h ${minutes}m`.replace('0d', '')
}
getAllEvents(years: any[]): Event[] {
const events: Event[] = [];
years.forEach(year => {
year.months.forEach(month => {
month.days.forEach(day => {
events.push(...day.events);
});
});
});
return events;
}
hasPrCalendar(data: TableSharedCalendar[]) {
for(const e of data) {
if(e.roleId == this.RoleIdService.PRES) {
return true
}
}
return false
}
}
+4 -2
View File
@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { CustomCalendarEvent, EventListStore } from 'src/app/models/agenda/AgendaEventList';
import { DateService } from '../date.service';
import { momentG } from 'src/plugin/momentG';
import { NativeNotificationService } from 'src/app/services/native-notification.service';
@Injectable({
providedIn: 'root'
@@ -12,7 +13,7 @@ export class ListBoxService {
constructor(
private dateService: DateService
private dateService: DateService,
){}
@@ -78,7 +79,8 @@ export class ListBoxService {
// console.log('newStracture', newStracture)
return this.display(newStracture, selectedDate).year
const data = this.display(newStracture, selectedDate)
return data.year
// const daysStringNum = Object.keys(daysObject)
@@ -60,7 +60,6 @@ export class ChatSystemService {
private sortService: SortService,
private ChatService: ChatService,
private NfService: NfService,
private changeProfileService: ChangeProfileService,
private chatService: ChatService,
private ChatMethodsService: ChatMethodsService,
private AESEncrypt: AESEncrypt,
+14 -6
View File
@@ -1,17 +1,14 @@
import { Injectable } from '@angular/core';
import { Event, EventToApproveEdit, } from '../models/event.model';
import { Event } from '../models/event.model';
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
import { Observable, from } from 'rxjs';
import { Observable } from 'rxjs';
import { environment } from 'src/environments/environment';
import { AuthService } from '../services/auth.service';
import { EventList } from '../models/agenda/AgendaEventList';
import { ChangeProfileService } from './change-profile.service';
import { OfflineManagerService } from 'src/app/services/offline-manager.service';
import { catchError } from "rxjs/operators";
import { SessionStore } from '../store/session.service';
import { calendarInterface } from '../models/user.model';
import { Subscribe } from './subcribe';
import { EventOutputDTO } from './Repositorys/Agenda/model/eventDTOOutput';
@Injectable({
@@ -1368,7 +1365,18 @@ export class EventsService {
params = params.set("notifyUsers", true)
const calendar = this.DetectCalendars(CalendarId)
const header = this.makeHeader(calendar)
let header;
console.log('calendar')
try {
header = this.makeHeader(calendar)
} catch (error) {}
console.log('header')
options = {
headers: header,
+164 -19
View File
@@ -1,36 +1,28 @@
import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';
import { CapacitorConfig } from '@capacitor/cli';
/* import { LocalNotifications, LocalNotificationSchema } from '@capacitor/local-notifications'; */
import { LocalNotifications } from '@capacitor/local-notifications';
import { v4 as uuidv4 } from 'uuid'
@Injectable({
providedIn: 'root'
})
export class NativeNotificationService {
constructor(private platform: Platform,) {
private scheduledEventIds: number[] = [];
constructor(
private platform: Platform,) {
this.askForPermission()
}
askForPermission() {
/* LocalNotifications.requestPermissions()
LocalNotifications.checkPermissions().then((data)=>{
//
}).catch((data)=>{
//
}) */
window['send'] = () => {
this.eventNotification({eventId:uuidv4()})
}
}
foregroundNotification() {
askForPermission() {}
/* LocalNotifications.addListener('localNotificationReceived', (notification) => {
}) */
}
foregroundNotification() {}
backgroundNotification() {
/* LocalNotifications.addListener('localNotificationActionPerformed', (action) => {
@@ -53,6 +45,142 @@ export class NativeNotificationService {
}
uuidTo32BitInt(uuid) {
// Remove hyphens and convert to a 16-byte hex string
const hex = uuid.replace(/-/g, '');
// Get the least significant 8 bytes (16 hex characters)
const leastSignificantBytes = hex.slice(-16);
// Convert to a 64-bit integer
const bigInt = BigInt('0x' + leastSignificantBytes);
// Convert to a 32-bit integer and ensure it fits within the int32 range
const int32 = Number(bigInt % BigInt(2 ** 32));
// Adjust to fit within the signed 32-bit range
return int32 >= 2 ** 31 ? int32 - 2 ** 32 : int32;
}
async cancelNotification(eventId: number) {
await LocalNotifications.cancel({ notifications: [{ id: eventId }] });
console.log(`Notification with event ID ${eventId} canceled.`);
}
didEventHappenToday(eventTime) {
const eventDate = new Date(eventTime);
const today = new Date();
return eventDate.toDateString() === today.toDateString();
}
async cancelAllNotification() {
try {
await LocalNotifications.cancel({
notifications: []
});
console.log('All notifications cancelled');
} catch (error) {
console.error('Error cancelling notifications:', error);
}
}
async scheduleNotifications(events: any) {
const notifications = [];
console.log({events});
events = events
.filter(e => new Date().getTime() <= new Date(e.start).getTime())
.filter(e => this.didEventHappenToday(e.start))
console.log('notify', events)
await this.cancelAllNotification();
for (const event of events) {
const eventTime = new Date(event.start).getTime();
const now = new Date().getTime();
// Schedule notifications for 1 hour before and 15 minutes before the event
const oneHourBefore = eventTime - 60 * 60 * 1000;
const fifteenMinutesBefore = eventTime - 15 * 60 * 1000;
const timeDifference = eventTime - now;
const oneHour = 60 * 60 * 1000; // 1 hour in milliseconds
const fifteenMinutes = 15 * 60 * 1000; // 15 minutes in milliseconds
console.log('notification to notify object', event)
// if (timeDifference <= fifteenMinutes) {
// console.log({notification: event, e: '15 minutes'})
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} minutes.£`,
// id: this.uuidTo32BitInt(event.event.id)
// });
// } else if (timeDifference <= oneHour) {
// console.log({notification: event, e: '1 hour.'})
// notifications.push({
// title: 'Event Reminder',
// body: `Reminder: ${event.Subject} starts in ${this.duration(event.start, new Date())} hour.£`,
// id: this.uuidTo32BitInt(event.id)
// });
// } else {
// console.log("Event is more than 1 hour away.")
if (timeDifference >= fifteenMinutes) {
notifications.push({
title: 'Event Reminder',
body: `Reminder: ${event.event.Subject} 15 minutes`,
id: this.uuidTo32BitInt(event.id)+1,
schedule: { at: new Date(fifteenMinutesBefore) },
});
console.log('15m', new Date(fifteenMinutesBefore))
}
if (timeDifference >= oneHour) {
notifications.push({
title: 'Event Reminder',
body: `Reminder: ${event.event.Subject} 1 hour`,
id: this.uuidTo32BitInt(event.id)+2,
schedule: { at: new Date(oneHourBefore) },
});
console.log('1h', new Date(oneHourBefore))
}
// }
}
await LocalNotifications.schedule({ notifications });
}
async eventNotification({eventId}) {
await LocalNotifications.schedule({
notifications: [
{
title: 'Test Notification 6',
body: 'This is a test notification. 6',
id: this.uuidTo32BitInt(eventId), // Unique ID for the notification
schedule: { at: new Date(Date.now() + 1000 * 10) }, // Schedule to show in 5 seconds
sound: null,
attachments: null,
actionTypeId: '',
extra: null,
},
],
});
console.log('send notificatino')
}
isDesktop() {
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
return true
@@ -62,4 +190,21 @@ export class NativeNotificationService {
}
}
duration(date1Str, date2Str) {
// Convert string dates to Date objects
const date1: any = new Date(date1Str);
const date2: any = new Date(date2Str);
// Calculate the difference in milliseconds
const timeDifferenceMs = date2 - date1;
// Convert difference to days, hours, and minutes
const totalMinutes = Math.floor(timeDifferenceMs / (1000 * 60));
const days = Math.floor(totalMinutes / (60 * 24));
const hours = Math.floor((totalMinutes % (60 * 24)) / 60);
const minutes = totalMinutes % 60;
return `${days}d ${hours}h ${minutes}m`.replace('0d', '')
}
}
@@ -211,6 +211,7 @@
placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
(ngModelChange)="onDateChange($event)"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -241,6 +242,7 @@
placeholder="Data Inicio*"
[(ngModel)]="postEvent.StartDate"
[disabled]="disabled"
(ngModelChange)="onDateChange($event)"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
@@ -457,8 +459,9 @@
<ion-label>
<p class="d-flex ion-justify-content-between">
<span class="attach-title-item">{{document.subject}}</span>
<span class="app-name" *ngIf="!document.appName">{{ TaskService.attachmentAppName(document)}}</span>
<span class="app-name" *ngIf="document.appName">{{document.appName}}</span>
<span class="app-name" *ngIf="document.applicationId == 8 || document.ApplicationId == 8"> Correspondência </span>
<span class="app-name" *ngIf="document.applicationId == 386 || document.ApplicationId == 386"> Acções Presidenciais </span>
<span class="app-name" *ngIf="document.applicationId == 361 || document.ApplicationId == 361 "> Arquivo Despacho Electrónico </span>
<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>
</span>
@@ -746,5 +746,16 @@ export class NewEventPage implements OnInit {
return date
}
onDateChange(e) {
const cloneDateStartDate = new Date(this.postEvent.StartDate);
const cloneDateEndDate = new Date(this.postEvent.EndDate);
if(cloneDateStartDate.getTime() >= cloneDateEndDate.getTime()) {
cloneDateStartDate.setHours(cloneDateStartDate.getHours() + 1);
this.postEvent.EndDate = cloneDateStartDate
}
}
}
+68 -60
View File
@@ -7,9 +7,10 @@
font-family: arial;
}
body {
.body {
background-color: #f5f7fb;
padding: 35px;
margin: 0px;
}
@@ -46,13 +47,13 @@
margin: auto 0px;
margin: 0px auto;
}
main {
.main {
background-color: white !important;
width: 680px;
margin: 0px auto;
box-shadow: 0px 0px 100px #e8e8e8;
}
footer {
.footer {
width: 680px;
margin: 0px auto;
}
@@ -63,6 +64,9 @@
}
.m-auto { margin: 0px auto; }
.d-block { display: block; }
.d-flex { display: flex;}
.px-40 { padding: 0px 40px; }
.pb-40 { padding-bottom: 40px; }
.pa-40 { padding: 40px; }
@@ -79,69 +83,73 @@
.text-gray { color: rgb(169, 169, 169); }
.link-color { color:rgb(0, 0, 255); }
</style>
</head>
<body>
<div class="body">
<div class="main" >
<main >
<div class="header" class="pa-40">
<img class="pa-15 m-auto" src="https://gwjkdh.stripocdn.email/content/guids/videoImgGuid/images/governo_de_angola_horizontal_logo_MH1.png" style="display:block; border:0; text-decoration:none;" alt="Logo" title="Logo" width="160" height="136">
<p class="f-22 ma-15 text-center"><b>República De Angola</b></p>
<p class="f-22 ma-15 text-center"><b>Gabinete do Presidente da República</b></p>
<p class="f-22 ma-15 text-center"><b>Convite para reunião</b></p>
</div>
<hr/>
<div class="pa-40">
<p class="f-weight-600 text-center" >Agenda da semana</p>
<table class="width-100">
<thead>
<tr>
<th>
Localiizas&ccedil;&atilde;o
</th>
<th>
Data
</th>
<th>
Assunto
</th>
</tr>
</thead>
<tbody>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
</tbody>
</table>
</div>
<hr/>
<div class="px-40 pb-40">
<div>
<p class="text-gray f-13 d-block ">Importante</p>
<span class="d-block ">Caso tenha recebido esta mensagem por engano, por favor informe por o e-mail:</span>
<span class="d-block link-color" > <u>notificacoes@oapr.gov.ao</u> </span>
<div class="header" class="pa-40">
<img class="pa-15 m-auto d-flex" src="https://gwjkdh.stripocdn.email/content/guids/videoImgGuid/images/governo_de_angola_horizontal_logo_MH1.png" style="display:block; border:0; text-decoration:none;" alt="Logo" title="Logo" width="160" height="136">
<p class="f-22 ma-15 text-center"><b>República De Angola</b></p>
<p class="f-22 ma-15 text-center"><b>Gabinete do Presidente da República</b></p>
<p class="f-22 ma-15 text-center"><b>Convite para reunião</b></p>
</div>
<hr/>
<div class="pa-40">
<p class="f-weight-600 text-center" >Agenda da semana</p>
<table class="width-100">
<thead>
<tr>
<th>
Localiizas&ccedil;&atilde;o
</th>
<th>
Data
</th>
<th>
Assunto
</th>
</tr>
</thead>
<tbody>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
<tr>
<td >Palácio Presidencial de</td>
<td >15 de Julho de 2024 19:00</td>
<td >Luanda</td>
</tr>
</tbody>
</table>
</div>
<hr/>
<div class="px-40 pb-40">
<div>
<p class="text-gray f-13 d-block ">Importante</p>
<span class="d-block ">Caso tenha recebido esta mensagem por engano, por favor informe por o e-mail:</span>
<span class="d-block link-color" > <u>notificacoes@oapr.gov.ao</u> </span>
</div>
</div>
</div>
<div class="footer">
<p>&nbsp;&nbsp;&nbsp;<b>Gabinete Digital - Uma iniciativa do Presidente da República</b></p>
</div>
</div>
</main>
<footer>
<p>&nbsp;&nbsp;&nbsp;<b>Gabinete Digital - Uma iniciativa do Presidente da República</b></p>
</footer>
</body>
+59 -52
View File
@@ -10,6 +10,7 @@
body {
background-color: #f5f7fb;
padding: 35px;
margin: 0px;
}
@@ -65,6 +66,7 @@
.m-auto { margin: 0px auto; }
.d-block { display: block; }
.d-flex { display: flex;}
.px-40 { padding: 0px 40px; }
.pb-40 { padding-bottom: 40px; }
@@ -74,75 +76,80 @@
.f-22 { font-size: 22px; }
.f-13 { font-size: 13px;}
.f-weight-600 { font-weight: 600; }
.ma-15 { margin: 15px; }
.text-center { text-align:center }
.width-100 { width: 100%; }
.text-gray { color: rgb(169, 169, 169); }
.link-color { color:rgb(0, 0, 255); }
</style>
</head>
<body>
<div class="body">
<main>
<main>
<div class="header" class="pa-40">
<img class="pa-15 m-auto" src="https://gwjkdh.stripocdn.email/content/guids/videoImgGuid/images/governo_de_angola_horizontal_logo_MH1.png" style="display:block; border:0; text-decoration:none;" alt="Logo" title="Logo" width="160" height="136">
<p class="f-22 ma-15 text-center"><b>República De Angola</b></p>
<p class="f-22 ma-15 text-center"><b>Gabinete do Presidente da República</b></p>
<p class="f-22 ma-15 text-center"><b>Convite para reunião</b></p>
</div>
<hr/>
<div class="px-40">
<div>
<p class="text-gray f-13 d-block ">Tipo de evento</p>
<span class="d-block ">Event Type</span>
<div class="header" class="pa-40">
<img class="pa-15 m-auto d-flex" src="https://gwjkdh.stripocdn.email/content/guids/videoImgGuid/images/governo_de_angola_horizontal_logo_MH1.png" style="display:block; border:0; text-decoration:none;" alt="Logo" title="Logo" width="160" height="136">
<p class="f-22 ma-15 text-center"><b>República De Angola</b></p>
<p class="f-22 ma-15 text-center"><b>Gabinete do Presidente da República</b></p>
<p class="f-22 ma-15 text-center"><b>Convite para reunião</b></p>
</div>
<div>
<p class="text-gray f-13 d-block ">Data/Hora</p>
<span class="d-block ">15 de Julho de 2024 19:00</span>
<hr/>
<div class="px-40">
<div>
<p class="text-gray f-13 d-block ">Tipo de evento</p>
<span class="d-block ">Event Type</span>
</div>
<div>
<p class="text-gray f-13 d-block ">Data/Hora</p>
<span class="d-block ">15 de Julho de 2024 19:00</span>
</div>
<div>
<p class="text-gray f-13 d-block ">Location</p>
<span class="d-block ">Luanda</span>
</div>
<div>
<p class="text-gray f-13 d-block ">Participantes</p>
<span class="d-block ">Kelson Guilherme</span>
</div>
<div>
<p class="text-gray f-13 d-block ">Assunto</p>
<span class="d-block ">Teste</span>
</div>
</div>
<div>
<p class="text-gray f-13 d-block ">Location</p>
<span class="d-block ">Luanda</span>
<hr/>
<div class="px-40">
<div>
<p class="text-gray f-13 d-block ">Mensagem</p>
<span class="d-block ">Teste</span>
</div>
</div>
<hr/>
<div class="px-40 pb-40">
<div>
<p class="text-gray f-13 d-block ">Importante</p>
<span class="d-block ">Caso tenha recebido esta mensagem por engano, por favor informe por o e-mail:</span>
<span class="d-block link-color" > <u>notificacoes@oapr.gov.ao</u> </span>
</div>
</div>
<div>
<p class="text-gray f-13 d-block ">Participantes</p>
<span class="d-block ">Kelson Guilherme</span>
</div>
</main>
<footer>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Gabinete Digital - Uma iniciativa do Presidente da República</b></p>
</footer>
<div>
<p class="text-gray f-13 d-block ">Assunto</p>
<span class="d-block ">Teste</span>
</div>
</div>
<hr/>
<div class="px-40">
<div>
<p class="text-gray f-13 d-block ">Mensagem</p>
<span class="d-block ">Teste</span>
</div>
</div>
<hr/>
<div class="px-40 pb-40">
<div>
<p class="text-gray f-13 d-block ">Importante</p>
<span class="d-block ">Caso tenha recebido esta mensagem por engano, por favor informe por o e-mail:</span>
<span class="d-block link-color" > <u>notificacoes@oapr.gov.ao</u> </span>
</div>
</div>
</main>
<footer>
<p>&nbsp;&nbsp;&nbsp;<b>Gabinete Digital - Uma iniciativa do Presidente da República</b></p>
</footer>
</div>
</body>
+6 -6
View File
@@ -1,11 +1,11 @@
export let versionData = {
"shortSHA": "6d3887076",
"SHA": "6d3887076102243aa85ee1ff6abb0b00b6bf2771",
"shortSHA": "0e12b5de5",
"SHA": "0e12b5de5e32ff09a2fa53b7f69a9bff30e20d57",
"branch": "feature/agenda-api-peter",
"lastCommitAuthor": "'Peter Maquiran'",
"lastCommitTime": "'Tue Jul 2 14:16:36 2024 +0100'",
"lastCommitMessage": "git chage",
"lastCommitNumber": "5857",
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 4 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.html\n\tmodified: src/app/pages/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.html\n\tmodified: src/app/shared/agenda/edit-event-to-approve/edit-event-to-approve.page.ts\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.html\n\tmodified: src/app/shared/agenda/edit-event/edit-event.page.ts\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.html\n\tmodified: src/app/shared/gabinete-digital/edit-event-to-approve/edit-event.page.ts\n\tmodified: version/Pedido_de_evento 1.html\n\tmodified: version/event-da-semana.html\n\tmodified: version/evento-revisao.html",
"lastCommitTime": "'Wed Jul 3 10:15:53 2024 +0100'",
"lastCommitMessage": "add margin",
"lastCommitNumber": "5858",
"changeStatus": "On branch feature/agenda-api-peter\nYour branch is ahead of 'origin/feature/agenda-api-peter' by 5 commits.\n (use \"git push\" to publish your local commits)\n\nChanges to be committed:\n (use \"git restore --staged <file>...\" to unstage)\n\tmodified: package-lock.json\n\tmodified: package.json\n\tmodified: src/app/app.module.ts\n\tmodified: src/app/home/home.page.ts\n\tmodified: src/app/models/entiry/agenda/eventList.ts\n\tmodified: src/app/pages/agenda/agenda.page.html\n\tmodified: src/app/pages/agenda/agenda.page.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html\n\tmodified: src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts\n\tmodified: src/app/services/Repositorys/Agenda/agenda-data-repository.service.ts\n\tnew file: src/app/services/Repositorys/Agenda/agenda-memory-source.service.ts\n\tmodified: src/app/services/Repositorys/Agenda/utils.ts\n\tmodified: src/app/services/agenda/list-box.service.ts\n\tmodified: src/app/services/chat/chat-system.service.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/services/native-notification.service.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.html\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: version/event-da-semana.html\n\tmodified: version/evento-revisao.html\n\tmodified: version/git-version.ts",
"changeAuthor": "peter.maquiran"
}