mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
merge
This commit is contained in:
@@ -11,6 +11,7 @@ import { DocumentDetailPage } from 'src/app/modals/document-detail/document-deta
|
||||
import { SearchCategory, SearchList } from 'src/app/models/search-document';
|
||||
import { ThemeService } from 'src/app/services/theme.service'
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-search',
|
||||
@@ -62,7 +63,8 @@ export class SearchPage implements OnInit {
|
||||
private search: SearchService,
|
||||
private modalCtrl: ModalController,
|
||||
private navParams: NavParams,
|
||||
public ThemeService: ThemeService)
|
||||
public ThemeService: ThemeService,
|
||||
private router: Router)
|
||||
{
|
||||
this.ordinance = "recent";
|
||||
this.currentPath= window.location.pathname;
|
||||
@@ -166,9 +168,7 @@ export class SearchPage implements OnInit {
|
||||
|
||||
wordCloud() {
|
||||
|
||||
this.search.mostSeachWord("15").subscribe(res=>{
|
||||
|
||||
console.log('LOAD LIST');
|
||||
this.search.mostSeachWord("15").subscribe( res => {
|
||||
|
||||
const highest= res[0].Hits;
|
||||
const lowest = res[res.length-1].Hits;
|
||||
@@ -191,7 +191,6 @@ export class SearchPage implements OnInit {
|
||||
});
|
||||
|
||||
this.list = list
|
||||
console.log('set list')
|
||||
|
||||
const elem = document.documentElement.querySelector('.most-searched-word-container');
|
||||
|
||||
@@ -213,7 +212,7 @@ export class SearchPage implements OnInit {
|
||||
|
||||
loadWordCloud() {
|
||||
|
||||
setTimeout(()=>{
|
||||
setTimeout(() => {
|
||||
const elem = document.documentElement.querySelector('.most-searched-word-container');
|
||||
|
||||
WordCloud(
|
||||
@@ -386,7 +385,7 @@ export class SearchPage implements OnInit {
|
||||
let counter = 0;
|
||||
|
||||
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '8').subscribe(res=>{
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '8').subscribe(res => {
|
||||
res.Categories.forEach( e => {
|
||||
e['Active'] = false;
|
||||
this.searchCategories.push(e)
|
||||
@@ -426,7 +425,7 @@ export class SearchPage implements OnInit {
|
||||
});
|
||||
|
||||
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '361').subscribe(res=>{
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '361').subscribe(res => {
|
||||
|
||||
res.Categories.forEach( e => {
|
||||
e['Active'] = false;
|
||||
@@ -442,7 +441,7 @@ export class SearchPage implements OnInit {
|
||||
this.reorderList(this.ordinance);
|
||||
|
||||
// hide show document
|
||||
if(this.searchDocuments.length >= 1){
|
||||
if(this.searchDocuments.length >= 1) {
|
||||
this.showDocuments = true;
|
||||
} else {
|
||||
this.showDocuments = false
|
||||
@@ -544,7 +543,7 @@ export class SearchPage implements OnInit {
|
||||
|
||||
counter++;
|
||||
|
||||
if(counter ==2){
|
||||
if(counter ==2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
@@ -552,7 +551,7 @@ export class SearchPage implements OnInit {
|
||||
},error => {
|
||||
counter++;
|
||||
|
||||
if(counter ==2){
|
||||
if(counter ==2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
this.searchResult = "Registo não encontrado"
|
||||
@@ -561,9 +560,13 @@ export class SearchPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
else if (this.type == "AccoesPresidenciais"){
|
||||
else if (this.type == "AccoesPresidenciais") {
|
||||
|
||||
let counter = 0;
|
||||
|
||||
this.showLoader = true;
|
||||
this.searchCategories = []
|
||||
this.searchDocuments = []
|
||||
|
||||
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{
|
||||
@@ -571,12 +574,18 @@ export class SearchPage implements OnInit {
|
||||
|
||||
res.Categories.forEach( e => {
|
||||
e['Active'] = false;
|
||||
e['Name'] = "Publicações"
|
||||
});
|
||||
|
||||
// bind respose
|
||||
this.searchCategories = res.Categories;
|
||||
for ( const a of res.Categories) {
|
||||
this.searchCategories.push(a);
|
||||
}
|
||||
|
||||
this.searchDocuments = this.sortArrayISODate(res.Documents);
|
||||
for ( const a of this.sortArrayISODate(res.Documents)) {
|
||||
a.DocTypeDesc = "Publicações"
|
||||
this.searchDocuments.push(a);
|
||||
}
|
||||
|
||||
this.reorderList(this.ordinance);
|
||||
|
||||
@@ -587,13 +596,71 @@ export class SearchPage implements OnInit {
|
||||
this.showDocuments = false
|
||||
}
|
||||
|
||||
this.showLoader = false;
|
||||
counter++;
|
||||
|
||||
if(counter ==2){
|
||||
this.showLoader = false;
|
||||
}
|
||||
|
||||
this.loadWordCloud();
|
||||
},error => {
|
||||
this.showLoader = false;
|
||||
counter++;
|
||||
|
||||
if(counter ==2){
|
||||
this.showLoader = false;
|
||||
}
|
||||
this.searchResult = "Registo não encontrado"
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
|
||||
|
||||
this.search.basicSearchPublication(this.searchSubject, this.searchDocumentDate, this.searchSender
|
||||
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res => {
|
||||
|
||||
|
||||
res.Categories.forEach( e => {
|
||||
e['Active'] = false;
|
||||
e['Name'] = "Acções"
|
||||
});
|
||||
|
||||
// bind respose
|
||||
for ( const a of res.Categories) {
|
||||
this.searchCategories.push(a);
|
||||
}
|
||||
|
||||
|
||||
|
||||
for ( const a of this.sortArrayISODate(res.Documents)) {
|
||||
a.DocTypeDesc = "Acções"
|
||||
this.searchDocuments.push(a);
|
||||
}
|
||||
|
||||
this.reorderList(this.ordinance);
|
||||
|
||||
// hide show document
|
||||
if(this.searchDocuments.length >= 1) {
|
||||
this.showDocuments = true;
|
||||
} else {
|
||||
this.showDocuments = false
|
||||
}
|
||||
|
||||
counter++;
|
||||
|
||||
if(counter ==2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
this.loadWordCloud();
|
||||
}, error => {
|
||||
counter++;
|
||||
|
||||
if(counter ==2) {
|
||||
this.showLoader = false;
|
||||
}
|
||||
this.searchResult = "Registo não encontrado"
|
||||
console.log(error)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -636,7 +703,7 @@ export class SearchPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
clearInputRemetente(){
|
||||
clearInputRemetente() {
|
||||
this.searchSender = "";
|
||||
}
|
||||
|
||||
@@ -704,6 +771,7 @@ export class SearchPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
TodosCategory = true
|
||||
async filterDocList(categoryName:string){
|
||||
|
||||
// show all category
|
||||
@@ -716,6 +784,27 @@ export class SearchPage implements OnInit {
|
||||
}
|
||||
|
||||
this.showCategory = categoryName;
|
||||
|
||||
for(let category of this.searchCategories) {
|
||||
if(category['Active']) {
|
||||
this.TodosCategory = false
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
this.TodosCategory = true
|
||||
|
||||
}
|
||||
|
||||
|
||||
noFilter() {
|
||||
this.TodosCategory = true
|
||||
let n = 0
|
||||
for(let category of this.searchCategories) {
|
||||
this.searchCategories[n]['Active'] = false
|
||||
n++
|
||||
}
|
||||
this.showSearchDocuments = this.searchDocuments;
|
||||
}
|
||||
|
||||
|
||||
@@ -735,6 +824,7 @@ export class SearchPage implements OnInit {
|
||||
const ApplicationType = searchDocument.ApplicationType.toString()
|
||||
const Id = searchDocument.Id
|
||||
const CalendarId = searchDocument.ApplicationName.split(':')[1]
|
||||
const DocTypeDesc = searchDocument.DocTypeDesc
|
||||
|
||||
if(this.select == false) {
|
||||
if(this.type == "Agenda") {
|
||||
@@ -754,31 +844,41 @@ export class SearchPage implements OnInit {
|
||||
|
||||
} else if(this.type == "AccoesPresidenciais") {
|
||||
|
||||
this.viewPublicationDetail(Id);
|
||||
this.viewPublicationDetail(Id, DocTypeDesc);
|
||||
}
|
||||
else if(this.type == "AccoesPresidenciais & ArquivoDespachoElect") {
|
||||
|
||||
if(ApplicationType == '8' || ApplicationType == '361') {
|
||||
|
||||
// 361
|
||||
if(ApplicationType == '8') {
|
||||
this.viewDocumentDetail(Id, ApplicationType);
|
||||
} else if (ApplicationType == '361') {
|
||||
this.viewDocumentModal(searchDocument)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async viewPublicationDetail(publicationId:string) {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps:{
|
||||
publicationId: publicationId,
|
||||
isModal: true
|
||||
},
|
||||
cssClass: 'publication-detail modal modal-desktop ',
|
||||
//backdropDismiss: false
|
||||
});
|
||||
async viewPublicationDetail(publicationId:string, DocTypeDesc) {
|
||||
// validation my friend
|
||||
|
||||
if(DocTypeDesc == 'Acções') {
|
||||
this.router.navigate(['/home/publications', publicationId]);
|
||||
} else if( DocTypeDesc == 'Publicações') {
|
||||
const modal = await this.modalController.create({
|
||||
component: PublicationDetailPage,
|
||||
componentProps:{
|
||||
publicationId: publicationId,
|
||||
isModal: true
|
||||
},
|
||||
cssClass: 'publication-detail modal modal-desktop ',
|
||||
//backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(()=>{});
|
||||
}
|
||||
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(()=>{});
|
||||
|
||||
}
|
||||
|
||||
@@ -805,4 +905,41 @@ export class SearchPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
|
||||
async viewDocumentModal(LoadedDocument) {
|
||||
|
||||
let task = {
|
||||
serialNumber: '',
|
||||
taskStartDate: '',
|
||||
isEvent: true,
|
||||
workflowInstanceDataFields: {
|
||||
FolderID: '',
|
||||
Subject: LoadedDocument.SourceName || LoadedDocument.Assunto,
|
||||
SourceSecFsID: LoadedDocument.ApplicationId || LoadedDocument.ApplicationType,
|
||||
SourceType: 'DOC',
|
||||
SourceID: LoadedDocument.Id || LoadedDocument.Id,
|
||||
DispatchNumber: ''
|
||||
}
|
||||
}
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
component: ViewDocumentPage,
|
||||
componentProps: {
|
||||
trustedUrl: '',
|
||||
file: {
|
||||
title: task.workflowInstanceDataFields.Subject,
|
||||
url: '',
|
||||
title_link: '',
|
||||
},
|
||||
Document: LoadedDocument,
|
||||
applicationId: task.workflowInstanceDataFields.SourceSecFsID,
|
||||
docId: task.workflowInstanceDataFields.SourceID ,
|
||||
folderId: '',
|
||||
task: task
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
await modal.present();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user