diff --git a/.husky/pre-commit b/.husky/pre-commit index fe58ea54a..1577fd5b5 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ #!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" +# . "$(dirname -- "$0")/_/husky.sh" -npm run build:version && git add version/git-version.ts +#npm run build:version && git add version/git-version.ts diff --git a/src/app/modals/add-note/add-note.page.html b/src/app/modals/add-note/add-note.page.html index d40eba2a3..df99f9ed1 100644 --- a/src/app/modals/add-note/add-note.page.html +++ b/src/app/modals/add-note/add-note.page.html @@ -35,12 +35,13 @@

{{document.Assunto}} - {{document.appName}} + {{ TaskService.attachmentAppName(document)}} + {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

diff --git a/src/app/modals/add-note/add-note.page.ts b/src/app/modals/add-note/add-note.page.ts index 5be2d0be6..ea27c63d8 100644 --- a/src/app/modals/add-note/add-note.page.ts +++ b/src/app/modals/add-note/add-note.page.ts @@ -3,7 +3,7 @@ import { AnimationController, ModalController, NavParams } from '@ionic/angular' import { SearchList } from 'src/app/models/search-document'; import { SearchPage } from 'src/app/pages/search/search.page'; import { ThemeService } from 'src/app/services/theme.service' - +import { TaskService } from 'src/app/services/task.service' @Component({ selector: 'app-add-note', templateUrl: './add-note.page.html', @@ -20,7 +20,8 @@ export class AddNotePage implements OnInit { private modalController: ModalController, private animationController: AnimationController, private navParams: NavParams, - public ThemeService: ThemeService + public ThemeService: ThemeService, + public TaskService: TaskService ) { this.note = ''; this.hideThisFeature = this.navParams.get('showAttachmentBtn'); diff --git a/src/app/modals/create-process/create-process.page.html b/src/app/modals/create-process/create-process.page.html index 7e7e81157..f53bccb9d 100644 --- a/src/app/modals/create-process/create-process.page.html +++ b/src/app/modals/create-process/create-process.page.html @@ -146,6 +146,7 @@

{{document.Assunto}} + {{ TaskService.attachmentAppName(document)}} {{document.appName}} diff --git a/src/app/modals/create-process/create-process.page.ts b/src/app/modals/create-process/create-process.page.ts index 8767490d4..0806e1635 100644 --- a/src/app/modals/create-process/create-process.page.ts +++ b/src/app/modals/create-process/create-process.page.ts @@ -22,7 +22,7 @@ import { fullTask } from 'src/app/models/dailyworktask.model'; import { ThemeService } from 'src/app/services/theme.service' import { SessionStore } from 'src/app/store/session.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; - +import { TaskService } from 'src/app/services/task.service' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -99,7 +99,8 @@ export class CreateProcessPage implements OnInit { private despachoService: DespachoService, private pedidoService: PedidoService, public ThemeService: ThemeService, - private httpsErrorHanlde: HttpErrorHandle + private httpsErrorHanlde: HttpErrorHandle, + public TaskService: TaskService ) { this.loggeduser = SessionStore.user; this.task = this.navParams.get('task'); @@ -357,7 +358,9 @@ export class CreateProcessPage implements OnInit { try { if (this.task.activityInstanceName == 'Tarefa de Despacho' || this.task.activityInstanceName == 'Reexecutar Despacho') { + // create parecer await this.despachoService.createParecer(this.postData).toPromise(); + // task complete await this.despachoService.solicitarParecer({ note: this.postData.DispatchFolder.Message, serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName }).toPromise(); } else { diff --git a/src/app/modals/dar-parecer/dar-parecer.page.html b/src/app/modals/dar-parecer/dar-parecer.page.html index c6603602d..5db28a1b1 100644 --- a/src/app/modals/dar-parecer/dar-parecer.page.html +++ b/src/app/modals/dar-parecer/dar-parecer.page.html @@ -40,12 +40,13 @@

{{document.Assunto}} - {{document.appName}} + {{ TaskService.attachmentAppName(document)}} + {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

diff --git a/src/app/modals/dar-parecer/dar-parecer.page.ts b/src/app/modals/dar-parecer/dar-parecer.page.ts index aea5428c4..cb8858f12 100644 --- a/src/app/modals/dar-parecer/dar-parecer.page.ts +++ b/src/app/modals/dar-parecer/dar-parecer.page.ts @@ -6,6 +6,7 @@ import { ProcessesService } from 'src/app/services/processes.service'; import { ToastService } from 'src/app/services/toast.service'; import { ThemeService } from 'src/app/services/theme.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; +import { TaskService } from 'src/app/services/task.service' @Component({ selector: 'app-dar-parecer', @@ -25,7 +26,8 @@ export class DarParecerPage implements OnInit { private animationController: AnimationController, private toastService: ToastService, public ThemeService: ThemeService, - private httpErroHanlde: HttpErrorHandle + private httpErroHanlde: HttpErrorHandle, + public TaskService: TaskService ) { this.serialNumber = this.navParams.get('serialNumber'); this.instanceId = this.navParams.get('ProcessInstanceID'); diff --git a/src/app/modals/delegar/delegar.page.html b/src/app/modals/delegar/delegar.page.html index f1301232e..536e39c56 100644 --- a/src/app/modals/delegar/delegar.page.html +++ b/src/app/modals/delegar/delegar.page.html @@ -62,12 +62,13 @@

{{document.Assunto}} - {{document.appName}} + {{ TaskService.attachmentAppName(document)}} + {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

diff --git a/src/app/modals/delegar/delegar.page.ts b/src/app/modals/delegar/delegar.page.ts index fcda6dddf..208e91b0f 100644 --- a/src/app/modals/delegar/delegar.page.ts +++ b/src/app/modals/delegar/delegar.page.ts @@ -11,7 +11,7 @@ import { SearchList } from 'src/app/models/search-document'; import { SearchPage } from 'src/app/pages/search/search.page'; import { ThemeService } from 'src/app/services/theme.service' import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; - +import { TaskService } from 'src/app/services/task.service' @Component({ selector: 'app-delegar', @@ -47,7 +47,8 @@ export class DelegarPage implements OnInit { public alertController: AlertController, private toastService: ToastService, public ThemeService: ThemeService, - private httpErrorHandle: HttpErrorHandle + private httpErrorHandle: HttpErrorHandle, + public TaskService: TaskService ) { this.task = this.navParams.get('task'); this.postData = new Event(); diff --git a/src/app/modals/document-detail/document-detail.page.ts b/src/app/modals/document-detail/document-detail.page.ts index 97d0379d4..629d48c91 100644 --- a/src/app/modals/document-detail/document-detail.page.ts +++ b/src/app/modals/document-detail/document-detail.page.ts @@ -192,7 +192,6 @@ export class DocumentDetailPage implements OnInit { componentProps: { taskAction: taskAction, task: this.DocumentTask, - seachDocuments: this.LoadedDocument, aplicationId: this.LoadedDocument.ApplicationId || this.LoadedDocument.ApplicationID }, cssClass: classs, 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 4997bfbc4..6c940c42a 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 @@ -317,12 +317,13 @@

{{document.Assunto}} + {{ TaskService.attachmentAppName(document)}} {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{(document.Data ||document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data ||document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

diff --git a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts index a9a166e9b..8c68182d4 100644 --- a/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts +++ b/src/app/modals/document-set-up-meeting/document-set-up-meeting.page.ts @@ -21,6 +21,7 @@ import { ThemeService } from 'src/app/services/theme.service'; import { SessionStore } from 'src/app/store/session.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { environment } from 'src/environments/environment'; +import { TaskService } from 'src/app/services/task.service' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { @@ -109,7 +110,8 @@ export class DocumentSetUpMeetingPage implements OnInit { private eventService: EventService, public ThemeService: ThemeService, public _eventService: EventsService, - private httpErroHandle: HttpErrorHandle + private httpErroHandle: HttpErrorHandle, + public TaskService: TaskService ) { this.loggeduser = SessionStore.user; this.document = this.navParams.get('document') diff --git a/src/app/modals/view-document/view-document.page.ts b/src/app/modals/view-document/view-document.page.ts index f59b7b3c9..3bb165703 100644 --- a/src/app/modals/view-document/view-document.page.ts +++ b/src/app/modals/view-document/view-document.page.ts @@ -33,7 +33,6 @@ export class ViewDocumentPage implements OnInit { private alertController: AlertController, ) { this.file = this.navParams.get('file'); - console.log(this.file ) this.applicationId = this.navParams.get('applicationId'); this.docId = this.navParams.get('docId'); this.Document = this.navParams.get('Document') @@ -45,6 +44,14 @@ export class ViewDocumentPage implements OnInit { this.file.title = 'Sem Título' } + console.log({ + file: this.file, + applicationId: this.applicationId, + docId: this.docId, + Document: this.Document, + task: this.task, + attachment: this.attachment + }) } @@ -94,10 +101,8 @@ export class ViewDocumentPage implements OnInit { component: EventDetailsDocumentsOptionsPage, cssClass: 'model aside-modal search-submodal', componentProps: { - fulltask: this.task, - task: this.task, - content: "", - Document:this.Document + content: "", // check + Document:this.Document // check } }); await modal.present(); @@ -127,11 +132,13 @@ export class ViewDocumentPage implements OnInit { } else { classs = 'modal modal-desktop showAsideOptions' } + + // check passing const modal = await this.modalController.create({ component: DocumentSetUpMeetingPage, componentProps: { - subject: this.task.workflowInstanceDataFields.Subject, - document: this.Document, + subject: this.task.workflowInstanceDataFields.Subject, // check + document: this.Document, // document }, cssClass: classs, backdropDismiss: false @@ -156,13 +163,14 @@ export class ViewDocumentPage implements OnInit { } else { classs = 'modal modal-desktop showAsideOptions' } + // check passing const modal = await this.modalController.create({ component: ExpedientTaskModalPage, componentProps: { - taskAction: taskAction, - task: this.task, - seachDocuments: this.Document, - aplicationId: this.Document.ApplicationId || this.Document.ApplicationID + taskAction: taskAction, // check + task: this.task, // check + document: this.Document, // nope + aplicationId: this.Document.ApplicationId || this.Document.ApplicationID // check }, cssClass: classs, }); diff --git a/src/app/models/folder.model.ts b/src/app/models/folder.model.ts index 0cf367597..da5aab8bf 100644 --- a/src/app/models/folder.model.ts +++ b/src/app/models/folder.model.ts @@ -2,10 +2,10 @@ export class Folder{ Nad:number; Subject: string; Message:string; - SourceSecFsId?:string; + SourceSecFsId:string; SourceType:string; SourceId:string; DeadlineType: string; SubjectTypes: string[]; - NumberPDPP?:string; + NumberPDPP:string; } \ No newline at end of file diff --git a/src/app/pages/agenda/new-event/new-event.page.html b/src/app/pages/agenda/new-event/new-event.page.html index ff291fdf6..1c5b103b5 100644 --- a/src/app/pages/agenda/new-event/new-event.page.html +++ b/src/app/pages/agenda/new-event/new-event.page.html @@ -288,7 +288,7 @@

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

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 c8c780d3e..88381a359 100644 --- a/src/app/pages/agenda/new-event/new-event.page.ts +++ b/src/app/pages/agenda/new-event/new-event.page.ts @@ -21,6 +21,7 @@ import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service'; 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' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -103,7 +104,8 @@ export class NewEventPage implements OnInit { private platform: Platform, private chatMethodService: ChatMethodsService, private hhtpErrorHandle: HttpErrorHandle, - private processeService: ProcessesService + private processeService: ProcessesService, + public TaskService: TaskService ) { this.loggeduser = SessionStore.user; this.postEvent = new Event(); 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 b9ba75d0a..f7022cafb 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.html +++ b/src/app/pages/chat/group-messages/group-messages.page.html @@ -52,8 +52,8 @@ A conversa original mantêm-se como chat individual
-
-
+
+
{{msg.u.name ?? ""}} {{msg.duration}}
@@ -64,7 +64,7 @@ Enviado - + Lido @@ -102,7 +102,7 @@ Enviado - + Lido @@ -122,7 +122,7 @@ - +
@@ -153,13 +153,13 @@ {{file.description}} - + - + Enviado - + Lido diff --git a/src/app/pages/chat/group-messages/group-messages.page.scss b/src/app/pages/chat/group-messages/group-messages.page.scss index 0cc4b5124..f3198487e 100644 --- a/src/app/pages/chat/group-messages/group-messages.page.scss +++ b/src/app/pages/chat/group-messages/group-messages.page.scss @@ -425,4 +425,13 @@ ion-footer { .font-40-rem { font-size: 2.5rem !important; -} \ No newline at end of file +} + + +.dateLabel { + background: #ebebeb !important; + float: unset !important; + margin: 0px auto !important; + width: 110px; + text-align: center; +} diff --git a/src/app/pages/chat/messages/messages.page.html b/src/app/pages/chat/messages/messages.page.html index 832e9111e..49bcd4cd4 100644 --- a/src/app/pages/chat/messages/messages.page.html +++ b/src/app/pages/chat/messages/messages.page.html @@ -50,8 +50,8 @@ *ngFor="let msg of ChatSystemService.getDmRoom(this.roomId).messages; let last = last" [class.messages-list-item-wrapper-active]="msg._id == selectedMsgId">
-
+ *ngIf="msg.msg !=''" [class.dateLabel]="msg.dateLabel"> +
{{msg.u.name}} {{msg.duration}}
@@ -64,7 +64,7 @@ Enviado - + Lido @@ -96,17 +96,17 @@
image - + Enviado - + Lido
Tentar
- +
@@ -159,20 +159,20 @@ {{file.description}} - + - + Enviado - + Lido
Tentar
- +
diff --git a/src/app/pages/chat/messages/messages.page.scss b/src/app/pages/chat/messages/messages.page.scss index eda37e81b..e675cbe6d 100644 --- a/src/app/pages/chat/messages/messages.page.scss +++ b/src/app/pages/chat/messages/messages.page.scss @@ -406,4 +406,13 @@ button::-moz-focus-inner { .font-40-rem { font-size: 2.5rem !important; -} \ No newline at end of file +} + + +.dateLabel { + background: #ebebeb !important; + float: unset !important; + margin: 0px auto !important; + width: 110px; + text-align: center; +} diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html index 0d43176c0..d09a8c2c9 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.html @@ -280,6 +280,7 @@

{{document.Assunto}} + {{ TaskService.attachmentAppName(document)}} {{document.appName}} diff --git a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts index 0f9e23232..585802c01 100644 --- a/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/book-meeting-modal/book-meeting-modal.page.ts @@ -22,7 +22,7 @@ import { SessionStore } from 'src/app/store/session.service'; import { RoleIdService } from 'src/app/services/role-id.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { environment } from 'src/environments/environment'; - +import { TaskService } from 'src/app/services/task.service' const moment = _rollupMoment || _moment; @@ -124,7 +124,8 @@ export class BookMeetingModalPage implements OnInit { public ThemeService: ThemeService, public eventService: EventsService, public RoleIdService: RoleIdService, - private httpErroHandle: HttpErrorHandle + private httpErroHandle: HttpErrorHandle, + public TaskService: TaskService ) { diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html index 3bfe7c377..64276e03a 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.html @@ -196,12 +196,13 @@

{{document.Assunto}} - {{document.appName}} + {{ TaskService.attachmentAppName(document)}} + {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

diff --git a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts index fa5e03309..66826fc22 100644 --- a/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts +++ b/src/app/pages/gabinete-digital/expediente/expedient-task-modal/expedient-task-modal.page.ts @@ -26,7 +26,7 @@ import { SessionStore } from 'src/app/store/session.service'; import { PermissionService } from 'src/app/services/permission.service'; import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'; import { RouteService } from 'src/app/services/route.service'; - +import { TaskService } from 'src/app/services/task.service' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { @@ -95,6 +95,7 @@ export class ExpedientTaskModalPage implements OnInit { Form: FormGroup; validateFrom = false; validateField = false; + document: any get toppingsValues() { return this.toppings.value; @@ -113,6 +114,7 @@ export class ExpedientTaskModalPage implements OnInit { public p: PermissionService, private httpErroHandle: HttpErrorHandle, private RouteService: RouteService, + public TaskService: TaskService ) { this.loggeduser = SessionStore.user; @@ -122,9 +124,39 @@ export class ExpedientTaskModalPage implements OnInit { this.SearchFolder = this.navParams.get('SearchFolder'); this.aplicationId = this.navParams.get('aplicationId') + this.document = this.navParams.get('document') this.taskType = this.navParams.get('taskAction'); + + if(this.document) { + const doc: any = this.document + + this.documents.push({ + ApplicationId: (doc.ApplicationType || doc.ApplicationId), + ApplicationType: (doc.ApplicationType || doc.ApplicationId), + SourceId: (doc.Id || doc.DocId || doc.SourceId), + Id: (doc.Id || doc.DocId || doc.SourceId), + EntidadeOrganicaNome: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome), + Sender: (doc.sender || doc.SourceName || doc. EntidadeOrganicaNome), + Data: (doc.DocDate || doc.Data), + DocDate: (doc.DocDate || doc.Data), + Assunto: doc.Assunto, + } as any) + } + + + const DocumentToSave = this.documents.map((e) => { + return { + ApplicationId: e.ApplicationType, + SourceId: e.Id + } + }); + + + console.log('this.document', this.document) + + this.selectedTypes = ['99999850']; this.postData = new Despacho(); diff --git a/src/app/services/chat/message.service.ts b/src/app/services/chat/message.service.ts index c9343aaff..91ee981b5 100644 --- a/src/app/services/chat/message.service.ts +++ b/src/app/services/chat/message.service.ts @@ -47,7 +47,7 @@ export class MessageService { uploadingFile = false errorUploadingAttachment = false loadHistory = false - from: 'Offline'|'History'|'stream'| 'send' + from: 'Offline'|'History'|'stream'| 'send' duration = '' localReference = null viewed: string[] = [] @@ -67,6 +67,8 @@ export class MessageService { messageModelInstance: MessageModel attachmentsModelData: any + dateLabel = false + constructor( private NfService: NfService, @@ -177,7 +179,7 @@ export class MessageService { return firstName + ' ' + lastName } catch (error) { return username - } + } } @@ -193,9 +195,9 @@ export class MessageService { if(!this.hasFile) { - const params = { - roomId:this.rid, - msg:this.msg, + const params = { + roomId:this.rid, + msg:this.msg, localReference: this.localReference } @@ -226,7 +228,7 @@ export class MessageService { this.RochetChatConnectorService.registerCallback({ type: 'reConnect', funx: async ()=> { - + await this.send().catch((error) => { console.error(error) }) @@ -257,10 +259,10 @@ export class MessageService { try { await this.getFileFromDB() } catch (error) {} - } + } if(!this.instanceHasTemporaryData) { - + await this.generateTemporaryData() } @@ -277,14 +279,14 @@ export class MessageService { this.saveChanges() } catch (error) { this.uploadingFile = false - + this.errorUploadingAttachment = true this.UploadAttachmentsTemp++ this.saveChanges() } - + } return uploadSuccessfully @@ -305,7 +307,7 @@ export class MessageService { (ChatMessage: any) => { ChatMessage = ChatMessage.message.result clearTimeout(this.functionTimer); - + this.redefinedMessage(ChatMessage) } ).catch((error) => { @@ -320,16 +322,16 @@ export class MessageService { (ChatMessage: any) => { ChatMessage = ChatMessage.message.result clearTimeout(this.functionTimer); - + this.redefinedMessage(ChatMessage) - + } ).catch((error) => { clearTimeout(this.functionTimer); console.error(error) }) } - + this.functionTimer = setTimeout(() => { this.RochetChatConnectorService.registerCallback({ type:'Onmessage', @@ -395,7 +397,7 @@ export class MessageService { this.notificationService.ChatSendMessageNotificationGrup(usersNames,ChatMessage.u.name,ChatMessage.msg,this.rid) } - + await this.saveChanges() } @@ -415,7 +417,7 @@ export class MessageService { } else if (this.file.type != "application/img") { downloadFile = new Uint8Array(event.body).reduce((data, byte) => data + String.fromCharCode(byte), ''); - + } this.attachments[0] = { @@ -462,7 +464,7 @@ export class MessageService { return true } } - + return false } @@ -525,21 +527,21 @@ export class MessageService { } earlySave = false - + async addMessageDB() { if(!this.addToDb && this.save) { this.addToDb = true const message = this.getChatObj() if(this.instanceHasAttachment) { - this.hasFile = true + this.hasFile = true } delete message.id const createdMessage = await MessageModel.create(message) if(this.instanceHasAttachment) { - this.addFileToDb() + this.addFileToDb() } this.messageModelInstance = createdMessage @@ -556,7 +558,7 @@ export class MessageService { if(!this.messageModelInstance) { this.messageModelInstance = await this.getRowInstance() } - + const createdMessage: any = this.messageModelInstance try { @@ -566,7 +568,7 @@ export class MessageService { if(this.attachmentsModelData) { file = {image_url: this.attachmentsModelData?.fileBase64} } - + await attachments.create({messageId: createdMessage.id, attachments: this.attachments, file: Object.assign(this.file, file) }) } catch (error) { console.log(error) @@ -578,8 +580,8 @@ export class MessageService { if(!this.messageModelInstance) { this.messageModelInstance = await this.getRowInstance() } - - + + const data = await this.messageModelInstance.getAttachments() console.log('data', data); @@ -590,7 +592,7 @@ export class MessageService { async generateTemporaryData () { const blob: any = await this.base64StringToBlob(this.file.image_url) - + const formData = new FormData(); formData.append("blobFile", blob); this.temporaryData = formData @@ -651,7 +653,7 @@ export class MessageService { if(!message.id) { delete message.id } - + if (this.localReference) { a = await MessageModel.get({localReference: this.localReference}) } else if (this._id) { @@ -662,7 +664,7 @@ export class MessageService { return a } - + } async saveChanges() { @@ -683,13 +685,299 @@ export class MessageService { this.messageModelInstance[name] = value } catch (error) {} } - + await this.messageModelInstance.save() - + } else { this.earlySave = true } - + + } + + decryptMessage() { + try { + // this.msg = this.AESEncrypt.decrypt(this.msg, SessionStore.user.UserName) + } catch (error) {} + } + + + + UIdata() { + this.incomingFromCurrentUser = this.u.username!= SessionStore.user.UserName + this.hasMessage = this.msg !='' + } + + incomingFromCurrentUser = false + hasMessage = false +} + + + + + + +export class MessageServiceDateLabel { + + customFields + channels = [] + mentions = [] + msg = '' + rid = '' + ts = {} + + u = { + name: '', + username: '', + _id: "" + } + + t = '' + _id = '' + id = '' // table id + _updatedAt + file + attachments + displayType = '' + temporaryData: any + hasFile = false + hasSendAttachment = false + sendAttempt = 0 + uploadingFile = false + errorUploadingAttachment = false + loadHistory = false + from: 'Offline'|'History'|'stream'| 'send' + duration = '' + localReference = null + viewed: string[] = [] + received: string[]= [] + addToDb = false + + messageSend = false + delate = false + delateRequest = false + downloadLoader: boolean = false + downloadAttachments = false; + downloadAttachmentsTemp = 0; + UploadAttachmentsTemp = 0; + manualRetry = false + origin: 'history' | 'stream' | 'local' + + messageModelInstance: MessageModel + attachmentsModelData: any + ChatSystemService + dateLabel = false + + + constructor() {} + + 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 = [] + this.mentions = [] + this.rid = rid + this.ts = ts + this.u = u || { name: this.usernameToDisplayName(SessionStore.user.UserName), username: SessionStore.user.UserName, _id: ""} + this.t = t + this._id = "" + this._updatedAt = _updatedAt || new Date().getTime() + this.file = file + this.temporaryData = temporaryData + this.localReference = localReference || null + this.id = id + this.delate = delate + this.delateRequest = delateRequest + 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]) + } else { + this.attachments = attachments + } + + this.viewed = []; + this.received = []; + + this.messageSend = true + this.hasFile = hasFile + + this.hasFile = false + + if(!this.u.name && this.u.username) { + const user = this.ChatSystemService.users.find((u)=> u.username == this.u.username) + if(user) { + this.u.name = user.name + } else if( this.u.username == SessionStore.user.UserName) { + this.u.name = SessionStore.user.FullName + } else { + } + } + + this.calDateDuration() + } + + + get offline () { + if(!this._id) { + return true + } + + if(!this.ts) { + return true + } + + return false + } + + /** + * Message is on the server + */ + get online() { + return !this.offline + } + + /** + * if Message is already saved on database + */ + get save() { + return this.id != '' + } + + + private usernameToDisplayName(username) { + + try { + const firstName = capitalizeTxt(username.split('.')[0]) + const lastName = capitalizeTxt(username.split('.')[1]) + return firstName + ' ' + lastName + } catch (error) { + return username + } + + } + + async send(): Promise { + + + } + + + functionTimer = null; + + async sendRequestAttachment() { + + } + + async sendRequest(params) { + + + } + + async redefinedMessage(ChatMessage , update = true) { + + } + + sendNotificaton + + downloadFileMsg() { + + } + + private calDateDuration(date = null) { + this.duration = showDateDuration(date || this._updatedAt); + } + + + async delateStatusFalse() { + + } + + addViewed(id: string) { + + } + + addReceived(id: string) { + + } + + async delateDB() { + + } + + + isSenderIsNotMe(ChatMessage) { + return SessionStore.user.ChatData.data.userId != ChatMessage.u._id + } + + messageOwner() { + return SessionStore.user.ChatData.data.userId == this.u._id + } + + getChatObj() { + + } + + earlySave = false + + async addMessageDB() { + + } + + async addFileToDb() { + + + } + + async getFileFromDB() { + + } + + async generateTemporaryData () { + + } + + + get instanceHasAttachment() { + return false + } + + get instanceHasAttachmentBase64() { + if (this.file) { + if(this.file.type) { + if(this.file?.image_url) { + return true + } + } + } + + return false + } + + get instanceHasTemporaryData() { + if (!this.temporaryData) { + return false + } + + return true + } + + + base64StringToBlob(base64Data) { + + } + + + + async getRowInstance () { + + + } + + async saveChanges() { + + } decryptMessage() { diff --git a/src/app/services/chat/room.service.ts b/src/app/services/chat/room.service.ts index 15cb34dc5..f8ac1ed31 100644 --- a/src/app/services/chat/room.service.ts +++ b/src/app/services/chat/room.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service'; -import { MessageService } from 'src/app/services/chat/message.service'; +import { MessageService, MessageServiceDateLabel } from 'src/app/services/chat/message.service'; import { showDateDuration } from 'src/plugin/showDateDuration'; import { chatHistory } from 'src/app/models/chatMethod'; import { Storage } from '@ionic/storage'; @@ -187,7 +187,7 @@ export class RoomService { } get online() { - + if(!this.isGroup) { for(let user of this.ChatSystemService.users) { @@ -196,7 +196,7 @@ export class RoomService { return user.status } } - + } } @@ -244,7 +244,7 @@ export class RoomService { }); } else { - this.chatService.deleteChannel(body).subscribe(res=>{ + this.chatService.deleteChannel(body).subscribe(res=>{ this.ChatSystemService.deleteRoom(this.id); this.ChatSystemService.getAllRooms(); this.chatServiceDeleteRoom(this.id); @@ -281,7 +281,7 @@ export class RoomService { if (typeof args[1] != 'object') { this.userThatIsTyping = this.usernameToDisplayName(args[0]) - + this.isTyping = args[1] this.otherUserType = args[1] @@ -298,9 +298,9 @@ export class RoomService { } } else if(args[0]?.method == 'deleteMessage' || args[1]?.method == 'deleteMessage') { - + this.deleteMessage(args[1]?.method?._id) - + } else { } @@ -316,13 +316,13 @@ export class RoomService { let ChatMessage : ChatMessageInterface = this.fix_updatedAt(IncomingChatMessageArgs) - let found = this.findMessageBy_id(ChatMessage._id) || + let found = this.findMessageBy_id(ChatMessage._id) || this.findMessageBy_localReference(ChatMessage?.localReference) // || await this.findMessageInDBByData({_id:ChatMessage._id, localReference:ChatMessage.localReference }) if(!found) { - ChatMessage.origin = 'stream' + ChatMessage.origin = 'stream' const message = await this.prepareCreate({message: ChatMessage, save: false}); this.registerSendMessage(message) @@ -342,7 +342,7 @@ export class RoomService { title: this.name }); */ } - + if(this.hasLoadHistory == true) { this.messages.push(message) await message.addMessageDB() @@ -350,14 +350,12 @@ export class RoomService { this.messagesBeforeOfflineAPI.push(message) } - if(this.chatOpen == false) { - this.messageUnread = true - } + this.messageUnread = true setTimeout(() => { this.scrollDown() - }, 50) - + }, 50) + } if(ChatMessage?.t == "au" || ChatMessage?.t == "ru" || ChatMessage?.t == "ul") { @@ -389,7 +387,7 @@ export class RoomService { } catch(error) { return [] } - + } getAllMemberThatIsNotOffline(): string[] { @@ -432,18 +430,18 @@ export class RoomService { async deleteMessageToReceive(userId) { - + const allDeleteMessages = await DeleteMessageModel.filter({rid: this.id}).execute() for(let message_ of allDeleteMessages) { - + if(message_.needToReceiveBy.includes(userId)) { message_.needToReceiveBy = message_.needToReceiveBy.filter((e)=> e != userId) this.sendFalseTypingReadMessage('deleteMessage',{_id:message_.messageId}) if(message_.needToReceiveBy.length == 0) { - + const deleteMessage = await DeleteMessageModel.get({messageId: message_.messageId}) await deleteMessage.delete() @@ -452,10 +450,10 @@ export class RoomService { } } - + } - } + } async receiveMessageDelete() { @@ -470,7 +468,7 @@ export class RoomService { if(message.delate == false) { this.deleteMessage(DeletedMessageId) } - + } ) } @@ -480,17 +478,17 @@ export class RoomService { * @param id message ID */ async deleteMessage(_id) { - + const id = _id for (let i =0; i <= this.messages.length; i++) { if(this.messages[i]?._id == id ) { - + if (SessionStore.user.UserName == this.messages[i]?.u?.username) { const allMemberThatIsOffline = this.getAllMemberThatIsOffline() - + DeleteMessageModel.create({ messageId: this.messages[i]._id, rid: this.messages[i].rid, @@ -499,7 +497,7 @@ export class RoomService { needToReceiveBy: allMemberThatIsOffline }) } - + this.messages[i]?.delateDB() this.messages.splice(i, 1) @@ -516,7 +514,7 @@ export class RoomService { return true } else { - // + // } } @@ -532,7 +530,7 @@ export class RoomService { } async delateMessageToSendToOthers(userId) { - + const deleteMessage = await DeleteMessageModel.all(); const toSend = deleteMessage.filter((DeleteMessage:string[])=> ! DeleteMessage.includes(userId)) @@ -546,7 +544,7 @@ export class RoomService { await message.delateStatusFalse() if(this.NetworkServiceService.getCurrentNetworkStatus() == ConnectionStatus.Online) { - + this.RochetChatConnectorService.deleteMessage(msgId).then(async() => { message.delateRequest = true await message.saveChanges(); @@ -557,7 +555,7 @@ export class RoomService { this.RochetChatConnectorService.registerCallback({ type: 'reConnect', funx: async ()=> { - + this.sendDeleteRequest(msgId) return true } @@ -575,7 +573,7 @@ export class RoomService { if(file && this.message) { this.send({}) } - + const localReference = uuidv4(); let offlineChatMessage = { @@ -593,20 +591,20 @@ export class RoomService { console.log('offlineChatMessage', offlineChatMessage) this.message= '' - + const message: MessageService = await this.prepareCreate({message:offlineChatMessage, save: environment.chatOffline}) this.registerSendMessage(message) if(this.hasLoadHistory == true) { await message.addMessageDB() } - + message.send() message.from = 'send' message.loadHistory = this.hasLoadHistory if (environment.chatOffline) { - + setTimeout(() => { this.scrollDown() }, 150) @@ -717,17 +715,65 @@ export class RoomService { return `${day}-${month}-${year}`; } + sortArrayISODate(messages: any): any[] { + + return messages.sort((a,b) => + new Date(b._updatedAt ).getTime() + - + new Date(a._updatedAt).getTime()) + } + restoreOnce = false - dateLabel: any = []; + labelDates = [] + + + goshPush(ChatMessage) { + let currentDateMessage = new Date(ChatMessage._updatedAt).toLocaleDateString() + + if(currentDateMessage) { + if(!this.labelDates.find( e => e == currentDateMessage)) { + this.labelDates.push(currentDateMessage) + + const newMessage = this.fix_updatedAt({...ChatMessage}) + newMessage.msg = currentDateMessage + const cloneMessage = new MessageServiceDateLabel() + + cloneMessage.ChatSystemService = this.ChatSystemService + cloneMessage.setData({...newMessage} as any) + // + cloneMessage._id = "" + cloneMessage._updatedAt = "" + cloneMessage.msg = currentDateMessage + cloneMessage.dateLabel = true + cloneMessage.delate = false + + if(new Date().toLocaleDateString() == currentDateMessage) { + + cloneMessage.msg = "hoje" + } else { + cloneMessage.msg = currentDateMessage + } + + this.messages.push(cloneMessage as any) + + console.log(currentDateMessage) + } + } + } + async restoreMessageFromDB() { if(environment.chatOffline && this.restoreOnce == false) { this.restoreOnce = true - const messages = await MessageModel.filter({rid:this.id}).execute() + const messages = this.sortArrayISODate(await MessageModel.filter({rid:this.id}).execute()).reverse() + console.log('MessageModel', messages) - - for (let ChatMessage of messages) { + + for (let ChatMessage of messages) { + + + this.goshPush(ChatMessage) const wewMessage = await this.simplePrepareMessage(ChatMessage) @@ -745,9 +791,9 @@ export class RoomService { message.loadHistory = this.hasLoadHistory wewMessage.messageModelInstance = ChatMessage message?.decryptMessage() - + } else { - + const offlineMessage = await this.prepareCreate({message:ChatMessage}) offlineMessage.from = 'Offline' @@ -765,10 +811,10 @@ export class RoomService { } if(!this.lastMessage) { - this.lastMessage = messages.pop(); + this.lastMessage = messages.pop(); } - - + + setTimeout(() => { this.scrollDown() }, 50) @@ -803,8 +849,9 @@ export class RoomService { messagesToSave.received = users.map((user) => user._id) messagesToSave.addMessageDB() + this.goshPush(messagesToSave) } - + } @@ -813,7 +860,8 @@ export class RoomService { if(messagesToSave != null) { messagesToSave.received = users.map((user) => user._id) - messagesToSave.addMessageDB() + + this.addMessageDB.push(messagesToSave) } } this.messagesBeforeOfflineAPI = [] @@ -821,11 +869,11 @@ export class RoomService { setTimeout(() => { this.scrollDown() }, 50) - + } if(chatHistory?.result?.messages) { - + if(!this.lastMessage) { this.lastMessage = chatHistory?.result?.messages.pop() as any } @@ -834,6 +882,13 @@ export class RoomService { } + + addMessageDB = FIFOProcessQueue(async ({messagesToSave}, callback) => { + + await messagesToSave.addMessageDB() + callback() + }) + async readAllMessage() { this.ViewedMessageService.requestReadAll(this) @@ -870,11 +925,11 @@ export class RoomService { const wewMessage = new MessageService(this.NfService, this.RochetChatConnectorService, this.ChatMethodsService, this.AESEncrypt, this.AttachmentsService, this.NetworkServiceService, this.ChatSystemService,this.notificationService) wewMessage.setData(message) wewMessage.loadHistory = this.hasLoadHistory - + if(save) { this.messages.push(wewMessage) } - + return wewMessage } @@ -895,7 +950,7 @@ export class RoomService { return true } } - + return false } @@ -911,7 +966,7 @@ export class RoomService { private async findMessageInDBByLocalReference({localReference}) { const a = await MessageModel.get({localReference: localReference}) - + return typeof a.id == 'number' } @@ -921,7 +976,7 @@ export class RoomService { } private async findMessageInDBByData({localReference, _id}) { - + const a = await MessageModel.filter({localReference: localReference}).execute() if(a.length >= 1) { @@ -990,7 +1045,7 @@ export class RoomService { } async addContacts(userId:any) { - + let body = { "roomId": this.id, "userId": userId, @@ -1002,12 +1057,12 @@ export class RoomService { async updateContacts() { - + let res let error = false if(this.t == 'd') { - + try { res = await this.chatService.getMembers(this.id).toPromise(); } catch (e) { @@ -1049,7 +1104,7 @@ export class RoomService { if(error) { res = await this.chatService.getChannelMembers(this.id).toPromise() } - + } } diff --git a/src/app/services/task.service.ts b/src/app/services/task.service.ts index 068542df7..06b4e286f 100644 --- a/src/app/services/task.service.ts +++ b/src/app/services/task.service.ts @@ -14,7 +14,6 @@ import { DespachoService } from 'src/app/Rules/despacho.service'; import { CustomTaskPipe } from '../pipes/custom-task.pipe'; import { SessionStore } from 'src/app/store/session.service'; import { EventsService } from './events.service'; -import { SortService } from './functions/sort.service'; import { customTask } from '../models/dailyworktask.model'; import { Router } from '@angular/router'; import { v4 as uuidv4 } from 'uuid' @@ -486,4 +485,14 @@ export class TaskService { } } + + attachmentAppName(e) { + const ApplicationId = e.ApplicationId || e.ApplicationType + if( ApplicationId =='8' || ApplicationId ==8) { + return 'Correspondencia' + } else if (ApplicationId =='361' || ApplicationId ==361) { + return 'ArquivoDespachoElect' + } + } + } diff --git a/src/app/shared/agenda/new-event/new-event.page.html b/src/app/shared/agenda/new-event/new-event.page.html index 9237e8b01..50e9746ee 100644 --- a/src/app/shared/agenda/new-event/new-event.page.html +++ b/src/app/shared/agenda/new-event/new-event.page.html @@ -318,12 +318,13 @@

{{document.Assunto}} - {{document.appName}} + {{ TaskService.attachmentAppName(document)}} + {{document.appName}}

-

{{document.EntidadeOrganicaNome}} {{document.Data | date: 'dd-MM-yyyy HH:mm'}}

+

{{(document.EntidadeOrganicaNome || document.Sender)}} {{(document.Data || document.DocDate) | date: 'dd-MM-yyyy HH:mm'}}

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 b21b67aff..171b676bb 100644 --- a/src/app/shared/agenda/new-event/new-event.page.ts +++ b/src/app/shared/agenda/new-event/new-event.page.ts @@ -33,6 +33,7 @@ import { EventToAprove } from 'src/app/models/eventToAprove.model'; import { ProcessesService } from 'src/app/services/processes.service'; import { Subject } from 'rxjs'; +import { TaskService } from 'src/app/services/task.service' const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { parse: { dateInput: "YYYY-MMMM-DD HH:mm" @@ -141,6 +142,7 @@ export class NewEventPage implements OnInit { private chatMethodService: ChatMethodsService, private hhtpErrorHandle: HttpErrorHandle, private processeService: ProcessesService, + public TaskService: TaskService ) { this.dateAdapter.setLocale('pt'); this.loggeduser = SessionStore.user; diff --git a/src/app/shared/chat/group-messages/group-messages.page.html b/src/app/shared/chat/group-messages/group-messages.page.html index 0d4b5eb4b..0cd98f95f 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.html +++ b/src/app/shared/chat/group-messages/group-messages.page.html @@ -42,14 +42,14 @@
-
-
+
+
-
+
{{msg.u.name}} {{msg.duration}}
@@ -61,7 +61,7 @@ Enviado - + Lido @@ -107,7 +107,7 @@ Enviado - + Lido @@ -120,7 +120,7 @@
- + {{ file.title}} @@ -164,7 +164,7 @@ Enviado - + Lido diff --git a/src/app/shared/chat/group-messages/group-messages.page.scss b/src/app/shared/chat/group-messages/group-messages.page.scss index 10a24294b..e3cfc5dea 100644 --- a/src/app/shared/chat/group-messages/group-messages.page.scss +++ b/src/app/shared/chat/group-messages/group-messages.page.scss @@ -328,4 +328,13 @@ padding: 6px; border-radius: 10px; cursor: pointer; -} \ No newline at end of file +} + + +.dateLabel { + background: #ebebeb !important; + float: unset !important; + margin: 0px auto !important; + width: 110px; + text-align: center; +} diff --git a/src/app/shared/chat/messages/messages.page.html b/src/app/shared/chat/messages/messages.page.html index 165bd22d4..ab245d97d 100644 --- a/src/app/shared/chat/messages/messages.page.html +++ b/src/app/shared/chat/messages/messages.page.html @@ -33,21 +33,22 @@ - +
-
-
+ *ngFor="let msg of ChatSystemService.getDmRoom(roomId).messages; index as i; let last = last" > + +
+
-
+
{{msg.u.name}} {{msg.duration}}
@@ -57,11 +58,11 @@ Apagou a mensagem - - + + Enviado - + Lido @@ -102,10 +103,10 @@
image - + Enviado - + Lido @@ -118,7 +119,7 @@
- + {{ file.title}} @@ -130,7 +131,7 @@
- + @@ -166,13 +167,13 @@ {{file.description}} - + - + Enviado - + Lido @@ -210,7 +211,7 @@
- +
diff --git a/src/app/shared/chat/messages/messages.page.scss b/src/app/shared/chat/messages/messages.page.scss index 362684b35..3e6dad75b 100644 --- a/src/app/shared/chat/messages/messages.page.scss +++ b/src/app/shared/chat/messages/messages.page.scss @@ -403,3 +403,12 @@ ion-footer { .enviado { font-size: rem(11); } + + +.dateLabel { + background: #ebebeb !important; + float: unset !important; + margin: 0px auto !important; + width: 110px; + text-align: center; +} diff --git a/src/global.scss b/src/global.scss index a9859e333..0366517a9 100644 --- a/src/global.scss +++ b/src/global.scss @@ -678,13 +678,13 @@ td.monthview-secondary-with-event, td.monthview-secondary-with-event[_ngcontent- outline: 0; } - - .btn-no-color { + + .btn-no-color { ion-icon { font-size: rem(35); } } - + // center app-diploma-assinar ion-content .main-content, @@ -1159,7 +1159,7 @@ background: rgb(92, 92, 92); // .mat-select-value { // display: table-cell; -// max-width: unset !important; +// max-width: unset !important; // width: 100% !important; // /* text-overflow: ellipsis; */ // /* white-space: nowrap; */ @@ -1477,7 +1477,7 @@ ngx-mat-datetime-content .actions { position: relative; top: -66px; margin-bottom: -44px; - + button { z-index: 11111111; } @@ -1522,7 +1522,7 @@ ion-textarea.heigh-200 textarea { font-size: rem(12); color: red; } - + .new-task { border-radius: 20px; background: #efefef; @@ -1591,7 +1591,7 @@ ion-textarea.heigh-200 textarea { -app-tiny-mce { +app-tiny-mce { justify-content: flex-start !important; } @@ -1603,11 +1603,11 @@ app-tiny-mce { @media only screen and (min-width: 100px) { - + html, body, .viewport-font-size { font-size: 14px; } - + } @media only screen and (min-width: 500px) { @@ -1654,3 +1654,8 @@ h5, .buttons{ .lowercase { text-transform: lowercase; } + + +.welcome-text { + margin-bottom: 15px; +} diff --git a/src/plugin/showDateDuration.js b/src/plugin/showDateDuration.js index 93d850d33..9dae76b48 100644 --- a/src/plugin/showDateDuration.js +++ b/src/plugin/showDateDuration.js @@ -1,4 +1,3 @@ - function addZero(i) { if (i < 10) { i = "0" + i; @@ -7,36 +6,39 @@ function addZero(i) { } function showDateDuration(start) { - let end; - end = new Date(); - start = new Date(start); - let customizedDate; + let end; + end = new Date(); + start = new Date(start); + let customizedDate; + const totalSeconds = Math.floor((end - start) / 1000); + const totalMinutes = Math.floor(totalSeconds / 60); + const totalHours = Math.floor(totalMinutes / 60); + const totalDays = Math.floor(totalHours / 24); - const totalSeconds = Math.floor((end - (start))/1000);; - const totalMinutes = Math.floor(totalSeconds/60); - const totalHours = Math.floor(totalMinutes/60); - const totalDays = Math.floor(totalHours/24); + const hours = totalHours - totalDays * 24; + const minutes = totalMinutes - totalDays * 24 * 60 - hours * 60; + const seconds = + totalSeconds - totalDays * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60; - const hours = totalHours - ( totalDays * 24 ); - const minutes = totalMinutes - ( totalDays * 24 * 60 ) - ( hours * 60 ); - const seconds = totalSeconds - ( totalDays * 24 * 60 * 60 ) - ( hours * 60 * 60 ) - ( minutes * 60 ); - - if(totalDays == 0){ - if(start.getDate() == new Date().getDate()){ - let time = start.getHours() + ":" + addZero(start.getUTCMinutes()); - return time; - } - else{ - return 'Ontem'; - } - } - else{ - let date = addZero(start.getDate()) + "-" + addZero(start.getMonth()+1) + "-" + start.getFullYear(); - return date; + let time = start.getHours() + ":" + addZero(start.getUTCMinutes()); + if (totalDays == 0) { + if (start.getDate() == new Date().getDate()) { + return time; + } else { + return time; } + } else { + let date = + addZero(start.getDate()) + + "-" + + addZero(start.getMonth() + 1) + + "-" + + start.getFullYear(); + return date; + } } module.exports = { - showDateDuration: showDateDuration -}; \ No newline at end of file + showDateDuration: showDateDuration, +};