mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
merge developer to feature/search
This commit is contained in:
@@ -3,4 +3,5 @@ export class AuthConnstants{
|
||||
/* My reference key */
|
||||
public static readonly AUTH = 'userDataKey';
|
||||
public static readonly PROFILE = 'profile';
|
||||
public static readonly USER = 'userId';
|
||||
}
|
||||
@@ -18,7 +18,7 @@
|
||||
<!-- <ion-icon name="file-tray-stacked"></ion-icon> -->
|
||||
<ion-icon class="nav-icon" src="assets/images/icons-nav-gabinete-inactive.svg"></ion-icon>
|
||||
<ion-badge color="danger">{{totalExpediente}}</ion-badge>
|
||||
<ion-label>Gabinete Digital</ion-label>
|
||||
<ion-label>Gabinete</ion-label>
|
||||
</ion-tab-button>
|
||||
<ion-tab-button tab="publications">
|
||||
<ion-icon class="nav-icon" src="assets/images/icons-nav-actions.svg"></ion-icon>
|
||||
@@ -27,8 +27,8 @@
|
||||
<ion-tab-button tab="search">
|
||||
<ion-icon name="search"></ion-icon>
|
||||
<ion-label>Pesquisa</ion-label>
|
||||
</ion-tab-button>
|
||||
<!-- <ion-tab-button tab="chat">
|
||||
</ion-tab-button>
|
||||
<ion-tab-button tab="chat">
|
||||
<ion-icon class="nav-icon" src="assets/images/icons-nav-chat-inactive.svg"></ion-icon>
|
||||
<ion-label>Chat</ion-label>
|
||||
</ion-tab-button>
|
||||
|
||||
@@ -24,13 +24,13 @@ export class HomePage implements OnInit {
|
||||
//Initialize profile as mdgpr
|
||||
this.profile = "mdgpr";
|
||||
if(this.profile == "mdgpr"){
|
||||
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.eventService.getAllMdEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.eventsList = res;
|
||||
this.totalEvent = this.eventsList.length;
|
||||
});
|
||||
}
|
||||
else{
|
||||
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 00:00:00', formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.eventService.getAllPrEvents(formatDate(new Date(), 'yyyy-MM-dd HH:mm:ss', 'pt'), formatDate(new Date(), 'yyyy-MM-dd', 'pt') + ' 23:59:59').subscribe(res => {
|
||||
this.eventsList = res;
|
||||
this.totalEvent = this.eventsList.length;
|
||||
});
|
||||
|
||||
@@ -86,9 +86,16 @@ export class ChatPage implements OnInit {
|
||||
getDirectMessages(){
|
||||
this.showLoader = true;
|
||||
|
||||
this.result = this.chatService.getAllDirectMessages().subscribe((res:any)=>{
|
||||
this.userDirectMessages = res.ims;
|
||||
console.log(res);
|
||||
/* this.result = */
|
||||
this.chatService.getAllDirectMessages().subscribe((res:any)=>{
|
||||
console.log(res.ims);
|
||||
|
||||
this.userDirectMessages = res.ims.sort((a,b)=>{
|
||||
var dateA = new Date(a.lastMessage._updatedAt).getTime();
|
||||
var dateB = new Date(b.lastMessage._updatedAt).getTime();
|
||||
return dateB - dateB;
|
||||
});
|
||||
console.log(this.userDirectMessages);
|
||||
|
||||
this.showLoader = false;
|
||||
});
|
||||
|
||||
@@ -104,6 +104,11 @@ export class EventsPage implements OnInit {
|
||||
|
||||
} */
|
||||
|
||||
this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
console.log(res);
|
||||
|
||||
});
|
||||
|
||||
this.showGreeting();
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
|
||||
@@ -55,14 +55,14 @@ export class LoginPage implements OnInit {
|
||||
await alert.present();
|
||||
}
|
||||
|
||||
loginRocketChat(){
|
||||
/* loginRocketChat(){
|
||||
this.authService.loginChat(this.postData).subscribe((res: any) =>{
|
||||
this.storageService.store(AuthConnstants.AUTH, res.data);
|
||||
console.log('Login to Rocket chat OK');
|
||||
},(error:any) =>{
|
||||
console.log('Network error');
|
||||
});
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ export class LoginPage implements OnInit {
|
||||
BasicAuthKey: ""
|
||||
}
|
||||
if (await this.authService.login(this.userattempt)){
|
||||
this.loginRocketChat();
|
||||
this.router.navigate(['/home/events']);this.presentAlert('1');
|
||||
/* this.loginRocketChat(); */
|
||||
this.router.navigate(['/home/events']);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -75,8 +75,8 @@
|
||||
<div class="d-flex ion-justify-content-center ion-text-center">
|
||||
<!-- SLIDE -->
|
||||
<ion-slides class="slide" pager="false" [options]="slideOpts">
|
||||
<ion-slide *ngFor="let category of searchCategories">
|
||||
<div class="button" (click)="filterDocList(category.Name)">
|
||||
<ion-slide *ngFor="let category of searchCategories; index as i;">
|
||||
<div class="button" (click)="filterDocList(category.Name)" [ngClass]="{'active-category': category.Active}">
|
||||
<p>{{ category.Name }}</p>
|
||||
<ion-label class="label">{{ category.Qtd }}</ion-label>
|
||||
</div>
|
||||
@@ -88,7 +88,6 @@
|
||||
<ion-icon src="assets/images/icons-most-searched-words-open.svg" class="icon" slot="end"></ion-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex ion-wrap word-searh-result-container">
|
||||
@@ -103,11 +102,15 @@
|
||||
<div class="header">
|
||||
<div class="d-flex ion-justify-content-between ion-align-items-center">
|
||||
<div class="d-flex sort-by ion-justify-content-center">
|
||||
<p><span class="order">Order por:</span><span class="order-labal">Mais Recente</span></p>
|
||||
<p>
|
||||
<span class="order">Order por:</span>
|
||||
<span *ngIf="ordinance == 'recent'" class="order-labal">Mais Recente</span>
|
||||
<span *ngIf="ordinance == 'old'" class="order-labal">Mais Antigo</span>
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<ion-icon *ngIf="ordinance == 'recent'" (click)="changeOrder('old')" src="assets/images/icons-arrow-arrow-up.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ordinance == 'old'" (click)="changeOrder('recent')" src="assets/images/icons-arrow-arrow-down-25.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ordinance == 'recent'" (click)="reorderList('old')" src="assets/images/icons-arrow-arrow-up.svg"></ion-icon>
|
||||
<ion-icon *ngIf="ordinance == 'old'" (click)="reorderList('recent')" src="assets/images/icons-arrow-arrow-down-25.svg"></ion-icon>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -61,13 +61,21 @@ export class SearchPage implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
close(){
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
|
||||
changeOrder(order: string){
|
||||
this.ordinance = order;
|
||||
reorderList(orderBy: string){
|
||||
|
||||
this.ordinance = orderBy;
|
||||
|
||||
if(this.ordinance == 'recent'){
|
||||
this.showSearchDocuments = this.sortArrayISODate(this.searchDocuments);
|
||||
} else {
|
||||
this.showSearchDocuments = this.sortArrayISODate(this.searchDocuments).reverse();
|
||||
}
|
||||
}
|
||||
|
||||
sortArrayISODate(myArray: any){
|
||||
@@ -82,15 +90,17 @@ export class SearchPage implements OnInit {
|
||||
*/
|
||||
basicSearch(){
|
||||
|
||||
console.log(this.searchDocumentDate);
|
||||
|
||||
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId).subscribe(res=>{
|
||||
|
||||
res.Categories.forEach( e => {
|
||||
e['Active'] = false;
|
||||
});
|
||||
|
||||
// bind respose
|
||||
this.searchCategories = res.Categories;
|
||||
|
||||
this.searchDocuments = this.sortArrayISODate(res.Documents);
|
||||
this.showSearchDocuments = this.sortArrayISODate(this.searchDocuments);
|
||||
|
||||
// hide show document
|
||||
if(this.searchDocuments.length >= 1){
|
||||
|
||||
@@ -13,12 +13,17 @@ import { AuthConnstants } from '../config/auth-constants';
|
||||
})
|
||||
export class AuthService {
|
||||
userData$ = new BehaviorSubject<any>('');
|
||||
userId$ = new BehaviorSubject<any>('');
|
||||
headers: HttpHeaders;
|
||||
opts:any;
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private httpService: HttpService,
|
||||
private storageService:StorageService,
|
||||
private router:Router
|
||||
) { }
|
||||
) {
|
||||
this.headers = new HttpHeaders();
|
||||
}
|
||||
|
||||
public ValidatedUser:User;
|
||||
|
||||
@@ -26,11 +31,21 @@ export class AuthService {
|
||||
user.BasicAuthKey = 'Basic ' + btoa(user.domainName + '\\' + user.username + ':' + user.password); //conversão em base64 das credenciais inseridas
|
||||
|
||||
const options = { headers: {'Authorization': user.BasicAuthKey }};
|
||||
this.headers = this.headers.set('Authorization',user.BasicAuthKey);
|
||||
this.opts = {
|
||||
headers: this.headers,
|
||||
}
|
||||
const service = environment.apiURL + "userauthentication/GetValidateAuth";
|
||||
|
||||
let result: boolean | PromiseLike<boolean>;
|
||||
let response: any;
|
||||
|
||||
result = await this.http.get<boolean>(service, options).toPromise();
|
||||
this.http.post(environment.apiURL + "UserAuthentication/Login", '', this.opts).subscribe(res=>{
|
||||
this.storageService.store(AuthConnstants.USER, res);
|
||||
});
|
||||
|
||||
|
||||
|
||||
if (result)
|
||||
{
|
||||
@@ -56,6 +71,12 @@ export class AuthService {
|
||||
this.userData$.next(res);
|
||||
});
|
||||
}
|
||||
//Get user Id | global object
|
||||
getUserId(){
|
||||
this.storageService.get(AuthConnstants.USER).then(res=>{
|
||||
this.userId$.next(res);
|
||||
});
|
||||
}
|
||||
|
||||
getProfile(){
|
||||
this.storageService.get(AuthConnstants.PROFILE).then(res=>{
|
||||
|
||||
@@ -17,7 +17,7 @@ export class HeaderPage implements OnInit {
|
||||
async openSearch() {
|
||||
const modal = await this.modalController.create({
|
||||
component: SearchPage,
|
||||
cssClass: 'search',
|
||||
cssClass: 'group-messages',
|
||||
componentProps: {
|
||||
}
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
apiURL: 'http://gpr-dev-01.gabinetedigital.local/GabineteDigital.Services/V3/api/',
|
||||
apiURL: 'https://equilibrium.dyndns.info/GabineteDigital.Services/V3/api/',
|
||||
apiChatUrl: 'http://chat.gabinetedigital.local:3000/api/v1/',
|
||||
domain: 'gabinetedigital.local',
|
||||
defaultuser: 'paulo.pinto',
|
||||
|
||||
Reference in New Issue
Block a user