diff --git a/.gitignore b/.gitignore index bc36db74b..34e76d797 100644 --- a/.gitignore +++ b/.gitignore @@ -97,3 +97,4 @@ src/app/pipes/process.service.ts src/app/domain _src/ -src +plugin copy diff --git a/Web.backup.config b/Web.backup.config new file mode 100644 index 000000000..81cc77a85 --- /dev/null +++ b/Web.backup.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/capacitor.config.ts b/capacitor.config.ts index cde2bab26..c41d7a974 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -1,4 +1,4 @@ -// / + // / // / diff --git a/codemagic.yaml b/codemagic.yaml index 5548710a0..3a221e315 100644 --- a/codemagic.yaml +++ b/codemagic.yaml @@ -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 \ No newline at end of file + 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 \ No newline at end of file diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 2b364ce34..581569877 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -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; diff --git a/package-lock.json b/package-lock.json index 17cb8590e..0206d79da 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index 0f93c0b98..c726aafe9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/app/app.module.ts b/src/app/app.module.ts index fc7a5413b..f0c360d09 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -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] diff --git a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts new file mode 100644 index 000000000..15fd47731 --- /dev/null +++ b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.spec.ts @@ -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(); + }); +}); diff --git a/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts new file mode 100644 index 000000000..487ac3e30 --- /dev/null +++ b/src/app/datasource/middleware/remote/middleware-remote-datasourcec.service.ts @@ -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) + } +} diff --git a/src/app/home/home-routing.module.ts b/src/app/home/home-routing.module.ts index 4724c3f8e..11b56d38d 100644 --- a/src/app/home/home-routing.module.ts +++ b/src/app/home/home-routing.module.ts @@ -413,6 +413,8 @@ const routes: Routes = [ canActivate: [InactivityGuard] }, + + { path: '**', redirectTo: '/', pathMatch: 'full' }, ]; @NgModule({ diff --git a/src/app/home/home.page.ts b/src/app/home/home.page.ts index 69b704ff5..9bf20ed0e 100644 --- a/src/app/home/home.page.ts +++ b/src/app/home/home.page.ts @@ -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; diff --git a/src/app/modals/create-process/create-process.page.html b/src/app/modals/create-process/create-process.page.html index 581196674..30ba71697 100644 --- a/src/app/modals/create-process/create-process.page.html +++ b/src/app/modals/create-process/create-process.page.html @@ -62,14 +62,14 @@
-
+
- + {{type.Description}} @@ -191,6 +191,6 @@ - +
diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index c7379a1e8..342f5ed11 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -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'); diff --git a/src/app/modals/document-detail/document-detail.page.ts b/src/app/modals/document-detail/document-detail.page.ts index 629d48c91..c8a57b312 100644 --- a/src/app/modals/document-detail/document-detail.page.ts +++ b/src/app/modals/document-detail/document-detail.page.ts @@ -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) diff --git a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html index 914fa162b..8e48ac78b 100644 --- a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html +++ b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.html @@ -331,7 +331,7 @@
-
+
{ + 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) + } + ); + } + } + } diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.html b/src/app/modals/profile/edit-profile/edit-profile.page.html index 8d88adadc..8b36f5b01 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.html +++ b/src/app/modals/profile/edit-profile/edit-profile.page.html @@ -61,16 +61,16 @@
- + - + src='assets/images/secretaria_geral.png'> -->
@@ -135,7 +135,7 @@
-
--> +
diff --git a/src/app/modals/profile/edit-profile/edit-profile.page.ts b/src/app/modals/profile/edit-profile/edit-profile.page.ts index be6f40f29..a3a46df6a 100644 --- a/src/app/modals/profile/edit-profile/edit-profile.page.ts +++ b/src/app/modals/profile/edit-profile/edit-profile.page.ts @@ -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 = ""; }) diff --git a/src/app/modals/profile/profile.page.html b/src/app/modals/profile/profile.page.html index 669d3361c..ea9778bcf 100644 --- a/src/app/modals/profile/profile.page.html +++ b/src/app/modals/profile/profile.page.html @@ -37,18 +37,18 @@
-
+
-
- +
+ - + src='assets/images/secretaria_geral.png'> -->
diff --git a/src/app/modals/profile/profile.page.ts b/src/app/modals/profile/profile.page.ts index 7d6191631..400ff9b21 100644 --- a/src/app/modals/profile/profile.page.ts +++ b/src/app/modals/profile/profile.page.ts @@ -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 = ""; }) diff --git a/src/app/modals/view-document/view-document.page.ts b/src/app/modals/view-document/view-document.page.ts index 3bb165703..9fdad3232 100644 --- a/src/app/modals/view-document/view-document.page.ts +++ b/src/app/modals/view-document/view-document.page.ts @@ -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) diff --git a/src/app/models/beast-orm.ts b/src/app/models/beast-orm.ts index 6d1062fe3..e1f119cce 100644 --- a/src/app/models/beast-orm.ts +++ b/src/app/models/beast-orm.ts @@ -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 diff --git a/src/app/models/eventperson.model.ts b/src/app/models/eventperson.model.ts index 959e16d3f..e9c2c199b 100644 --- a/src/app/models/eventperson.model.ts +++ b/src/app/models/eventperson.model.ts @@ -3,5 +3,6 @@ export class EventPerson{ Name: string; IsRequired: boolean; UserType: string; - IsPR: boolean + IsPR: boolean; + RoleDescription: string; } \ No newline at end of file diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index d44521415..6da2c31de 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -4,7 +4,7 @@ - +
@@ -14,7 +14,7 @@ -
+
@@ -55,13 +55,13 @@ class="select-calendar"> - + - +
PR
MDGPR
-
Agenda do {{calendars.Fullname}}
+
Agenda do {{calendars.Fullname}}
+
+ + -
-
- {{ TimelineDay(events.key)}}
{{ viewTitle }}
-
+
-
+
+ {{ day.daysInfo.dayName }}
{{month.monthInfo.monthName}}
+
-
+
+
@@ -258,10 +264,11 @@
{{SessionStore.user.FullName}}
{{eventService.getCalendarOwnNameByCalendarId(event.event.CalendarId)}}
+
-
+
diff --git a/src/app/pages/agenda/agenda.page.scss b/src/app/pages/agenda/agenda.page.scss index 02ecb1522..94edd8f82 100644 --- a/src/app/pages/agenda/agenda.page.scss +++ b/src/app/pages/agenda/agenda.page.scss @@ -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; diff --git a/src/app/pages/agenda/agenda.page.ts b/src/app/pages/agenda/agenda.page.ts index 74d32527a..8d167459e 100644 --- a/src/app/pages/agenda/agenda.page.ts +++ b/src/app/pages/agenda/agenda.page.ts @@ -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) diff --git a/src/app/pages/agenda/edit-event/edit-event.page.ts b/src/app/pages/agenda/edit-event/edit-event.page.ts index 9c12e2bb7..99a693e34 100644 --- a/src/app/pages/agenda/edit-event/edit-event.page.ts +++ b/src/app/pages/agenda/edit-event/edit-event.page.ts @@ -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; diff --git a/src/app/pages/agenda/new-event/new-event.page.ts b/src/app/pages/agenda/new-event/new-event.page.ts index a19cd824e..fd24f995a 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -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) + } + ); + } + } } diff --git a/src/app/pages/agenda/view-event/view-event.page.html b/src/app/pages/agenda/view-event/view-event.page.html index 9f1d43005..1032f20b8 100644 --- a/src/app/pages/agenda/view-event/view-event.page.html +++ b/src/app/pages/agenda/view-event/view-event.page.html @@ -11,7 +11,7 @@
diff --git a/src/app/pages/chat/group-messages/group-messages.page.html b/src/app/pages/chat/group-messages/group-messages.page.html index 83fcbe6bf..5dd2879c2 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -40,7 +40,6 @@ {{roomCountDownDate}}
- {{ RouteService.history }}
@@ -341,4 +340,4 @@
- \ No newline at end of file + diff --git a/src/app/pages/chat/group-messages/group-messages.page.ts b/src/app/pages/chat/group-messages/group-messages.page.ts index e243c7405..0f25ba173 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.ts +++ b/src/app/pages/chat/group-messages/group-messages.page.ts @@ -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") } } diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index 2d5982a83..5e82e5eb5 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -23,7 +23,7 @@
- +
@@ -97,7 +97,7 @@
- +
diff --git a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts index 0ec04ce59..afc672c98 100644 --- a/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts +++ b/src/app/pages/gabinete-digital/despachos-pr/despacho-pr/despacho-pr.page.ts @@ -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); } diff --git a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html index 6c4cdbb55..0430080cd 100644 --- a/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html +++ b/src/app/pages/gabinete-digital/despachos/despacho/despacho.page.html @@ -12,7 +12,7 @@ {{ task.Folio }}
- +
diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html index c1b8944fa..c633527c8 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.html @@ -21,7 +21,7 @@
- +
diff --git a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts index 655626b0f..8132d5590 100644 --- a/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts +++ b/src/app/pages/gabinete-digital/diplomas-assinar/diploma-assinar/diploma-assinar.page.ts @@ -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); - } + } } diff --git a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html index 59cd60223..42d745768 100644 --- a/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html +++ b/src/app/pages/gabinete-digital/event-list/approve-event/approve-event.page.html @@ -28,7 +28,7 @@