improve create publication

This commit is contained in:
Peter Maquiran
2022-10-04 16:04:23 +01:00
parent f5644ff5bb
commit ea89f72a33
6 changed files with 15 additions and 58 deletions
@@ -105,7 +105,7 @@
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-textarea-class">
<div class="ion-textarea-class" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom ">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
</div>
</div>
@@ -126,6 +126,9 @@ export class NewActionPage implements OnInit {
Date: new FormControl(this.dateValid, [
Validators.required
]),
Detail: new FormControl(this.folder.Detail, [
Validators.required
])
})
}
+5 -50
View File
@@ -12,7 +12,7 @@ import { AESEncrypt } from '../services/aesencrypt.service';
import { CookieService } from 'ngx-cookie-service';
import { RochetChatConnectorService } from 'src/app/services/chat/rochet-chat-connector.service';
import { Router } from '@angular/router';
import { NfService } from 'src/app/services/chat/nf.service'
import { NfService } from 'src/app/services/chat/nf.service';
import { MessageService } from 'src/app/services/chat/message.service';
import { ProcessesService } from 'src/app/services/processes.service';
import { AttachmentsService } from 'src/app/services/attachments.service';
@@ -97,10 +97,6 @@ export class AuthService {
SetSession(response: LoginUserRespose, user:UserForm) {
const session: UserSession = Object.assign(SessionStore.user, response)
if (response) {
if( session.RoleID == 100000014) {
session.Profile = 'PR'
@@ -124,58 +120,25 @@ export class AuthService {
this.initialsService.getInitials(session.FullName);
}
//Login to rocketChat server2
//user: UserForm
async loginChat(responseChat = this.ValidatedUserChat) {
if(SessionStore?.user?.ChatData) {
this.ValidatedUserChat = SessionStore.user.ChatData
}
/* const expirationMinutes = 30;
let date = new Date().getTime();
let expirationDate = new Date(new Date().getTime() + expirationMinutes*60*1000);
let postData = {
"user": SessionStore.user.UserName,
"password": SessionStore.user.Password,
}
let responseChat = await this.httpService.post('login', postData).toPromise();
if(responseChat) {
this.ValidatedUserChat = responseChat;
localStorage.setItem('userChat', JSON.stringify(responseChat));
this.storageService.store(AuthConnstants.AUTH, responseChat);
}
else{
this.presentAlert('Network error');
}
this.autoLoginChat(expirationDate.getTime() - date); */
}
async autoLoginChat(expirationDate:number) {
/* setTimeout(()=>{
this.loginChat(this.ValidatedUserChat);
}, expirationDate) */
}
loginToChatWs() {
setTimeout(()=>{
setTimeout(() => {
this.RochetChatConnectorService.connect();
this.RochetChatConnectorService.login().then((message: any) => {
SessionStore.user.RochetChatUserId = message.result.id
SessionStore.save()
//
this.RochetChatConnectorService.setStatus('online')
setTimeout(() => {
@@ -185,7 +148,6 @@ export class AuthService {
// alert('wsLogin')
}).catch((message) => {
// alert('ws login failed')
})
@@ -239,8 +201,6 @@ export class AuthService {
if (message.file.type == "application/img") {
const event: any = await this.AttachmentsService.downloadFile(message.file.guid).toPromise();
if (event.type === HttpEventType.DownloadProgress) {
//this.downloadProgess = Math.round((100 * event.loaded) / event.total);
//
@@ -267,7 +227,7 @@ export class AuthService {
}
autologout(expirationDate:number) {
setTimeout(()=>{
setTimeout(() => {
this.logout();
}, expirationDate)
}
@@ -278,14 +238,14 @@ export class AuthService {
localStorage.removeItem('userChat');
SessionStore.setInativity(false)
SessionStore.setUrlBeforeInactivity(this.router.url)
SessionStore.setUrlBeforeInactivity(this.router.url);
setTimeout(() => {
this.router.navigateByUrl('/', { replaceUrl: true });
}, 100)
}
//Get user data from RocketChat | global object
// Get user data from RocketChat | global object
getUserData() {
this.storageService.get(AuthConnstants.AUTH).then(res=>{
this.userData$.next(res);
@@ -293,11 +253,6 @@ export class AuthService {
}
logoutChat() {
//this.storageService.clear();
/* this.storageService.removeStorageItem(AuthConnstants.AUTH).then(res =>{
this.userData$.next('');
this.router.navigate(['']);
}) */
}
async presentAlert(message: string) {
@@ -599,8 +599,6 @@ export class ChatSystemService {
this.loadingUsers = true
let _res
// console.log('getuser')
try {
_res = await this.ChatService.getAllUsers().toPromise();
} catch (error) {
@@ -97,12 +97,12 @@
</div>
</div>
<div class="container-div">
<div class="container-div" >
<div class="ion-item-class-2 d-flex">
<div class="ion-icon-class">
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div>
<div class="ion-textarea-class flex-grow-1">
<div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom ">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea>
</div>
</div>
@@ -85,16 +85,17 @@ export class NewActionPage implements OnInit {
injectValidation() {
this.Form = new FormGroup({
Subject: new FormControl(this.folder.Description, [
Validators.required,
// Validators.minLength(4)
//Validators.minLength(1)
]),
Date: new FormControl(this.dateValid, [
Validators.required
]),
Detail: new FormControl(this.folder.Detail, [
Validators.required
])
})
}