pull from developer-prod made

This commit is contained in:
Eudes Inácio
2023-11-29 16:06:56 +01:00
109 changed files with 2301 additions and 702 deletions
+1
View File
@@ -97,3 +97,4 @@ src/app/pipes/process.service.ts
src/app/domain
_src/
-src
plugin copy
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="AngularRewrite" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="/" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
+1 -1
View File
@@ -1,4 +1,4 @@
// / <reference types="@capacitor/local-notifications" />
// / <reference types="@capacitor/push-notifications" />
// / <reference types="@capacitor/splash-screen" />
+48 -17
View File
@@ -1,28 +1,44 @@
workflows:
ios-native-workflow:
name: iOS Native
instance_type: mac_mini_m1
workflows:
ios-workflow:
name: iOS Workflow
max_build_duration: 120
integrations:
app_store_connect: GabineteDigital
app_store_connect: 433YAF3YWG
environment:
ios_signing:
distribution_type: app_store
bundle_identifier: com.gpr.gabinetedigital.teste
vars:
BUNDLE_ID: "com.gpr.gabinetedigital.teste"
APP_STORE_APPLE_ID: DV5P2ZCAPJ
xcode: latest
cocoapods: default
APP_STORE_APPLE_ID: 1664747447
XCODE_WORKSPACE: "platforms/ios/App.app.xcworkspace"
XCODE_SCHEME: "App.app"
scripts:
- name: Install CocoaPods dependencies
script: |
pod install
- name: Set up provisioning profiles settings on Xcode project
script: xcode-project use-profiles
- name: Install npm dependencies for Ionic Capacitor project
script: |
npm install
- name: Cocoapods installation
script: |
cd ios/App && pod install
- name: Update dependencies and copy web assets to native project
script: |
# if you don't need to update native dependencies, use this:
# npx cap copyapp
#
# to update native dependencies, use this command:
npx cap sync
- name: Set up code signing settings on Xcode project
script: |
xcode-project use-profiles
- name: Increment build number
script: |
cd $CM_BUILD_DIR/ios/App
LATEST_BUILD_NUMBER=$(app-store-connect get-latest-app-store-build-number "$APP_STORE_APPLE_ID")
agvtool new-version -all $(($LATEST_BUILD_NUMBER + 1))
- name: Build ipa for distribution
script: |
script: |
cd $CM_BUILD_DIR/ios/App
xcode-project build-ipa \
--workspace "$CM_BUILD_DIR/$XCODE_WORKSPACE" \
--workspace "$XCODE_WORKSPACE" \
--scheme "$XCODE_SCHEME"
artifacts:
- build/ios/ipa/*.ipa
@@ -30,7 +46,22 @@ workflows:
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.app
- $HOME/Library/Developer/Xcode/DerivedData/**/Build/**/*.dSYM
publishing:
email:
recipients:
- romavicdosanjoskc@gmail.com
notify:
success: true
failure: false
app_store_connect:
auth: integration
# Configuration related to TestFlight (optional)
# Note: This action is performed during post-processing.
submit_to_testflight: true
submit_to_app_store: false
beta_groups: # Specify the names of beta tester groups that will get access to the build once it has passed beta review.
- group name 1
- group name 2
# Configuration related to App Store (optional)
# Note: This action is performed during post-processing.
submit_to_app_store: false
+8 -8
View File
@@ -189,7 +189,7 @@
/* Begin PBXShellScriptBuildPhase section */
5B7AACB22ECDCEAA343DC840 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 8;
files = (
);
inputPaths = (
@@ -197,14 +197,14 @@
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-resources.sh\"\n";
showEnvVarsInLog = 0;
};
6634F4EFEBD30273BCE97C65 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 8;
files = (
);
inputPaths = (
@@ -215,14 +215,14 @@
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9592DBEFFC6D2A0C8D5DEB22 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
buildActionMask = 8;
files = (
);
inputPaths = (
@@ -230,7 +230,7 @@
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n";
showEnvVarsInLog = 0;
@@ -390,7 +390,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 63;
CURRENT_PROJECT_VERSION = 65;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist;
@@ -419,7 +419,7 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 63;
CURRENT_PROJECT_VERSION = 65;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 94BRNM2LSS;
INFOPLIST_FILE = App/Info.plist;
+54
View File
@@ -128,6 +128,7 @@
"crypto-js": "^4.0.0",
"date-fns": "^2.17.0",
"depd": "^2.0.0",
"dompurify": "^3.0.6",
"dotenv": "^10.0.0",
"duration": "^0.2.2",
"faker": "^5.5.3",
@@ -164,6 +165,7 @@
"rocket.chat.realtime.api.rxjs": "^2.1.1",
"rxjs": "~6.6.3",
"rxjs-compat": "^6.6.7",
"sanitize-filename-ts": "^1.0.2",
"send-intent": "^5.0.0",
"sharp": "^0.30.7",
"socket.io-client": "^2.3.0",
@@ -14702,6 +14704,11 @@
"url": "https://github.com/fb55/domhandler?sponsor=1"
}
},
"node_modules/dompurify": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.6.tgz",
"integrity": "sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w=="
},
"node_modules/domutils": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
@@ -33190,6 +33197,14 @@
"which": "bin/which"
}
},
"node_modules/sanitize-filename-ts": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/sanitize-filename-ts/-/sanitize-filename-ts-1.0.2.tgz",
"integrity": "sha512-bON2VOJoappmaBHlnxvBNk5R7HkUAsirf5m1M5Kz15uZykDGbHfGPCQNcEQKR8HrQhgh9CmQ6Xe9y71yM9ywkw==",
"dependencies": {
"truncate-utf8-bytes": "^1.0.2"
}
},
"node_modules/sass": {
"version": "1.36.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.36.0.tgz",
@@ -35724,6 +35739,14 @@
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
},
"node_modules/truncate-utf8-bytes": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
"integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==",
"dependencies": {
"utf8-byte-length": "^1.0.1"
}
},
"node_modules/ts-jest": {
"version": "27.1.5",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz",
@@ -41686,6 +41709,11 @@
"node": ">=0.10.0"
}
},
"node_modules/utf8-byte-length": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA=="
},
"node_modules/util": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
@@ -54703,6 +54731,11 @@
"domelementtype": "^2.2.0"
}
},
"dompurify": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.0.6.tgz",
"integrity": "sha512-ilkD8YEnnGh1zJ240uJsW7AzE+2qpbOUYjacomn3AvJ6J4JhKGSZ2nh4wUIXPZrEPppaCLx5jFe8T89Rk8tQ7w=="
},
"domutils": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-2.8.0.tgz",
@@ -68985,6 +69018,14 @@
}
}
},
"sanitize-filename-ts": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/sanitize-filename-ts/-/sanitize-filename-ts-1.0.2.tgz",
"integrity": "sha512-bON2VOJoappmaBHlnxvBNk5R7HkUAsirf5m1M5Kz15uZykDGbHfGPCQNcEQKR8HrQhgh9CmQ6Xe9y71yM9ywkw==",
"requires": {
"truncate-utf8-bytes": "^1.0.2"
}
},
"sass": {
"version": "1.36.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.36.0.tgz",
@@ -70933,6 +70974,14 @@
"resolved": "https://registry.npmjs.org/triple-beam/-/triple-beam-1.3.0.tgz",
"integrity": "sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw=="
},
"truncate-utf8-bytes": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/truncate-utf8-bytes/-/truncate-utf8-bytes-1.0.2.tgz",
"integrity": "sha512-95Pu1QXQvruGEhv62XCMO3Mm90GscOCClvrIUwCM0PYOXK3kaF3l3sIHxx71ThJfcbM2O5Au6SO3AWCSEfW4mQ==",
"requires": {
"utf8-byte-length": "^1.0.1"
}
},
"ts-jest": {
"version": "27.1.5",
"resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-27.1.5.tgz",
@@ -75594,6 +75643,11 @@
"resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz",
"integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ=="
},
"utf8-byte-length": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/utf8-byte-length/-/utf8-byte-length-1.0.4.tgz",
"integrity": "sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA=="
},
"util": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/util/-/util-0.11.1.tgz",
+2
View File
@@ -142,6 +142,7 @@
"crypto-js": "^4.0.0",
"date-fns": "^2.17.0",
"depd": "^2.0.0",
"dompurify": "^3.0.6",
"dotenv": "^10.0.0",
"duration": "^0.2.2",
"faker": "^5.5.3",
@@ -178,6 +179,7 @@
"rocket.chat.realtime.api.rxjs": "^2.1.1",
"rxjs": "~6.6.3",
"rxjs-compat": "^6.6.7",
"sanitize-filename-ts": "^1.0.2",
"send-intent": "^5.0.0",
"sharp": "^0.30.7",
"socket.io-client": "^2.3.0",
+4 -3
View File
@@ -90,6 +90,7 @@ import { PopupQuestionPipe } from './modals/popup-question.pipe';
import '@teamhive/capacitor-video-recorder';
import { tokenInterceptor } from './interceptors/token.interceptors';
import { InputFilterDirective } from './services/directives/input-filter.directive';
// import { ServiceWorkerModule } from '@angular/service-worker';
// import { AngularFireModule } from '@angular/fire';
@@ -119,7 +120,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
SentrySibling.init
);
@NgModule({
declarations: [AppComponent, PopupQuestionPipe],
declarations: [AppComponent, PopupQuestionPipe, InputFilterDirective],
imports: [BrowserModule,
CommonModule,
FormsModule,
@@ -173,8 +174,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
EditorModule,
// options
DeplomaOptionsPageModule,
CreateProcessPageModule
CreateProcessPageModule,
],
entryComponents: [
DiplomaOptionsPage,
@@ -216,6 +216,7 @@ import { FirebaseX } from '@ionic-native/firebase-x/ngx'; */
DocumentViewer,
{ provide: HTTP_INTERCEPTORS, useClass: LoggingInterceptorService, multi: true },
tokenInterceptor
],
bootstrap: [AppComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MiddlewareRemoteDatasourcecService } from './middleware-remote-datasourcec.service';
describe('MiddlewareRemoteDatasourcecService', () => {
let service: MiddlewareRemoteDatasourcecService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MiddlewareRemoteDatasourcecService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,17 @@
import { Injectable } from '@angular/core';
import { SessionStore } from "src/app/store/session.service"
import { MiddlewareServiceService } from "src/app/shared/API/middleware/middleware-service.service"
@Injectable({
providedIn: 'root'
})
export class MiddlewareRemoteDatasourcecService {
constructor(
private MiddlewareServiceService: MiddlewareServiceService,
) {}
refreshToken() {
const refreshToken = SessionStore.user.Authorization
return this.MiddlewareServiceService.refreshToken(refreshToken)
}
}
+2
View File
@@ -413,6 +413,8 @@ const routes: Routes = [
canActivate: [InactivityGuard]
},
{ path: '**', redirectTo: '/', pathMatch: 'full' },
];
@NgModule({
+4
View File
@@ -22,6 +22,8 @@ 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';
@@ -104,6 +106,8 @@ export class HomePage implements OnInit {
private modalController: ModalController,
private zone: NgZone
// private ChunkService: ChunkService,
// private StreamService: StreamService
) {
if (SessionStore.exist) {
this.user = SessionStore.user;
@@ -62,14 +62,14 @@
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom ">
<div class="ion-input-class" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom || validateField ">
<mat-form-field
floatLabel="never"
appearance="fill"
class="width-100 d-block"
appearance="none">
<mat-select [(ngModel)]="selectedTypes" placeholder="Selecione o tipo de assunto*">
<mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="{{placeholderSubject}}">
<mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option>
</mat-select>
</mat-form-field>
@@ -191,6 +191,6 @@
<button *ngIf="taskType == '1'" class="btn-ok" shape="round" (click)="saveTask()">Solicitar</button>
<button *ngIf="taskType == '2'" class="btn-ok" shape="round" (click)="saveTask()">Solicitar</button>
<button class="btn-cancel" shape="round" (click)="cancelTask()">Cancelar</button>
</div>
</ion-footer>
@@ -63,6 +63,7 @@ export class CreateProcessPage implements OnInit {
loadedAttachments: any;
subjectTypes: any;
selectedTypes: string[] = [];
placeholderSubject: string;
postData: Despacho;
dispatchFolder: Folder;
@@ -125,7 +126,13 @@ export class CreateProcessPage implements OnInit {
this.postData = new Despacho();
this.participants = this.participants = new Array();
//Initialize SubjectTypes Array with the value "Indefinido"
this.selectedTypes = ['99999850'];
if(this.loggeduser.Profile == 'PR') {
this.selectedTypes = ['99999850'];
this.placeholderSubject = 'Indefinido'
} else {
this.placeholderSubject = 'Selecione o tipo de assunto*'
}
let NumberPDPP;
@@ -179,9 +186,9 @@ export class CreateProcessPage implements OnInit {
ngOnInit() {
console.log('crete process')
this.getSubjectType();
setTimeout(() => {
/* setTimeout(() => {
this.selectedTypes = ['99999850'];
}, 500);
}, 500); */
this.taskDate = new Date(this.task.taskStartDate);
@@ -420,7 +427,7 @@ export class CreateProcessPage implements OnInit {
AttachmentList: docs
}
/* if (this.postData.DispatchFolder.Message) { */
/* if (this.postData.DispatchFolder.Message) { */
try {
await this.despachoService.createDespacho(this.postData).toPromise();
await this.despachoService.CompleteTask({ serialNumber: this.task.serialNumber, note: this.dispatchFolder.Message }).toPromise();
@@ -432,7 +439,7 @@ export class CreateProcessPage implements OnInit {
} finally {
loader.remove();
}
/* }
/* }
else {
this.validateField = true;
this.toastService._badRequest('Por favor adicione uma descrição');
@@ -223,7 +223,7 @@ export class DocumentDetailPage implements OnInit {
backdropDismiss: false
});
modal.onDidDismiss().then(res=>{
modal.onDidDismiss().then(res => {
//this.RouteService.goBack();
}, (error) => {
console.log(error)
@@ -331,7 +331,7 @@
</div>
</div>
<div *ngIf="loggeduser.Profile != 'PR'" class="aside-righ flex-grow-1">
<div class="aside-righ flex-grow-1">
<app-empty-container
[texto]="emptyTextDescription"
*ngIf="!showAttendees"
@@ -22,6 +22,7 @@ import { SessionStore } from 'src/app/store/session.service';
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';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -75,8 +76,8 @@ export class DocumentSetUpMeetingPage implements OnInit {
taskParticipants: EventPerson[] = [];
taskParticipantsCc: EventPerson[] = [];
taskDocId:string;
loadedAttachments:any;
taskDocId: string;
loadedAttachments: any;
attachments: SearchList[] = [];
@@ -85,24 +86,26 @@ export class DocumentSetUpMeetingPage implements OnInit {
postData: Event;
formLocationSatus: boolean = false;
showAttendees= false;
showAttendees = false;
loggeduser: LoginUserRespose;
emptyTextDescription = "Selecionar intervenientes";
document: SearchFolderDetails | SearchDocumentDetails | any;
subject: string;
docs:any[] = [];
docs: any[] = [];
eventPipe = new EventPipe()
eventPipe = new EventPipe()
CalendarName;
CalendarNameShow = true
CalendarNamesOptions
testeFormDefaul = "Eudes"
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
private router:Router,
private router: Router,
private navParams: NavParams,
authService: AuthService,
private toastService: ToastService,
@@ -111,40 +114,72 @@ export class DocumentSetUpMeetingPage implements OnInit {
public ThemeService: ThemeService,
public _eventService: EventsService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
this.loggeduser = SessionStore.user;
this.document = this.navParams.get('document')
if(Array.isArray(this.document)) {
if (Array.isArray(this.document)) {
const E = this.document
this.document = []
E.forEach((e) => {
this.document.push({
ApplicationId: e.ApplicationId || e.ApplicationType,
Source: 1,
SourceId: e.DocId || e.docID || e.docId || e.SourceId || e.Id,
SourceName: e.Assunto || e.attachments,
DocDate: e.CreateDate,
Data: e.Data,
Assunto: e.Description,
...e
})
})
} else if (this.document) {
const E = this.document
this.document = []
this.document.push({
ApplicationId: E.ApplicationId || E.ApplicationType,
Source: 1,
SourceId: E.DocId || E.docID || E.docId || E.SourceId || E.Id,
SourceName: E.Assunto || E.attachments,
DocDate: E.CreateDate,
Data: E.Data,
Assunto: E.Description,
...E
})
} else {
this.document = []
}
if (Array.isArray(this.document)) {
this.attachments = this.document
} else {
this.attachments = [this.document]
}
this.document = []
this.subject = this.navParams.get('subject')
this.postData = new Event();
this.postData.Body ={ BodyType : "1", Text : ""};
this.postData.Body = { BodyType: "1", Text: "" };
this.postData.Subject = this.subject
this.postData.CalendarName = "Oficial";
this.postData.Category = 'Reunião'
if(!this.CalendarName) {
if(this._eventService.calendarNamesAry.includes('Meu calendario')) {
if (!this.CalendarName) {
if (this._eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this._eventService.calendarNamesAry[0]
}
}
if(this.taskParticipants.length == 0) {
if (this.taskParticipants.length == 0) {
this.taskParticipants = [
// {
// EmailAddress: SessionStore.user.Email,
@@ -163,6 +198,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "intervenient";
this.setDefaultTime()
this.getRecurrenceTypes();
this.fetchContacts("")
}
@@ -172,15 +208,15 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
}, 1000);
getRecurrenceTypes() {
this.calendarService.getRecurrenceTypes().subscribe( res=> {
this.calendarService.getRecurrenceTypes().subscribe(res => {
this.recurringTypes = res;
});
}
@@ -191,13 +227,13 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
setStartDate() {
if(!this.postData.StartDate) {
if (!this.postData.StartDate) {
this.postData.StartDate = this.roundTimeQuarterHour();
}
}
setEndDate() {
if(!this.postData.EndDate) {
if (!this.postData.EndDate) {
this.postData.EndDate = this.roundTimeQuarterHourPlus15(this.postData.StartDate);
}
}
@@ -207,11 +243,11 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
runValidation() {
this.validateFrom = true
this.validateFrom = true
}
get dateValid() {
return new Date(this.postData.StartDate).getTime() < new Date(this.postData.EndDate).getTime() ? 'ok': null
return new Date(this.postData.StartDate).getTime() < new Date(this.postData.EndDate).getTime() ? 'ok' : null
}
injectValidation() {
@@ -227,7 +263,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
CalendarName: new FormControl(this.postData.CalendarName, [
// Validators.required
]),
Date: new FormControl( (this.dateValid), [
Date: new FormControl((this.dateValid), [
Validators.required
]),
participantes: new FormControl(this.taskParticipants, [
@@ -248,7 +284,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.CalendarNameShow = true
if(this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this._eventService.calendarNamesType[this.CalendarName]?.['Pessoal']) {
this.CalendarNamesOptions = ['Oficial', 'Pessoal']
@@ -269,33 +305,14 @@ export class DocumentSetUpMeetingPage implements OnInit {
async saveTask() {
if(this.loggeduser.Profile == 'MDGPR') {
if (this.loggeduser.Profile == 'MDGPR') {
this.injectValidation()
this.runValidation()
if(this.Form.invalid) return false
if (this.Form.invalid) return false
}
let Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
if(this.document.Documents) {
this.document.Documents.forEach((e)=> {
this.docs.push({
ApplicationId: e.ApplicationId || e.ApplicationType,
Source: 1,
SourceId: e.DocId || e.docID || e.docId || e.SourceId || e.Id,
SourceName: e.Assunto
})
})
}
else{
this.docs.push({
ApplicationId: this.document.ApplicationId || this.document.ApplicationType,
Source: 1,
SourceId: this.document.DocId || this.document.docID || this.document.docId || this.document.SourceId || this.document.Id,
SourceName: this.document.Assunto
})
}
let postEvent = {
EventId: '',
Subject: this.postData.Subject,
@@ -318,10 +335,11 @@ export class DocumentSetUpMeetingPage implements OnInit {
Type: this.EventRecurrenceType,
LastOccurrence: this.Occurrence,
},
// Attachments: this.docs,
Attachments: this.attachments,
}
const laoder = this.toastService.loading()
const laoder = this.toastService.loading();
this.eventService.create({ body: postEvent, calendar: this.postData.CalendarName }).subscribe(async (respose) => {
laoder.remove();
@@ -330,7 +348,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
}, (error) => {
laoder.remove();
this.httpErroHandle.httpStatusHandle(error)
}, ()=>{
}, () => {
laoder.remove();
});
@@ -340,10 +358,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "intervenient";
if(window.innerWidth <= 801){
if (window.innerWidth <= 801) {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
@@ -354,7 +372,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data) {
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -378,10 +396,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
this.adding = "CC";
if(window.innerWidth <= 800) {
if (window.innerWidth <= 800) {
const modal = await this.modalController.create({
component: AttendeesPageModal,
componentProps: {
componentProps: {
adding: this.adding,
taskParticipants: this.taskParticipants,
taskParticipantsCc: this.taskParticipantsCc
@@ -394,7 +412,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
modal.onDidDismiss().then((data) => {
if(data){
if (data) {
data = data['data'];
const newAttendees: EventPerson[] = data['taskParticipants'];
@@ -424,30 +442,30 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
});
modal.onDidDismiss().then((res)=> {
if(res){
const data = res.data;
this.attachments.push(data.selected);
}
}, (error) => {
console.log(error)
});
modal.onDidDismiss().then((res) => {
if (res) {
const data = res.data;
this.attachments.push(data.selected);
}
}, (error) => {
console.log(error)
});
await modal.present();
await modal.present();
}
removeAttachment(index: number) {
this.attachments = this.attachments.filter( (e, i) => index != i);
this.attachments = this.attachments.filter((e, i) => index != i);
}
validateFormInputs() {
let formLocation = this.postData.Location.trim();
if(!this.postData.Location && formLocation.length <= 0){
if (!this.postData.Location && formLocation.length <= 0) {
this.formLocationSatus = true;
}
}
selectedCalendarId () {
selectedCalendarId() {
if (this._eventService.calendarNamesType[this.CalendarName]?.['Oficial'] && this.postData.CalendarName == 'Oficial') {
return this._eventService.calendarNamesType[this.CalendarName]['OficialId']
@@ -461,7 +479,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
}
}
dynamicSetIntervenient({taskParticipants, taskParticipantsCc}) {
dynamicSetIntervenient({ taskParticipants, taskParticipantsCc }) {
this.taskParticipants = taskParticipants;
this.taskParticipantsCc = taskParticipantsCc;
}
@@ -484,7 +502,7 @@ export class DocumentSetUpMeetingPage implements OnInit {
const minutes = date.getMinutes();
date.setSeconds(0);
if(minutes % 15 != 0) {
if (minutes % 15 != 0) {
if (minutes > 45) {
date.setMinutes(60)
@@ -501,10 +519,10 @@ export class DocumentSetUpMeetingPage implements OnInit {
return date
}
roundTimeQuarterHourPlus15(date:Date) {
roundTimeQuarterHourPlus15(date: Date) {
const _date = new Date(date);
const minutes = _date .getMinutes();
_date .setMinutes(minutes + 15)
const minutes = _date.getMinutes();
_date.setMinutes(minutes + 15)
return _date
}
@@ -512,5 +530,34 @@ export class DocumentSetUpMeetingPage implements OnInit {
return this._eventService.calendarRole.includes(str);
}
async fetchContacts(filter: string) {
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
console.log('Attendes Email', filterLoggedUserEmail)
this.contacts = filterLoggedUserEmail;
const newAttendees: EventPerson[] = this.contacts;
this.setIntervenient(newAttendees);
console.log('Attendes Email', this.contacts)
}
);
}
}
}
@@ -61,16 +61,16 @@
<div class="d-flex align-center flex-column" (click)="takePicture()">
<div *ngIf="profilePicture == '' ">
<ion-icon
*ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' "
class="profile-pic" src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<img
class="profile-pic" src="assets/images/theme/gov/icons-profile.svg">
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
<!-- <img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
src='assets/images/presidente.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Ministro e Director do Gabinete do PR' "
class="profile-pic" src='assets/images/ministro.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic"
src='assets/images/secretaria_geral.png'>
src='assets/images/secretaria_geral.png'> -->
</div>
<div *ngIf="profilePicture != '' ">
@@ -135,7 +135,7 @@
</div>
</div>
</div> -->
</div>
</div>
@@ -44,8 +44,12 @@ export class EditProfilePage implements OnInit {
}
getProfilpictureFromStorage() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
if(picture) {
this.profilePicture = picture
} else {
this.profilePicture = "";
}
/* console.log(picture) */
}).catch((error) => {
this.profilePicture = "";
})
+6 -6
View File
@@ -37,18 +37,18 @@
<ion-header class=" bg-blue ion-no-border">
<div class="profile-content">
<div class="d-flex align-center">
<div class="d-flex align-center flex-column">
<div *ngIf="profilePicture == ''" class="profile-pic">
<ion-icon *ngIf="SessionStore.user.RoleDescription != 'Presidente da República' && SessionStore.user.RoleDescription != 'Ministro e Director do Gabinete do PR' && SessionStore.user.RoleDescription != 'Secretário Geral' " class="profile-pic"
src="assets/images/theme/gov/icons-profile.svg"></ion-icon>
<div *ngIf="profilePicture == ''">
<img
class="profile-pic" src="assets/images/theme/gov/icons-profile.svg">
<img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
<!-- <img *ngIf="SessionStore.user.RoleDescription == 'Presidente da República' " class="profile-pic"
src='assets/images/presidente.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-pic"
src='assets/images/ministro.png'>
<img *ngIf="SessionStore.user.RoleDescription == 'Secretário Geral' " class="profile-pic"
src='assets/images/secretaria_geral.png'>
src='assets/images/secretaria_geral.png'> -->
</div>
<div *ngIf="profilePicture != ''" class="profile-pic">
+6 -2
View File
@@ -99,8 +99,12 @@ export class ProfilePage implements OnInit {
getProfilpicture() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
if(picture) {
this.profilePicture = picture
} else {
this.profilePicture = "";
}
/* console.log(picture) */
}).catch((error ) => {
this.profilePicture = "";
})
@@ -58,7 +58,7 @@ export class ViewDocumentPage implements OnInit {
ngOnInit() {
this.processes.GetViewer(this.docId, this.applicationId).subscribe(async(res)=> {
const link: string = res.replace('//pdfjs/web/', '/pdfjs/web/')
this.trustedUrl = this.sanitazer.bypassSecurityTrustResourceUrl(link);
@@ -125,7 +125,7 @@ export class ViewDocumentPage implements OnInit {
}
async openBookMeetingModal() {
console.log('this.Document', this.Document)
console.log('this.Document----------', this.Document)
let classs;
if( window.innerWidth < 701) {
classs = 'book-meeting-modal modal modal-desktop'
@@ -164,6 +164,8 @@ export class ViewDocumentPage implements OnInit {
classs = 'modal modal-desktop showAsideOptions'
}
// check passing
console.log('this.Document----------openExpedientActionsModal', this.Document)
const modal = await this.modalController.create({
component: ExpedientTaskModalPage,
componentProps: {
@@ -175,7 +177,7 @@ export class ViewDocumentPage implements OnInit {
cssClass: classs,
});
modal.onDidDismiss().then(
modal.onDidDismiss().then(
async(res)=>{}
, (error) => {
console.log(error)
+6 -2
View File
@@ -57,7 +57,7 @@ models.register({
// // acçoes
export class ActionModel extends models.Model{
static $tableName = 'ActionModel11'
ProcessId = models.IntegerField({unique: true})
Description = models.CharField()
Detail = models.CharField()
@@ -91,7 +91,7 @@ export class PublicationDetailsModel extends models.Model{
export class WebtrixUserModel extends models.Model {
FullName = models.CharField()
Role = models.CharField()
}
@@ -110,3 +110,7 @@ models.register({
version: 14,
models: [PublicationDetailsModel, ActionModel, PublicationFolderModel]
})
window["MessageModel"] = MessageModel
+2 -1
View File
@@ -3,5 +3,6 @@ export class EventPerson{
Name: string;
IsRequired: boolean;
UserType: string;
IsPR: boolean
IsPR: boolean;
RoleDescription: string;
}
+31 -24
View File
@@ -4,7 +4,7 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="d-flex container-wrapper">
<div class="calendar-timeline d-flex flex-column height-100 bg-blue">
@@ -14,7 +14,7 @@
<!-- Toolbar -->
<ion-progress-bar type="indeterminate" *ngIf="showLoader"></ion-progress-bar>
<div class="weeksToShow">
<div class="weeksToShow">
<!-- Calendar is here -->
<div class="calendar-segment-{{profile}}" [class.calendar-segment-pr-force]="SessionStore.user.Profile =='PR'">
@@ -55,13 +55,13 @@
class="select-calendar">
<mat-form-field class="select-calendar" appearance="none" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName" (selectionChange)="reloadCalendar()">
<mat-option *ngFor="let calendars of eventService.calendarNamesAry" value="{{calendars.Fullname || calendars}}">
<div *ngIf="environment.presidential">
<div *ngIf="calendars.Role == 'Presidente da República'"> PR </div>
<div *ngIf="calendars.Role == 'Ministro e Director do Gabinete do PR'"> MDGPR </div>
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República' && calendars.Fullname"> Agenda do {{calendars.Fullname}} </div>
<div *ngIf="calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República' && calendars.Fullname"> Agenda do {{calendars.Fullname}} </div>
<div *ngIf="calendars.Role != 'Presidente da República' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars == 'Meu calendario' ">
<!-- <span *ngIf="SessionStore.user.Profile == 'PR' ">PR</span>
<span *ngIf="SessionStore.user.Profile == 'MDGPR' ">MDGPR</span>
@@ -69,7 +69,7 @@
Minha agenda
</div>
</div>
<div *ngIf="!environment.presidential">
<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>
@@ -82,14 +82,14 @@
<mat-option value="PR+MDGPR" *ngIf="p.userPermission([p.permissionList.Gabinete.md_tasks]) && environment.presidential">
PR+MDGPR
</mat-option>
</mat-select>
</mat-form-field>
</div>
<div class="float-button">
<div class="float-button">
<button title="Visualizar a lista de Eventos para aprovação" class="cursor-pointer resize pr-20-rem" (click)="viewEventsToApprove()" *ngIf="p.userPermission([p.permissionList.Gabinete.aprove_event])">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="right-icons" src="assets/images/icons-received-event.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' && !mobileComponent.showEventList" class="right-icons" src="assets/images/theme/gov/icons-received-event.svg"></ion-icon>
@@ -105,7 +105,7 @@
</button>
</div>
</ion-row>
<ion-row class="ion-align-items-center calendar-options">
@@ -215,24 +215,30 @@
</div>
<div class="timeline-wrapper flex-grow-1 height-100" >
<div class="height-100">
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}}" >
<div class="timeline-container height-100 d-flex pt-10 pl-20 filter-{{segment}} flex-column" >
<div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
<span >Hoje,&nbsp;</span> {{ timelineDate }}
</div>
<div class="ss-timeline timeline-mobile flex-grow-1 pr-10 text-black height-100 width-100 overflow-y-auto" >
<div class="timeline-date align-center" *ngIf="isSelectedDayHasEvent && hasEventToday">
<span >Hoje,&nbsp;</span> {{ timelineDate }}
</div>
<div *ngFor="let events of TimelineMDList | keyvalue; " >
<div *ngFor="let year of TimelineMDList " >
<!-- {{year.yearInfo.yearName}} -->
<div *ngFor="let month of year.months " class="header-day" >
<!-- {{ month.monthInfo.monthName | json }} -->
<!-- <hr> -->
<div class="EventListBox-container" >
<div class="day " [class.dayShow]="isSelectedDayHasEvent && hasEventToday" >
{{ TimelineDay(events.key)}} <div style="text-transform: capitalize; display: inline;">{{ viewTitle }}</div>
</div>
<div *ngFor="let day of month.days " class="EventListBox-container" >
<div *ngFor="let event of events.value" class="EventListBox mb-10" >
<div class="day " [class.dayShow]="isSelectedDayHasEvent && hasEventToday" >
{{ day.daysInfo.dayName }} <div style="text-transform: capitalize; display: inline;">{{month.monthInfo.monthName}}</div>
</div>
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)"
*ngIf="viewEventMonth <= dateMonth(event) ">
<div *ngFor="let event of day.events " class="EventListBox mb-10" >
<div class="d-flex content-{{event.profile}}-{{event.event.CalendarName}} mt-10 cursor-pointer width-100 " (click)="eventClicked(event)"
>
<div class="schedule-time" *ngIf="!event.event.IsAllDayEvent">
@@ -258,10 +264,11 @@
<div class="font-13 calendar-owner"*ngIf="eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId) == 'Meu calendario'">{{SessionStore.user.FullName}} </div>
<ng-template #other_content>{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}</ng-template>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
+4 -5
View File
@@ -875,13 +875,12 @@ $font-size: rem(15);
font-weight: bold !important;
}
.ss-timeline > :nth-child(2) .dayShow {
display: none;
.header-day .dayShow:nth-child(1) {
display: none !important;
}
.ss-timeline > :nth-child(1) .dayShow {
margin-top: 0px !important;
}
.calendar-options {
position: relative;
+157 -105
View File
@@ -105,7 +105,7 @@ export class AgendaPage implements OnInit {
selectedEvent: Event;
selectedEventId: string | number;
selectedEventCalendarId : string | number;
selectedEventCalendarId: string | number;
postEvent: any;
// temporary data
@@ -213,14 +213,14 @@ export class AgendaPage implements OnInit {
} else if (this.loggeduser.Profile == 'PR') {
this.profile = "pr";
} else {
if(this.eventService.usersCalendarIds.length >= 2) {
if (this.eventService.usersCalendarIds.length >= 2) {
this.profile = "mdgpr";
} else if (this.eventService.hasOwnCalendar) {
this.profile = "mdgpr";
} else if (this.eventService.hasSharedCalendar) {
this.profile = "pr";
}
}
this.calendarHeight = ["height-356"];
@@ -253,7 +253,7 @@ export class AgendaPage implements OnInit {
}, 1000)
}
ngOnInit() {
@@ -270,18 +270,29 @@ export class AgendaPage implements OnInit {
this.segment = "Combinado";
}
if (realoadCounter != 0) {
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
this.updateEventListBox()
}
this.calendar.currentDate = new Date();
try {
this.myCal.update();
this.myCal.loadEvents();
this.onDropDownScrollWeal()
} catch (e) { }
this.updateEventListBox()
realoadCounter++;
this.weekToShow()
}
});
this.backgroundservice.registerBackService('Online', () => {
//this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
});
window.onresize = (event) => {
// if not table remove all component
if (window.innerWidth <= 1024) {
@@ -296,31 +307,31 @@ export class AgendaPage implements OnInit {
setTimeout(() => {
try {
let weekNum = 0;
function Week(a) {
for(let b of a.querySelectorAll('td')) {
if(!b.className.includes('text-muted')) {
for (let b of a.querySelectorAll('td')) {
if (!b.className.includes('text-muted')) {
weekNum++;
return true
}
}
}
const dayBoxHeight = document.querySelector('.monthview-container .swiper-container .swiper-slide-active table tbody tr td').clientHeight
const weeks = document.querySelectorAll('.monthview-container .swiper-container .swiper-slide-active table tbody tr');
for (let week of weeks as any ){
for (let week of weeks as any) {
Week(week)
}
}
this.showCalendar = true
this.listBoxService.height = (weekNum * dayBoxHeight) +'px'
if(dayBoxHeight == 0) {
this.listBoxService.height = (weekNum * dayBoxHeight) + 'px'
if (dayBoxHeight == 0) {
this.weekToShow()
}
} catch (e) {
setTimeout(()=> {
setTimeout(() => {
this.weekToShow()
}, 100)
}
@@ -328,8 +339,8 @@ export class AgendaPage implements OnInit {
}
setCalendarByDefault() {
if(!this.CalendarName) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
if (!this.CalendarName) {
if (this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.CalendarName = 'Meu calendario';
} else {
this.CalendarName = this.eventService.calendarNamesAry[0]
@@ -410,13 +421,16 @@ export class AgendaPage implements OnInit {
onDropDownScrollWeal() {
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
try {
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[1].scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300)
}, 10)
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[0].scrollIntoView({ behavior: 'smooth', block: 'center' });
setTimeout(() => {
document.querySelector('.dropdown-scroll-weel').querySelectorAll('.active')[1].scrollIntoView({ behavior: 'smooth', block: 'center' });
}, 300)
}, 10)
} catch (error) {
console.log(error)
}
}
@@ -424,10 +438,23 @@ export class AgendaPage implements OnInit {
this.eventSelectedDate2 = ev.selectedTime;
}
currentMoth = {
rangeStartDate: null,
rangeEndDate: null
}
onRangeChanged(ev: { startTime: Date, endTime: Date }) {
this.rangeStartDate = ev.startTime;
this.rangeEndDate = ev.endTime;
if (this.currentMoth.rangeEndDate == null) {
this.currentMoth = {
rangeStartDate: ev.startTime,
rangeEndDate: ev.endTime
}
}
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
@@ -554,8 +581,8 @@ export class AgendaPage implements OnInit {
loadRangeEvents(startTime: Date, endTime: Date) {
this.weekToShow()
if(!this.eventService.hasAnyCalendar) {
if (!this.eventService.hasAnyCalendar) {
return false
}
@@ -565,9 +592,9 @@ export class AgendaPage implements OnInit {
this.showLoader = true;
const index = `${startTime}${endTime}`
if(!this.loadRequest[index]) {
this.loadRequest[index] = {startTime, endTime}
this.loadRequestHistory[index] = {lastTimeUpdate: new Date()}
if (!this.loadRequest[index]) {
this.loadRequest[index] = { startTime, endTime }
this.loadRequestHistory[index] = { lastTimeUpdate: new Date() }
this.loadRangeEventRun(startTime, endTime)
} else {
@@ -582,7 +609,7 @@ export class AgendaPage implements OnInit {
loadRangeEventRun(startTime: Date, endTime: Date) {
if(SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
if (SessionStore.user.OwnerCalendars.length == 0 && SessionStore.user.SharedCalendars.length == 0) {
return false
}
@@ -602,18 +629,18 @@ export class AgendaPage implements OnInit {
} catch (error) {
}
let load = 0;
for ( const selectedCalendar of selectedCalendarIds) {
let load = 0;
for (const selectedCalendar of selectedCalendarIds) {
this.eventService.getEventsByCalendarId(momentG(new Date(startTime), 'yyyy-MM-dd HH:mm:ss'), momentG(new Date(endTime), 'yyyy-MM-dd 23:59:59'), selectedCalendar.CalendarId).then((response: any) => {
let label;
if(SessionStore.user.Profile == 'PR') {
if (SessionStore.user.Profile == 'PR') {
label = "pr"
} else if(SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
} else if (SessionStore.user.OwnerCalendars.find(e => e.CalendarId == selectedCalendar.CalendarId)) {
label = 'md'
} else {
label = "pr"
@@ -622,7 +649,7 @@ export class AgendaPage implements OnInit {
let eventsList = response;
this.CalendarStore.removeRangeForCalendar(startTime, endTime, label, selectedCalendar.CalendarId)
this.CalendarStore.pushEvent(eventsList, label);
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
this.updateEventListBox()
@@ -632,10 +659,10 @@ export class AgendaPage implements OnInit {
this.deleteLoadRangeEvent(startTime, endTime);
load++
if(load == selectedCalendarIds.length) {
if (load == selectedCalendarIds.length) {
this.showLoader = false;
}
this.myCal.update();
this.myCal.loadEvents();
this.updateEventListBox()
@@ -645,9 +672,9 @@ export class AgendaPage implements OnInit {
selectedAgenda = {}
getSelectedAgendaCalendars () {
getSelectedAgendaCalendars() {
if(this.CalendarName == 'PR+MDGPR') {
if (this.CalendarName == 'PR+MDGPR') {
let result = this.SessionStore.user.OwnerCalendars
@@ -657,50 +684,50 @@ export class AgendaPage implements OnInit {
return result.concat(join)
} else {
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
if(Oficial && Pessoal) {
return [
{
CalendarId : Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
const calendar = this.eventService.calendarNamesType[this.CalendarName];
let Oficial = calendar?.['OficialId']
let Pessoal = calendar?.['PessoalId']
if (Oficial && Pessoal) {
return [
{
CalendarId: Oficial,
OwnerId: calendar.OwnerId,
CalendarName: calendar.CalendarName
},
{
OwnerId: calendar.OwnerId,
CalendarId: Pessoal,
CalendarName: calendar.CalendarName
}
]
} else if (Oficial) {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId: Oficial,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
} else {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId: Pessoal,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
]
} else if (Oficial) {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Oficial,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
} else {
try {
return [{
OwnerId: calendar.OwnerId,
CalendarId : Pessoal,
CalendarName: calendar.CalendarName
}]
} catch (error) {
console.log(error)
}
}
}
}
@@ -710,11 +737,26 @@ export class AgendaPage implements OnInit {
const selectedCalendarIds = this.getSelectedAgendaCalendars();
this.listToPresent = this.CalendarStore.getEventsByCalendarIds(selectedCalendarIds)
this.TimelineMDList = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
const year = this.listBoxService.list(this.listToPresent, 'md', this.rangeStartDate, this.rangeEndDate, { segment: this.segment, selectedDate: this.eventSelectedDate })
this.TimelineMDList = year
const selectedDay = momentG(this.eventSelectedDate, 'dd', 'pt');
if(this.TimelineMDList[selectedDay]) {
this.hasEventToday = true
const yearName = momentG(new Date(this.eventSelectedDate), 'yyyy')
const monthName = momentG(new Date(this.eventSelectedDate), 'MMMM')
const dayName = momentG(new Date(this.eventSelectedDate), 'dd')
let YearIndex = year.findIndex( x => x.yearInfo.yearName == yearName)
if(YearIndex == 0) {
let MonthNameIndex = year[YearIndex].months.findIndex( x => x.monthInfo.monthName == monthName)
if(MonthNameIndex == 0) {
let DayNameIndex = year[YearIndex].months[MonthNameIndex].days.findIndex( x => x.daysInfo.dayName == dayName)
if(DayNameIndex == 0) {
this.hasEventToday = true
} else {
this.hasEventToday = false
}
} else {
this.hasEventToday = false
}
} else {
this.hasEventToday = false
}
@@ -742,16 +784,13 @@ export class AgendaPage implements OnInit {
} catch (e) { }
this.updateEventListBox()
} else {
}
} else { }
}
changeMonth = (month) => {
const a = this.calendar.currentDate;
const isInvalidDate = (dateString) => JSON.stringify(new Date(dateString)) === 'null';
@@ -768,7 +807,7 @@ export class AgendaPage implements OnInit {
this.updateEventListBox()
} else {
}
}
@@ -796,7 +835,7 @@ export class AgendaPage implements OnInit {
}
changeProfile() {
if (this.profile == "mdgpr") {
this.profile = "pr";
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
@@ -839,7 +878,7 @@ export class AgendaPage implements OnInit {
cssClass: 'modal modal-desktop',
backdropDismiss: false
});
modal.onDidDismiss().then((data) => {
if (data) {
@@ -870,7 +909,7 @@ export class AgendaPage implements OnInit {
openAddEventDismiss(data) {
try {
let postEvent: Event = data;
if (postEvent.Subject != null) {
// this.eventSource.push({
@@ -884,7 +923,7 @@ export class AgendaPage implements OnInit {
this.myCal.loadEvents();
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
} catch (error) {
} catch (error) {
}
@@ -899,8 +938,8 @@ export class AgendaPage implements OnInit {
let navigationExtras: NavigationExtras = { queryParams: { CalendarId } }
this.router.navigate(['/home/agenda/',eventId,'agenda'], navigationExtras);
this.router.navigate(['/home/agenda/', eventId, 'agenda'], navigationExtras);
}
// open component
@@ -914,16 +953,16 @@ export class AgendaPage implements OnInit {
this.postEvent = data.event;
this.mobileComponent.showEditEvent = true;
} else if(data.type == 'delete') {
} else if (data.type == 'delete') {
}
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
setTimeout(()=>{
setTimeout(() => {
this.onCurrentChanged(this.eventSelectedDate)
}, 500)
}
@@ -1083,7 +1122,7 @@ export class AgendaPage implements OnInit {
}
reloadCalendar() {
//
//
this.loadRangeEvents(this.rangeStartDate, this.rangeEndDate);
}
@@ -1129,10 +1168,8 @@ export class AgendaPage implements OnInit {
// THIS LINE
this.updateEventListBox();
}
shoeEventDay(events: any[]) {
if (this.segment == 'Combinado') {
@@ -1150,3 +1187,18 @@ export class AgendaPage implements OnInit {
}
}
function endOfMonth(myDate) {
let date = new Date(myDate);
date.setDate(1); // Avoids edge cases on the 31st day of some months
date.setMonth(date.getMonth() + 1);
date.setDate(0);
date.setHours(23);
date.setMinutes(59);
date.setSeconds(59);
return date;
}
const addDays = 5;
const endDateRange = endOfMonth(new Date(5))
endDateRange.setDate(endDateRange.getDate() + addDays)
@@ -18,6 +18,7 @@ import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
import { environment } from 'src/environments/environment';
import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -98,7 +99,8 @@ export class EditEventPage implements OnInit {
private router: Router,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private contactsService: ContactsService
private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService
) {
/* this.postEvent = new Event(); */
@@ -363,6 +365,9 @@ export class EditEventPage implements OnInit {
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc)
this.postEvent.Subject = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Subject/* ) */;
this.postEvent.Location = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Location/* ) */;
this.postEvent.Body.Text = /* this.domSanitazerService.sanitizeInput( */this.postEvent.Body.Text/* ) */;
this.postEvent.EventRecurrence.Type = this.selectedRecurringType;
@@ -22,6 +22,8 @@ import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { environment } from 'src/environments/environment';
import { ProcessesService } from 'src/app/services/processes.service';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
@@ -93,6 +95,9 @@ export class NewEventPage implements OnInit {
roomId: string;
globalEnd = new Date('1999')
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
@@ -105,7 +110,9 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService
) {
this.loggeduser = SessionStore.user;
this.postEvent = new Event();
@@ -196,6 +203,7 @@ export class NewEventPage implements OnInit {
this.checkRoleInArray()
this.changeAgenda()
this.fetchContacts("")
}
ngOnDestroy() {
@@ -407,6 +415,9 @@ export class NewEventPage implements OnInit {
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.postEvent.Subject = this.domSanitazerService.sanitizeInput(this.postEvent.Subject);
this.postEvent.Location = this.domSanitazerService.sanitizeInput(this.postEvent.Location);
this.postEvent.Body.Text = this.domSanitazerService.sanitizeInput(this.postEvent.Body.Text);
let eventId: any;
@@ -831,4 +842,33 @@ export class NewEventPage implements OnInit {
return toAproveObject;
}
async fetchContacts(filter: string) {
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
console.log('Attendes Email', filterLoggedUserEmail)
this.contacts = filterLoggedUserEmail;
const newAttendees: EventPerson[] = this.contacts;
this.setIntervenient(newAttendees);
console.log('Attendes Email', this.contacts)
}
);
}
}
}
@@ -11,7 +11,7 @@
<div class="title-content d-flex justify-between width-100 mb-10">
<div class="left d-flex">
<button class="btn-no-color d-flex align-center" (click)="goBack()">
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/doneIt/icons-calendar-arrow-left.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-calendar-arrow-left.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="end" src='assets/images/theme/gov/icons-calendar-arrow-left.svg'></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="end" src='assets/images/theme/{{ThemeService.currentTheme}}/icons-calendar-arrow-left.svg'></ion-icon>
</button>
@@ -40,7 +40,6 @@
<i class="far fa-clock font-15"></i>
<ion-label class="font-15 pl-10" color="warning">{{roomCountDownDate}}</ion-label>
</div>
{{ RouteService.history }}
</div>
</ion-toolbar>
</ion-header>
@@ -341,4 +340,4 @@
</div>
</div>
</ion-footer>
</ion-footer>
@@ -32,6 +32,10 @@ import { SessionStore } from 'src/app/store/session.service';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { Camera, CameraResultType, CameraSource } from '@capacitor/camera';
import { RouteService } from 'src/app/services/route.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
import { sanitize } from "sanitize-filename-ts";
@Component({
selector: 'app-group-messages',
templateUrl: './group-messages.page.html',
@@ -104,6 +108,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
private file: File,
private fileOpener: FileOpener,
public RouteService: RouteService,
private FileValidatorService: FileValidatorService
) {
this.ChatSystemService.getUser()
@@ -507,7 +512,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": fileName,
"title": sanitize(fileName),
"title_link_download": true,
"type": "audio"
}],
@@ -828,37 +833,45 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
const file: any = await this.fileService.getFileFromDevice(types);
const fileName = file.name
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
const validation = this.FileValidatorService.fileNameValidation(fileName)
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
const blob = this.fileService.base64toBlob(encodedData, file.type)
if(validation.isOk) {
const formData = new FormData();
formData.append('blobFile', blob);
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
const blob = this.fileService.base64toBlob(encodedData, file.type)
const formData = new FormData();
formData.append('blobFile', blob);
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData
}
});
this.ChatSystemService.getGroupRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": sanitize(fileName),
"name": sanitize(fileName),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData
}
});
} else {
}
} else {
this.toastService._badRequest("Ficheiro inválido")
}
}
@@ -23,7 +23,7 @@
</div>
<div hidden class="right">
<button class="btn-no-color" (click)="openMessagesOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
</ion-icon>
</button>
+39 -36
View File
@@ -33,6 +33,10 @@ import { Filesystem, Directory } from '@capacitor/filesystem';
import { NewEventPage } from '../../agenda/new-event/new-event.page';
import { NotificationsService } from 'src/app/services/notifications.service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'
import { FileValidatorService } from "src/app/services/file/file-validator.service"
import { sanitize } from "sanitize-filename-ts";
const IMAGE_DIR = 'stored-images';
@@ -117,6 +121,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
private fileOpener: FileOpener,
private router: Router,
public RochetChatConnectorService: RochetChatConnectorService,
private FileValidatorService: FileValidatorService
) {
try {
@@ -413,12 +418,13 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
this.audioRecorded = `data:${recordData.value.mimeType};base64,${recordData?.value?.recordDataBase64}`;
}
//Converting base64 to blob
const encodedData = btoa(this.audioRecorded);
const blob = this.fileService.base64toBlob(encodedData, recordData.value.mimeType)
const validation = await this.FileValidatorService.validateAudioFromBlob(blob)
const formData = new FormData();
formData.append("blobFile", blob);
@@ -429,7 +435,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
"mimeType": audioFile.value.mimeType,
},
attachments: [{
"title": fileName,
"title": sanitize(fileName),
"title_link_download": true,
"type": "audio"
}],
@@ -759,7 +765,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
}
async addFileToChatMobile(types: typeof FileType[]) {
console.log('add image from gallery')
const roomId = this.roomId
const file = await Camera.getPhoto({
@@ -852,43 +857,41 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
formData.append('blobFile', blob);
console.log('add file', fileBase64) */
const fileName = file.name
const validation = this.FileValidatorService.fileNameValidation(fileName)
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
console.log('TYPE', file.type)
if(validation.isOk) {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
console.log(encodedData)
const blob = this.fileService.base64toBlob(encodedData, file.type)
console.log('BLOB BLOB', blob)
const formData = new FormData();
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
});
} else {
console.log('file not supported')
}
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
console.log(encodedData)
const blob = this.fileService.base64toBlob(encodedData, file.type)
const formData = new FormData();
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": sanitize(fileName),
"name": sanitize(fileName),
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: encodedData,
}
});
} else {
this.toastService._badRequest("Ficheiro inválido")
}
}
@@ -21,27 +21,27 @@ export class AttendeesPageModal implements OnInit {
eventPersons: EventPerson[];
adding: "intervenient" | "CC";
currentPath = window.location.pathname;
taskParticipants:EventPerson[] = [];
taskParticipantsCc:EventPerson[] = [];
loggeduser: LoginUserRespose;
@Input() loggedAttendSon: boolean;
taskType: any;
constructor(
private modalCtrl: ModalController,
private modalCtrl: ModalController,
private contactsService: ContactsService,
private navParams: NavParams,
private modalController: ModalController,
public ThemeService: ThemeService,
private router: Router,) {
this.adding = this.navParams.get('adding');
this.taskParticipants = this.navParams.get('taskParticipants');
this.taskParticipantsCc = this.navParams.get('taskParticipantsCc');
this.taskType = this.navParams.get('taskType');
this.loggeduser = SessionStore.user;
}
@@ -49,7 +49,7 @@ export class AttendeesPageModal implements OnInit {
ngOnInit() {
console.log('Pesquisa de contactos current path1',this.router.url)
this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined){
this.taskParticipants = [];
}
@@ -57,9 +57,9 @@ export class AttendeesPageModal implements OnInit {
if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined){
this.taskParticipantsCc = [];
}
}
ngOnChanges(event) {}
save(){
@@ -81,16 +81,16 @@ export class AttendeesPageModal implements OnInit {
filterSearchList(itm: EventPerson): boolean {
const result = this.taskParticipants.concat( this.taskParticipantsCc).find((contact, index)=>{
if(contact.Name.toLocaleLowerCase() == itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() == itm.EmailAddress.toLocaleLowerCase()){
index = index;
return contact;
}
})
return undefined == result;
}
remove(itm: EventPerson) {
@@ -103,7 +103,7 @@ export class AttendeesPageModal implements OnInit {
return contact;
}
return false;
});
} else if (this.adding == "CC") {
@@ -114,7 +114,7 @@ export class AttendeesPageModal implements OnInit {
return contact;
}
return false;
});
}
@@ -124,7 +124,7 @@ export class AttendeesPageModal implements OnInit {
if(this.adding == "intervenient"){
itm.IsRequired = true;
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
itm.IsRequired = false;
this.taskParticipantsCc.push(itm);
@@ -142,7 +142,7 @@ export class AttendeesPageModal implements OnInit {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
@@ -153,16 +153,16 @@ export class AttendeesPageModal implements OnInit {
this.showLoader = false;
} else {
this.contacts = result;
console.log('Attendes Email',this.loggeduser.Email)
// console.log('Attendes Email',this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase())
if(this.taskType == 0 || this.taskType == 1){
filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false)
}
console.log('Attendes Email', filterLoggedUserEmail)
// console.log('Attendes Email', filterLoggedUserEmail)
let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
this.contacts = filterEmptyEmail;
console.log('Attendes Email', this.contacts)
//console.log('Attendes Email', this.contacts)
this.showLoader = false;
}
@@ -183,4 +183,4 @@ export class AttendeesPageModal implements OnInit {
}).reverse()
}
}
}
+2 -1
View File
@@ -311,7 +311,8 @@ label {
.time {
font-family: Roboto;
text-align: center;
color: var(--header-tab-text-white);
/* color: var(--header-tab-text-white); */
color: black;
line-height: unset;
margin-top: 10px;
width: 100%;
@@ -12,7 +12,7 @@
<div class="title">{{ task.Folio}}</div>
</div>
<div class="div-icon" (click)="openOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-25 cursor-pointer" src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-25 cursor-pointer" src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-25 cursor-pointer" src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " class="font-25 cursor-pointer" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-menu.svg"></ion-icon>
</div>
@@ -97,7 +97,7 @@
</div>
<div class="buttons px-20" *ngIf="task.activityInstanceName == 'Concluir Despacho'">
<button *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" (click)="openAddNoteModal('Concluido')" class="btn-cancel" shape="round" >Marcar como Concluído</button>
<button *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" (click)="openAddNoteModal('Reexecução')" class="btn-cancel" shape="round" >Enviar para Reexecução</button>
<button *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks])" (click)="openAddNoteModal('Reexecutar')" class="btn-cancel" shape="round" >Enviar para Reexecução</button>
<button *ngIf="p.userPermission([p.permissionList.Agenda.access])" (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
<button *ngIf="p.userPermission([p.permissionList.Gabinete.pr_tasks]) && task.Status != 'Pending'" (click)="sendExpedienteToPending()" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div>
@@ -328,7 +328,7 @@ export class DespachoPrPage implements OnInit {
async reexecutar(note: string, documents: any) {
let body = {
"serialNumber": this.serialNumber,
"action": "Reexecução",
"action": "Reexecutar",
"ActionTypeId": 100000010,
"dataFields": {
"ReviewUserComment": note,
@@ -416,7 +416,7 @@ export class DespachoPrPage implements OnInit {
// console.log('actionName', actionName)
await this.concluir(res.data.note, docs);
}
else if (actionName == 'Reexecução') {
else if (actionName == 'Reexecutar') {
await this.reexecutar(res.data.note, docs);
}
@@ -12,7 +12,7 @@
<ion-label class="title">{{ task.Folio }}</ion-label>
</div>
<div class="div-icon" (click)="openOptions()" *ngIf="p.userPermission([p.permissionList.Agenda.access])">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-menu.svg"></ion-icon>
</div>
@@ -21,7 +21,7 @@
<div class="solid"></div>
</div>
<div class="buttons">
<button class="btn-cancel" shape="round" >Arquivar</button>
<button class="btn-cancel" shape="round" (click)="openAddNoteModal('Arquivo')">Arquivar</button>
<!-- <div class="solid"></div> -->
</div>
<div class="buttons">
@@ -504,7 +504,7 @@ export class DiplomaAssinarPage implements OnInit {
});
await Promise.all(draftPromises);
if(this.draftArray.length == 0 ) {
if (this.draftArray.length == 0) {
console.log('No draft found.');
this.asDraft = false
}
@@ -512,7 +512,7 @@ export class DiplomaAssinarPage implements OnInit {
if (this.DraftNames) {
this.DraftNames = this.DraftNames.slice(0, -1);
this.DraftIds = this.DraftIds.slice(0, -1);
}
}
}
@@ -28,7 +28,7 @@
</div>
<div class="menu-ptions">
<button class="btn-no-color" (click)="openOptions(loadedEvent)">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</button>
@@ -17,7 +17,7 @@
<div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
<div *ngIf="Form.get('Subject').errors?.required">
</div>
<div *ngIf="Form.get('Subject').errors?.minlength">
O campo deve ter pelo menos 4 caracteres.
@@ -34,12 +34,12 @@
<mat-form-field appearance="none" class="width-100" color="ion-color-secondary" placeholder="Selecione agenda">
<mat-select [(value)]="CalendarName" (selectionChange)="changeAgenda()">
<!-- <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>
<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>
@@ -47,7 +47,7 @@
<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>
</mat-form-field>
@@ -72,16 +72,16 @@
<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}}">
Agenda {{ calendars }}
</mat-option>
</mat-select>
</mat-form-field>
</div>
</div>
</div>
@@ -195,7 +195,7 @@
[stepHour]="stepHour" [stepMinute]="stepMinute"
[stepSecond]="stepSecond"
[touchUi]="touchUi"
>
</ngx-mat-datetime-picker>
</mat-form-field>
@@ -232,7 +232,7 @@
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-people-cc.svg"></ion-icon>
</div>
<div class="ion-input-class-no-height">
<div class="ion-input-class-no-height cursor-pointer" (click)="addParticipantsCc()">
<div class="list-people">
<ion-item lines="none">
<ion-list>
@@ -241,7 +241,7 @@
</ion-list>
</ion-item>
</div>
<div class="add-people" (click)="addParticipantsCc()">
<div class="add-people" >
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " slot="start" src="assets/images/icons-arrow-forward.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " slot="start" src="assets/images/theme/gov/icons-arrow-forward.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " slot="start" src="assets/images/theme/{{ThemeService.currentTheme}}/icons-arrow-forward.svg"></ion-icon>
@@ -294,7 +294,7 @@
</div>
</div>
<div *ngIf="sessionStore.user.Profile != 'PR'" class="aside-righ flex-grow-1">
<div class="aside-righ flex-grow-1">
<app-empty-container
[texto]="emptyTextDescription"
*ngIf="!showAttendees"
@@ -23,6 +23,7 @@ import { RoleIdService } from 'src/app/services/role-id.service';
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';
const moment = _rollupMoment || _moment;
@@ -114,6 +115,9 @@ export class BookMeetingModalPage implements OnInit {
sessionStore = SessionStore;
environment = environment
loggeduser: LoginUserRespose;
eventPersons: EventPerson[];
contacts: EventPerson[];
constructor(
private modalController: ModalController,
@@ -125,7 +129,8 @@ export class BookMeetingModalPage implements OnInit {
public eventService: EventsService,
public RoleIdService: RoleIdService,
private httpErroHandle: HttpErrorHandle,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
) {
@@ -136,7 +141,7 @@ export class BookMeetingModalPage implements OnInit {
console.log('fulltask', this.fulltask)
if(this.fulltask?.Documents) {
if (this.fulltask?.Documents) {
this.documents = this.fulltask.Documents
}
@@ -174,6 +179,7 @@ export class BookMeetingModalPage implements OnInit {
}
this.changeAgenda();
this.loggeduser = SessionStore.user;
}
ngOnInit() {
@@ -182,6 +188,7 @@ export class BookMeetingModalPage implements OnInit {
this.getAttachments();
this.setDefaultTime()
this.getRecurrenceTypes();
this.fetchContacts("")
}
@@ -191,8 +198,8 @@ export class BookMeetingModalPage implements OnInit {
}
myInterval = setInterval(() => {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e :any) => {
if(e) {
document.querySelectorAll('.ngx-mat-timepicker input').forEach((e: any) => {
if (e) {
e.disabled = true;
}
})
@@ -327,8 +334,8 @@ export class BookMeetingModalPage implements OnInit {
return {
ApplicationId: e.ApplicationType || e.ApplicationId,
Source: 1,
SourceId: e.Id || e.DocId || e.SourceId,
SourceName:e.Assunto,
SourceId: e.Id || e.DocId || e.SourceId,
SourceName: e.Assunto,
Description: e.Assunto,
Stakeholders: e.EntidadeOrganicaNome
}
@@ -417,7 +424,7 @@ export class BookMeetingModalPage implements OnInit {
modal.onDidDismiss().then((data) => {
console.log('attenes return', data)
if (data) {
data = data['data'];
@@ -587,4 +594,33 @@ export class BookMeetingModalPage implements OnInit {
this.postData.EndDate = this.postData.StartDate;
}
async fetchContacts(filter: string) {
console.log(this.loggeduser)
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
console.log('Attendes Email', filterLoggedUserEmail)
this.contacts = filterLoggedUserEmail;
const newAttendees: EventPerson[] = this.contacts;
this.setIntervenient(newAttendees);
console.log('Attendes Email', this.contacts)
}
);
}
}
}
@@ -97,7 +97,7 @@
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-input-class" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom ">
<div class="ion-input-class" [class.input-error]="Form?.get('selectedTypes')?.invalid && validateFrom || validateField ">
<!-- <ion-item
class="ion-no-border ion-no-padding ion-no-margin d-block d-md-none">
<ion-select
@@ -112,7 +112,7 @@
appearance="fill"
class="width-100 d-block"
appearance="none">
<mat-select [(ngModel)]="selectedTypes" multiple placeholder="Selecione o tipo de assunto*">
<mat-select [multiple]="false" [(ngModel)]="selectedTypes" placeholder="{{placeholderSubject}}">
<mat-option *ngFor="let type of subjectTypes" value="{{type.Code}}">{{type.Description}}</mat-option>
</mat-select>
</mat-form-field>
@@ -69,7 +69,7 @@ export class ExpedientTaskModalPage implements OnInit {
loadedAttachments:any;
documents:SearchList[] = [];
subjectTypes:any[] = [];
subjectTypes:any;
selectedTypes: string[]=[];
SearchFolder: any = []
@@ -96,6 +96,7 @@ export class ExpedientTaskModalPage implements OnInit {
validateFrom = false;
validateField = false;
document: any
placeholderSubject: string;
get toppingsValues() {
return this.toppings.value;
@@ -124,40 +125,38 @@ export class ExpedientTaskModalPage implements OnInit {
this.SearchFolder = this.navParams.get('SearchFolder');
this.aplicationId = this.navParams.get('aplicationId')
// this.document = this.navParams.get('document')
this.document = this.navParams.get('document')
this.taskType = this.navParams.get('taskAction');
// if(this.document) {
// const doc: any = this.document
// this.documents.push({
// ApplicationId: (doc.ApplicationType || doc.ApplicationId),
// ApplicationType: (doc.ApplicationType || doc.ApplicationId),
// SourceId: (doc.Id || doc.DocId || doc.SourceId),
// Id: (doc.Id || doc.DocId || doc.SourceId),
// EntidadeOrganicaNome: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome),
// Sender: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome),
// Data: (doc.DocDate || doc.Data),
// DocDate: (doc.DocDate || doc.Data),
// Assunto: doc.Assunto,
// } as any)
// try {
// if(this.document) {
// const doc: any = this.document
// this.documents.push({
// ApplicationId: (doc.ApplicationType || doc.ApplicationId),
// ApplicationType: (doc.ApplicationType || doc.ApplicationId),
// SourceId: (doc.Id || doc.DocId || doc.SourceId),
// Id: (doc.Id || doc.DocId || doc.SourceId),
// EntidadeOrganicaNome: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome),
// Sender: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome),
// Data: (doc.DocDate || doc.Data),
// DocDate: (doc.DocDate || doc.Data),
// Assunto: doc.Assunto,
// } as any)
// }
// } catch (error) {
// console.log(error)
// }
const DocumentToSave = this.documents.map((e) => {
return {
ApplicationId: e.ApplicationType,
SourceId: e.Id
}
});
// console.log('this.document', this.document)
console.log('this.document', this.document)
this.selectedTypes = ['99999850'];
if(this.loggeduser.Profile == 'PR') {
this.selectedTypes = ['99999850'];
this.placeholderSubject = 'Indefinido'
} else {
this.placeholderSubject = 'Selecione o tipo de assunto*'
}
this.postData = new Despacho();
this.participants = this.participants = new Array();
@@ -461,16 +460,22 @@ export class ExpedientTaskModalPage implements OnInit {
}
}
/* if(this.postData.DispatchFolder.Message){ */
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.httpErroHandle.httpsSucessMessagge('Efetuar Despacho')
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
//loader.remove()
}
/* if(this.postData.DispatchFolder.Message){
if(this.selectedTypes.length > 0) { */
try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.httpErroHandle.httpsSucessMessagge('Efetuar Despacho')
this.modalController.dismiss(action_despacho_pr);
} catch (error) {
this.httpErroHandle.httpStatusHandle(error)
} finally {
//loader.remove()
}
/* } else {
this.validateField = true;
this.toastService._badRequest('Por favor selecione um assunto');
} */
/* }
else{
this.validateField = true;
@@ -17,7 +17,7 @@
</div>
<div class="menu-ptions">
<button class="btn-no-color d-flex" (click)="openOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</button>
@@ -21,7 +21,7 @@
</div>
<div class="menu-ptions">
<button class="btn-no-color" (click)="openOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</button>
</div>
@@ -14,7 +14,7 @@
</div>
<div class="div-icon d-flex">
<div autoHide="false" class="d-flex" (click)="openOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-30-rem cursor-pointer" src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " class="font-30-rem cursor-pointer" src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="font-30-rem cursor-pointer" src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</div>
</div>
+3 -2
View File
@@ -7,15 +7,16 @@
<div class="bg-4 d-flex justify-center align-center">
<div class="div-logo">
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/fullLogo-no-g.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'default' " src='assets/images/donit.jpg' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'gov' " src='assets/images/theme/gov/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/theme/{{ThemeService.currentTheme}}/governoangola_A.png' alt='logo'>
<img *ngIf="ThemeService.currentTheme == 'doneIt' " src='assets/images/doneit.jpg' alt='logo'>
</div>
</div>
</div>
</div>
</div>
<!-- <h3 class="center text-white">doneIT</h3> -->
<h3 class="center text-white">Gabinete Digital</h3>
<form class="form">
<p class="form-label">Email</p>
+12 -1
View File
@@ -112,8 +112,15 @@ export class LoginPage implements OnInit {
if (this.validateUsername()) {
if (this.validatePassword()) {
let newUserName = ""
if (this.usernameAsDomain(environment.domain, this.username.trim())) {
newUserName = this.username.trim();
} else {
newUserName = this.username.trim() + "@" + environment.domain;
}
this.userattempt = {
username: this.username.trim(),
username: newUserName.trim(),
password: this.password.trim(),
domainName: environment.domain,
BasicAuthKey: ""
@@ -233,4 +240,8 @@ export class LoginPage implements OnInit {
}
usernameAsDomain(substring, mainString) {
return mainString.includes(substring);
}
}
@@ -30,6 +30,7 @@ import { Capacitor } from '@capacitor/core';
import { File } from '@ionic-native/file/ngx';
import { Media } from '@ionic-native/media/ngx';
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
const config = {
quality: 0.5,
maxWidth: 800,
@@ -130,7 +131,8 @@ export class NewPublicationPage implements OnInit {
private RouteService: RouteService,
public FileService: FileService,
private mediaCapture: MediaCapture,
public checkFileType: checkFileTypeService
public checkFileType: checkFileTypeService,
private FileValidatorService: FileValidatorService
) {
this.publicationType = this.navParams.get('publicationType');
@@ -695,3 +697,4 @@ export class NewPublicationPage implements OnInit {
}
@@ -19,6 +19,9 @@
<div class="title-content width-100 d-flex justify-space-between">
<div class="div-title flex-grow-1">
<ion-label class="title font-25-em">Acções</ion-label>
<!-- <div>
<input type="file" (change)="onFileSelect($event)" />
</div> -->
</div>
<div *ngIf="!intent" class="div-icon">
+63 -12
View File
@@ -15,6 +15,10 @@ import { ThemeService } from 'src/app/services/theme.service'
import { PermissionService } from 'src/app/services/permission.service';
import { Storage } from '@ionic/storage';
import { NewPublicationPage } from './new-publication/new-publication.page';
import { ChunkService } from 'src/app/services/stream/chunk.service'
import { StreamService } from 'src/app/services/stream/stream.service'
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
// import { ActionModel } from 'src/app/models/beast-orm';
@@ -70,6 +74,9 @@ export class PublicationsPage implements OnInit {
public ThemeService: ThemeService,
public p: PermissionService,
private storage: Storage,
private ChunkService: ChunkService,
private StreamService:StreamService,
private http: HttpClient,
) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
@@ -153,11 +160,11 @@ export class PublicationsPage implements OnInit {
this.publications.GetPublicationFolderList().subscribe(async res => {
this.showLoader = false;
const folders: PublicationFolder[] = this.getPublicationFolderMap(res)
this.publicationsEventFolderList = folders.filter((e)=>e.ActionType == 'Evento')
await this.storage.set('actionsEvents', this.publicationsEventFolderList);
this.showLoader = false;
// (async ()=> {
@@ -199,35 +206,79 @@ export class PublicationsPage implements OnInit {
}
async getFromDB() {
//const folders: PublicationFolder[] = await ActionModel.all()
//this.showLoader = false;
// this.publicationsEventFolderList = folders
this.storage.get('actionsEvents').then((events = []) => {
if(Array.isArray(events)) {
const folders: PublicationFolder[] = this.getPublicationFolderMap(events)
this.showLoader = false;
this.publicationsEventFolderList = folders
}
}
});
this.storage.get('actionsViagens').then((viagens = []) => {
if(Array.isArray(viagens)) {
const folders: PublicationFolder[] = this.getPublicationFolderMap(viagens)
this.publicationsTravelFolderList = folders
this.showLoader = false;
}
});
}
async onFileSelect(event: any) {
const file:File = event.target.files[0];
const chunkSize = 1024 * 1024; // Adjust the chunk size as needed
const chunks = [];
let offset = 0;
let i = 0;
let j = 0;
function count () {
j++
return j
}
while (offset < file.size) {
const chunk = file.slice(offset, offset + chunkSize);
const reader = new FileReader();
reader.onload = async () => {
const headers = new HttpHeaders()
.append('X-File-Name', "fileName")
.append('X-File-Extension', "mp4")
.append('X-File-Content-Length', i.toString())
.append('X-File-Index', count().toString());
const a = new Uint8Array(reader.result as ArrayBuffer)
await this.http.post('http://localhost:3001/upload', a.buffer, { headers, responseType: 'blob' }).toPromise();
};
reader.readAsArrayBuffer(chunk);
offset += chunkSize;
i++;
}
}
async editAction(folderId?: string) {
const modal = await this.modalController.create({
component: EditActionPage,
@@ -254,7 +305,7 @@ export class PublicationsPage implements OnInit {
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}
@@ -262,7 +313,7 @@ export class PublicationsPage implements OnInit {
loader.remove()
this.refreshing()
}
}
async AddPublicationFolder(item?: any) {
@@ -280,7 +331,7 @@ export class PublicationsPage implements OnInit {
cssClass: 'new-action modal modal-desktop',
backdropDismiss: false
});
modal.onDidDismiss().then(() => {
this.getActions();
});
@@ -368,7 +419,7 @@ export class PublicationsPage implements OnInit {
cssClass: 'new-action modal modal-desktop',
backdropDismiss: false
});
modal.onDidDismiss();
await modal.present();
@@ -502,7 +553,7 @@ export class PublicationsPage implements OnInit {
},
//translucent: true
});
modal.onDidDismiss().then(res => {
if (res['data'] == 'edit') {
this.closeDesktopComponent();
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MiddlewareRepositoryService } from './middleware-repository.service';
describe('MiddlewareRepositoryService', () => {
let service: MiddlewareRepositoryService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MiddlewareRepositoryService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,16 @@
import { Injectable } from '@angular/core';
import { MiddlewareRemoteDatasourcecService } from "src/app/datasource/middleware/remote/middleware-remote-datasourcec.service";
@Injectable({
providedIn: 'root'
})
export class MiddlewareRepositoryService {
constructor(
private MiddlewareRemoteDatasourcecService: MiddlewareRemoteDatasourcecService,
) {}
refreshToken() {
return this.MiddlewareRemoteDatasourcecService.refreshToken()
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DomSanitizerService } from './DomSanitizer.service';
describe('ActiveTabService', () => {
let service: DomSanitizerService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(DomSanitizerService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+38
View File
@@ -0,0 +1,38 @@
import { Injectable, SecurityContext } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
import { Router } from '@angular/router';
import DOMPurify from 'dompurify';
@Injectable({
providedIn: 'root'
})
export class DomSanitizerService {
constructor(private sanitizer: DomSanitizer) {
}
sanitizeInput(input: string) {
// Encode special characters to prevent XSS attacks
const encodedInput = this.encodeSpecialCharacters(input);
// Use DomSanitizer to sanitize the content
return this.sanitizer.sanitize(SecurityContext.HTML, encodedInput);
}
private encodeSpecialCharacters(input: string): string {
// You can use a library like DOMPurify to encode special characters
return DOMPurify.sanitize(input);
// If you don't want to use an external library, you can manually encode
// Here's a simple example, you may need to extend this based on your requirements
/* return input.replace(/</g, '&lt;').replace(/>/g, '&gt;'); */
}
/* sanitizeInput(input: string): string {
return this.sanitizer.sanitize(SecurityContext.HTML, input);
} */
}
+10
View File
@@ -0,0 +1,10 @@
export type Either<T, E> = { isOk: true; isError: false, value: T } | { isOk: false; isError: true, error: E };
export function ok<T, E>(value: T): Either<T, E> {
return { isOk: true, isError: false, value };
}
export function error<T, E>(error: E): Either<T, E> {
return { isOk: false, isError: true, error};
}
+236 -39
View File
@@ -1,6 +1,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';
@Injectable({
providedIn: 'root'
@@ -8,12 +9,13 @@ import { DateService } from '../date.service';
export class ListBoxService {
height = "unset"
constructor(
private dateService: DateService
){}
filterProfile(eventSource: EventListStore[] = [], profile: 'md' | 'pr' | 'all') {
return eventSource.filter((e) => e.profile == profile)
}
@@ -21,7 +23,7 @@ export class ListBoxService {
getEventInsideRange(eventSource: EventListStore[], rangeStartDate, randEndDate) {
return eventSource.filter((e)=> {
if(new Date(rangeStartDate).getTime() <= new Date(e.startTime).getTime() &&
new Date(randEndDate).getTime() >= new Date(e.endTime).getTime()) {
new Date(randEndDate).getTime() >= new Date(e.endTime).getTime()) {
return true
}
return false
@@ -29,43 +31,84 @@ export class ListBoxService {
}
filterSegment(eventSource: EventListStore[], segment): EventListStore[] {
return eventSource.filter( data => data.calendarName == segment)
}
daysBetween(){ }
list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}) {
list(eventSource: EventListStore[], profile: 'md' | 'pr' | 'all', rangeStartDate, randEndDate, {segment = 'Combinado', selectedDate= null}): Year[] {
// // filter range
// if(selectedDate) {
// eventSource = eventSource.filter(data =>
// data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') &&
// eventSource = eventSource.filter(data =>
// data.startTime.toLocaleDateString('pt') >= new Date(rangeStartDate).toLocaleDateString('pt') &&
// data.startTime.toLocaleDateString('pt') <= new Date(rangeStartDate).toLocaleDateString('pt')
// )
// }
if(segment!='Combinado') {
eventSource = this.filterSegment(eventSource, segment)
eventSource = this.filterSegment(eventSource, segment)
}
// if(profile != 'all') {
// eventSource = this.filterProfile(eventSource, profile)
// }
let newStracture:CustomCalendarEvent[];
let newStracture:CustomCalendarEvent[];
newStracture = this.encapsulation(eventSource);
return this.display(newStracture, selectedDate)
// const object = {}
// for (const e of newStracture.reverse()) {
// if(!object[momentG(new Date(e.start), 'MMMM yyyy')]) {
// object[momentG(new Date(e.start), 'MMMM yyyy')] = []
// }
// object[momentG(new Date(e.start), 'MMMM yyyy')].push(e)
// }
// console.log({object})
// const daysStringNum = Object.keys(object).reverse()
// const daysObject = {}
// for(const day of daysStringNum) {
// daysObject[day] = object[day]
// }
// console.log({daysObject})
return this.display(newStracture, selectedDate).year
// console.log({daysObject})
// const daysStringNum = Object.keys(daysObject)
// for(const day of daysStringNum) {
// daysObject[day] = daysObject[day].reverse()
// }
// daysObject = this.transformObjectKeyOrder(daysObject, daysStringNum)
// return daysObject
}
sortArrayISODate(myArray: any): any[] {
return myArray.sort((a,b) =>
Date.parse(b.start )
-
Date.parse(a.start))
}
display(list: CustomCalendarEvent[], selectedDate) {
let days = {};
const year: Year[] = []
list.forEach( (event:CustomCalendarEvent, index) => {
this.sortArrayISODate(list).reverse().forEach( (event:CustomCalendarEvent, index) => {
var startDate: any = new Date(event.start);
@@ -74,8 +117,8 @@ export class ListBoxService {
endTime: event.end
})
const day = this.dateService.getDay(event.start)
const day = this.dateService.getDay(event.start)
event['manyDays'] = !this.dateService.isSameDate(event.start, event.end)
event['todayOnly'] = this.dateService.isSameDate(event.start, event.end)
@@ -94,56 +137,58 @@ export class ListBoxService {
if (diffDays >= 1) {
const StartEvent = this.transForm(event, {startMany: true, endMany: false, middle: false})
if(this.CanPush(event, selectedDate)) days[day].push(StartEvent)
if(this.CanPush(event, selectedDate)) {days[day].push(StartEvent); this.push(StartEvent, year)}
let i = 1;
// create event between date
while (startDate.getFullYear() != endDate.getFullYear() ||
while (startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate()) {
const newDate = startDate.setDate(startDate.getDate()+ i)
let otherDays = this.dateService.getDay(newDate)
let otherDays = this.dateService.getDay(newDate)
event['other'] = true
event.start = newDate
if(!days.hasOwnProperty(otherDays)) {
days[otherDays] = []
}
if (!(startDate.getFullYear() != endDate.getFullYear() ||
if (!(startDate.getFullYear() != endDate.getFullYear() ||
startDate.getMonth() != endDate.getMonth() ||
startDate.getDate() != endDate.getDate())) {
// last push
const EndEvent = this.transForm(event, {startMany: false, endMany: true, middle: false})
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
if(this.CanPush(event, selectedDate)) {days[otherDays].push(EndEvent) ; this.push(event, year)}
} else {
const EndEvent = this.transForm(event, {startMany: false,endMany: true, middle: true})
if(this.CanPush(event, selectedDate)) days[otherDays].push(EndEvent)
if(this.CanPush(event, selectedDate)) {days[otherDays].push(EndEvent) ; this.push(event, year)}
}
days[otherDays] = days[otherDays].reverse()
}
} else {
if(this.CanPush(event, selectedDate)) days[day].push(event)
if(this.CanPush(event, selectedDate)) { days[day].push(event) ; this.push(event, year) }
}
} else {
if(this.CanPush(event, selectedDate)) days[day].push(event)
if(this.CanPush(event, selectedDate)) { days[day].push(event) ; this.push(event, year) }
}
} else {
if(this.CanPush(event, selectedDate) && diffDays != 2) days[day].push(event)
if(this.CanPush(event, selectedDate) && diffDays != 2) { days[day].push(event) ; this.push(event, year) }
}
//
//
})
@@ -157,14 +202,73 @@ export class ListBoxService {
})
return days
return {days, year}
}
push(event: any, year: Year[]) {
const date = new Date(event.start)
const yearName = momentG(new Date(date), 'yyyy')
const monthName = momentG(new Date(date), 'MMMM')
const dayName = momentG(new Date(date), 'dd')
let YearIndex = year.findIndex( x => x.yearInfo.yearName == yearName)
if(YearIndex == -1) {
YearIndex = year.push({
yearInfo: {
yearName: yearName
},
months: []
})
YearIndex--
}
let MonthNameIndex = year[YearIndex].months.findIndex( x => x.monthInfo.monthName == monthName)
if(MonthNameIndex == -1) {
MonthNameIndex = year[YearIndex].months.push({
monthInfo: {
monthName: monthName
},
days: []
})
MonthNameIndex --
}
let DayNameIndex = year[YearIndex].months[MonthNameIndex].days.findIndex( x => x.daysInfo.dayName == dayName)
if(DayNameIndex == -1) {
year[YearIndex].months[MonthNameIndex].days.push({
daysInfo: {
dayName: dayName
},
events: [event]
})
} else {
year[YearIndex].months[MonthNameIndex].days[DayNameIndex].events.push(event)
}
}
CanPush(event: any, selectedDate: Date) {
return new Date(event.start).getMonth() == selectedDate.getMonth() &&
new Date(event.start).getFullYear() == selectedDate.getFullYear() &&
new Date(event.start).getDate() >= selectedDate.getDate()
const limite = this.endOfMonth(selectedDate)
limite.setDate(limite.getDate() + 10)
limite.setHours(0)
selectedDate.setHours(0);
selectedDate.setMinutes(0);
selectedDate.setSeconds(0);
return (selectedDate.getTime() <= new Date(event.start).getTime() || selectedDate.getTime() <= new Date(event.end).getTime()) &&
(limite.getTime() >= new Date(event.start).getTime() || limite.getTime() >= new Date(event.end).getTime())
}
encapsulation(eventsList:EventListStore[]): CustomCalendarEvent[] {
@@ -173,7 +277,7 @@ export class ListBoxService {
let events: CustomCalendarEvent[] = [];
eventsList.forEach((element, eventIndex) => {
events.push({
start: new Date(element.startTime),
end: new Date(element.endTime),
@@ -209,4 +313,97 @@ export class ListBoxService {
})
}
transformObjectKeyOrder(originalObject, keyOrder) {
const transformedObject = {};
for (const key of keyOrder) {
if (originalObject.hasOwnProperty(key)) {
transformedObject[key] = originalObject[key];
}
}
// Include any remaining keys not in the specified order
for (const key in originalObject) {
if (!keyOrder.includes(key) && originalObject.hasOwnProperty(key)) {
transformedObject[key] = originalObject[key];
}
}
return transformedObject;
}
endOfMonth(myDate){
let date = new Date(myDate);
date.setDate(1); // Avoids edge cases on the 31st day of some months
date.setMonth(date.getMonth() +1);
date.setDate(0);
date.setHours(23);
date.setMinutes(59);
date.setSeconds(59);
return date;
}
}
interface DayInfo {
// Define properties for dayInfo here
dayName: string
}
interface Day {
// Define properties for day here
}
interface Month {
monthInfo: {
monthName: string
// Define properties for yearInfo inside months here
}
days: {
daysInfo: DayInfo;
events: Day[];
}[]
}
interface Year {
yearInfo: {
yearName: string
// Define properties for yearInfo here
};
months: Month[];
}
const years: Year[] = [
{
yearInfo: {
yearName: ""
// Define properties for yearInfo inside the first year here
},
months: [
{
monthInfo: {
monthName: "",
// Define properties for yearInfo inside the first month here
},
days: [
{
daysInfo: {
dayName: "",
// Define properties for dayInfo inside the first day here
},
events: [
{
// Define properties for the first day here
},
],
}
],
},
// Add more months here as needed
],
},
// Add more years here as needed
];
+2
View File
@@ -319,6 +319,8 @@ export class MessageService {
if(params?.attachments) {
if(params?.attachments[0]?.image_url) {
delete params?.attachments[0]?.image_url
delete params?.file?.image_url
// delete
}
}
@@ -0,0 +1,8 @@
import { InputFilterDirective } from './input-filter.directive';
describe('InputFilterDirective', () => {
it('should create an instance', () => {
const directive = new InputFilterDirective();
expect(directive).toBeTruthy();
});
});
@@ -0,0 +1,31 @@
import { Directive, ElementRef, HostListener, Input, SecurityContext } from '@angular/core';
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
@Directive({
selector: '[appInputFilter]'
})
export class InputFilterDirective {
@Input() isAlphaNumeric: boolean;
constructor(private el: ElementRef, private sanitizer: DomSanitizer) {}
removeTags(inputValue) {
const div = document.createElement("div");
div.innerHTML = inputValue;
var text = div.textContent || div.innerText || "";
return text
}
filter(inputValue) {
this.el.nativeElement.value = this.removeTags(inputValue)
}
@HostListener('keypress', ['$event']) onInput(event: any): void {
const inputValue: string = event.target.value;
// Notify the subject when the input changes
this.filter(inputValue);
}
}
@@ -21,22 +21,22 @@ export class AttendeesPageModal implements OnInit {
eventPersons: EventPerson[];
adding: "intervenient" | "CC";
currentPath = window.location.pathname;
taskParticipants:EventPerson[] = [];
taskParticipantsCc:EventPerson[] = [];
loggeduser: LoginUserRespose;
@Input() loggedAttendSon: boolean;
taskType: any;
constructor(
private modalCtrl: ModalController,
private modalCtrl: ModalController,
private contactsService: ContactsService,
private navParams: NavParams,
private modalController: ModalController,
public ThemeService: ThemeService,
private router: Router,) {
this.adding = this.navParams.get('adding');
this.taskParticipants = this.navParams.get('taskParticipants');
this.taskParticipantsCc = this.navParams.get('taskParticipantsCc');
@@ -48,7 +48,7 @@ export class AttendeesPageModal implements OnInit {
ngOnInit() {
console.log('Pesquisa de contactos current path2',this.router.url)
this.fetchContacts("");
if(this.taskParticipants == null || this.taskParticipants == undefined){
this.taskParticipants = [];
}
@@ -56,9 +56,9 @@ export class AttendeesPageModal implements OnInit {
if(this.taskParticipantsCc == null || this.taskParticipantsCc == undefined){
this.taskParticipantsCc = [];
}
}
ngOnChanges(event) {}
save(){
@@ -80,16 +80,16 @@ export class AttendeesPageModal implements OnInit {
filterSearchList(itm: EventPerson): boolean {
const result = this.taskParticipants.concat( this.taskParticipantsCc).find((contact, index)=>{
if(contact.Name.toLocaleLowerCase() == itm.Name.toLocaleLowerCase() && contact.EmailAddress.toLocaleLowerCase() == itm.EmailAddress.toLocaleLowerCase()){
index = index;
return contact;
}
})
return undefined == result;
}
remove(itm: EventPerson){
@@ -102,7 +102,7 @@ export class AttendeesPageModal implements OnInit {
return contact;
}
return false;
});
} else if (this.adding == "CC") {
@@ -113,7 +113,7 @@ export class AttendeesPageModal implements OnInit {
return contact;
}
return false;
});
}
@@ -123,7 +123,7 @@ export class AttendeesPageModal implements OnInit {
if(this.adding == "intervenient"){
itm.IsRequired = true;
this.taskParticipants.push(itm);
} else if (this.adding == "CC") {
itm.IsRequired = false;
this.taskParticipantsCc.push(itm);
@@ -141,7 +141,7 @@ export class AttendeesPageModal implements OnInit {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
@@ -151,12 +151,12 @@ export class AttendeesPageModal implements OnInit {
this.showLoader = false;
} else {
this.contacts = result;
console.log('Attendes Email',this.loggeduser.Email)
// console.log('Attendes Email',this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase())
console.log('Attendes Email', filterLoggedUserEmail)
// console.log('Attendes Email', filterLoggedUserEmail)
let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
this.contacts = filterEmptyEmail;
console.log('Attendes Email', this.contacts)
// console.log('Attendes Email', this.contacts)
this.showLoader = false;
}
@@ -164,4 +164,4 @@ export class AttendeesPageModal implements OnInit {
);
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ export class FileLoaderService {
// input.onchange = () => {
// // you can use this method to get file and perform respective operations
// let files = Array.from(input.files);
//
//
// };
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { FileValidatorService } from './file-validator.service';
describe('FileValidatorService', () => {
let service: FileValidatorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(FileValidatorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,173 @@
import { Injectable } from '@angular/core';
import { Either, error, ok} from "src/app/services/Either"
import * as Sentry from '@sentry/capacitor';
@Injectable({
providedIn: 'root'
})
export class FileValidatorService {
forbiddenExtensions = [
".exe",
".bat",
".sh",
".jar",
".js",
".vbs",
".ps1",
".ini",
".config",
".zip",
".rar",
".tar.gz",
".7z",
".cab",
".sql",
".bak",
".htaccess",
".htpasswd",
".scr",
".pif",
".com",
".msi",
".dll",
".sys",
".ini",
".docm",
".xlsm",
".pptm",
".rtf",
".so",
".dylib",
".dat",
".log",
".conf",
".php",
".py",
".rb",
];
constructor() { }
private base64ToBlob(base64) {
const binaryData = atob(base64);
const arrayBuffer = new ArrayBuffer(binaryData.length);
const view = new Uint8Array(arrayBuffer);
for (let i = 0; i < binaryData.length; i++) {
view[i] = binaryData.charCodeAt(i);
}
return new Blob([arrayBuffer], { type: 'video/mp4' }); // Adjust the type as per your video format
}
ValidateImage(base64Image: string): Promise<Either<true, Event>> {
const imageDiv: HTMLImageElement = document.createElement("img")
return new Promise((resolve, reject) => {
imageDiv.onload = () => {
resolve(ok(true))
}
imageDiv.onerror = (e: Event) => {
resolve(error(e))
Sentry.captureMessage('FileValidatorService invalid image content');
}
imageDiv.src = base64Image
})
}
ValidateVideoFromBase64Data(base64Data: string) : Promise<Either<true, false>> {
const blob = this.base64ToBlob(base64Data);
return new Promise((resolve, reject) => {
const videoElement = document.createElement('video');
videoElement.src = URL.createObjectURL(blob);
// Add event listeners to handle video load and error
videoElement.addEventListener('loadeddata', () => {
resolve(ok(true))
// You can also perform additional validation checks here if needed.
});
videoElement.addEventListener('error', () => {
resolve(ok(true))
Sentry.captureMessage('FileValidatorService invalid video content');
});
})
}
ValidateVideoFromBlob(blob: Blob) : Promise<Either<true, false>> {
return new Promise((resolve, reject) => {
const videoElement = document.createElement('video');
videoElement.src = URL.createObjectURL(blob);
// Add event listeners to handle video load and error
videoElement.addEventListener('loadeddata', () => {
resolve(ok(true))
// You can also perform additional validation checks here if needed.
});
videoElement.addEventListener('error', () => {
resolve(ok(true))
Sentry.captureMessage('FileValidatorService invalid video content');
});
})
}
validateAudioFromBlob(blob: Blob): Promise<Either<true, false>> {
return new Promise((resolve, reject) => {
const audioElement = new Audio();
// Add event listeners to handle audio load and error
audioElement.addEventListener('canplaythrough', () => {
console.log('Valid audio');
resolve(ok(true))
// You can also perform additional validation checks here if needed.
});
audioElement.addEventListener('error', () => {
console.log('Invalid audio');
resolve(error(false))
});
audioElement.src = URL.createObjectURL(blob);
})
}
hasDuplicateExtension(filename): Either<true, false> {
// Use a regular expression to match multiple consecutive dots
const duplicateExtensionRegex = /\.\.+/;
const a = duplicateExtensionRegex.test(filename);
if(a) {
return ok(true)
} else {
Sentry.captureMessage('FileValidatorService invalid filename '+ filename);
return error(false)
}
}
fileNameValidation(fileName): Either<true, false> {
const fileExtension = fileName.slice(((fileName.lastIndexOf(".") - 1) >>> 0) + 2);
const found = this.forbiddenExtensions.includes(`.${fileExtension.toLowerCase()}`);
if(found) {
return error(false)
} else {
return ok(true)
}
}
}
@@ -91,7 +91,7 @@ export class HttpErrorHandle {
validationMessagge(service: string, callback?: any) {
switch (service) {
case 'diplomaAsDraft':
this.toastService._badRequest('Este diploma não contem um draft para ser assinado!')
this.toastService._badRequest('Este diploma não contem um rascunho para ser assinado!')
break;
case 'filetype':
this.toastService._badRequest('Formato de ficheiro inválido!')
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { HttpServiceService } from './http-service.service';
describe('HttpServiceService', () => {
let service: HttpServiceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HttpServiceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,43 @@
import { HttpClient, HttpContext, HttpHeaders, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
// import { Result, err, ok } from 'neverthrow'
import { tap, shareReplay, catchError } from "rxjs/operators";
import { Observable, of } from "rxjs";
@Injectable({
providedIn: 'root'
})
export class HttpServiceService {
constructor(private http: HttpClient) {}
put(url: string, body: any | null, options: Options): Observable<any> {
return this.http.put(url, body, options as any).pipe(
tap((response) => {
// Handle success response if needed
}),
catchError((error) => {
// Handle error response if needed
return of(error);
})
);
}
}
interface Options {
headers?: HttpHeaders | {
[header: string]: string | string[];
};
context?: HttpContext;
observe?: 'body';
params?: HttpParams | {
[param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
};
reportProgress?: boolean;
responseType?: 'arraybuffer';
withCredentials?: boolean;
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { TokenInterceptorService } from './token-interceptor.service';
describe('TokenInterceptorService', () => {
let service: TokenInterceptorService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(TokenInterceptorService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,81 @@
import { Injectable } from "@angular/core";
import {
HttpRequest,
HttpHandler,
HttpEvent,
HttpInterceptor,
HttpErrorResponse,
HTTP_INTERCEPTORS,
} from "@angular/common/http";
import { Observable, throwError, BehaviorSubject } from "rxjs";
import { catchError, filter, take, switchMap } from "rxjs/operators";
import { SessionStore } from "src/app/store/session.service";
import { MiddlewareRepositoryService } from "src/app/repository/middleWare/middleware-repository.service"
@Injectable({
providedIn: 'root'
})
export class TokenInterceptorService {
private isRefreshing = false;
private refreshTokenSubject: BehaviorSubject<any> = new BehaviorSubject<any>(
null
);
constructor(private middlewareRepositoryService: MiddlewareRepositoryService) {
this.middlewareRepositoryService = middlewareRepositoryService
}
intercept(
request: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
if (SessionStore.user.Authorization) {
request = this.addToken(request, SessionStore.user.Authorization);
}
return next.handle(request).pipe(
catchError((error) => {
if (error instanceof HttpErrorResponse && error.status === 401) {
return this.handle401Error(request, next);
} else {
return throwError(error);
}
})
) as any
}
private addToken(request: HttpRequest<any>, token: string) {
return request.clone({
setHeaders: {
Authorization: `Bearer ${token}`,
},
});
}
private handle401Error(request: HttpRequest<any>, next: HttpHandler) {
if (!this.isRefreshing) {
this.isRefreshing = true;
this.refreshTokenSubject.next(null);
return this.middlewareRepositoryService.refreshToken().pipe(
switchMap((token: any) => {
this.isRefreshing = false;
this.refreshTokenSubject.next(token['result'].accessToken);
return next.handle(this.addToken(request, token['result'].accessToken));
})
);
} else {
return this.refreshTokenSubject.pipe(
filter((token) => token != null),
take(1),
switchMap((jwt) => {
return next.handle(this.addToken(request, jwt));
})
);
}
}
}
+15 -10
View File
@@ -239,17 +239,22 @@ export class NotificationsService {
}
);
} else {
navigator.serviceWorker.onmessage = (event) => {
console.log('Mensagem recebida do Service Worker:', event.data.data);
let object = {
notification: event.data
}
try {
if (event.data.notificationClicked) {
console.log('Notificação push do Firebase clicada em segundo plano!');
this.notificatinsRoutes(object)
}
};
navigator.serviceWorker.onmessage = (event) => {
console.log('Mensagem recebida do Service Worker:', event.data.data);
let object = {
notification: event.data
}
if (event.data.notificationClicked) {
console.log('Notificação push do Firebase clicada em segundo plano!');
this.notificatinsRoutes(object)
}
};
} catch(e) {
console.log(e)
}
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ChunkService } from './chunk.service';
describe('ChunkService', () => {
let service: ChunkService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ChunkService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+140
View File
@@ -0,0 +1,140 @@
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class ChunkService {
constructor() {
window["ChunkService"] = this
// const a = this.generateChunkFile({} as any, {} as any)
}
generateChunkFile(base64: string, chunkSizeInBytes: number): File[] {
const byteCharacters = atob(base64); // Decode base64 data to binary
const chunks: File[] = [];
let start = 0;
function createChunk(): File {
const chunkSize = Math.min(chunkSizeInBytes, byteCharacters.length - start);
const chunkData = byteCharacters.slice(start, start + chunkSize);
start += chunkSize;
// console.log({chunkData})
const chunkArray = new Uint8Array(chunkData.length);
for (let i = 0; i < chunkData.length; i++) {
chunkArray[i] = chunkData.charCodeAt(i);
// console.log('chunkData.charCodeAt', chunkData.charCodeAt(i))
}
// console.log({Uint8Array:"Uint8Array", chunkArray})
const blob = new Blob([chunkArray]);
// console.log('blob')
// console.log('File')
return new File([blob], `chunk_${chunks.length + 1}`);
}
while (start < byteCharacters.length) {
chunks.push(createChunk());
}
return chunks;
}
generateChunkOfUint8Array(base64: string, chunkSizeInBytes: number): Uint8Array[] {
const byteCharacters = atob(base64); // Decode base64 data to binary
const chunks: Uint8Array[] = [];
let start = 0;
function createChunk(): Uint8Array {
const chunkSize = Math.min(chunkSizeInBytes, byteCharacters.length - start);
const chunkData = byteCharacters.slice(start, start + chunkSize);
start += chunkSize;
const chunkArray = new Uint8Array(chunkData.length);
for (let i = 0; i < chunkData.length; i++) {
chunkArray[i] = chunkData.charCodeAt(i);
}
return chunkArray;
}
while (start < byteCharacters.length) {
chunks.push(createChunk());
}
return chunks;
}
async uploadChunk(file: File): Promise<any> {
// Read and upload the file in chunks (as you've previously implemented)
const chunkSize = 1024 * 500; // Adjust the chunk size as needed
const chunks = [];
let offset = 0;
let i = 0
while (offset < file.size) {
console.log(offset)
const chunk = file.slice(offset, offset + chunkSize);
const reader = new FileReader();
reader.onload = () => {
chunks[i] = new Uint8Array(reader.result as ArrayBuffer)
};
reader.readAsArrayBuffer(chunk);
offset += chunkSize;
}
return chunks
}
onFileSelect(event: any, chunkSizeInBytes):Promise<Blob[]> {
const file:File = event.target.files[0];
const filename = file.name;
//const chunkSize = 1024 * 1024; // 1 MB chunks (adjust as needed)
const chunkSize = chunkSizeInBytes
return new Promise((resolve, reject) => {
// Read and upload chunks
const fileReader = new FileReader();
fileReader.onload = (e) => {
const arrayBuffer = e.target.result as ArrayBuffer;
const blob = new Blob([new Uint8Array(arrayBuffer)]);
const totalChunks = Math.ceil(file.size / chunkSize);
const chunks: Blob[] = []
for (let i = 1; i <= totalChunks; i++) {
const start = (i - 1) * chunkSize;
const end = i * chunkSize;
const chunk = blob.slice(start, end);
chunks.push(chunk)
}
resolve(chunks)
};
fileReader.readAsArrayBuffer(file);
})
}
generateChunkFromBase64(base64: string, chunkSizeInBytes: number) {
const byteCharacters = atob(base64); // Decode base64 data to binary
const chunkArray = [];
for (let offset = 0; offset < byteCharacters.length; offset += chunkSizeInBytes) {
const chunkData = byteCharacters.slice(offset, offset + chunkSizeInBytes);
chunkArray.push(chunkData);
}
return chunkArray;
}
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { StreamService } from './stream.service';
describe('StreamService', () => {
let service: StreamService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(StreamService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+112
View File
@@ -0,0 +1,112 @@
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class StreamService {
constructor(
private http: HttpClient,
) {
window["StreamService"] = this
}
async uploadFile() {
const API_URL = 'http://localhost:3000/upload'; // Replace with your server URL
const filePath = 'path/to/large-file.zip'; // Replace with the path to your file
const fileName = 'my-file'; // Specify your desired filename
const fileExtension = 'zip'; // Specify the file extension
const headers = new HttpHeaders()
.append('X-File-Name', fileName)
.append('X-File-Extension', fileExtension);
const file = await this.readFileInChunks(filePath);
const chunkSize = 1024 * 1024; // 1 MB chunk size (adjust as needed)
for (let offset = 0; offset < file.length; offset += chunkSize) {
const chunk = file.slice(offset, offset + chunkSize);
// await this.uploadChunk(API_URL, chunk, headers);
}
console.log('Upload completed.');
}
async readFileInChunks(filePath: string): Promise<Uint8Array> {
const response = await fetch(filePath);
const reader = response.body.getReader();
const chunks: Uint8Array[] = [];
let done = false;
while (!done) {
const { value, done: isDone } = await reader.read();
if (!isDone) {
chunks.push(value);
}
done = isDone;
}
return new Uint8Array([].concat(...chunks.map((chunk) => Array.from(chunk))));
}
async uploadChunk(url: string, chunks: Uint8Array[], fileName, fileExtension): Promise<void> {
let i = 1
console.log('123', chunks.length)
for(const chunk of chunks) {
try {
console.log("iterate")
const headers = new HttpHeaders()
.append('X-File-Name', fileName)
.append('X-File-Extension', fileExtension)
.append('X-File-Content-Length', chunks.length.toString())
.append('X-File-Index', i.toString())
await this.http.post('http://localhost:3001/upload', chunk.buffer, { headers, responseType: 'blob' }).toPromise();
i++
} catch (error) {
console.error('Upload error:', error);
}
}
}
async uploadChunkNoLoop(url: string, chunk: Uint8Array, fileName, fileExtension, i, length): Promise<void> {
console.log("iterate")
const headers = new HttpHeaders()
.append('X-File-Name', fileName)
.append('X-File-Extension', fileExtension)
.append('X-File-Content-Length', length)
.append('X-File-Index', i.toString())
await this.http.post('http://localhost:3001/upload', chunk.buffer, { headers, responseType: 'blob' }).toPromise();
}
uploadChunk1(chunk: Blob, chunkNumber: number, totalChunks: number, filename: string) {
console.log(chunk)
const headers = new HttpHeaders()
.append('X-File-Name', filename)
.append('X-File-Content-Length', totalChunks.toString())
.append('X-File-Index', chunkNumber.toString())
return this.http.post('http://localhost:3001/upload-chunk', Blob, { headers, responseType: 'blob' });
}
}
// const text = 'Hello, World00120301010asdf1002sdf 0fsdfasf0001230 12300!\n';
// const base64 = btoa(text);
// let chunks = window["ChunkService"].generateChunkOfUint8Array(base64, 8)
// window.StreamService.uploadChunk("", chunks, "peter12", "txt")
+5
View File
@@ -0,0 +1,5 @@
export interface refreshToken {
Authorization: string,
refreshToken: null
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { MiddlewareServiceService } from './middleware-service.service';
describe('MiddlewareServiceService', () => {
let service: MiddlewareServiceService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(MiddlewareServiceService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,23 @@
import { Injectable } from '@angular/core';
import { environment } from 'src/environments/environment';
import { HttpServiceService } from 'src/app/services/http/http-service.service';
import { Observable } from "rxjs";
import { refreshToken } from "./interface"
@Injectable({
providedIn: 'root'
})
export class MiddlewareServiceService {
constructor(
private HttpServiceService: HttpServiceService,
) {}
refreshToken(refreshToken: string): Observable<refreshToken> {
const data = {
refreshToken: refreshToken
}
return this.HttpServiceService.put(environment.apiURL + "UserAuthentication/RefreshToken", data, {})
}
}
@@ -15,6 +15,7 @@ import { removeDuplicate } from 'src/plugin/removeDuplicate.js'
import { EventToApproveEdit } from 'src/app/models/event.model';
import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -131,7 +132,8 @@ export class EditEventToApprovePage implements OnInit {
private processes:ProcessesService,
private toastService: ToastService,
public ThemeService: ThemeService,
public httpErrorHandler: HttpErrorHandle
public httpErrorHandler: HttpErrorHandle,
private domSanitizeService: DomSanitizerService
) {
this.isEventEdited = false;
}
@@ -324,6 +326,10 @@ export class EditEventToApprovePage implements OnInit {
e.IsRequired = false
})
this.eventProcess.workflowInstanceDataFields.Subject = /* this.domSanitizeService.sanitizeInput( */this.eventProcess.workflowInstanceDataFields.Subject/* ) */;
this.eventProcess.workflowInstanceDataFields.Location = /* this.domSanitizeService.sanitizeInput( */this.eventProcess.workflowInstanceDataFields.Location/* ) */;
this.eventProcess.workflowInstanceDataFields.Body = /* this.domSanitizeService.sanitizeInput( */this.eventProcess.workflowInstanceDataFields.Body/* ) */;
this.eventProcess.workflowInstanceDataFields.ParticipantsList = this.taskParticipants.concat(this.taskParticipantsCc)
this.eventProcess.workflowInstanceDataFields.ParticipantsList.forEach(e=>{
@@ -15,6 +15,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
import { ContactsService } from 'src/app/services/contacts.service'
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
@Component({
selector: 'app-edit-event',
@@ -100,7 +101,8 @@ export class EditEventPage implements OnInit {
private attachmentsService: AttachmentsService,
public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle,
private contactsService: ContactsService
private contactsService: ContactsService,
private domSanitizeService: DomSanitizerService
) {}
ngOnInit() {
@@ -344,6 +346,9 @@ export class EditEventPage implements OnInit {
}
this._postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this._postEvent.Subject = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Subject/* ) */;
this._postEvent.Location = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Location/* ) */;
this._postEvent.Body.Text = /* this.domSanitizeService.sanitizeInput( */this._postEvent.Body.Text/* ) */;
if(!this._postEvent.EventRecurrence.hasOwnProperty('Type')) {
this._postEvent.EventRecurrence.Type = '-1'
@@ -14,9 +14,9 @@ import { MatInputModule } from '@angular/material/input';
import { MatNativeDateModule } from '@angular/material/core';
import {
NgxMatDatetimePickerModule,
NgxMatNativeDateModule,
NgxMatTimepickerModule
NgxMatDatetimePickerModule,
NgxMatNativeDateModule,
NgxMatTimepickerModule
} from '@angular-material-components/datetime-picker';
import { ReactiveFormsModule } from '@angular/forms';
@@ -24,13 +24,14 @@ import { MatButtonModule } from '@angular/material/button';
import { MatSelectModule } from '@angular/material/select';
import { NgxMatMomentModule } from '@angular-material-components/moment-adapter';
import {
import {
MAT_MOMENT_DATE_FORMATS,
MomentDateAdapter,
MAT_MOMENT_DATE_ADAPTER_OPTIONS
} from '@angular/material-moment-adapter';
import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from '@angular/material/core';
import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/attendee-modal.module';
import { InputFilterDirective } from 'src/app/services/directives/input-filter.directive';
@NgModule({
@@ -47,7 +48,7 @@ import { AttendeeModalPageModule } from 'src/app/shared/event/attendee-modal/att
NgxMatDatetimePickerModule,
NgxMatTimepickerModule,
NgxMatNativeDateModule,
//
//
NgxMatMomentModule,
// BrowserAnimationsModule,
@@ -22,14 +22,14 @@
<div *ngIf="Form && validateFrom" >
<div *ngIf="Form.get('Subject').invalid " class="input-errror-message">
<div *ngIf="Form.get('Subject').errors?.required">
</div>
<div *ngIf="Form.get('Subject').errors?.minlength">
O campo deve ter pelo menos 4 caracteres.
</div>
</div>
</div>
<div class="container-div" (click)="changeAgenda()">
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
@@ -44,7 +44,7 @@
<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>
<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>
@@ -138,7 +138,7 @@
[disabled]="disabled"
>
<mat-datepicker-toggle id="new-inicio" matSuffix [for]="picker1" ></mat-datepicker-toggle>
<ngx-mat-datetime-picker #picker1
<ngx-mat-datetime-picker #picker1
[showSpinners]="showSpinners"
[showSeconds]="showSeconds"
[stepHour]="stepHour" [stepMinute]="stepMinute"
@@ -329,10 +329,10 @@
</ion-item>
</ion-list>
</div>
</div>
@@ -343,7 +343,7 @@
</ion-content>
<ion-footer class="ion-no-border">
<ion-toolbar class="footer-toolbar">
<ion-buttons slot="start">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Gravar</ion-label>
@@ -355,7 +355,7 @@
<ion-label>Cancelar</ion-label>
</button>
</ion-buttons>
<!-- <app-new-event
[loggedAttend]="loggedAttend"
@@ -34,6 +34,8 @@ import { ProcessesService } from 'src/app/services/processes.service';
import { Subject } from 'rxjs';
import { TaskService } from 'src/app/services/task.service'
import { ContactsService } from 'src/app/services/contacts.service';
import { DomSanitizerService } from 'src/app/services/DomSanitizer.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: {
dateInput: "YYYY-MMMM-DD HH:mm"
@@ -131,6 +133,8 @@ export class NewEventPage implements OnInit {
CalendarNamesOptions = ['Oficial', 'Pessoal']
environment = environment
eventPersons: EventPerson[];
contacts: EventPerson[] = [];
constructor(
private modalController: ModalController,
@@ -142,7 +146,9 @@ export class NewEventPage implements OnInit {
private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle,
private processeService: ProcessesService,
public TaskService: TaskService
public TaskService: TaskService,
private contactsService: ContactsService,
private domSanitazerService: DomSanitizerService
) {
this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user;
@@ -220,6 +226,7 @@ export class NewEventPage implements OnInit {
}
})
}
console.log('Attendes',this.taskParticipants)
this.taskParticipants = removeDuplicate(this.taskParticipants);
this.taskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
@@ -234,6 +241,7 @@ export class NewEventPage implements OnInit {
this.injectValidation();
this.changeAgenda()
this.fetchContacts("")
}
@@ -497,6 +505,10 @@ export class NewEventPage implements OnInit {
}
this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc);
this.postEvent.Subject = this.domSanitazerService.sanitizeInput(this.postEvent.Subject);
this.postEvent.Location = this.domSanitazerService.sanitizeInput(this.postEvent.Location);
this.postEvent.Body.Text = this.domSanitazerService.sanitizeInput(this.postEvent.Body.Text);
if (this.documents.length > 0) {
@@ -987,5 +999,34 @@ export class NewEventPage implements OnInit {
return toAproveObject;
}
async fetchContacts(filter: string) {
if (this.loggeduser.Profile == 'PR') {
this.contactsService.getContacts(filter).subscribe(result => {
if (this.eventPersons != null) {
this.eventPersons.forEach(attendee => {
const index: number = result.findIndex((cont) => {
return cont.EmailAddress.toLocaleLowerCase() == attendee.EmailAddress.toLocaleLowerCase()
});
result.splice(index, 1);
});
}
this.contacts = result;
console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.RoleDescription == "Ministro e Director do Gabinete do PR")
console.log('Attendes Email', filterLoggedUserEmail)
this.contacts = filterLoggedUserEmail;
this.taskParticipants.push(this.contacts[0]);
this.setIntervenient.emit(this.taskParticipants);
console.log('Attendes Email', this.taskParticipants)
}
);
}
}
}
@@ -31,7 +31,7 @@
<!-- <div class="div-icon" (click)="openOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'doneIt' " src="assets/images/theme/{{ThemeService.currentTheme}}/icons-menu.svg"></ion-icon>
</div>
@@ -130,7 +130,7 @@
</div>
<!-- <div (click)="docIndex(i);LoadDocumentDetails()" class="doc-options">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' "
src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</div> -->
@@ -8,7 +8,7 @@
<div class="right">
<!-- <div (click)=" ChatSystemService.getGroupRoom(this.roomId).deleteAll()">delete all</div> -->
<button title="Menu" class="btn-no-color" (click)="openGroupMessagesOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</button>
</div>
@@ -29,6 +29,7 @@ import { FileOpener } from '@awesome-cordova-plugins/file-opener/ngx';
import { SessionStore } from 'src/app/store/session.service';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { PermissionService } from 'src/app/services/permission.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
@Component({
selector: 'app-group-messages',
@@ -105,6 +106,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
private platform: Platform,
private fileOpener: FileOpener,
public p: PermissionService,
private FileValidatorService: FileValidatorService
) {
this.ChatSystemService.getUser()
@@ -901,9 +903,11 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
const file: any = await this.fileService.getFileFromDevice(types);
const fileName = file.name
const validation = this.FileValidatorService.fileNameValidation(fileName)
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
if(validation.isOk) {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch ((error) => {
console.error(error);
@@ -946,9 +950,8 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
fileBase64: fileBase64,
}
})
} else {
this.toastService._badRequest("Ficheiro inválido")
}
@@ -9,7 +9,7 @@
</div>
<div hidden class="right">
<button title="Menu" class="btn-no-color" (click)="_openMessagesOptions()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg">
</ion-icon>
</button>
+98 -85
View File
@@ -33,6 +33,7 @@ import { Howl } from 'howler';
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { ChatMessageDebuggingPage } from 'src/app/shared/popover/chat-message-debugging/chat-message-debugging.page';
import { PermissionService } from 'src/app/services/permission.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
const IMAGE_DIR = 'stored-images';
@@ -100,7 +101,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
roomName: any;
isAdmin = false;
roomCountDownDate: string;
constructor(
public popoverController: PopoverController,
@@ -122,6 +123,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
private platform: Platform,
private fileOpener: FileOpener,
public p: PermissionService,
private FileValidatorService: FileValidatorService
) {
// update
this.checkAudioPermission()
@@ -172,8 +174,8 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
this.audioPermissionStatus = permissionStatus.state
permissionStatus.onchange = (data: any) => {
//
//
//
//
}
}
@@ -510,7 +512,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
}
getChatMembers() {
//
//
// this.showLoader = true;
// this.chatService.getMembers(this.roomId).subscribe(res => {
@@ -648,7 +650,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
resultType: CameraResultType.Base64,
source: CameraSource.Camera
});
console.log('Selected: ', file)
var base64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
base64,
@@ -656,7 +658,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
base64 = picture
});
@@ -788,42 +790,46 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
//const imageData = await this.fileToBase64Service.convert(file)
//
console.log('Selected: ', file)
var base64 = 'data:image/jpeg;base64,' + file.base64String
const compressedImage = await this.compressImageBase64(
base64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
base64 = picture
});
if (file.format == "jpeg" || file.format == "png" || file.format == "gif") {
const response = await fetch(base64);
const blob = await response.blob();
const compressedImage = await this.compressImageBase64(
base64,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log(base64)
base64 = picture
});
const formData = new FormData();
formData.append("blobFile", blob);
const response = await fetch(base64);
const blob = await response.blob();
console.log(base64)
const formData = new FormData();
formData.append("blobFile", blob);
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.path,
//"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: base64,
}
})
}
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": "application/img",
"guid": ''
},
temporaryData: formData,
attachments: [{
"title": file.path,
//"image_url": 'data:image/jpeg;base64,' + file.base64String,
"text": "description",
"title_link_download": false,
}],
attachmentsModelData: {
fileBase64: base64,
}
})
}
@@ -835,63 +841,70 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
const roomId = this.roomId
const file: any = await this.fileService.getFileFromDevice(types);
console.log(file.type)
if (file.type == 'application/pdf' || file.type == 'application/doc' || file.type == 'application/docx' ||
file.type == 'application/xls' || file.type == 'application/xlsx' || file.type == 'application/ppt' ||
file.type == 'application/pptx' || file.type == 'application/txt') {
console.log('FILE', file)
const fileName = file.name
const validation = this.FileValidatorService.fileNameValidation(fileName)
if (validation.isOk) {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
let blob;
let formData
let fileBase64
if (this.platform.is("tablet")) {
blob = this.fileService.base64toBlob(encodedData, file.type)
console.log('BLOB BLOB', blob)
formData = new FormData();
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
} else {
blob = this.fileService.base64toBlob(encodedData, file.type)
fileBase64 = await this._getBase64(file)
formData = new FormData();
formData.append('blobFile', blob);
}
if (file.type != "application/img" && file.type != "image/png" && file.type != "image/jpeg" && file.type != "image/gif") {
const encodedData = btoa(JSON.stringify(await this.getBase64(file).catch((error) => {
console.error(error);
})));
let blob;
let formData
let fileBase64
if (this.platform.is("tablet")) {
blob = this.fileService.base64toBlob(encodedData, file.type)
console.log('BLOB BLOB', blob)
formData = new FormData();
formData.append('blobFile', blob);
/* console.log('add file', fileBase64) */
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
//"image_url": res,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: fileBase64,
}
})
} else {
blob = this.fileService.base64toBlob(encodedData, file.type)
fileBase64 = await this._getBase64(file)
formData = new FormData();
formData.append('blobFile', blob);
this.toastService._badRequest("Ficheiro inválido")
}
this.ChatSystemService.getDmRoom(roomId).send({
file: {
"type": file.type,
"guid": '',
},
attachments: [{
"title": file.name,
"name": file.name,
//"image_url": res,
// "text": "description",
"title_link_download": false,
}],
temporaryData: formData,
attachmentsModelData: {
fileBase64: fileBase64,
}
})
} else {
}
}
_getBase64(file) {
@@ -59,7 +59,7 @@ export class AttendeePage implements OnInit {
this.LtaskParticipants = removeDuplicate(this.taskParticipants);
this.LtaskParticipantsCc = removeDuplicate(this.taskParticipantsCc);
this.loggeduser = SessionStore.user;
}
ngOnChanges() {
@@ -137,7 +137,7 @@ export class AttendeePage implements OnInit {
itm.IsRequired = false;
this.LtaskParticipantsCc.push(itm);
} else {
//
//
}
// run only in gabinete digital
@@ -247,15 +247,15 @@ export class AttendeePage implements OnInit {
this.showLoader = false;
} else {
this.contacts = this.sort(result as any);
console.log('Attendes Email', this.loggeduser.Email)
// console.log('Attendes Email', this.loggeduser.Email)
let filterLoggedUserEmail = this.contacts.filter(item => item.EmailAddress.toLocaleLowerCase() != this.loggeduser.Email.toLocaleLowerCase())
if(this.taskType == 0 || this.taskType == 1){
filterLoggedUserEmail = this.contacts.filter(item => item.IsPR == false)
}
console.log('Attendes Email', filterLoggedUserEmail)
// console.log('Attendes Email', filterLoggedUserEmail)
let filterEmptyEmail = filterLoggedUserEmail.filter(item => item.EmailAddress.toLocaleLowerCase() != "")
this.contacts = filterEmptyEmail;
console.log('Attendes Email', this.contacts)
// console.log('Attendes Email', this.contacts)
this.showLoader = false;
}
@@ -271,4 +271,4 @@ export class AttendeePage implements OnInit {
}
}
}
}
@@ -9,7 +9,7 @@
<ion-label class="title">{{ task.Folio}}</ion-label>
</div>
<div class="div-icon" (click)="openOptions.emit()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</div>
</div>
@@ -9,7 +9,7 @@
<ion-label class="title">{{ task.Folio}}</ion-label>
</div>
<div class="div-icon" (click)="openOptions.emit()">
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'default' " src="assets/images/theme/blue/icons-menu.svg"></ion-icon>
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " src="assets/images/theme/gov/icons-menu.svg"></ion-icon>
</div>
</div>
+4 -6
View File
@@ -48,15 +48,14 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
<div *ngIf="profilePicture == ''" class="profile-image">
<img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
<!-- <img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
src='assets/images/presidente.png'>
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
src='assets/images/ministro.png'>
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="profile-image"
src='assets/images/secretaria_geral.png'>
src='assets/images/secretaria_geral.png'> -->
<ion-icon
*ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' "
class="icon font-45-em" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
</div>
@@ -212,15 +211,14 @@
<ion-icon *ngIf="ThemeService.currentTheme == 'gov' " class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon> -->
<div *ngIf="profilePicture == ''" class="profile-image">
<img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
<!-- <img *ngIf="loggeduser.RoleDescription == 'Presidente da República' " class="profile-image"
src='assets/images/presidente.png'>
<img *ngIf="loggeduser.RoleDescription == 'Ministro e Director do Gabinete do PR' " class="profile-image"
src='assets/images/ministro.png'>
<img *ngIf="loggeduser.RoleDescription == 'Secretário Geral' " class="profile-image"
src='assets/images/secretaria_geral.png'>
src='assets/images/secretaria_geral.png'> -->
<ion-icon
*ngIf="loggeduser.RoleDescription != 'Presidente da República'&& loggeduser.RoleDescription != 'Ministro e Director do Gabinete do PR' && loggeduser.RoleDescription != 'Secretário Geral' "
class="icon" src='assets/images/theme/gov/icons-profile.svg'></ion-icon>
</div>
+29 -17
View File
@@ -102,26 +102,29 @@ export class HeaderPage implements OnInit {
getProfilpicture() {
this.attachmentService.getUserProfilePhoto(this.SessionStore.user.UserPhoto).subscribe((base) => {
if (this.SessionStore.user.UserPhoto) {
this.attachmentService.getUserProfilePhoto(this.SessionStore.user.UserPhoto).subscribe((base) => {
this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,' + base).then((value) => {
this.profilePicture = 'data:image/jpeg;base64,' + base;
this.storageService.store(this.SessionStore.user.RoleID.toString(), 'data:image/jpeg;base64,' + base).then((value) => {
this.profilePicture = 'data:image/jpeg;base64,' + base;
console.log('picture saved', value)
}).catch((error) => {
console.log('picture not saved')
});
}, (error) => {
console.log('profile picture errro: ', error)
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
console.log(picture)
this.profilePicture = picture
}).catch((error) => {
this.profilePicture = "";
console.log('picture saved')
}).catch((error) => {
console.log('picture not saved')
});
}, (error) => {
console.log('profile picture errro: ', error)
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
/* console.log(picture) */
this.profilePicture = picture
}).catch((error) => {
this.profilePicture = "";
})
})
})
} else {
this.profilePicture = "";
}
}
@@ -266,7 +269,7 @@ export class HeaderPage implements OnInit {
modal.onDidDismiss().then(() => {
this.notificationLengthData()
this.getProfilpicture()
this.getProfilePictureSorage()
this.showProfileModal = false
})
@@ -311,4 +314,13 @@ export class HeaderPage implements OnInit {
}
getProfilePictureSorage() {
this.storageService.get(this.SessionStore.user.RoleID.toString()).then((picture) => {
/* console.log(picture) */
this.profilePicture = picture
}).catch((error) => {
this.profilePicture = "";
})
}
}
@@ -28,7 +28,7 @@ export class DiplomaOptionsPage implements OnInit {
fulltask: any
DraftIds = ""
DraftNames = ""
asDrat: boolean;
asDraft: boolean;
constructor(
@@ -48,7 +48,7 @@ export class DiplomaOptionsPage implements OnInit {
this.DraftIds = this.navParams.get("DraftIds");
this.DraftNames = this.navParams.get("DraftNames");
this.asDrat = this.navParams.get('asDrat');
this.asDraft = this.navParams.get('asDraft');
console.log('this.task', this.task)
@@ -241,7 +241,7 @@ export class DiplomaOptionsPage implements OnInit {
async AssinarNew(note?, doc?) {
if (this.asDrat) {
if (this.asDraft) {
const modal = await this.modalController.create({
component: PopupQuestionPage,
componentProps: {
@@ -9,7 +9,7 @@
</div>
<div *ngIf="content != ''" class="buttons header-fix">
<!-- <button (click)="save(Document, content)" class="btn-cancel" shape="round" >Salvar</button> -->
<button (click)="AssinarDraft()" class="btn-cancel" shape="round" >Assinar</button>
<button *ngIf="p.userRole('PR')" (click)="AssinarDraft()" class="btn-cancel" shape="round" >Assinar</button>
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
</div>
</ion-content>
@@ -14,6 +14,7 @@ import { FilePicker } from '@capawesome/capacitor-file-picker';
import { Directory, Encoding, Filesystem } from '@capacitor/filesystem';
import { utf8Encode } from '@angular/compiler/src/util';
import { checkFileTypeService } from 'src/app/services/checkFileType.service';
import { FileValidatorService } from "src/app/services/file/file-validator.service"
@Component({
selector: 'app-new-publication',
@@ -60,7 +61,8 @@ export class NewPublicationPage implements OnInit {
public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle,
public PublicationFolderService: PublicationFolderService,
public checkFileType: checkFileTypeService
public checkFileType: checkFileTypeService,
private FileValidatorService: FileValidatorService
) {
this.publicationTitle = 'Nova Publicação';
@@ -145,6 +147,7 @@ export class NewPublicationPage implements OnInit {
this.capturedImage = 'data:image/jpeg;base64,' + capturedImage.base64String;
this.capturedImageTitle = 'foto';
/* if(validation.isOk) { */
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
@@ -157,6 +160,9 @@ export class NewPublicationPage implements OnInit {
}
this.seletedContent.push(fileObject)
});
/* } else {
this.toastService._badRequest("Imagem inválida")
} */
}
async laodPicture() {
@@ -211,6 +217,27 @@ export class NewPublicationPage implements OnInit {
});
/* this.capturedImage = 'data:image/jpeg;base64,' +capturedImage.base64String;
this.capturedImageTitle = 'foto';
const validation = await this.FileValidatorService.ValidateImage(this.capturedImage)
if(validation.isOk) {
const compressedImage = await this.compressImageBase64(
this.capturedImage,
800, // maxWidth
800, // maxHeight
0.9 // quality
).then((picture) => {
console.log('Selected: ', picture)
this.capturedImage = picture
});
} else {
this.toastService._badRequest("Imagem inválida")
} */
};
@@ -320,7 +347,6 @@ export class NewPublicationPage implements OnInit {
} */
}
else {
let time = new Date()
@@ -1,4 +1,4 @@
import { NgModule } from '@angular/core';
import { NgModule,CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
@@ -31,6 +31,7 @@ setup(attributes: Attributes) {
],
exports: [ViewPublicationsPage],
declarations: [ViewPublicationsPage],
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}]
providers: [{provide: LAZYLOAD_IMAGE_HOOKS, useClass: LazyLoadImageHooks}],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class ViewPublicationsPageModule {}
@@ -34,7 +34,7 @@
<ion-refresher-content>
</ion-refresher-content>
</ion-refresher>
<div class="main-container px-20" *ngIf="publicationFolderService.FolderDetails[foldserId]">
<div class="main-container px-20" *ngIf="publicationFolderService.FolderDetails[folderId]">
<p class="item-content-detail">{{publicationFolderService.FolderDetails[folderId].Detail}}</p>
<ion-card *ngFor="let publication of publicationFolderService.publicationList[folderId] let i = index">

Some files were not shown because too many files have changed in this diff Show More