Improve modal search

This commit is contained in:
Peter Maquiran
2021-01-29 16:25:03 +01:00
parent b7d9838612
commit 0b86c30f82
4 changed files with 136 additions and 2 deletions
+11
View File
@@ -138,6 +138,17 @@ export class AgendaPage implements OnInit {
},5000)
// console.log(setHours(setMinutes(new Date(), 0), 12))
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
// AccoesPresidenciais = Correspondencia = 0
setCookie('searchModalAPPType','0', 99999999);
}
ngOnInit() {
@@ -19,7 +19,17 @@ export class GabineteDigitalPage implements OnInit {
private processesbackend:ProcessesService,
private modalController: ModalController,
private eventService: EventsService,
private alertService: AlertService) { }
private alertService: AlertService) {
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
// AccoesPresidenciais = Correspondencia = 8
setCookie('searchModalAPPType','8,361', 99999999);
}
count_exp_dailywork=0;
count_exp_pp : string;
@@ -39,9 +39,19 @@ export class PublicationsPage implements OnInit {
private animationController: AnimationController,
private loading: LoadingService,
private publications: PublicationsService,
) {
) {
this.months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
this.days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
function setCookie(cname, cvalue, exdays) {
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
// AccoesPresidenciais = AccoesPresidenciais = 386,,
setCookie('searchModalAPPType','386', 99999999);
}
ngOnInit() {
+103
View File
@@ -88,6 +88,106 @@ export class SearchPage implements OnInit {
*/
basicSearch(){
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
const APPType = getCookie('searchModalAPPType');
if(APPType == '0'){
console.log('aplication type 0');
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '0').subscribe(res=>{
console.log(res);
res.Categories.forEach( e => {
e['Active'] = false;
});
// bind respose
this.searchCategories = res.Categories;
this.searchDocuments = this.sortArrayISODate(res.Documents);
this.reorderList(this.ordinance);
// hide show document
if(this.searchDocuments.length >= 1){
this.showDocuments = true;
} else {
this.showDocuments = false
}
});
} else if (APPType == '8,361'){
console.log('aplication type 8,361');
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '8').subscribe(res=>{
console.log(res);
res.Categories.forEach( e => {
e['Active'] = false;
});
// bind respose
this.searchCategories = res.Categories;
this.searchDocuments = this.sortArrayISODate(res.Documents);
this.reorderList(this.ordinance);
// hide show document
if(this.searchDocuments.length >= 1){
this.showDocuments = true;
} else {
this.showDocuments = false
}
});
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '361').subscribe(res=>{
console.log(res);
res.Categories.forEach( e => {
e['Active'] = false;
});
// bind respose
this.searchCategories = res.Categories;
this.searchDocuments = this.sortArrayISODate(res.Documents);
this.reorderList(this.ordinance);
// hide show document
if(this.searchDocuments.length >= 1){
this.showDocuments = true;
} else {
this.showDocuments = false
}
});
} else if (APPType == '386'){
console.log('aplication type 386');
this.search.basicSearch(this.searchSubject, this.searchDocumentDate, this.searchSender
,this.searchOrganicEntiry, this.searchDocTypeId, '386').subscribe(res=>{
console.log(res);
@@ -111,6 +211,9 @@ export class SearchPage implements OnInit {
}
});
}
}
/**