mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
Take out all special characters in string
This commit is contained in:
@@ -8,8 +8,6 @@ import {
|
|||||||
ComponentRef,
|
ComponentRef,
|
||||||
ComponentFactory,
|
ComponentFactory,
|
||||||
Output,
|
Output,
|
||||||
AfterViewChecked,
|
|
||||||
AfterViewInit
|
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { ModalController, Platform } from '@ionic/angular';
|
import { ModalController, Platform } from '@ionic/angular';
|
||||||
import { AuthService } from 'src/app/services/auth.service';
|
import { AuthService } from 'src/app/services/auth.service';
|
||||||
@@ -40,7 +38,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
|
|||||||
templateUrl: './chat.page.html',
|
templateUrl: './chat.page.html',
|
||||||
styleUrls: ['./chat.page.scss'],
|
styleUrls: ['./chat.page.scss'],
|
||||||
})
|
})
|
||||||
export class ChatPage implements OnInit, AfterViewInit {
|
export class ChatPage implements OnInit {
|
||||||
|
|
||||||
showLoader: boolean;
|
showLoader: boolean;
|
||||||
|
|
||||||
@@ -164,42 +162,25 @@ export class ChatPage implements OnInit, AfterViewInit {
|
|||||||
this.openNewGroupPage();
|
this.openNewGroupPage();
|
||||||
} */
|
} */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.router.events.forEach((event) => {
|
this.router.events.forEach((event) => {
|
||||||
if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
|
if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
|
||||||
alert('Aqui' + this.dataService.get("newGroup"))
|
|
||||||
if (this.dataService.get("newGroup")) {
|
if (this.dataService.get("newGroup")) {
|
||||||
this.openNewGroupPage();
|
this.openNewGroupPage();
|
||||||
}
|
}
|
||||||
/* if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/chat')) {
|
else{
|
||||||
alert(this.dataService.get("newGroup"))
|
this.closeAllDesktopComponents();
|
||||||
|
this.showEmptyComponent = true;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
if (this.dataService.get("newGroup")) {
|
|
||||||
this.openNewGroupPage();
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
this.dataService.set("newGroup", false);
|
this.dataService.set("newGroup", false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (this.dataService.get("newGroup")) {
|
|
||||||
this.openNewGroupPage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewInit() {
|
|
||||||
alert(this.dataService.get("newGroup"))
|
|
||||||
}
|
|
||||||
|
|
||||||
ngAfterViewChecked(){
|
|
||||||
//alert(this.dataService.get("newGroup"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnDestroy() {
|
ngOnDestroy() {
|
||||||
this.setStatus('offline');
|
this.setStatus('offline');
|
||||||
|
this.dataService.set("newGroup", false);
|
||||||
console.log('On Destroy')
|
console.log('On Destroy')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -513,6 +494,13 @@ export class ChatPage implements OnInit, AfterViewInit {
|
|||||||
console.log('Chat list', res);
|
console.log('Chat list', res);
|
||||||
|
|
||||||
if (res != 200) {
|
if (res != 200) {
|
||||||
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
|
this.userDirectMessages = res.ims.sort((a, b) => {
|
||||||
|
var dateA = new Date(a._updatedAt).getTime();
|
||||||
|
var dateB = new Date(b._updatedAt).getTime();
|
||||||
|
return dateB - dateA;
|
||||||
|
});
|
||||||
|
}
|
||||||
//console.log(res.ims);
|
//console.log(res.ims);
|
||||||
/* this.userDirectMessages = res.ims.sort((a, b) => {
|
/* this.userDirectMessages = res.ims.sort((a, b) => {
|
||||||
var dateA = new Date(a._updatedAt).getTime();
|
var dateA = new Date(a._updatedAt).getTime();
|
||||||
@@ -557,9 +545,10 @@ export class ChatPage implements OnInit, AfterViewInit {
|
|||||||
this.chatService.getAllUsers().subscribe(res => {
|
this.chatService.getAllUsers().subscribe(res => {
|
||||||
console.log('chatusers', res);
|
console.log('chatusers', res);
|
||||||
this.transformDataUserList(res['users'])
|
this.transformDataUserList(res['users'])
|
||||||
|
if (this.platform.is('desktop') || this.platform.is('mobileweb')) {
|
||||||
//this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
|
this.dmUsers = res['users'].filter(data => data.username != this.loggedUserChat.me.username);
|
||||||
//console.log(this.dmUsers);
|
console.log(this.dmUsers);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-6
@@ -634,13 +634,8 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openNewGroupPage() {
|
openNewGroupPage() {
|
||||||
console.log(this.fulltask);
|
|
||||||
this.dataService.set("newGroup", true);
|
|
||||||
|
|
||||||
this.router.navigate(['/home/chat']);
|
|
||||||
this.dataService.set("newGroup", true);
|
|
||||||
|
|
||||||
if (window.innerWidth < 801) {
|
if (window.innerWidth < 801) {
|
||||||
|
this.router.navigate(['/home/chat']);
|
||||||
this.newGroup();
|
this.newGroup();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -648,6 +643,7 @@ export class ExpedienteDetailPage implements OnInit {
|
|||||||
this.dataService.set("task", this.task);
|
this.dataService.set("task", this.task);
|
||||||
this.dataService.set("newGroupName", this.task.Folio);
|
this.dataService.set("newGroupName", this.task.Folio);
|
||||||
this.dataService.set("documents", this.fulltask.Documents);
|
this.dataService.set("documents", this.fulltask.Documents);
|
||||||
|
this.router.navigate(['/home/chat']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { analyzeAndValidateNgModules } from '@angular/compiler';
|
import { analyzeAndValidateNgModules } from '@angular/compiler';
|
||||||
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core';
|
||||||
|
import { NavigationStart, Router } from '@angular/router';
|
||||||
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
|
import { ModalController, NavParams, PickerController, PopoverController } from '@ionic/angular';
|
||||||
import { ChatService } from 'src/app/services/chat.service';
|
import { ChatService } from 'src/app/services/chat.service';
|
||||||
import { DataService } from 'src/app/services/data.service';
|
import { DataService } from 'src/app/services/data.service';
|
||||||
@@ -35,22 +36,29 @@ export class NewGroupPage implements OnInit{
|
|||||||
private chatService: ChatService,
|
private chatService: ChatService,
|
||||||
private dataService:DataService,
|
private dataService:DataService,
|
||||||
private processesService: ProcessesService,
|
private processesService: ProcessesService,
|
||||||
|
private router: Router,
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.isGroupCreated = false;
|
this.isGroupCreated = false;
|
||||||
//this.groupName = this.navParams.get('name');
|
//this.groupName = this.navParams.get('name');
|
||||||
|
alert('New group '+this.dataService.get("newGroup"))
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
//alert(this.dataService.get("newGroup"))
|
this.router.events.forEach((event) => {
|
||||||
setTimeout(() => {
|
if (event instanceof NavigationStart && event.url.startsWith('/home/chat')) {
|
||||||
//alert(this.dataService.get("newGroup"))
|
alert('New group '+this.dataService.get("newGroup"))
|
||||||
}, 100)
|
if (this.dataService.get("newGroup")) {
|
||||||
if(this.dataService.get("newGroup") == true){
|
this.task = this.dataService.get("task");
|
||||||
this.task = this.dataService.get("task");
|
this.groupName = this.task.Folio;
|
||||||
this.groupName = this.task.Folio;
|
this.documents = this.dataService.get("documents");
|
||||||
this.documents = this.dataService.get("documents");
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
this.dataService.set("newGroup", false);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log(this.task);
|
console.log(this.task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,6 +90,8 @@ export class NewGroupPage implements OnInit{
|
|||||||
|
|
||||||
createGroup(){
|
createGroup(){
|
||||||
let name = this.groupName.split(' ').join('-');
|
let name = this.groupName.split(' ').join('-');
|
||||||
|
//Take out all special characters in string
|
||||||
|
name = name.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
|
||||||
let body = { "name":name, }
|
let body = { "name":name, }
|
||||||
this.chatService.addGroup(body).subscribe(res=>{
|
this.chatService.addGroup(body).subscribe(res=>{
|
||||||
console.log('group created');
|
console.log('group created');
|
||||||
|
|||||||
Reference in New Issue
Block a user