diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 83bd08cfa..08f5b548a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,7 +13,7 @@ import { HttpClientModule } from '@angular/common/http'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; -import { File } from '@ionic-native/File/ngx'; +//import { File } from '@ionic-native/File/ngx'; import { WebView } from '@ionic-native/ionic-webview/ngx'; import { FilePath } from '@ionic-native/file-path/ngx'; import { Camera } from '@ionic-native/camera/ngx'; @@ -53,7 +53,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }, InAppBrowser, Camera, - File, + //File, WebView, FilePath, ], diff --git a/src/app/pages/agenda/agenda.page.html b/src/app/pages/agenda/agenda.page.html index 5cb9cdebe..6f827411d 100644 --- a/src/app/pages/agenda/agenda.page.html +++ b/src/app/pages/agenda/agenda.page.html @@ -5,6 +5,7 @@
{{ searchDocument.Assunto}}
diff --git a/src/app/pages/search/search.page.scss b/src/app/pages/search/search.page.scss index 5b92e2f08..fa5ec326e 100644 --- a/src/app/pages/search/search.page.scss +++ b/src/app/pages/search/search.page.scss @@ -199,7 +199,6 @@ ion-slide{ } .most-searched-word-container{ - width: 441px; height: 400px; } } @@ -211,42 +210,42 @@ ion-slide{ @media only screen and (min-width: 1024px) { -// .header-main { -// background-color: #0782c9; -// .profile{ -// display: inline-block; -// } -// .icon-most-searched-word-open{ -// display: none !important; -// } -// } + .header-main { + background-color: #0782c9; + .profile{ + display: inline-block; + } + .icon-most-searched-word-open{ + display: none !important; + } + } -// .options{ -// .container{ -// border-bottom: 1px solid #ebebeb; -// .icon{ -// display: flex; -// } -// } -// padding: 0px 20px; -// } + .options{ + .container{ + border-bottom: 1px solid #ebebeb; + .icon{ + display: flex; + } + } + padding: 0px 20px; + } -// .search-result{ -// border-left: 1px solid #d8d8d8; -// .header{ -// border-top: unset !important; -// } -// } + .search-result{ + border-left: 1px solid #d8d8d8; + .header{ + border-top: unset !important; + } + } -// .most-searched-words{ -// width: 400px !important; -// } + .most-searched-words{ + width: 400px !important; + } -// .word-searh-result-container{ -// flex-wrap: wrap; -// } + .word-searh-result-container{ + flex-wrap: wrap; + } } diff --git a/src/app/pages/search/search.page.ts b/src/app/pages/search/search.page.ts index 3d8d77d8f..09991ba83 100644 --- a/src/app/pages/search/search.page.ts +++ b/src/app/pages/search/search.page.ts @@ -1,17 +1,14 @@ import { Component, OnInit } from '@angular/core'; import { ModalController } from '@ionic/angular'; -import { ProcessesService } from 'src/app/services/processes.service'; import { SearchService } from "../../services/search.service"; import { SearchCategory } from "src/app/models/search-category"; import { SearchDocument } from "src/app/models/search-document"; import { formatDate } from '@angular/common'; -import { CloudData, CloudOptions } from 'angular-tag-cloud-module'; import { SenderPage } from 'src/app/pages/search/sender/sender.page'; import { OrganicEntityPage } from 'src/app/pages/search/organic-entity/organic-entity.page'; -import WordCloud from 'src/plugin/wordcloud2.js' -import { TopSearch } from 'src/app/models/top-search'; - -import { NgModel } from '@angular/forms'; +import WordCloud from 'src/plugin/wordcloud2.js'; +import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page'; +import { PublicationDetailPage } from '../publications/view-publications/publication-detail/publication-detail.page'; @Component({ selector: 'app-search', templateUrl: './search.page.html', @@ -39,15 +36,6 @@ export class SearchPage implements OnInit { height: number = 411; width: number = 411; - - data: CloudData[] = [ - {text: 'Docents', weight: 0.1, color: '#ffaaee'}, - {text: '1232', weight: 0.2, tooltip: 'display a tooltip'}, - {text: 'Dcuments', weight: 0.1, color: '#ffaaee'}, - {text: 'Cat', weight: 0.3, color: '#ffaaee'}, - {text: 'Dogs', weight: 0.1, tooltip: 'display a tooltip'}, - {text: 'cars', weight: 0.2, color: '#ffaaee'}, - ]; // See http://idangero.us/swiper/api/ for valid options. slideOpts = { @@ -56,28 +44,51 @@ export class SearchPage implements OnInit { speed: 400, } + loadedAttachments:any; list = [] constructor(private modalController: ModalController, - private search: SearchService) { + private search: SearchService, + private modalCtrl: ModalController,) { this.ordinance = "recent"; } ngOnInit() { - this.search.mostSeachWord("10").subscribe(res=>{ + this.wordCloud() + } - let list = [] + wordCloud(){ - res.forEach(element => { - list.push(Object.values(element)) + this.search.mostSeachWord("15").subscribe(res=>{ + + const container = document.querySelector('.most-searched-word-container'); + + container.setAttribute('style',`width: ${window.innerWidth}px`); + + const highest= res[0].Hits; + const lowest = res[res.length-1].Hits; + const range = highest - lowest; + const perPercent = range / 100; + let list = []; + + // minimum font sixe + // Editable ----------------------------------- + const minimumSize = 9; + // Editable ------------------------------------ + const maximum = 64; + + res.forEach(e => { + const array: any = Object.values(e); + + array[1] = (((array[1] - lowest) / perPercent) * (maximum - minimumSize)/ 100 ) + minimumSize; + list.push(array) }); this.list = list - - const elem = document.documentElement.querySelector('.most-searched-word-container'); + const elem = document.documentElement.querySelector('.most-searched-word-container'); WordCloud( elem, @@ -89,7 +100,6 @@ export class SearchPage implements OnInit { ); }); - } close(){ @@ -123,7 +133,6 @@ export class SearchPage implements OnInit { if(window.location.pathname == '/home/agenda'){ - console.log('aplication type 0'); this.showLoader = true; @@ -153,7 +162,6 @@ export class SearchPage implements OnInit { }); } else if (window.location.pathname =='/home/gabinete-digital'){ - console.log('aplication type 8,361'); this.showLoader = true; @@ -209,8 +217,6 @@ export class SearchPage implements OnInit { this.showLoader = true; - console.log('aplication type 386'); - this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender ,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{ console.log(res); @@ -245,6 +251,13 @@ export class SearchPage implements OnInit { */ clearSearchInput(){ this.searchSubject = "" + + this.searchCategories = []; + this.searchDocuments = []; + this.showDocuments = false; + + this.wordCloud(); + } /** @@ -260,11 +273,18 @@ export class SearchPage implements OnInit { activeCategoty(i){ - this.searchCategories.forEach((e) => { - e['Active'] = false; + this.searchCategories.forEach((e, j) => { + if(i != j){ + e['Active'] = false; + } }) - this.searchCategories[i]['Active'] = true; + if (this.searchCategories[i]['Active']){ + this.searchCategories[i]['Active'] = false; + } else { + this.searchCategories[i]['Active'] = true + } + } clearInputRemetente(){ @@ -290,7 +310,7 @@ export class SearchPage implements OnInit { const modal = await this.modalController.create({ component: SenderPage, - cssClass: 'sender', + cssClass: 'modal modal-desktop', componentProps: { } }); @@ -308,7 +328,7 @@ export class SearchPage implements OnInit { const modal = await this.modalController.create({ component: OrganicEntityPage, - cssClass: 'organicEnity', + cssClass: 'modal modal-desktop', componentProps: { } }); @@ -334,4 +354,57 @@ export class SearchPage implements OnInit { this.showCategory = categoryName; } -} \ No newline at end of file + + + itemIcons(): string{ + return window.location.pathname + } + + viewDocument(){ + const url: string = this.loadedAttachments.DocumentURL.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1"); + // const browser = this.iab.create(url,"_blank"); + // browser.show(); + } + + + async viewDetail(id:any) { + + if(window.location.pathname == '/home/agenda'){ + + const modal = await this.modalCtrl.create({ + component: ViewEventPage, + componentProps:{ + eventId: id + }, + cssClass: 'modal', + backdropDismiss: false + }); + await modal.present(); + modal.onDidDismiss().then((res)=>{}); + + } else if(window.location.pathname == '/home/publications'){ + + this.viewPublicationDetail(id); + } + + } + + async viewPublicationDetail(publicationId:string) { + const modal = await this.modalController.create({ + component: PublicationDetailPage, + componentProps:{ + publicationId: publicationId, + }, + cssClass: 'publication-detail', + backdropDismiss: false + }); + + await modal.present(); + modal.onDidDismiss().then(()=>{}); + + } + +} + + + diff --git a/src/app/pages/search/sender/sender.page.html b/src/app/pages/search/sender/sender.page.html index 928716704..50117aa85 100644 --- a/src/app/pages/search/sender/sender.page.html +++ b/src/app/pages/search/sender/sender.page.html @@ -1,13 +1,15 @@ -