- +
{{header}} diff --git a/src/app/pages/chat/messages/messages.page.ts b/src/app/pages/chat/messages/messages.page.ts index 19163d8b5..2b72ee069 100644 --- a/src/app/pages/chat/messages/messages.page.ts +++ b/src/app/pages/chat/messages/messages.page.ts @@ -1003,6 +1003,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { openFile(pdfString, filename, type) { const blob = this.b64toBlob(pdfString, type) + console.log(blob) let pathFile = '' const fileName = filename const contentFile = blob @@ -1012,7 +1013,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy { pathFile = this.file.externalRootDirectory } - + console.log(pathFile) this.file .writeFile(pathFile, fileName, contentFile, { replace: true }) diff --git a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html index 231a8e6d6..51bd68ef9 100644 --- a/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html +++ b/src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html @@ -7,7 +7,7 @@
-
+
diff --git a/src/app/pages/publications/new-publication/new-publication.page.ts b/src/app/pages/publications/new-publication/new-publication.page.ts index b9e15b1cc..01de8ea31 100644 --- a/src/app/pages/publications/new-publication/new-publication.page.ts +++ b/src/app/pages/publications/new-publication/new-publication.page.ts @@ -19,6 +19,8 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera import { Filesystem, Directory } from '@capacitor/filesystem'; import { NgxImageCompressService } from "ngx-image-compress"; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; + const IMAGE_DIR = 'stored-images'; @@ -87,14 +89,15 @@ export class NewPublicationPage implements OnInit { private platform: Platform, private loadingCtrl: LoadingController, public imageCompress: NgxImageCompressService, - private httpErrorHandle: HttpErrorHandle + private httpErrorHandle: HttpErrorHandle, + public PublicationFolderService: PublicationFolderService ) { this.publicationType = this.navParams.get('publicationType'); this.folderId = this.navParams.get('folderId'); + this.publication = this.navParams.get('publication'); this.publicationTitle = 'Nova Publicação'; - this.convertBlobToBase64Worker = new Worker(new URL('./convertBlobToBase64.worker.js', import.meta.url)); } @@ -151,27 +154,6 @@ export class NewPublicationPage implements OnInit { }); - /* async laodPicture() { - const capturedImage = await Camera.getPhoto({ - resultType: CameraResultType.Uri, - source: CameraSource.Photos, - quality: 90, - width: 1080, - height: 720, - }); - - const response = await fetch(capturedImage.webPath!); - const blob = await response.blob(); - - this.photos.unshift({ - filepath: "soon...", - webviewPath: capturedImage.webPath - }); - - this.capturedImage = await this.convertBlobToBase64(blob); - this.capturedImageTitle = new Date().getTime() + '.jpeg'; - } */ - async laodPicture() { const capturedImage = await Camera.getPhoto({ @@ -295,8 +277,6 @@ export class NewPublicationPage implements OnInit { FileBase64: this.capturedImage, FileExtension: 'jpeg', } - - const loader = this.toastService.loading() @@ -312,6 +292,8 @@ export class NewPublicationPage implements OnInit { } } + + this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId) } else { diff --git a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts index a0013f0e6..e02b7030d 100644 --- a/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts @@ -76,33 +76,54 @@ export class PublicationDetailPage implements OnInit { } getPublicationDetail() { - this.showLoader = true; - - this.publications.GetPublicationById(this.publicationId).subscribe(res => { - - /* this.publication = res; */ + const folderId = this.folderId + const localPublication = this.publicationFolderService.getLocalPublication(folderId, this.publicationId); + + if(localPublication?.DocumentId) { + this.publication = { - DateIndex: res.DateIndex, - DocumentId: res.DocumentId, - ProcessId:res.ProcessId, - Title:res.Title, - Message: res.Message, - DatePublication: res.DatePublication, - FileBase64: "data:image/jpg;base64," + res.FileBase64, - OriginalFileName: res.OriginalFileName, + DateIndex: localPublication.DateIndex, + DocumentId: localPublication.DocumentId, + ProcessId:localPublication.ProcessId, + Title:localPublication.Title, + Message: localPublication.Message, + DatePublication: localPublication.DatePublication, + FileBase64: localPublication.FileBase64, + OriginalFileName: localPublication.OriginalFileName, FileExtension: 'jpeg', } - console.log('PUBLICATIO ImG',this.publication.FileBase64) - this.showLoader = false; - }, (error) => { + } else { - if(error.status == 404) { - this.publicationFolderService.deletePost(this.folderId, this.publicationId) - } + this.showLoader = true; + + this.publications.GetPublicationById(this.publicationId).subscribe(res => { + + /* this.publication = res; */ + this.publication = { + DateIndex: res.DateIndex, + DocumentId: res.DocumentId, + ProcessId:res.ProcessId, + Title:res.Title, + Message: res.Message, + DatePublication: res.DatePublication, + FileBase64: "data:image/jpg;base64," + res.FileBase64, + OriginalFileName: res.OriginalFileName, + FileExtension: 'jpeg', + } + + this.showLoader = false; + }, (error) => { + this.showLoader = false; + + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) + } + + this.goBack(); + this.httpErrorHandle.httpStatusHandle(error) + }); + } - this.goBack(); - this.httpErrorHandle.httpStatusHandle(error) - }); } close() { @@ -110,7 +131,7 @@ export class PublicationDetailPage implements OnInit { } goBack() { - if(!window.location.href.includes('/home/publications/view-publications')) { + if(this.isModal) { this.close() } else { this.RouteService.goBack(); @@ -179,9 +200,4 @@ export class PublicationDetailPage implements OnInit { modal.present(); } - - - - - } diff --git a/src/app/pages/publications/view-publications/view-publications.page.html b/src/app/pages/publications/view-publications/view-publications.page.html index 7ff5f4681..dee636a27 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.html +++ b/src/app/pages/publications/view-publications/view-publications.page.html @@ -7,9 +7,8 @@
-
+

{{publicationFolderService.FolderDetails[folderId].Description}}

-

{{publicationFolderService.FolderDetails[folderId].Detail}}

@@ -30,6 +29,9 @@
+ +

{{publicationFolderService.FolderDetails[folderId].Detail}}

+ @@ -51,65 +53,6 @@
-
diff --git a/src/app/pages/publications/view-publications/view-publications.page.ts b/src/app/pages/publications/view-publications/view-publications.page.ts index fd11fdd61..c7b85af1b 100644 --- a/src/app/pages/publications/view-publications/view-publications.page.ts +++ b/src/app/pages/publications/view-publications/view-publications.page.ts @@ -100,6 +100,7 @@ export class ViewPublicationsPage implements OnInit { createPublicationList(folderId = this.folderId) { + console.log('create') if(!this.publicationFolderService.publicationList[folderId]) { this.publicationFolderService.publicationList[folderId] = [] } @@ -132,7 +133,6 @@ export class ViewPublicationsPage implements OnInit { getPublicationDetail() { const folderId = this.folderId this.publications.GetPresidentialAction(folderId).subscribe(res =>{ - this.publicationFolderService.FolderDetails[folderId] = res this.storage.set(folderId+"name", res) }, (error) => { diff --git a/src/app/pipes/filter.pipe.ts b/src/app/pipes/filter.pipe.ts index 97100f9eb..9992c805d 100644 --- a/src/app/pipes/filter.pipe.ts +++ b/src/app/pipes/filter.pipe.ts @@ -7,13 +7,15 @@ export class FilterPipe implements PipeTransform { transform(array: any[], text:string, column:string): any { + console.log(array, text, column); + if(text === ''){ return array; } text = text.toLowerCase(); - if(Array.isArray(array)) { + if(!Array.isArray(array)) { array = [] } diff --git a/src/app/services/chat/chat-system.service.ts b/src/app/services/chat/chat-system.service.ts index 6c5c85cc7..0e2766c77 100644 --- a/src/app/services/chat/chat-system.service.ts +++ b/src/app/services/chat/chat-system.service.ts @@ -65,6 +65,23 @@ export class ChatSystemService { private notificationService: NotificationsService ) { + + const user = this.users + + const alfa = {} + + const sortedUserList = user.sort((a, b) => { + if(a.name < b.name) { + return -1; + } + if(a.name > b.name) { + return 1; + } + return 0; + }) + + console.log({sortedUserList}) + this.RochetChatConnectorService.registerCallback({ type: 'reConnect', funx: async () => { diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index 599700e12..a1b6ab1e4 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -79,7 +79,7 @@ export class MessageService { private notificationService: NotificationsService) { } - setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin, attachmentsModelData, hasFile = false }:Message) { + setData({customFields = {}, channels, mentions, msg ,rid ,ts, u, t, _id, id, _updatedAt, file, attachments, temporaryData, localReference = 'out-'+uuidv4() , viewed = [], received = [], delate = false, delateRequest =false, from, sendAttempt = 0, origin, attachmentsModelData, hasFile = false, UploadAttachmentsTemp = 0 }:Message) { this.channels = channels || [] this.mentions = mentions || [] @@ -99,6 +99,7 @@ export class MessageService { this.sendAttempt = 0 this.origin = origin this.attachmentsModelData = attachmentsModelData + this.UploadAttachmentsTemp = UploadAttachmentsTemp if(this.attachments?.length >= 1 && attachments?.length >= 1) { this.attachments[0] = Object.assign(this.attachments[0], attachments[0]) @@ -268,15 +269,20 @@ export class MessageService { uploadSuccessfully = await this.NfService.beforeSendAttachment(this) this.UploadAttachmentsTemp++ this.uploadingFile = false - + this.manualRetry = false this.errorUploadingAttachment = false this.hasSendAttachment = true + + this.saveChanges() } catch (error) { this.uploadingFile = false + this.errorUploadingAttachment = true this.UploadAttachmentsTemp++ + + this.saveChanges() } } @@ -513,7 +519,8 @@ export class MessageService { localReference: this.localReference, attachments: this.attachments, file: this.file, - delate: this.delate + delate: this.delate, + UploadAttachmentsTemp: this.UploadAttachmentsTemp } } diff --git a/src/app/services/events.service.ts b/src/app/services/events.service.ts index 1eb8620bb..7985330b6 100644 --- a/src/app/services/events.service.ts +++ b/src/app/services/events.service.ts @@ -939,6 +939,7 @@ export class EventsService { event.TimeZone = now.toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1] params = params.set("CalendarName", calendarName); + params = params.set("notifyUsers", true) let options: any; switch (calendarName) { @@ -973,6 +974,7 @@ export class EventsService { event.TimeZone = now.toString().match(/([A-Z]+[\+-][0-9]+.*)/)[1]; params = params.set("CalendarName", calendarName); + params = params.set("notifyUsers", true) let options: any; @@ -1139,6 +1141,7 @@ export class EventsService { params = params.set("DocId", docId); params = params.set("SerialNumber", serialNumber); params = params.set("applicationID", applicationID); + params = params.set("notifyUsers", true) switch (SessionStore.user.Profile) { case 'MDGPR': @@ -1245,6 +1248,7 @@ export class EventsService { params = params.set("FolderId", folderId); params = params.set("SerialNumber", serialNumber); params = params.set("applicationID", applicationID); + params = params.set("notifyUsers", true) const calendar = this.DetectCalendars(CalendarId) const header = this.makeHeader(calendar) diff --git a/src/app/services/task.service.ts b/src/app/services/task.service.ts index 12283484b..12407e95b 100644 --- a/src/app/services/task.service.ts +++ b/src/app/services/task.service.ts @@ -18,6 +18,7 @@ import { SortService } from './functions/sort.service'; import { customTask } from '../models/dailyworktask.model'; import { Router } from '@angular/router'; import { v4 as uuidv4 } from 'uuid' +import { ChangeProfileService } from './change-profile.service'; @Injectable({ providedIn: 'root' @@ -64,8 +65,14 @@ export class TaskService { private despachoRule: DespachoService, public eventService: EventsService, private router: Router, + private changeProfileService: ChangeProfileService, ) { + this.changeProfileService.registerCallback(() => { + this.updateCount() + this.runCallback(); + }) + window['all-process-gabinete'] = () => { this.updateAllProcess(); this.updateCount(); diff --git a/src/app/shared/agenda/new-event/new-event.page.ts b/src/app/shared/agenda/new-event/new-event.page.ts index 962a68ba4..3d583d500 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -487,6 +487,7 @@ export class NewEventPage implements OnInit { this.postEvent.Attendees = this.taskParticipants.concat(this.taskParticipantsCc); + if(this.documents.length >= 0) { this.postEvent.HasAttachments = true; } @@ -495,9 +496,11 @@ export class NewEventPage implements OnInit { this.postEvent.EventRecurrence.Type = '-1' } + if(this.loggeduser.Profile == 'MDGPR') { const CalendarId = this.selectedCalendarId() this.showLoader = true; + this.postEvent.CalendarId = CalendarId let loader = this.toastService.loading(); @@ -554,6 +557,7 @@ export class NewEventPage implements OnInit { const CalendarId = this.selectedCalendarId() let loader = this.toastService.loading(); + this.postEvent.CalendarId = CalendarId this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe( (id) => { @@ -609,11 +613,13 @@ export class NewEventPage implements OnInit { }); } else { - + this.postEvent.CalendarName const CalendarId = this.selectedCalendarId() let loader = this.toastService.loading(); + + this.postEvent.CalendarId = CalendarId this.eventService.postEventGeneric(this.postEvent, this.postEvent.CalendarName, CalendarId).subscribe( (id) => { diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html index 6e820fa0b..97e77ffd0 100644 --- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html +++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html @@ -40,7 +40,7 @@
-

{{user.name}}

+

{{user.name}}

- -
- {{header}} +
+ +
+ {{ userContainer.key }}
-
- - {{user.name}} +
+ + {{user.name}}
- - +
diff --git a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts index 7dd8027bb..00e1b7b81 100644 --- a/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts +++ b/src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts @@ -36,6 +36,10 @@ export class GroupContactsPage implements OnInit { @Input() roomId:string; @Output() openGroupMessage:EventEmitter = new EventEmitter(); + + objectUserSingleStone = [] + userContainer = {} + constructor( private modalController: ModalController, private chatService: ChatService, @@ -168,7 +172,7 @@ export class GroupContactsPage implements OnInit { }); } - loadUsers(){ + loadUsers() { this.chatService.getAllUsers().subscribe((res:any)=>{ @@ -192,24 +196,31 @@ export class GroupContactsPage implements OnInit { }); + for( const user of this.users) { + + const foundUser = this.objectUserSingleStone.find( e => e.name == user.name) + + if(!foundUser) { + this.objectUserSingleStone.push(user) + } + + } + + for(const user of this.objectUserSingleStone) { + const firstLetter = user.name.charAt(0) + + if(!this.userContainer[firstLetter]) { + this.userContainer[firstLetter] = [user] + } else { + this.userContainer[firstLetter].push(user) + } + + } + this.showLoader = false; }); } - separateLetter(record, recordIndex, records){ - if(recordIndex == 0){ - return record.name[0]; - } - - let first_prev = records[recordIndex - 1].name[0]; - let first_current = record.name[0]; - - if(first_prev != first_current){ - return first_current; - } - return null; - } - doRefresh(ev){ ev.target.complete(); } @@ -267,6 +278,24 @@ export class GroupContactsPage implements OnInit { this.users = users + + let a = this.objectUserSingleStone.filter( e => e.name.toLowerCase().includes(this.textSearch.toLowerCase())) + + let b = {} + for(const user of a) { + const firstLetter = user.name.charAt(0) + + if(!b[firstLetter]) { + b[firstLetter] = [user] + } else { + b[firstLetter].push(user) + } + + } + + + this.userContainer = b + // console.log('this.users', this.users) } @@ -274,18 +303,22 @@ export class GroupContactsPage implements OnInit { } - selectedContact(user:any){ - /* this.groupName = this.room.name; */ - user.isChecked = !user.isChecked; - - const userIndex = this.users.findIndex((e) => e._id == user._id) - this.users[userIndex] = user + selectedContact(user:any) { + /* this.groupName = this.room.name; */ + if(user.isChecked != true ) { + user.isChecked = false + } else { + user.isChecked = true + } + + const userIndex = this.objectUserSingleStone.findIndex((e) => e._id == user._id) + this.objectUserSingleStone[userIndex].isChecked = user.isChecked } - addContacts(roomId:any){ + addContacts(roomId:any) { - this.selectedUserList = this.users.filter(function(contact) { + this.selectedUserList = this.objectUserSingleStone.filter(function(contact) { return contact.isChecked == true; }); diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 5ae210611..165bd22d4 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -39,7 +39,6 @@
-
diff --git a/src/app/shared/header/header.page.html b/src/app/shared/header/header.page.html index 6d30dbe3a..23c215e1c 100644 --- a/src/app/shared/header/header.page.html +++ b/src/app/shared/header/header.page.html @@ -54,8 +54,10 @@ + +
-
+
{{notificationLength}}
@@ -206,9 +208,11 @@ + +
-
+
{{notificationLength}}
diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.html b/src/app/shared/popover/opts-expediente/opts-expediente.page.html index 59f5fd715..86a2711b7 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.html +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.html @@ -7,7 +7,7 @@
-
+
@@ -22,23 +22,9 @@ +
- -
-
diff --git a/src/app/shared/popover/opts-expediente/opts-expediente.page.scss b/src/app/shared/popover/opts-expediente/opts-expediente.page.scss index 121c5db26..677be7d4a 100644 --- a/src/app/shared/popover/opts-expediente/opts-expediente.page.scss +++ b/src/app/shared/popover/opts-expediente/opts-expediente.page.scss @@ -35,7 +35,7 @@ } @media only screen and (max-width: 800px) { .btn-ok, .btn-cancel, .btn-delete{ - width: 100% !important; + width: 47% !important; } } @media only screen and (min-width: 1024px) { @@ -45,11 +45,11 @@ } .btn-cancel{ display: none; - width: 100% !important; + width: 47% !important; margin-bottom: 10px !important; } .btn-delete, .btn-ok{ - width: 100% !important; + width: 47% !important; margin-bottom: 10px !important; margin-top: 10px !important; } diff --git a/src/app/shared/publication/new-publication/new-publication.page.ts b/src/app/shared/publication/new-publication/new-publication.page.ts index 89f89425f..91211de48 100644 --- a/src/app/shared/publication/new-publication/new-publication.page.ts +++ b/src/app/shared/publication/new-publication/new-publication.page.ts @@ -9,6 +9,8 @@ import { FormControl, FormGroup, Validators } from '@angular/forms'; import { ThemeService } from 'src/app/services/theme.service'; import { Camera, CameraResultType, CameraSource} from '@capacitor/camera'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; +import { PublicationFolderService } from 'src/app/store/publication-folder.service'; + @Component({ selector: 'app-new-publication', templateUrl: './new-publication.page.html', @@ -50,7 +52,8 @@ export class NewPublicationPage implements OnInit { private publications: PublicationsService, private toastService: ToastService, public ThemeService: ThemeService, - private httpErroHandle: HttpErrorHandle + private httpErroHandle: HttpErrorHandle, + public PublicationFolderService: PublicationFolderService ) { this.publicationTitle = 'Nova Publicação'; } @@ -65,22 +68,43 @@ export class NewPublicationPage implements OnInit { } getPublicationDetail() { - this.showLoader = true; - this.publications.GetPublicationById(this.publicationId).subscribe( res => { + + + const folderId = this.folderId + const localPublication = this.PublicationFolderService.getLocalPublication(folderId, this.publicationId); + + if(localPublication?.DocumentId) { + this.publication = { - DateIndex: res.DateIndex, - DocumentId: res.DocumentId, - ProcessId:res.ProcessId, - Title:res.Title, - Message: res.Message, - DatePublication: res.DatePublication, - FileBase64: "data:image/jpg;base64," + res.FileBase64, - OriginalFileName: res.OriginalFileName, + DateIndex: localPublication.DateIndex, + DocumentId: localPublication.DocumentId, + ProcessId:localPublication.ProcessId, + Title:localPublication.Title, + Message: localPublication.Message, + DatePublication: localPublication.DatePublication, + FileBase64: localPublication.FileBase64, + OriginalFileName: localPublication.OriginalFileName, FileExtension: 'jpeg', } - this.pub = this.publication; - this.showLoader = false; - }); + } else { + this.showLoader = true; + this.publications.GetPublicationById(this.publicationId).subscribe( res => { + this.publication = { + DateIndex: res.DateIndex, + DocumentId: res.DocumentId, + ProcessId:res.ProcessId, + Title:res.Title, + Message: res.Message, + DatePublication: res.DatePublication, + FileBase64: "data:image/jpg;base64," + res.FileBase64, + OriginalFileName: res.OriginalFileName, + FileExtension: 'jpeg', + } + this.pub = this.publication; + this.showLoader = false; + }); + } + } @@ -228,6 +252,9 @@ export class NewPublicationPage implements OnInit { } } + + + this.PublicationFolderService.loadPublication(this.publication.DocumentId, this.publication.ProcessId) } else { diff --git a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html index 077646950..c2bfb2b33 100644 --- a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html +++ b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html @@ -19,6 +19,7 @@

+ diff --git a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts index 475a05a4b..14a2b5491 100644 --- a/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts +++ b/src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts @@ -18,7 +18,6 @@ export class PublicationDetailPage implements OnInit { showLoader: boolean; /* folderId: string; */ publication: Publication; - @Input() publicationId: string; @Input() folderId: string; @Output() addNewPublication = new EventEmitter(); @@ -64,30 +63,52 @@ export class PublicationDetailPage implements OnInit { } getPublicationDetail() { - this.showLoader = true; - this.publications.GetPublicationById(this.publicationId).subscribe(res => { - + + const folderId = this.folderId + const localPublication = this.publicationFolderService.getLocalPublication(folderId, this.publicationId); + + if(localPublication?.DocumentId) { + this.publication = { - DateIndex: res.DateIndex, - DocumentId: res.DocumentId, - ProcessId:res.ProcessId, - Title:res.Title, - Message: res.Message, - DatePublication: res.DatePublication, - FileBase64: "data:image/jpg;base64," + res.FileBase64, - OriginalFileName: res.OriginalFileName, + DateIndex: localPublication.DateIndex, + DocumentId: localPublication.DocumentId, + ProcessId:localPublication.ProcessId, + Title:localPublication.Title, + Message: localPublication.Message, + DatePublication: localPublication.DatePublication, + FileBase64: localPublication.FileBase64, + OriginalFileName: localPublication.OriginalFileName, FileExtension: 'jpeg', } - this.showLoader = false; - }, (error) => { + } else { + + this.showLoader = true; + this.publications.GetPublicationById(this.publicationId).subscribe(res => { + + this.publication = { + DateIndex: res.DateIndex, + DocumentId: res.DocumentId, + ProcessId:res.ProcessId, + Title:res.Title, + Message: res.Message, + DatePublication: res.DatePublication, + FileBase64: "data:image/jpg;base64," + res.FileBase64, + OriginalFileName: res.OriginalFileName, + FileExtension: 'jpeg', + } + this.showLoader = false; + }, (error) => { + this.showLoader = false; - if(error.status == 404) { - this.publicationFolderService.deletePost(this.folderId, this.publicationId) - } - - this.goBack(); - this.httpErrorHandle.httpStatusHandle(error) - }); + if(error.status == 404) { + this.publicationFolderService.deletePost(this.folderId, this.publicationId) + } + + this.goBack(); + this.httpErrorHandle.httpStatusHandle(error) + }); + } + } close() { diff --git a/src/app/shared/publication/view-publications/view-publications.page.html b/src/app/shared/publication/view-publications/view-publications.page.html index 1fa05e351..9f716f4a6 100644 --- a/src/app/shared/publication/view-publications/view-publications.page.html +++ b/src/app/shared/publication/view-publications/view-publications.page.html @@ -1,12 +1,12 @@
-
+
{{publicationFolderService.FolderDetails[folderId].Description}}
-
+
-

{{publicationFolderService.FolderDetails[folderId].Detail}}

@@ -36,6 +35,8 @@
+

{{publicationFolderService.FolderDetails[folderId].Detail}}

+ diff --git a/src/app/store/publication-folder.service.ts b/src/app/store/publication-folder.service.ts index 0597856c2..a54700c33 100644 --- a/src/app/store/publication-folder.service.ts +++ b/src/app/store/publication-folder.service.ts @@ -2,6 +2,8 @@ import { Injectable } from '@angular/core'; import { PublicationFolder } from '../models/publicationfolder'; import { Storage } from '@ionic/storage'; import { Publication } from '../models/publication'; +import { PublicationsService } from '../services/publications.service'; +import { PublicationPipe } from 'src/app/pipes/publication.pipe'; @Injectable({ providedIn: 'root' @@ -14,9 +16,15 @@ export class PublicationFolderService { restoreFolder: {} = {} keyName: string + + showLoader = true + publicationPipe = new PublicationPipe() + getpublication = []; + constructor( private storage: Storage, + private publications: PublicationsService, ) {} @@ -31,6 +39,7 @@ export class PublicationFolderService { getFromDB(folderId: any) { + if(!this.restoreFolder[folderId]) { this.storage.get(folderId).then((viewPublications) => { @@ -69,11 +78,8 @@ export class PublicationFolderService { const findIndex = this.publicationFindIndex(publicationId, folderId) const found = this.publicationIsPresent(publicationId, folderId) if(!found) { - console.log('push',folderId, Publication) this.publicationList[folderId].push(Publication) } else { - - console.log('update',folderId, Publication) this.publicationList[folderId][findIndex] = Publication } } @@ -88,6 +94,108 @@ export class PublicationFolderService { } } + + getPublicationDetail(folderId) { + + this.publications.GetPresidentialAction(folderId).subscribe(res => { + this.FolderDetails[folderId] = res + this.storage.set(folderId+"name", res) + }, (error) => { + this.showLoader = false; + // this.httpErroHandle.httpStatusHandle(error) + }); + } + + + async getPublicationsIds(folderId) { + + this.showLoader = true; + + try { + const publicationIds = await this.publications.GetPublicationsList(folderId).toPromise(); + + this.createPublicationList(folderId) + let loadLater = [] + for (let publicationId of publicationIds) { + + if(!this.publicationIsPresent(publicationId, folderId)) { + await this.loadPublication(publicationId, folderId) + + } else { + loadLater.push(publicationId) + } + } + + for( let publicationId of loadLater) { + await this.loadPublication(publicationId, folderId) + } + + this.showLoader = false; + + this.storage.set(folderId, this.publicationList[folderId]); + this.getpublication = this.publicationList[folderId]; + } catch(error) { + this.showLoader = false; + } + + } + + + async loadPublication(publicationId, folderId) { + let Publication = await this.publications.GetPublicationById(publicationId).toPromise(); + let publicationDetails: Publication = this.publicationPipe.itemList(Publication) + + const findIndex = this.publicationFindIndex(publicationId, folderId) + const found = this.publicationIsPresent(publicationId, folderId) + if(!found) { + this.publicationList[folderId].push(publicationDetails) + } else { + this.publicationList[folderId][findIndex] = publicationDetails + } + + } + + async setPublication(publicationId, folderId, publicationDetails: Publication) { + + + const findIndex = this.publicationFindIndex(publicationId, folderId) + const found = this.publicationIsPresent(publicationId, folderId) + if(!found) { + this.publicationList[folderId].push(publicationDetails) + } else { + this.publicationList[folderId][findIndex] = publicationDetails + } + + } + + + async getPublication(publicationId, folderId, publicationDetails: Publication) { + + + const findIndex = this.publicationFindIndex(publicationId, folderId) + const found = this.publicationIsPresent(publicationId, folderId) + if(!found) { + this.publicationList[folderId].push(publicationDetails) + } else { + return this.publicationList[folderId][findIndex] + } + + } + + + getLocalPublication (folderId, publicationId) { + + if(this.publicationList[folderId]) { + + this.publicationList[folderId].filter( e=> e.ProcessId == publicationId || e.DocumentId == publicationId); + + return this.publicationList[folderId].filter( e => e.ProcessId == publicationId || e.DocumentId == publicationId)?.[0] + } else { + + } + + } + } diff --git a/src/theme/variables.scss b/src/theme/variables.scss index ae5d5b2ae..29fb1618f 100644 --- a/src/theme/variables.scss +++ b/src/theme/variables.scss @@ -779,7 +779,7 @@ body { --login-background: linear-gradient(180deg, #c63527 60%, #000 100%) !important; --button-hover: #c63527; --button-color: #ffb81c; - --button-text-color: white; + --button-text-color: black; --inicio-open-page-from-box: #c63527; --PinBackground: #e1e7eb; --background-mobile: var(--color); diff --git a/version/git-version.ts b/version/git-version.ts index 82a1c9507..93336b3c1 100644 --- a/version/git-version.ts +++ b/version/git-version.ts @@ -1,12 +1,12 @@ export let versionData = { - "shortSHA": "eb82f5a43", - "SHA": "eb82f5a4302404f86edd52f0a64de252949d83ba", + "shortSHA": "1e4321d29", + "SHA": "1e4321d2946ee8ef98f0547f002ea74402b95c3a", "branch": "developer", "lastCommitAuthor": "'Eudes Inácio'", - "lastCommitTime": "'Fri Aug 18 21:17:57 2023 +0100'", - "lastCommitMessage": "merge with developer_prod", - "lastCommitNumber": "5174", + "lastCommitTime": "'Sat Aug 19 22:25:12 2023 +0100'", + "lastCommitMessage": "mock profile picture added", + "lastCommitNumber": "5175", "change": "", - "changeStatus": "On branch developer\nYour branch and 'origin/developer' have diverged,\nand have 5 and 5 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nChanges to be committed:\n (use \"git restore --staged ...\" to unstage)\n\tmodified: src/app/modals/profile/edit-profile/edit-profile.page.html\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/header/header.page.scss\n\tnew file: src/assets/images/ministro.png\n\tdeleted: src/assets/images/presidente.jpeg\n\tnew file: src/assets/images/presidente.png\n\tnew file: src/assets/images/secretaria_geral.png", + "changeStatus": "On branch developer\nYour branch and 'origin/developer' have diverged,\nand have 6 and 5 different commits each, respectively.\n (use \"git pull\" to merge the remote branch into yours)\n\nAll conflicts fixed but you are still merging.\n (use \"git commit\" to conclude merge)\n\nChanges to be committed:\n\tmodified: src/app/models/beast-orm.ts\n\tmodified: src/app/models/chatMethod.ts\n\tmodified: src/app/pages/agenda/new-event/new-event.page.ts\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/pages/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/pages/chat/messages/contacts/contacts.page.html\n\tmodified: src/app/pages/chat/messages/messages.page.ts\n\tmodified: src/app/pages/gabinete-digital/expediente/expediente-detail/expediente-detail.page.html\n\tmodified: src/app/pages/publications/new-publication/new-publication.page.ts\n\tmodified: src/app/pages/publications/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.html\n\tmodified: src/app/pages/publications/view-publications/view-publications.page.ts\n\tmodified: src/app/pipes/filter.pipe.ts\n\tmodified: src/app/services/chat/chat-system.service.ts\n\tmodified: src/app/services/chat/message.service.ts\n\tmodified: src/app/services/events.service.ts\n\tmodified: src/app/services/task.service.ts\n\tmodified: src/app/shared/agenda/new-event/new-event.page.ts\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.html\n\tmodified: src/app/shared/chat/group-messages/group-contacts/group-contacts.page.ts\n\tmodified: src/app/shared/chat/messages/messages.page.html\n\tmodified: src/app/shared/header/header.page.html\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.html\n\tmodified: src/app/shared/popover/opts-expediente/opts-expediente.page.scss\n\tmodified: src/app/shared/publication/new-publication/new-publication.page.ts\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.html\n\tmodified: src/app/shared/publication/view-publications/publication-detail/publication-detail.page.ts\n\tmodified: src/app/shared/publication/view-publications/view-publications.page.html\n\tmodified: src/app/store/publication-folder.service.ts\n\tmodified: src/theme/variables.scss", "changeAuthor": "eudes.inacio" } \ No newline at end of file