All changes i made

This commit is contained in:
Eudes Inácio
2023-02-27 09:34:36 +01:00
77 changed files with 8025 additions and 6717 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
server: { server: {
command: `http-server -a 127.0.0.1 --port ${port} ./www`, command: `http-server -a 127.0.0.1 --port ${port} ./www`,
port: port, port: port,
launchTimeout: 8000 launchTimeout: 10000
}, },
launch: { launch: {
dumpio: true, dumpio: true,
+7201 -5745
View File
File diff suppressed because it is too large Load Diff
+7 -5
View File
@@ -101,8 +101,8 @@
"@pdftron/pdfjs-express": "^8.0.1", "@pdftron/pdfjs-express": "^8.0.1",
"@sentry/angular": "^7.13.0", "@sentry/angular": "^7.13.0",
"@sentry/capacitor": "^0.10.1", "@sentry/capacitor": "^0.10.1",
"@types/jest-environment-puppeteer": "^4.4.1", "@types/jest-environment-puppeteer": "^5.0.3",
"@types/puppeteer": "^5.4.4", "@types/puppeteer": "^7.0.4",
"alasql": "^1.7.3", "alasql": "^1.7.3",
"angular-calendar": "^0.28.22", "angular-calendar": "^0.28.22",
"angular-cropperjs": "^0.1.5", "angular-cropperjs": "^0.1.5",
@@ -151,7 +151,8 @@
"ionic2-alpha-scroll": "^2.0.1", "ionic2-alpha-scroll": "^2.0.1",
"ionic2-calendar": "^0.6.6", "ionic2-calendar": "^0.6.6",
"ionicons": "^5.5.3", "ionicons": "^5.5.3",
"jest-puppeteer": "^5.0.4", "jest": "^27.5.1",
"jest-puppeteer": "^7.0.1",
"jetifier": "^1.6.8", "jetifier": "^1.6.8",
"lite-server": "^2.6.1", "lite-server": "^2.6.1",
"moment": "^2.29.3", "moment": "^2.29.3",
@@ -172,6 +173,7 @@
"sharp": "^0.30.7", "sharp": "^0.30.7",
"socket.io-client": "^2.3.0", "socket.io-client": "^2.3.0",
"ts-jest": "^27.0.3", "ts-jest": "^27.0.3",
"ts-jest-puppeteer": "^0.0.5",
"tslib": "^2.0.0", "tslib": "^2.0.0",
"uuidv4": "^6.2.11", "uuidv4": "^6.2.11",
"wordcloud": "^1.1.2", "wordcloud": "^1.1.2",
@@ -209,7 +211,8 @@
"es6-promise-plugin": "^4.2.2", "es6-promise-plugin": "^4.2.2",
"jasmine-core": "~3.6.0", "jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0", "jasmine-spec-reporter": "~5.0.0",
"jest": "^27.0.6", "jest-environment-jsdom": "^29.4.3",
"jest-jasmine2": "^29.4.3",
"jest-preset-angular": "^9.0.4", "jest-preset-angular": "^9.0.4",
"karma": "^6.3.20", "karma": "^6.3.20",
"karma-chrome-launcher": "~3.1.0", "karma-chrome-launcher": "~3.1.0",
@@ -217,7 +220,6 @@
"karma-jasmine": "~4.0.0", "karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0", "karma-jasmine-html-reporter": "^1.5.0",
"protractor": "~7.0.0", "protractor": "~7.0.0",
"ts-jest-puppeteer": "0.0.5",
"ts-node": "~8.3.0", "ts-node": "~8.3.0",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"typescript": "^4.3.5", "typescript": "^4.3.5",
@@ -21,6 +21,7 @@ import { PedidoService } from 'src/app/Rules/pedido.service'
import { fullTask } from 'src/app/models/dailyworktask.model'; import { fullTask } from 'src/app/models/dailyworktask.model';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -98,6 +99,7 @@ export class CreateProcessPage implements OnInit {
private despachoService: DespachoService, private despachoService: DespachoService,
private pedidoService: PedidoService, private pedidoService: PedidoService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpsErrorHanlde: HttpErrorHandle
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
@@ -297,14 +299,9 @@ export class CreateProcessPage implements OnInit {
await this.despachoService.EfectuarDespacho({note: this.dispatchFolder.Message, serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise(); await this.despachoService.EfectuarDespacho({note: this.dispatchFolder.Message, serialnumber: this.task.serialNumber, activityInstanceName: this.task.activityInstanceName}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Despacho criado'); this.httpsErrorHanlde.httpsSucessMessagge('Efetuar Despacho')
} catch (error) { } catch (error) {
if(error?.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove() loader.remove()
@@ -333,15 +330,10 @@ export class CreateProcessPage implements OnInit {
} }
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Pedido de Parecer enviado'); this.httpsErrorHanlde.httpsSucessMessagge('Solicitar Parecer')
} }
catch (error) { catch (error) {
if(error?.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -363,15 +355,10 @@ export class CreateProcessPage implements OnInit {
await this.pedidoService.taskCompleteDeferimento({note: this.postData.DispatchFolder.Message,serialNumber:this.task.serialNumber}).toPromise(); await this.pedidoService.taskCompleteDeferimento({note: this.postData.DispatchFolder.Message,serialNumber:this.task.serialNumber}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Pedido de Deferimento criado'); this.httpsErrorHanlde.httpsSucessMessagge('Pedido de Deferimento')
} }
catch (error) { catch (error) {
if(error?.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -397,14 +384,9 @@ export class CreateProcessPage implements OnInit {
await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber, note: this.dispatchFolder.Message}).toPromise(); await this.despachoService.CompleteTask({serialNumber: this.task.serialNumber, note: this.dispatchFolder.Message}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Despacho criado'); this.httpsErrorHanlde.httpsSucessMessagge('Efetuar Despacho')
} catch (error) { } catch (error) {
if(error?.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove(); loader.remove();
} }
@@ -437,15 +419,10 @@ export class CreateProcessPage implements OnInit {
} }
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Pedido de Parecer criado'); this.httpsErrorHanlde.httpsSucessMessagge('Solicitar Parecer')
} }
catch (error) { catch (error) {
if(error.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -467,15 +444,10 @@ export class CreateProcessPage implements OnInit {
await this.pedidoService.taskCompleteDeferimento({note: this.postData.DispatchFolder.Message, serialNumber:this.task.serialNumber}).toPromise(); await this.pedidoService.taskCompleteDeferimento({note: this.postData.DispatchFolder.Message, serialNumber:this.task.serialNumber}).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Pedido de Deferimento criado'); this.httpsErrorHanlde.httpsSucessMessagge('Pedido de Deferimento')
} }
catch (error) { catch (error) {
if(error.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -528,14 +500,9 @@ export class CreateProcessPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService._successMessage(message); this.httpsErrorHanlde.httpsSucessMessagge('Efetuar Despacho')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpsErrorHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não efectuado');
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -4,7 +4,8 @@ import { SearchList } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { ProcessesService } from 'src/app/services/processes.service'; import { ProcessesService } from 'src/app/services/processes.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-dar-parecer', selector: 'app-dar-parecer',
@@ -23,7 +24,8 @@ export class DarParecerPage implements OnInit {
private navParams: NavParams, private navParams: NavParams,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHanlde: HttpErrorHandle
) { ) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('ProcessInstanceID'); this.instanceId = this.navParams.get('ProcessInstanceID');
@@ -66,13 +68,9 @@ export class DarParecerPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.modalController.dismiss('sucess'); this.modalController.dismiss('sucess');
this.toastService._successMessage('Parecer enviado'); this.httpErroHanlde.httpsSucessMessagge('Dar o meu Parecer')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHanlde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest("Parecer não solicitado");
}
} finally { } finally {
loader.remove() loader.remove()
} }
+5 -7
View File
@@ -13,6 +13,7 @@ import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.pag
import { SearchList } from 'src/app/models/search-document'; import { SearchList } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -52,7 +53,8 @@ export class DelegarPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.postData = new Event(); this.postData = new Event();
@@ -103,15 +105,11 @@ export class DelegarPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
this.processes.DelegateTask(body).subscribe(res=>{ this.processes.DelegateTask(body).subscribe(res=>{
this.toastService._successMessage('Processo delegado') this.httpErrorHandle.httpsSucessMessagge('Delegar')
this.close(); this.close();
}, },
(error)=>{ (error)=>{
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest("Processo não delegado")
}
}, },
()=>{ ()=>{
loader.remove() loader.remove()
@@ -35,7 +35,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postData.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postData.Location"></ion-input>
</div> </div>
</div> </div>
</div> </div>
+5 -8
View File
@@ -16,6 +16,7 @@ import { SearchList } from 'src/app/models/search-document';
import { SearchPage } from 'src/app/pages/search/search.page'; import { SearchPage } from 'src/app/pages/search/search.page';
import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page'; import { AttendeesPageModal } from 'src/app/pages/events/attendees/attendees.page';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -55,7 +56,8 @@ export class ForwardPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
private animationController: AnimationController, private animationController: AnimationController,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.task = this.navParams.get('task'); this.task = this.navParams.get('task');
this.postData = new Event(); this.postData = new Event();
@@ -147,16 +149,11 @@ export class ForwardPage implements OnInit {
"AttachmentList" :docs, "AttachmentList" :docs,
} }
this.processes.CompleteParecerPrTask(body).subscribe(res=>{ this.processes.CompleteParecerPrTask(body).subscribe(res=>{
this.toastService._successMessage('Processo Reencaminhado'); this.httpErroHandle.httpsSucessMessagge('Reencaminhar')
this.goBack(); this.goBack();
}, },
(error)=>{ (error)=>{
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest("Processo não delegado")
}
}); });
} }
} }
@@ -38,7 +38,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div> </div>
</div> </div>
</div> </div>
@@ -350,6 +350,6 @@
<ion-footer class="background-whit"> <ion-footer class="background-whit">
<div class="buttons"> <div class="buttons">
<button class="btn-cancel cursor-pointer" shape="round" (click)="close()">Cancelar</button> <button class="btn-cancel cursor-pointer" shape="round" (click)="close()">Cancelar</button>
<button class="btn-ok cursor-pointer" shape="round" (click)="save()">Enviar</button> <button class="btn-ok cursor-pointer" shape="round" (click)="save()">Gravar</button>
</div> </div>
</ion-footer> </ion-footer>
@@ -15,6 +15,7 @@ import { ThemeService } from 'src/app/services/theme.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -90,7 +91,8 @@ export class EditEventPage implements OnInit {
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private toastService: ToastService, private toastService: ToastService,
private router: Router, private router: Router,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) { ) {
/* this.postEvent = new Event(); */ /* this.postEvent = new Event(); */
@@ -343,15 +345,10 @@ export class EditEventPage implements OnInit {
} }
this.toastService._successMessage(); this.httpErrorHandle.httpsSucessMessagge('Editar evento')
}, error => { }, error => {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}); });
} else { } else {
this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => { this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).subscribe(async () => {
@@ -371,15 +368,10 @@ export class EditEventPage implements OnInit {
} }
this.toastService._successMessage(); this.httpErrorHandle.httpsSucessMessagge('Editar evento')
}, error => { }, error => {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
}); });
} }
@@ -6,6 +6,7 @@ import { EditEventToApproveComponent } from 'src/app/shared/gabinete-digital/edi
import { EmendMessageModalPage } from '../emend-message-modal/emend-message-modal.page'; import { EmendMessageModalPage } from '../emend-message-modal/emend-message-modal.page';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -25,6 +26,7 @@ export class EventActionsPopoverPage implements OnInit {
private popoverController: PopoverController, private popoverController: PopoverController,
private toastService: ToastService, private toastService: ToastService,
private RouteService: RouteService, private RouteService: RouteService,
private httpErrorHandle: HttpErrorHandle,
public ThemeService: ThemeService) { public ThemeService: ThemeService) {
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
this.instanceId = this.navParams.get('InstanceId'); this.instanceId = this.navParams.get('InstanceId');
@@ -57,15 +59,10 @@ export class EventActionsPopoverPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento aprovar') this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não aprovar')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -81,15 +78,10 @@ export class EventActionsPopoverPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.toastService._successMessage('Evento enviado para revisão'); this.httpErrorHandle.httpsSucessMessagge('Rever')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -128,15 +120,10 @@ export class EventActionsPopoverPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage('Evento enviado para revisão'); this.httpErrorHandle.httpsSucessMessagge('Rever')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
this.toastService.badRequest(); this.toastService.badRequest();
} }
finally { finally {
@@ -159,15 +146,10 @@ export class EventActionsPopoverPage implements OnInit {
const loader = this.toastService.loading(); const loader = this.toastService.loading();
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
this.toastService._successMessage('Evento rejeitado') this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não rejeitado')
}
} }
finally { finally {
loader.remove(); loader.remove();
@@ -54,7 +54,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div> </div>
</div> </div>
</div> </div>
@@ -329,7 +329,7 @@
<ion-title></ion-title> <ion-title></ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<button class="btn-ok cursor-pointer" fill="clear" color="#fff" (click)="save()"> <button class="btn-ok cursor-pointer" fill="clear" color="#fff" (click)="save()">
<ion-label>Enviar</ion-label> <ion-label>Gravar</ion-label>
</button> </button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
@@ -18,6 +18,7 @@ import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service'; import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -97,6 +98,7 @@ export class NewEventPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private platform: Platform, private platform: Platform,
private chatMethodService: ChatMethodsService, private chatMethodService: ChatMethodsService,
private hhtpErrorHandle: HttpErrorHandle
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.postEvent = new Event(); this.postEvent = new Event();
@@ -440,17 +442,12 @@ export class NewEventPage implements OnInit {
this.chatMethodService.sendMessage(this.roomId, data1); this.chatMethodService.sendMessage(this.roomId, data1);
} }
this.toastService._successMessage() this.hhtpErrorHandle.httpsSucessMessagge('new event');
let data = Object.assign(this.postEvent,{id:eventId}) let data = Object.assign(this.postEvent,{id:eventId})
this.modalController.dismiss(data); this.modalController.dismiss(data);
} catch (error) { } catch (error) {
if(error.status == 0) { this.hhtpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -19,6 +19,7 @@ import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { CalendarService } from 'src/app/store/calendar.service'; import { CalendarService } from 'src/app/store/calendar.service';
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service'
@Component({ @Component({
@@ -72,6 +73,7 @@ export class ViewEventPage implements OnInit {
private RouteService: RouteService, private RouteService: RouteService,
private ionicStorage: Storage, private ionicStorage: Storage,
private CalendarService: CalendarService, private CalendarService: CalendarService,
private httpErrorHandle: HttpErrorHandle
) { ) {
@@ -199,7 +201,7 @@ export class ViewEventPage implements OnInit {
if (error.status === 0) { if (error.status === 0) {
this.getFromDb(); this.getFromDb();
} else { } else {
this.toastService.badRequest('Este evento já não existe na sua agenda') this.httpErrorHandle.httpStatusHandle(error)
loader.remove() loader.remove()
this.modalController.dismiss('Eevent not Foud'); this.modalController.dismiss('Eevent not Foud');
this.RouteService.goBack(); this.RouteService.goBack();
@@ -277,7 +279,7 @@ export class ViewEventPage implements OnInit {
alert.dismiss(); alert.dismiss();
}, 1500); }, 1500);
this.goBack(); this.goBack();
this.toastService._successMessage('Evento apagado'); this.httpErrorHandle.httpsSucessMessagge('delete event')
}, () => { }, }, () => { },
() => { () => {
loader.remove(); loader.remove();
@@ -188,9 +188,7 @@ export class GroupMessagesPage implements OnInit, AfterViewInit, OnDestroy {
let containerHeight = windowHeight - e.srcElement.clientHeight; let containerHeight = windowHeight - e.srcElement.clientHeight;
if (scroll > this.currentPosition) { if (scroll > this.currentPosition) {
//alert('BOTTOM');
} else { } else {
//alert('UP');
this.scrollingOnce = false; this.scrollingOnce = false;
} }
if ((containerHeight - 100) > scroll) { if ((containerHeight - 100) > scroll) {
+1 -4
View File
@@ -362,9 +362,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
let containerHeight = windowHeight - e.srcElement.clientHeight; let containerHeight = windowHeight - e.srcElement.clientHeight;
if (scroll > this.currentPosition) { if (scroll > this.currentPosition) {
//alert('BOTTOM');
} else { } else {
//alert('UP');
this.scrollingOnce = false; this.scrollingOnce = false;
} }
if ((containerHeight - 100) > scroll) { if ((containerHeight - 100) > scroll) {
@@ -647,7 +645,6 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
async takePicture() { async takePicture() {
// alert("!");
const roomId = this.roomId const roomId = this.roomId
@@ -656,7 +653,7 @@ export class MessagesPage implements OnInit, AfterViewInit, OnDestroy {
const lastphoto: any = await this.fileService.loadFiles(); const lastphoto: any = await this.fileService.loadFiles();
const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto); const { capturedImage, capturedImageTitle } = await this.fileService.loadFileData(lastphoto);
// alert('!!');
const base64 = await fetch(capturedImage); const base64 = await fetch(capturedImage);
const blob = await base64.blob(); const blob = await base64.blob();
const formData = new FormData(); const formData = new FormData();
@@ -13,6 +13,7 @@ import { AttachmentsService } from 'src/app/services/attachments.service';
import { FormGroup, FormBuilder, Validators } from "@angular/forms"; import { FormGroup, FormBuilder, Validators } from "@angular/forms";
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx'; import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
import { AttachmentsPage } from '../attachments/attachments.page'; import { AttachmentsPage } from '../attachments/attachments.page';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -45,11 +46,13 @@ export class EventDetailPage implements OnInit {
private alertService: AlertService, private alertService: AlertService,
private attachamentsService: AttachmentsService, private attachamentsService: AttachmentsService,
private route: Router, private route: Router,
private iab: InAppBrowser) { private iab: InAppBrowser,
private httpErrorHandle: HttpErrorHandle) {
this.loadedEvent = new Event(); this.loadedEvent = new Event();
this.loadedEvent.Body = new EventBody(); this.loadedEvent.Body = new EventBody();
} }
ngOnInit() { ngOnInit() {
this.loadEvent(); this.loadEvent();
this.loadAttachments(); this.loadAttachments();
@@ -81,6 +84,8 @@ export class EventDetailPage implements OnInit {
); );
this.eventsService.getEvent(eventid).subscribe(response => { this.eventsService.getEvent(eventid).subscribe(response => {
this.loadedEvent = response; this.loadedEvent = response;
},(error) => {
this.httpErrorHandle.httpStatusHandle(error)
}); });
} }
@@ -25,6 +25,7 @@ import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-despacho-pr', selector: 'app-despacho-pr',
@@ -66,6 +67,7 @@ export class DespachoPrPage implements OnInit {
public ThemeService: ThemeService, public ThemeService: ThemeService,
private RouteService: RouteService, private RouteService: RouteService,
public p: PermissionService, public p: PermissionService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if (params["params"].SerialNumber) { if (params["params"].SerialNumber) {
@@ -157,7 +159,7 @@ export class DespachoPrPage implements OnInit {
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} }
this.toastService._badRequest('Processo não encontrado') this.httpErroHandle.httpStatusHandle(error)
} }
}); });
@@ -272,14 +274,9 @@ export class DespachoPrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Executado')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -302,14 +299,9 @@ export class DespachoPrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage('Processo arquivado') this.httpErroHandle.httpsSucessMessagge('Arquivar')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não arquivado')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -329,14 +321,9 @@ export class DespachoPrPage implements OnInit {
documents documents
}).toPromise() }).toPromise()
this.toastService._successMessage('Processo criado') this.httpErroHandle.httpsSucessMessagge('Gerar Diploma')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não criado')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -359,14 +346,9 @@ export class DespachoPrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage('') this.httpErroHandle.httpsSucessMessagge('Concluir')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -389,14 +371,9 @@ export class DespachoPrPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Reexecução')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -412,17 +389,12 @@ export class DespachoPrPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => { this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
this.popoverController.dismiss('close') this.popoverController.dismiss('close')
this.toastService._successMessage('Processo enviado para pendentes') this.httpErroHandle.httpsSucessMessagge('Enviar para Pendentes')
this.goBack() this.goBack()
loader.remove() loader.remove()
}, (error) => { }, (error) => {
loader.remove() loader.remove()
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
}); });
} }
@@ -127,7 +127,7 @@
<div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto"> <div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
<div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho'"> <div class="buttons" *ngIf="task.activityInstanceName == 'Tarefa de Despacho'">
<div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' "> <div>Responder ao PR</div> </div> <div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' "> <div>Responder ao PR</div> </div>
<button (click)="tstemethod(executadoText)" class="btn-cancel" shape="round" >Executado</button> <button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' ">Reencaminhar para Área Jurídica</div> <div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' ">Reencaminhar para Área Jurídica</div>
<button (click)="openAddNoteModal('Gerar Diploma')" *ngIf="task.WorkflowName == 'Despacho do Presidente da República'" class="btn-cancel" style="margin-bottom: 0px !important;" shape="round" >Gerar Diploma </button> <button (click)="openAddNoteModal('Gerar Diploma')" *ngIf="task.WorkflowName == 'Despacho do Presidente da República'" class="btn-cancel" style="margin-bottom: 0px !important;" shape="round" >Gerar Diploma </button>
<div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' " >Outras opções</div> <div class="option-desc" *ngIf="task.WorkflowName == 'Despacho do Presidente da República' " >Outras opções</div>
@@ -140,7 +140,7 @@
<button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button> <button (click)="sendExpedienteToPending()" *ngIf="task.Status != 'Pending'" class="btn-cancel" shape="round" >Enviar para Pendentes</button>
</div> </div>
<div class="buttons" *ngIf="task.activityInstanceName == 'Reexecutar Despacho'"> <div class="buttons" *ngIf="task.activityInstanceName == 'Reexecutar Despacho'">
<button (click)="tstemethod('Executado')" class="btn-cancel" shape="round" >Executado</button> <button (click)="openAddNoteModal('Executado')" class="btn-cancel" shape="round" >Executado</button>
<button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button> <button (click)="openDelegarModal(task)" class="btn-cancel" shape="round" >Delegar</button>
<div class="solid"></div> <div class="solid"></div>
<button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button> <button (click)="openExpedientActionsModal('0',fulltask)" class="btn-cancel" shape="round" >Efetuar Despacho</button>
@@ -23,6 +23,7 @@ import { Platform } from '@ionic/angular';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -66,6 +67,7 @@ export class DespachoPage implements OnInit {
private platform: Platform, private platform: Platform,
private backgroundservice: BackgroundService, private backgroundservice: BackgroundService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) { ) {
@@ -154,7 +156,7 @@ export class DespachoPage implements OnInit {
} catch (e) { } catch (e) {
this.RouteService.goBack(); this.RouteService.goBack();
} }
this.toastService.badRequest('Processo não encontrado') this.httpErrorHandle.httpStatusHandle(error)
} }
}); });
} }
@@ -279,15 +281,10 @@ export class DespachoPage implements OnInit {
try { try {
await this.despachoService.executado(note, documents, this.serialnumber).toPromise(); await this.despachoService.executado(note, documents, this.serialnumber).toPromise();
this.toastService._successMessage('Processo criado') this.httpErrorHandle.httpsSucessMessagge('Executado')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest("Processo não criado")
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -300,15 +297,10 @@ export class DespachoPage implements OnInit {
try { try {
await this.despachoService.arquivar(note, documents, this.serialnumber).toPromise() await this.despachoService.arquivar(note, documents, this.serialnumber).toPromise()
this.toastService._successMessage('Processo descartado') this.httpErrorHandle.httpsSucessMessagge('Arquivar')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest("Processo não descartado")
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -331,16 +323,11 @@ export class DespachoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.httpErrorHandle.httpsSucessMessagge('Reexecução')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -363,15 +350,10 @@ export class DespachoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.httpErrorHandle.httpsSucessMessagge('Gerar Diploma')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error);
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -388,17 +370,17 @@ export class DespachoPage implements OnInit {
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => { this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
this.goBack(); this.goBack();
loader.remove() loader.remove()
this.toastService.successMessage() this.httpErrorHandle.httpsSucessMessagge('Enviar para Pendentes')
}, },
error => { error => {
loader.remove() loader.remove()
this.toastService.badRequest("Processo não enviado para despacho") this.httpErrorHandle.httpStatusHandle(error)
}); });
// loader.remove() // loader.remove()
} }
tstemethod(value: string) { tstemethod(value: string) {
alert(value)
} }
async openAddNoteModal(actionName: string) { async openAddNoteModal(actionName: string) {
@@ -9,6 +9,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import {HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-diploma-assinar', selector: 'app-diploma-assinar',
@@ -36,7 +37,8 @@ export class DiplomaAssinarPage implements OnInit {
private activatedRoute: ActivatedRoute, private activatedRoute: ActivatedRoute,
private toastService: ToastService, private toastService: ToastService,
private RouteService: RouteService, private RouteService: RouteService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
@@ -110,21 +112,12 @@ export class DiplomaAssinarPage implements OnInit {
}, (error)=>{ }, (error)=>{
try { try {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService._badRequest('Processo não encontrado')
}
} }
}); });
@@ -177,16 +170,11 @@ export class DiplomaAssinarPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage(false, ()=>{ this.httpErroHandle.httpsSucessMessagge('Assinado',() => {
this.goBack(); this.goBack();
}) })
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -13,6 +13,7 @@ import { DespachoService } from 'src/app/Rules/despacho.service'
import { DelegarPage } from 'src/app/modals/delegar/delegar.page'; import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page'; import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { DiplomasGerarOptionsPage } from 'src/app/shared/popover/diplomas-gerar-options/diplomas-gerar-options.page'; import { DiplomasGerarOptionsPage } from 'src/app/shared/popover/diplomas-gerar-options/diplomas-gerar-options.page';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
@Component({ @Component({
selector: 'app-diplomas-gerar', selector: 'app-diplomas-gerar',
@@ -43,7 +44,8 @@ export class DiplomasGerarPage implements OnInit {
private RouteService: RouteService, private RouteService: RouteService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private despachoService: DespachoService, private despachoService: DespachoService,
) { private httpErroHandle: HttpErrorHandle
) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) { if(params["params"].SerialNumber) {
this.serialnumber = params["params"].SerialNumber; this.serialnumber = params["params"].SerialNumber;
@@ -118,16 +120,12 @@ export class DiplomasGerarPage implements OnInit {
}, (error)=>{ }, (error)=>{
try { try {
this.toastService._badRequest('Processo não encontrado') this.httpErroHandle.httpStatusHandle(error)
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService._badRequest('Processo não encontrado')
}
} }
}); });
@@ -250,15 +248,10 @@ export class DiplomasGerarPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.modalController.dismiss('sucess'); this.modalController.dismiss('sucess');
this.toastService._successMessage(); this.httpErroHandle.httpsSucessMessagge('Gerar Diploma')
this.goBack() this.goBack()
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest();
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -79,6 +79,8 @@
<div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto"> <div *ngIf="task" class="aside-right flex-column height-100 overflow-y-auto">
<div class="buttons" *ngIf="task.activityInstanceName == 'Revisar Diploma'"> <div class="buttons" *ngIf="task.activityInstanceName == 'Revisar Diploma'">
<button (click)="tempMethod('Arquivo')" class="btn-cancel" shape="round" >Arquivar</button>
<button (click)="tempMethod('Despacho')" class="btn-cancel" shape="round" >Efectuar Despacho</button>
<button (click)="openAddNoteModal('Solicitar assinatura')" class="btn-cancel" shape="round" >Solicitar assinatura do Presidente</button> <button (click)="openAddNoteModal('Solicitar assinatura')" class="btn-cancel" shape="round" >Solicitar assinatura do Presidente</button>
<button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button> <button (click)="openAddNoteModal('Solicitar alteração')" class="btn-cancel" shape="round" >Solicitar alteração</button>
<button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button> <button (click)="openBookMeetingModal(task)" class="btn-cancel" shape="round" >Marcar Reunião</button>
@@ -15,6 +15,7 @@ import { SqliteService } from 'src/app/services/sqlite.service';
import { BackgroundService } from 'src/app/services/background.service'; import { BackgroundService } from 'src/app/services/background.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -50,7 +51,8 @@ export class DiplomaPage implements OnInit {
private sqliteservice: SqliteService, private sqliteservice: SqliteService,
private backgroundservice: BackgroundService, private backgroundservice: BackgroundService,
private platform: Platform, private platform: Platform,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// //
@@ -162,12 +164,7 @@ export class DiplomaPage implements OnInit {
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} }
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
} }
}); });
@@ -286,17 +283,12 @@ export class DiplomaPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage(false, () => { this.httpErrorHandle.httpsSucessMessagge('Solicitar Assinatura',() => {
this.close(); this.close();
}) })
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -317,14 +309,9 @@ export class DiplomaPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.httpErrorHandle.httpsSucessMessagge('Solicitar alteração')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -348,14 +335,9 @@ export class DiplomaPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.toastService._successMessage('Processo concluído') this.httpErrorHandle.httpsSucessMessagge('Concluir')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -441,5 +423,9 @@ export class DiplomaPage implements OnInit {
this.modalController.dismiss(); this.modalController.dismiss();
} }
tempMethod(actionname) {
console.log(actionname)
}
} }
@@ -17,6 +17,7 @@ import { OfflineManagerService } from 'src/app/services/offline-manager.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import config from 'capacitor.config'; import config from 'capacitor.config';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-approve-event', selector: 'app-approve-event',
@@ -58,7 +59,8 @@ export class ApproveEventPage implements OnInit {
private backgroundservice: BackgroundService, private backgroundservice: BackgroundService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private offlineManager: OfflineManagerService, private offlineManager: OfflineManagerService,
private storage: Storage private storage: Storage,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
// //
@@ -216,7 +218,11 @@ export class ApproveEventPage implements OnInit {
} }
}, (error) => { }, (error) => {
this.getProcessFromDB(); if(error.status == 0) {
this.getProcessFromDB();
} else {
this.httpErrorHandle.httpStatusHandle(error)
}
}) })
} }
@@ -229,15 +235,10 @@ export class ApproveEventPage implements OnInit {
try { try {
await this.processes.PostTaskAction(body).toPromise() await this.processes.PostTaskAction(body).toPromise()
this.goBack(); this.goBack();
this.toastService._successMessage('Evento aprovado') this.httpErrorHandle.httpsSucessMessagge('Evento aprovação')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não aprovado')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -280,15 +281,10 @@ export class ApproveEventPage implements OnInit {
this.offlineManager.storeRequestData('event-listRever', body); this.offlineManager.storeRequestData('event-listRever', body);
}); });
this.toastService._successMessage('Evento enviado para revisão'); this.httpErrorHandle.httpsSucessMessagge('Rever')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não enviado para revisão');
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -308,15 +304,10 @@ export class ApproveEventPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
try { try {
await this.processes.PostTaskAction(body).toPromise(); await this.processes.PostTaskAction(body).toPromise();
await this.toastService._successMessage('Processo rejeitado'); this.httpErrorHandle.httpsSucessMessagge('Rejeitar')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não rejeitado')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -19,7 +19,7 @@
<!-- <ion-segment-button value="MDGPR"> <!-- <ion-segment-button value="MDGPR">
Minha agenda Minha agenda
</ion-segment-button> --> </ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : 'PR'"> <ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> <div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -40,14 +40,14 @@
<div class="main-content d-flex height-100" > <div class="main-content d-flex height-100" >
<div class="content height-100 d-flex flex-column"> <div class="content height-100 d-flex flex-column">
<div [ngSwitch]="segment"> <div >
<ion-list class="width-100 height-100" *ngSwitchCase="'MDGPR'"> <ion-list class="width-100 height-100" >
<div *ngIf="eventoaprovacaostore.listmd" class="overflow-y-auto height-100"> <div class="overflow-y-auto height-100">
<ion-item-sliding> <ion-item-sliding>
<ion-item class="Rectangle cursor-pointer" lines="none" <ion-item class="Rectangle cursor-pointer" lines="none"
*ngFor="let event of eventoaprovacaostore.listmd" (click)="goToEventToApproveDetail(event.serialNumber)"> *ngFor="let event of eventoaprovacaostore.get(segment)" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100"> <div class="content-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time"> <div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
@@ -65,51 +65,19 @@
</ion-item-sliding> </ion-item-sliding>
</div> </div>
</ion-list> </ion-list>
<ion-label></ion-label>
<ion-list *ngSwitchCase="'PR'">
<div *ngIf="eventoaprovacaostore.listpr" class="overflow-y-auto height-100">
<ion-item-sliding>
<ion-item class="Rectangle cursor-pointer" lines="none"
*ngFor="let event of eventoaprovacaostore.listpr" (click)="goToEventToApproveDetail(event.serialNumber)">
<div class="content-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="event.workflowInstanceDataFields.StartDate != event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="event.workflowInstanceDataFields.StartDate == event.workflowInstanceDataFields.EndDate">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</ion-item>
</ion-item-sliding>
</div>
</ion-list>
</div> </div>
<div class="height-100" [ngSwitch]="segment"> <div class="height-100" >
<div *ngSwitchCase="'MDGPR'" class="d-flex height-100 align-center justify-content-center" > <div class="d-flex height-100 align-center justify-content-center" >
<div <div
*ngIf="!skeletonLoader && (!eventoaprovacaostore.listmd || eventoaprovacaostore.listmd.length == 0)" *ngIf="!skeletonLoader && (eventoaprovacaostore.get(segment).length == 0)"
class="empty-list d-flex height-100 align-center justify-content-center" class="empty-list d-flex height-100 align-center justify-content-center"
> >
<span>Lista vazia</span> <span>Lista vazia</span>
</div> </div>
</div> </div>
<div *ngSwitchCase="'PR'" class="d-flex height-100 align-center justify-content-center">
<div
*ngIf="!skeletonLoader && (!eventoaprovacaostore.listmd || eventoaprovacaostore.listmd.length == 0)"
class="empty-list d-flex height-100 align-center justify-content-center"
>
<span>Lista vazia</span>
</div>
</div>
</div> </div>
</div> </div>
@@ -16,6 +16,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { SessionStore } from 'src/app/store/session.service';
@Component({ @Component({
selector: 'app-event-list', selector: 'app-event-list',
@@ -36,8 +37,9 @@ export class EventListPage implements OnInit {
serialnumber: string; serialnumber: string;
skeletonLoader = true skeletonLoader = true
eventaprovacaostore = EventoAprovacaoStore;
eventoaprovacaostore = EventoAprovacaoStore; eventoaprovacaostore = EventoAprovacaoStore;
eventsList: any = []
color: 'pr' | 'mdgpr'
constructor( constructor(
private processes: ProcessesService, private processes: ProcessesService,
@@ -56,7 +58,13 @@ export class EventListPage implements OnInit {
ngOnInit() { ngOnInit() {
this.segment = 'MDGPR'; if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
const location = window.location const location = window.location
const pathname = location.pathname + location.search const pathname = location.pathname + location.search
@@ -150,47 +158,53 @@ export class EventListPage implements OnInit {
} }
async LoadToApproveEvents() { async LoadToApproveEvents() {
// this.processes.GetTasksList('Agenda Oficial MDGPR', false).subscribe(async res => { this.showLoader = true;
this.showLoader = true; this.skeletonLoader = true
this.skeletonLoader = true
const segment = this.segment
if (this.segment != 'PR') { if(this.segment == 'Meu calendario') {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise(); // color
this.eventsMDGPRList = mdEventsOficial if(SessionStore.user.Profile == 'PR') {
this.color = 'pr'
this.eventsMDGPRList = this.sortService.sortDate(this.eventsMDGPRList, 'taskStartDate') } else {
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList) this.color = 'mdgpr'
this.eventoaprovacaostore.resetmd(this.eventsMDGPRList);
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => {
})
} }
else if (this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
this.eventsPRList = prEventsOficial
this.eventsPRList = this.sortService.sortDate(this.eventsPRList, 'taskStartDate')
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList)
this.eventoaprovacaostore.resetpr(this.eventsPRList);
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => {
})
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
this.eventsList = [];
} }
this.eventoaprovacaostore.save(segment, this.eventsList)
} else {
this.color = 'pr'
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
this.eventsList = []
}
this.eventsList = this.eventsList
this.eventsList = this.eventsList
this.showLoader = false; this.showLoader = false;
this.skeletonLoader = false this.eventoaprovacaostore.save(segment, this.eventsList)
}
this.showLoader = false;
this.skeletonLoader = false
// }, (error) => {
// this.getEventToAproveFromDB();
// })
} }
toDateString(e) {
return new Date(e).toDateString()
}
async openApproveModal(eventSerialNumber, event) { async openApproveModal(eventSerialNumber, event) {
const modal = await this.modalController.create({ const modal = await this.modalController.create({
@@ -61,7 +61,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postData.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postData.Location"></ion-input>
</div> </div>
</div> </div>
</div> </div>
@@ -314,7 +314,7 @@
<ion-footer> <ion-footer>
<div class="buttons"> <div class="buttons">
<button class="btn-cancel" shape="round" (click)="close()">Cancelar</button> <button class="btn-cancel" shape="round" (click)="close()">Cancelar</button>
<button class="btn-ok" shape="round" (click)="saveTask()">Enviar</button> <button class="btn-ok" shape="round" (click)="saveTask()">Gravar</button>
</div> </div>
</ion-footer> </ion-footer>
@@ -20,6 +20,7 @@ import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-pick
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { RoleIdService } from 'src/app/services/role-id.service'; import { RoleIdService } from 'src/app/services/role-id.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const moment = _rollupMoment || _moment; const moment = _rollupMoment || _moment;
@@ -120,7 +121,8 @@ export class BookMeetingModalPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public eventService: EventsService, public eventService: EventsService,
public RoleIdService: RoleIdService public RoleIdService: RoleIdService,
private httpErroHandle: HttpErrorHandle
) { ) {
@@ -304,15 +306,10 @@ export class BookMeetingModalPage implements OnInit {
await this.calendarService.genericPostExpedientEvent(this.task.DocId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise(); await this.calendarService.genericPostExpedientEvent(this.task.DocId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.modalController.dismiss(); this.modalController.dismiss();
this.toastService._successMessage('Reunião criada'); this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Reunião não criada')
}
} }
finally { finally {
loader.remove() loader.remove()
@@ -329,14 +326,10 @@ export class BookMeetingModalPage implements OnInit {
await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise(); await this.calendarService.genericCreateTaskEvent(this.task.FolderID | this.task.FolderId, this.postData, "",this.task.SerialNumber, this.task.FsId, CalendarId).toPromise();
this.close(); this.close();
this.toastService._successMessage('Reunião criada'); this.httpErroHandle.httpsSucessMessagge('Marcar Reunião')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -24,6 +24,7 @@ import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -111,6 +112,7 @@ export class ExpedientTaskModalPage implements OnInit {
private despachoService: DespachoService, private despachoService: DespachoService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public p: PermissionService, public p: PermissionService,
private httpErroHandle: HttpErrorHandle,
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
@@ -325,16 +327,11 @@ export class ExpedientTaskModalPage implements OnInit {
try { try {
this.taskResult = await this.processes.postDespatcho(this.postData).toPromise(); this.taskResult = await this.processes.postDespatcho(this.postData).toPromise();
await this.toastService._successMessage('Processo efetuado'); await this.httpErroHandle.httpsSucessMessagge('Efetuar Despacho')
this.modalController.dismiss(action_despacho); this.modalController.dismiss(action_despacho);
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
await this.toastService._badRequest('Processo não efetuado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -364,16 +361,12 @@ export class ExpedientTaskModalPage implements OnInit {
try { try {
this.taskResult = await this.processes.postParecer(this.postData).toPromise(); this.taskResult = await this.processes.postParecer(this.postData).toPromise();
await this.toastService._successMessage('Pedido enviado'); await this.httpErroHandle.httpsSucessMessagge('Solicitar Parecer')
this.modalController.dismiss(action_parecer); this.modalController.dismiss(action_parecer);
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
await this.toastService._badRequest('Processo não efetuado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -401,15 +394,10 @@ export class ExpedientTaskModalPage implements OnInit {
try { try {
this.taskResult = await this.processes.postDeferimento(this.postData).toPromise(); this.taskResult = await this.processes.postDeferimento(this.postData).toPromise();
this.toastService._successMessage('Processo efetuado'); this.httpErroHandle.httpsSucessMessagge('Pedido de Deferimento')
this.modalController.dismiss(action_deferimento); this.modalController.dismiss(action_deferimento);
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
await this.toastService._badRequest('Processo não efetuado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -444,15 +432,10 @@ export class ExpedientTaskModalPage implements OnInit {
if(this.postData.DispatchFolder.Message){ if(this.postData.DispatchFolder.Message){
try { try {
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise(); this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
await this.toastService._successMessage('Processo efetuado'); await this.httpErroHandle.httpsSucessMessagge('Efetuar Despacho')
this.modalController.dismiss(action_despacho_pr); this.modalController.dismiss(action_despacho_pr);
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
await this.toastService._badRequest('Processo não efetuado')
}
} finally { } finally {
//loader.remove() //loader.remove()
} }
@@ -486,15 +469,10 @@ export class ExpedientTaskModalPage implements OnInit {
try { try {
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise(); this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
await this.toastService._successMessage('Pedido enviado'); await this.httpErroHandle.httpsSucessMessagge('Solicitar Parecer')
this.modalController.dismiss(action_parecer_pr); this.modalController.dismiss(action_parecer_pr);
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
await this.toastService._badRequest('Processo não efetuado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -35,6 +35,7 @@ import { Storage } from '@ionic/storage';
import { LoginUserRespose } from 'src/app/models/user.model'; import { LoginUserRespose } from 'src/app/models/user.model';
import { AuthService } from 'src/app/services/auth.service'; import { AuthService } from 'src/app/services/auth.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-expediente-detail', selector: 'app-expediente-detail',
@@ -88,6 +89,7 @@ export class ExpedienteDetailPage implements OnInit {
private dataService: DataService, private dataService: DataService,
private storage: Storage, private storage: Storage,
private userAuth: AuthService, private userAuth: AuthService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.loggeduser = SessionStore.user this.loggeduser = SessionStore.user
console.log('SessionStore', SessionStore) console.log('SessionStore', SessionStore)
@@ -242,14 +244,9 @@ export class ExpedienteDetailPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.close(); this.close();
this.toastService._successMessage('Processo aprovado') this.httpErroHandle.httpsSucessMessagge('Avaliação Superiror')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não aprovado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -272,14 +269,9 @@ export class ExpedienteDetailPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Rever')
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -402,17 +394,12 @@ export class ExpedienteDetailPage implements OnInit {
this.getFromDB(); this.getFromDB();
} else { } else {
try { try {
this.toastService._badRequest('Processo não encontrado') this.httpErroHandle.httpStatusHandle(error)
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} }
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
} }
}); });
@@ -545,12 +532,7 @@ export class ExpedienteDetailPage implements OnInit {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não descartado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -22,6 +22,7 @@ import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.pag
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-expediente-pr', selector: 'app-expediente-pr',
@@ -60,7 +61,8 @@ export class ExpedientePrPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private RouteService: RouteService, private RouteService: RouteService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
@@ -137,18 +139,13 @@ export class ExpedientePrPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{ this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
this.toastService._successMessage('Processo enviado para pendentes') this.httpErroHandle.httpsSucessMessagge('Enviar para Pendente')
this.goBack(); this.goBack();
loader.remove() loader.remove()
}, },
(error)=>{ (error)=>{
loader.remove() loader.remove()
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não enviado para pendentes')
}
}); });
} }
@@ -193,16 +190,12 @@ export class ExpedientePrPage implements OnInit {
}, (error)=>{ }, (error)=>{
try { try {
this.toastService._badRequest('Processo não encontrado') this.httpErroHandle.httpStatusHandle(error)
this.goBack() this.goBack()
} catch (e) { } catch (e) {
window.history.back(); window.history.back();
} finally { } finally {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Não é possível visualizar este processo no modo offline')
} else {
this.toastService._badRequest('Processo não encontrado')
}
} }
}); });
} }
@@ -312,14 +305,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise(); await this.processes.CompleteTask(body).toPromise();
this.close(); this.close();
this.toastService._successMessage('Processo aprovado') this.httpErroHandle.httpsSucessMessagge('Aprovar')
} catch(error) { } catch(error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não aprovado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -342,14 +330,9 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.close(); this.close();
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Rever')
} catch(error) { } catch(error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -468,15 +451,10 @@ export class ExpedientePrPage implements OnInit {
try { try {
await this.processes.CompleteTask(otherbody).toPromise() await this.processes.CompleteTask(otherbody).toPromise()
this.toastService._successMessage('Processo descartado'); this.httpErroHandle.httpsSucessMessagge('Arquivar')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não descartado')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -242,7 +242,7 @@
<ion-icon src="assets/images/icons-agenda.svg"></ion-icon> <ion-icon src="assets/images/icons-agenda.svg"></ion-icon>
</div> </div>
<p class="text-center exp-card-title ">Eventos para Aprovação</p> <p class="text-center exp-card-title ">Eventos para Aprovação</p>
<p class="text-center exp-card-content"> {{eventoaprovacaostore.countMd + eventoaprovacaostore.countPr}} <span class="title1">Documentos</span></p> <p class="text-center exp-card-content"> {{eventoaprovacaostore.countAll}} <span class="title1">Documentos</span></p>
</div> </div>
<!-- List --> <!-- List -->
@@ -33,6 +33,8 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { NotificationsService } from 'src/app/services/notifications.service' import { NotificationsService } from 'src/app/services/notifications.service'
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { EventsService } from 'src/app/services/events.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-gabinete-digital', selector: 'app-gabinete-digital',
templateUrl: './gabinete-digital.page.html', templateUrl: './gabinete-digital.page.html',
@@ -126,7 +128,9 @@ export class GabineteDigitalPage implements OnInit {
private sortService: SortService, private sortService: SortService,
private storage: Storage, private storage: Storage,
public p: PermissionService, public p: PermissionService,
public NotificationsService: NotificationsService public NotificationsService: NotificationsService,
public eventService: EventsService,
private httpErroHandle: HttpErrorHandle
) { ) {
// this.workerList = new Worker(new URL('./list.worker.js', import.meta.url)); // this.workerList = new Worker(new URL('./list.worker.js', import.meta.url));
@@ -598,7 +602,7 @@ export class GabineteDigitalPage implements OnInit {
updateAllProcess = () => { updateAllProcess = () => {
this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento)
.concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.contactList).concat(this.despachoStore.list)
.concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list) .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list)
// try{ // try{
@@ -732,21 +736,48 @@ export class GabineteDigitalPage implements OnInit {
this.updateAllProcess() this.updateAllProcess()
} }
let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
let eventsMDGPRList = mdEventsOficial
eventsMDGPRList = eventsMDGPRList.filter((item) => item.activityInstanceName != 'Editar Evento') for(let calendar of this.eventService.calendarNamesAry) {
if(calendar == 'Meu calendario') {
// color
let genericEvents = await this.processesbackend.GetTasksList('Agendar Evento', false).toPromise();
let eventsList
try {
eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
eventsList = [];
}
this.eventoaprovacaostore.countMd = eventsMDGPRList.length this.eventoaprovacaostore.save(calendar, eventsList)
this.eventoaprovacaostore.resetmd(eventsMDGPRList);
this.updateAllProcess()
let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise(); } else {
let eventsPRList = prEventsOficial
eventsPRList = eventsPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
this.eventoaprovacaostore.countPr = eventsPRList.length let allEvents = await this.processesbackend.eventsToApprove(calendar.OwnerUserId).toPromise()
this.eventoaprovacaostore.resetpr(eventsPRList); let eventsList
try {
eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
eventsList = []
}
this.eventoaprovacaostore.save(calendar, eventsList)
}
}
// let mdEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
// let eventsMDGPRList = mdEventsOficial
// eventsMDGPRList = eventsMDGPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
// this.eventoaprovacaostore.countMd = eventsMDGPRList.length
// this.eventoaprovacaostore.resetmd(eventsMDGPRList);
// this.updateAllProcess()
// let prEventsOficial = await this.processesbackend.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
// let eventsPRList = prEventsOficial
// eventsPRList = eventsPRList.filter((item) => item.activityInstanceName != 'Editar Evento')
// this.eventoaprovacaostore.countPr = eventsPRList.length
// this.eventoaprovacaostore.resetpr(eventsPRList);
this.updateAllProcess() this.updateAllProcess()
let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma"); let diplomasValidar = depachoAPI.filter(data => data.activityInstanceName == "Revisar Diploma");
@@ -29,6 +29,7 @@ import { DataService } from 'src/app/services/data.service';
import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page'; import { NewGroupPage } from 'src/app/pages/chat/new-group/new-group.page';
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-pedido', selector: 'app-pedido',
@@ -68,7 +69,7 @@ export class PedidoPage implements OnInit {
private platform: Platform, private platform: Platform,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private dataService: DataService, private dataService: DataService,
) { private htppErroHandle: HttpErrorHandle ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@@ -178,9 +179,8 @@ export class PedidoPage implements OnInit {
}, (error) => { }, (error) => {
if (error.status == 0) { if (error.status == 0) {
this.getfromDb(); this.getfromDb();
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else { } else {
this.toastService._badRequest('Processo não encontrado') this.htppErroHandle.httpsSucessMessagge(error)
try { try {
this.goBack() this.goBack()
this.close() this.close()
@@ -358,7 +358,6 @@ export class PedidoPage implements OnInit {
this.goBack() this.goBack()
} }
// alert(JSON.stringify(res)+' nada')
})) }))
} }
@@ -379,15 +378,10 @@ export class PedidoPage implements OnInit {
try { try {
await this.processes.CompleteTask(body).toPromise() await this.processes.CompleteTask(body).toPromise()
this.toastService._successMessage() this.htppErroHandle.httpsSucessMessagge('Solicitar alteração')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.htppErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -404,15 +398,10 @@ export class PedidoPage implements OnInit {
note note
}).toPromise() }).toPromise()
this.toastService._successMessage() this.htppErroHandle.httpsSucessMessagge('Arquivar')
this.close(); this.close();
} catch (error) { } catch (error) {
if(error.status == 0) { this.htppErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -456,12 +445,7 @@ export class PedidoPage implements OnInit {
loader.remove() loader.remove()
}, (error) => { }, (error) => {
loader.remove() loader.remove()
if(error.status == 0) { this.htppErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
}); });
} }
@@ -16,6 +16,7 @@ import { Platform } from '@ionic/angular';
import { SortService } from 'src/app/services/functions/sort.service'; import { SortService } from 'src/app/services/functions/sort.service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -49,7 +50,8 @@ export class PendentesPage implements OnInit {
private platform: Platform, private platform: Platform,
private backgroundservices: BackgroundService, private backgroundservices: BackgroundService,
private sortService: SortService, private sortService: SortService,
private storage: Storage private storage: Storage,
private httpErroHandle: HttpErrorHandle
) { ) {
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
this.profile = 'mdgpr'; this.profile = 'mdgpr';
@@ -116,6 +118,8 @@ export class PendentesPage implements OnInit {
}, (error) => { }, (error) => {
if(error.status == 0) { if(error.status == 0) {
this.getFromDb(); this.getFromDb();
} else {
this.httpErroHandle.httpStatusHandle(error)
} }
}) })
@@ -96,7 +96,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-textarea-class flex-grow-1"> <div class="ion-textarea-class flex-grow-1">
<ion-textarea [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea> <ion-textarea [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção*"></ion-textarea>
</div> </div>
</div> </div>
</div> </div>
@@ -5,6 +5,7 @@ import * as moment from 'moment';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle} from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-edit-action', selector: 'app-edit-action',
@@ -41,6 +42,7 @@ export class EditActionPage implements OnInit {
private toastService: ToastService, private toastService: ToastService,
private navParams: NavParams, private navParams: NavParams,
private modalController: ModalController, private modalController: ModalController,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
this.folderId = this.navParams.get('folderId'); this.folderId = this.navParams.get('folderId');
@@ -117,14 +119,9 @@ export class EditActionPage implements OnInit {
await this.publicationsService.UpdatePresidentialAction(body).toPromise() await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close(); this.close();
this.updateDesktopComponent.emit(); this.updateDesktopComponent.emit();
this.toastService._successMessage('Acção presidencial atualizada') this.httpErrorHandle.httpsSucessMessagge('Editar publicação');
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Não foi possivel atualizar a acção presidencial')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -88,7 +88,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-textarea-class" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom "> <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> <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>
</div> </div>
</div> </div>
@@ -7,6 +7,7 @@ import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { NgxMatDateFormats } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats } from '@angular-material-components/datetime-picker';
import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
@@ -65,7 +66,8 @@ export class NewActionPage implements OnInit {
constructor( constructor(
private modalController: ModalController, private modalController: ModalController,
private publication: PublicationsService, private publication: PublicationsService,
private toastService: ToastService private toastService: ToastService,
private httpErroHandle: HttpErrorHandle
) { ) {
@@ -138,11 +140,11 @@ export class NewActionPage implements OnInit {
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise(); await this.publication.CreatePublicationFolder(this.folder).toPromise();
this.toastService._successMessage("Acção criada"); this.httpErroHandle.httpsSucessMessagge('Acção criada')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService._badRequest("Acção não criada"); this.httpErroHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -18,6 +18,7 @@ import { Camera, CameraResultType, CameraSource, Photo } from '@capacitor/camera
import { Filesystem, Directory } from '@capacitor/filesystem'; import { Filesystem, Directory } from '@capacitor/filesystem';
import { NgxImageCompressService } from "ngx-image-compress"; import { NgxImageCompressService } from "ngx-image-compress";
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const IMAGE_DIR = 'stored-images'; const IMAGE_DIR = 'stored-images';
@@ -85,6 +86,7 @@ export class NewPublicationPage implements OnInit {
private platform: Platform, private platform: Platform,
private loadingCtrl: LoadingController, private loadingCtrl: LoadingController,
public imageCompress: NgxImageCompressService, public imageCompress: NgxImageCompressService,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.publicationType = this.navParams.get('publicationType'); this.publicationType = this.navParams.get('publicationType');
@@ -198,14 +200,14 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({ this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [ Subject: new FormControl(this.pub.Title, [
//Validators.required, Validators.required,
// Validators.minLength(4) // Validators.minLength(4)
]), ]),
capturedImage: new FormControl(this.capturedImage, [ capturedImage: new FormControl(this.capturedImage, [
]), ]),
Message: new FormControl(this.pub.Message, [ Message: new FormControl(this.pub.Message, [
// Validators.required Validators.required,
Validators.maxLength(1000) Validators.maxLength(1000)
]) ])
@@ -241,11 +243,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação editada") this.httpErrorHandle.httpsSucessMessagge('Publicação Editada')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService._badRequest("Publicação não editada") this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -269,11 +271,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação criado") this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService._badRequest("Publicação não criado") this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -297,11 +299,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage("Publicação criado") this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService._badRequest("Publicação não criado") this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -333,12 +335,12 @@ export class NewPublicationPage implements OnInit {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise(); await this.publications.CreatePublication(this.folderId, this.publication).toPromise();
this.close(); this.close();
this.toastService._successMessage("Publicação criado") this.httpErrorHandle.httpsSucessMessagge('Criar publicação')
this.close(); this.close();
} catch (error) { } catch (error) {
this.toastService._badRequest("Publicação não criado") this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -9,6 +9,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page'; import { ViewMediaPage } from 'src/app/modals/view-media/view-media.page';
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-publication-detail', selector: 'app-publication-detail',
@@ -30,6 +31,7 @@ export class PublicationDetailPage implements OnInit {
private RouteService: RouteService, private RouteService: RouteService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
public p:PermissionService, public p:PermissionService,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@@ -87,6 +89,9 @@ export class PublicationDetailPage implements OnInit {
FileExtension: 'jpeg', FileExtension: 'jpeg',
} }
this.showLoader = false; this.showLoader = false;
}, (error) => {
this.httpErrorHandle.httpStatusHandle(error)
this.goBack();
}); });
} }
@@ -109,7 +114,7 @@ export class PublicationDetailPage implements OnInit {
try { try {
await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise(); await this.publications.DeletePublication(this.folderId, this.publicationId).toPromise();
this.toastService._successMessage('Publicação removida') this.httpErrorHandle.httpsSucessMessagge('Eliminar publicação')
if(window['app-view-publications-page-doRefresh']) { if(window['app-view-publications-page-doRefresh']) {
window['app-view-publications-page-doRefresh']() window['app-view-publications-page-doRefresh']()
@@ -117,7 +122,7 @@ export class PublicationDetailPage implements OnInit {
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
this.toastService._badRequest('Publicaçao não removida') this.httpErrorHandle.httpStatusHandle(error)
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -13,6 +13,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { forkJoin } from 'rxjs'; import { forkJoin } from 'rxjs';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-view-publications', selector: 'app-view-publications',
@@ -44,7 +45,8 @@ export class ViewPublicationsPage implements OnInit {
private backgroundservice: BackgroundService, private backgroundservice: BackgroundService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private toastService: ToastService, private toastService: ToastService,
public p: PermissionService,) { public p: PermissionService,
private httpErroHandle: HttpErrorHandle) {
this.item = new PublicationFolder(); this.item = new PublicationFolder();
this.activatedRoute.paramMap.subscribe(params => { this.activatedRoute.paramMap.subscribe(params => {
@@ -119,6 +121,8 @@ export class ViewPublicationsPage implements OnInit {
this.item = res; this.item = res;
this.sqliteservice.updatePublicationsDetails(this.folderId, JSON.stringify(res)); this.sqliteservice.updatePublicationsDetails(this.folderId, JSON.stringify(res));
}, (error) => {
this.httpErroHandle.httpStatusHandle(error)
}); });
} }
@@ -161,7 +165,12 @@ export class ViewPublicationsPage implements OnInit {
this.showLoader = false; this.showLoader = false;
}, (error) => { }, (error) => {
this.getFromDB() if(error.status == 0) {
this.getFromDB()
} else {
this.httpErroHandle.httpStatusHandle(error)
}
}); });
} }
@@ -196,6 +205,8 @@ export class ViewPublicationsPage implements OnInit {
if (error.status == '404') { if (error.status == '404') {
this.error = 'Sem publicações disponíveis!'; this.error = 'Sem publicações disponíveis!';
this.publicationList = []; this.publicationList = [];
} else {
this.httpErroHandle.httpStatusHandle(error)
} }
this.showLoader = false; this.showLoader = false;
}); });
+4 -2
View File
@@ -13,6 +13,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-search', selector: 'app-search',
@@ -65,7 +66,8 @@ export class SearchPage implements OnInit {
private modalCtrl: ModalController, private modalCtrl: ModalController,
private navParams: NavParams, private navParams: NavParams,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private router: Router) private router: Router,
private httpErrorhandle: HttpErrorHandle)
{ {
this.ordinance = "recent"; this.ordinance = "recent";
this.currentPath= window.location.pathname; this.currentPath= window.location.pathname;
@@ -287,6 +289,7 @@ export class SearchPage implements OnInit {
},error => { },error => {
this.showLoader = false; this.showLoader = false;
// this.searchResult = "Registo não encontrado" // this.searchResult = "Registo não encontrado"
this.httpErrorhandle.httpStatusHandle(error)
console.log(error) console.log(error)
}); });
} }
@@ -334,7 +337,6 @@ export class SearchPage implements OnInit {
this.loadWordCloud(); this.loadWordCloud();
},error => { },error => {
this.searchResult = "Registo não encontrado" this.searchResult = "Registo não encontrado"
counter++; counter++;
console.log('application 8 failed', error) console.log('application 8 failed', error)
if(counter ==2) { if(counter ==2) {
-3
View File
@@ -4,7 +4,6 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http';
import { LoginUserRespose, UserForm, UserSession } from '../models/user.model'; import { LoginUserRespose, UserForm, UserSession } from '../models/user.model';
import { environment } from 'src/environments/environment'; import { environment } from 'src/environments/environment';
import { BehaviorSubject } from 'rxjs'; import { BehaviorSubject } from 'rxjs';
import { AuthConnstants } from '../config/auth-constants';
import { AlertController } from '@ionic/angular'; import { AlertController } from '@ionic/angular';
import { SessionStore } from '../store/session.service'; import { SessionStore } from '../store/session.service';
import { AESEncrypt } from '../services/aesencrypt.service'; import { AESEncrypt } from '../services/aesencrypt.service';
@@ -141,7 +140,6 @@ export class AuthService {
const formData = message.temporaryData const formData = message.temporaryData
try { try {
// alert('upload try')
let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise() let guid: any = await this.AttachmentsService.uploadFile(formData).toPromise()
message.file.guid = guid.path message.file.guid = guid.path
@@ -217,7 +215,6 @@ export class AuthService {
SessionStore.setInativity(false) SessionStore.setInativity(false)
SessionStore.setUrlBeforeInactivity(this.router.url); SessionStore.setUrlBeforeInactivity(this.router.url);
setTimeout(() => { setTimeout(() => {
// alert('logout')
this.router.navigateByUrl('/', { replaceUrl: true }); this.router.navigateByUrl('/', { replaceUrl: true });
}, 100) }, 100)
+1 -2
View File
@@ -20,9 +20,8 @@ export class ClearStoreService {
clear() { clear() {
EventoAprovacaoStore.clear();
DespachoStore.reset([]) DespachoStore.reset([])
EventoAprovacaoStore.resetmd([])
EventoAprovacaoStore.resetpr([])
ExpedienteGdStore.reset([]) ExpedienteGdStore.reset([])
PendentesStore.reset([]) PendentesStore.reset([])
PedidosStore.resetdeferimento([]) PedidosStore.resetdeferimento([])
+12 -9
View File
@@ -259,9 +259,11 @@ export class EventsService {
if(!this.calendarNamesAry.find(x => x.Role == e.Role)) { if(!this.calendarNamesAry.find(x => x.Role == e.Role)) {
let objectShared = { let objectShared = {
"Fullname": e.FullName, "Fullname": e.FullName,
"Role": e.Role, "Role": e.Role,
"OwnerUserId": sharedCalendar.OwnerUserId,
"RoleId": sharedCalendar.CalendarRoleId "RoleId": sharedCalendar.CalendarRoleId
} }
@@ -864,17 +866,18 @@ export class EventsService {
let options: any; let options: any;
const headers = [ const Selectedcalendar = SessionStore.user.OwnerCalendars.concat(SessionStore.user.SharedCalendars).find((calendar) =>{
this.headerSharedOficial, return calendar.CalendarId == CalendarId
this.headerSharedPessoal,
this.headerOwnPessoal,
this.headerOwnOficial
]
const header = headers.find((header)=> {
return header?.get('CalendarId')?.includes(CalendarId)
}) })
let header = new HttpHeaders();
header = header.set('Authorization',SessionStore.user.BasicAuthKey);
header = header.set('CalendarId', Selectedcalendar.CalendarId);
header = header.set('CalendarRoleId', Selectedcalendar.CalendarRoleId);
console.log(Selectedcalendar)
options = { options = {
headers: header, headers: header,
params: params params: params
+10 -1
View File
@@ -9,6 +9,10 @@ export class SortService {
constructor(private ObjectService: ObjectService) { } constructor(private ObjectService: ObjectService) { }
sortArrayISODate(myArray: any) { sortArrayISODate(myArray: any) {
if(!Array.isArray(myArray)) {
myArray = []
}
if(myArray.length > 0){ if(myArray.length > 0){
return myArray.sort(function (a, b) { return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0); return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
@@ -17,7 +21,9 @@ export class SortService {
} }
sortArrayByDate(myArray: any) { sortArrayByDate(myArray: any) {
if(!Array.isArray(myArray)) {
myArray = []
}
if(myArray.length > 0){ if(myArray.length > 0){
return myArray.sort(function (a, b) { return myArray.sort(function (a, b) {
return (new Date(a.workflowInstanceDataFields.StartDate) < new Date(b.workflowInstanceDataFields.StartDate)) ? -1 : ((new Date(a.workflowInstanceDataFields.StartDate) > new Date(b.workflowInstanceDataFields.StartDate)) ? 1 : 0); return (new Date(a.workflowInstanceDataFields.StartDate) < new Date(b.workflowInstanceDataFields.StartDate)) ? -1 : ((new Date(a.workflowInstanceDataFields.StartDate) > new Date(b.workflowInstanceDataFields.StartDate)) ? 1 : 0);
@@ -26,6 +32,9 @@ export class SortService {
} }
sortDate(array = [], path: string) { sortDate(array = [], path: string) {
if(!Array.isArray(array)) {
array = []
}
return array.sort( (a,b)=> { return array.sort( (a,b)=> {
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { HttpErrorHandle } from './http-error-handle.service';
describe('HttpErrorHandle.ServiceService', () => {
let service: HttpErrorHandle;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(HttpErrorHandle);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,145 @@
import { Injectable } from '@angular/core';
import { ToastService } from 'src/app/services/toast.service';
@Injectable({
providedIn: 'root'
})
export class HttpErrorHandle {
constructor(
private toastService: ToastService
) { }
httpStatusHandle(error) {
switch (error.status
) {
case 0:
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
break;
case 400:
this.toastService._badRequest('Lamentamos, mas houve um problema com sua solicitação. Por favor, tente novamente')
break;
case 401:
this.toastService._badRequest('Ocorreu um problema, por favor valide o username e password');
break;
case 403:
this.toastService._badRequest('Lamentamos, você não tem permissão para acessar este serviço.')
break;
case 404:
this.toastService._badRequest('Lamentamos, não encontramos o que procura.')
break;
case 500:
this.toastService._badRequest('Lamentamos, mas houve um erro interno do servidor. Por favor, tente novamente mais tarde.')
break;
case 502:
this.toastService._badRequest('Lamentamos, houve um problema com o servidor. Por favor, tente novamente mais tarde.')
break;
case 503:
this.toastService._badRequest('Lamentamos, o serviço está indisponível no momento. Por favor, tente novamente mais tarde.')
break
default:
break;
}
}
httpsSucessMessagge(service: string, callback?: any) {
switch (service) {
case 'new event':
this.toastService._successMessage('Evento criado!')
break;
case 'Editar evento':
this.toastService._successMessage('Evento editado!')
break
case 'delete event':
this.toastService._successMessage('Evento eliminado!')
break;
case 'Executado':
this.toastService._successMessage('Despacho executado!')
break;
case 'Gerar Diploma':
this.toastService._successMessage('Diploma gerado!')
break;
case 'Efetuar Despacho':
this.toastService._successMessage('Despacho efetuado!')
break;
case 'Solicitar Parecer':
this.toastService._successMessage('Pedido de parecer solicitado!')
break;
case 'Delegar':
this.toastService._successMessage('Tarefa delegada!')
break;
case 'Marcar Reunião':
this.toastService._successMessage('Evento criado!')
break;
case 'Enviar para Pendentes':
this.toastService._successMessage('Enviado com sucesso!')
break;
case 'Aprovar':
this.toastService._successMessage('Evento aprovado!')
break;
case 'Rever':
this.toastService._successMessage('Evento enviado para revisão!')
break;
case 'Avaliação Superiror':
this.toastService._successMessage('Enviado para avaliação!')
break;
case 'Mandar para Revisão':
this.toastService._successMessage('Enviado para revisão!')
break;
case 'Pedido de Deferimento':
this.toastService._successMessage('Enviado com sucesso!')
break;
case 'Arquivar':
this.toastService._successMessage('Tarefa Arquivada!')
break
case 'Concluir':
this.toastService._successMessage('Diploma concluido')
case 'Reexecução':
this.toastService._successMessage('Enviado para reexecução!')
break;
case 'Assinado':
this.toastService._successMessage('Diploma assinado!')
break;
case 'Solicitar Assinatura':
this.toastService._successMessage('Solicitação enviada!')
break;
case 'Solicitar alteração':
this.toastService._successMessage('Solicitação enviada!')
break;
case 'Evento aprovação':
this.toastService._successMessage('Evento aprovado!')
break;
case 'Rejeitar':
this.toastService._successMessage('Evento Rejeitado!')
break;
case 'Dar o meu Parecer':
this.toastService._successMessage('Parecer enviado!')
break;
case 'Reencaminhar':
this.toastService._successMessage('Reencaminhado!')
break;
case 'Eliminar publicação':
this.toastService._successMessage('Publicação Eliminada!')
break;
case 'Editar publicação':
this.toastService._successMessage('Publicação Editada!')
break;
case 'Criar publicação':
this.toastService._successMessage('Publicação criada!')
break;
case 'Acção criada':
this.toastService._successMessage('Acção criada!')
break;
case 'Editar Acção':
this.toastService._successMessage('Acção editada!')
break;
case 'Eliminar Acção':
this.toastService._successMessage('Acção eliminada!')
break;
default:
this.toastService._successMessage('Processo efetuado!')
break;
}
}
}
-1
View File
@@ -23,7 +23,6 @@ export class InativityService {
function userIsNotActive() { function userIsNotActive() {
// your function for too long inactivity goes here // your function for too long inactivity goes here
SessionStore.setInativity(false) SessionStore.setInativity(false)
// alert('go out')
try { try {
window['inactivity/function']() window['inactivity/function']()
} catch (error) {} } catch (error) {}
+16
View File
@@ -69,6 +69,22 @@ export class ProcessesService {
return this.http.get<fullTaskList[]>(`${geturl}`, options); return this.http.get<fullTaskList[]>(`${geturl}`, options);
} }
eventsToApprove(userid) {
const geturl = environment.apiURL + 'tasks/events-to-approve';
let params = new HttpParams();
params = params.set("pageNum", 1);
params = params.set("pageSize", 500);
params = params.set("userid", userid);
let options = {
headers: this.headers,
params: params
};
return this.http.get<fullTaskList[]>(`${geturl}`, options);
}
GetTaskListExpediente(onlycount1): Observable<ExpedienteFullTask[]> { GetTaskListExpediente(onlycount1): Observable<ExpedienteFullTask[]> {
const processname = "Expediente" const processname = "Expediente"
const onlycount = false const onlycount = false
@@ -38,7 +38,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
</div> </div>
</div> </div>
@@ -34,7 +34,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom "> <div class="ion-input-class flex-grow-1" [class.input-error]="Form?.get('Location')?.invalid && validateFrom ">
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div> </div>
</div> </div>
<!-- Error messages --> <!-- Error messages -->
@@ -321,7 +321,7 @@
<ion-title></ion-title> <ion-title></ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()"> <button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Enviar</ion-label> <ion-label>Gravar</ion-label>
</button> </button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
@@ -14,6 +14,7 @@ import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ParticipantsPipe } from 'src/app/pipes/participants.pipe'; import { ParticipantsPipe } from 'src/app/pipes/participants.pipe';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-edit-event', selector: 'app-edit-event',
@@ -92,7 +93,8 @@ export class EditEventPage implements OnInit {
public alertController: AlertController, public alertController: AlertController,
private attachmentsService: AttachmentsService, private attachmentsService: AttachmentsService,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) {} ) {}
ngOnInit() { ngOnInit() {
@@ -332,7 +334,7 @@ export class EditEventPage implements OnInit {
} catch (e) {} } catch (e) {}
} }
this.showLoader = false; this.showLoader = false;
this.toastService.successMessage() this.httpErrorHandle.httpsSucessMessagge('Editar evento')
} else { } else {
await this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).toPromise() await this.eventsService.editEvent(this.postEvent, 2, 3, this.postEvent.CalendarId).toPromise()
if(this.initCalendarName != this.postEvent.CalendarName) { if(this.initCalendarName != this.postEvent.CalendarName) {
@@ -346,13 +348,13 @@ export class EditEventPage implements OnInit {
} catch (e) {} } catch (e) {}
} }
this.showLoader = false; this.showLoader = false;
this.toastService.successMessage() this.httpErrorHandle.httpsSucessMessagge('Editar evento')
} }
} catch(error) { } catch(error) {
this.showLoader = false this.showLoader = false
this.toastService.badRequest() this.httpErrorHandle.httpStatusHandle(error)
} }
this.clearPostEvent.emit(); this.clearPostEvent.emit();
@@ -10,10 +10,7 @@
</div> </div>
<ion-toolbar> <ion-toolbar>
<ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)"> <ion-segment [(ngModel)]="segment" (ionChange)="segmentChanged($event)">
<!-- <ion-segment-button value="MDGPR"> <ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId ">
Minha agenda
</ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : 'PR'">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> <div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
@@ -30,39 +27,17 @@
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
<div class="main-content overflow-y-auto height-100" [ngSwitch]="segment" *ngIf="eventsMDGPRList"> <div class="main-content overflow-y-auto height-100" >
<!-- <div class="header-content width-100"> --> <!-- <div class="header-content width-100"> -->
<!-- </div> --> <!-- </div> -->
<ion-list class="width-100" *ngSwitchCase="'MDGPR'" > <ion-list class="width-100">
<div <div class="width-100" >
class="item item-hover ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsMDGPRList"
(click)="openApproveModal(event.serialNumber, event)"
>
<div class="event-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</div>
</ion-list>
<ion-list class="width-100" *ngSwitchCase="'PR'">
<div class="width-100" *ngIf="eventsPRList">
<div <div
class="item ion-no-padding width-100 cursor-pointer" class="item ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsPRList" *ngFor="let event of eventoaprovacaostore.get(segment)"
(click)="openApproveModal(event.serialNumber, event)" (click)="openApproveModal(event.serialNumber, event)"
> >
<div class="event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100"> <div class="event-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time"> <div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
@@ -78,30 +53,9 @@
</div> </div>
</div> </div>
</div> </div>
</ion-list> </ion-list>
<ion-list class="width-100" *ngSwitchCase="'Unknown'">
<div class="width-100" *ngIf="eventsGenericList">
<div
class="item ion-no-padding width-100 cursor-pointer"
*ngFor="let event of eventsGenericList"
(click)="openApproveModal(event.serialNumber, event)"
>
<div class="event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
<div *ngIf="event.activityInstanceName">
<div class="label-event-type"> {{ event.activityInstanceName }} </div>
</div>
</div>
</div>
</div>
</div>
</ion-list>
</div> </div>
</ion-content> </ion-content>
@@ -7,6 +7,7 @@ import { LoginUserRespose } from 'src/app/models/user.model';
import { SortService } from 'src/app/services/functions/sort.service'; import { SortService } from 'src/app/services/functions/sort.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { EventsService } from 'src/app/services/events.service'; import { EventsService } from 'src/app/services/events.service';
import { EventoAprovacaoStore } from 'src/app/store/eventoaprovacao-store.service';
@Component({ @Component({
selector: 'app-event-list', selector: 'app-event-list',
@@ -17,15 +18,16 @@ export class EventListPage implements OnInit {
// [desktop] event list to approve // [desktop] event list to approve
showLoader: boolean; showLoader: boolean;
eventsPRList: any = [] eventsList: any = []
eventsMDGPRList: any = []
eventsGenericList: any = []
eventPerson: EventPerson; eventPerson: EventPerson;
eventBody: EventBody; eventBody: EventBody;
categories: string[]; categories: string[];
serialnumber:string; serialnumber:string;
loggeduser: LoginUserRespose; loggeduser: LoginUserRespose;
segment:string; segment:string;
eventoaprovacaostore = EventoAprovacaoStore;
color: 'pr' | 'mdgpr'
@Input() profile:string; @Input() profile:string;
@Input() showComponent:string; @Input() showComponent:string;
@@ -44,11 +46,13 @@ export class EventListPage implements OnInit {
ngOnInit() { ngOnInit() {
this.segment = this.loggeduser.Profile; if(!this.segment) {
if(this.segment != "PR" && this.segment != "MDGPR") { if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = "Unknown"; this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
} }
const pathname = window.location.pathname const pathname = window.location.pathname
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
@@ -76,82 +80,53 @@ export class EventListPage implements OnInit {
async LoadToApproveEvents() { async LoadToApproveEvents() {
this.showLoader = true; this.showLoader = true;
try { const segment = this.segment
if(this.segment == 'MDGPR') {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR', false).toPromise();
let mdEventsPessoal = await this.processes.GetTasksList('Agenda Pessoal MDGPR', false).toPromise();
let allEvents = mdEventsOficial.concat(mdEventsPessoal); if(this.segment == 'Meu calendario') {
if(allEvents.length > 0) { // color
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse(); if(SessionStore.user.Profile == 'PR') {
} this.color = 'pr'
this.showLoader = false;
}
else if(this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
let allEvents = prEventsOficial
if(allEvents.length > 0) {
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
} else { } else {
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise(); this.color = 'mdgpr'
if(genericEvents.length > 0) {
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
}
this.showLoader = false;
} }
} catch(erro) { let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
this.showLoader = false; try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
this.eventsList = [];
}
this.eventoaprovacaostore.save(segment, this.eventsList)
} else {
this.color = 'pr'
let allEvents = await this.processes.eventsToApprove(segment).toPromise()
try {
this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
} catch(error) {
this.eventsList = []
}
this.eventsList = this.eventsList
this.eventsList = this.eventsList
this.eventoaprovacaostore.save(segment, this.eventsList)
} }
this.showLoader = false;
} }
async LoadToApproveEventsNoLoader() { async LoadToApproveEventsNoLoader() {
try { this.LoadToApproveEvents()
if(this.segment == 'MDGPR') {
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise();
let allEvents = mdEventsOficial
if(allEvents.length > 0) {
this.eventsMDGPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
}
else if(this.segment == 'PR') {
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise();
let allEvents = prEventsOficial
if(allEvents.length > 0) {
this.eventsPRList = this.sortService.sortArrayByDate(allEvents).reverse();
}
this.showLoader = false;
} else {
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
if(genericEvents.length > 0) {
this.eventsGenericList = this.sortService.sortArrayByDate(genericEvents).reverse();
}
this.showLoader = false;
}
} catch(erro) {
this.showLoader = false;
}
} }
async openApproveModal(eventSerialNumber, data) { async openApproveModal(eventSerialNumber, data) {
let a = this.eventsMDGPRList.filter((elem) => {
//
return eventSerialNumber == elem.serialNumber
});
this.approveEventDismiss.emit({ this.approveEventDismiss.emit({
"serialNumber": eventSerialNumber, "serialNumber": eventSerialNumber,
"action": "Aprovar", "action": "Aprovar",
@@ -66,7 +66,7 @@
</div> </div>
<div class="ion-input-class flex-grow-1 width-100" [class.input-error]="Form?.get('Location')?.invalid && validateFrom " > <div class="ion-input-class flex-grow-1 width-100" [class.input-error]="Form?.get('Location')?.invalid && validateFrom " >
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" type="text" placeholder="Localização*" [(ngModel)]="postEvent.Location"></ion-input> <ion-input autocomplete="on" autocorrect="on" spellcheck="true" type="text" placeholder="Localização" [(ngModel)]="postEvent.Location"></ion-input>
</div> </div>
</div> </div>
@@ -341,7 +341,7 @@
<ion-title></ion-title> <ion-title></ion-title>
<ion-buttons slot="end"> <ion-buttons slot="end">
<button class="btn-ok" fill="clear" color="#fff" (click)="save()"> <button class="btn-ok" fill="clear" color="#fff" (click)="save()">
<ion-label>Enviar</ion-label> <ion-label>Gravar</ion-label>
</button> </button>
</ion-buttons> </ion-buttons>
</ion-toolbar> </ion-toolbar>
@@ -27,6 +27,7 @@ import { ThemeService } from 'src/app/services/theme.service'
import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service'; import { ChatMethodsService } from 'src/app/services/chat/chat-methods.service';
import { ServerConnectionService } from 'src/app/services/server-connection.service'; import { ServerConnectionService } from 'src/app/services/server-connection.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -130,8 +131,9 @@ export class NewEventPage implements OnInit {
private dateAdapter: DateAdapter<any>, private dateAdapter: DateAdapter<any>,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private chatMethodService: ChatMethodsService, private chatMethodService: ChatMethodsService,
private ServerConnectionService: ServerConnectionService private ServerConnectionService: ServerConnectionService,
// private translate: TranslateService // private translate: TranslateService
private hhtpErrorHandle: HttpErrorHandle
) { ) {
this.dateAdapter.setLocale('pt'); this.dateAdapter.setLocale('pt');
this.loggeduser = SessionStore.user; this.loggeduser = SessionStore.user;
@@ -521,7 +523,7 @@ export class NewEventPage implements OnInit {
if(DocumentToSave.length == 0) { if(DocumentToSave.length == 0) {
this.afterSave(); this.afterSave();
} }
this.toastService._successMessage('Evento criado'); this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = { let data = {
"subject": this.postEvent.Subject, "subject": this.postEvent.Subject,
"start": this.postEvent.StartDate, "start": this.postEvent.StartDate,
@@ -540,12 +542,7 @@ export class NewEventPage implements OnInit {
console.log(error, 'error') console.log(error, 'error')
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
this.hhtpErrorHandle.httpStatusHandle(error)
if(error.status == 0) {
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
}); });
} }
@@ -585,7 +582,7 @@ export class NewEventPage implements OnInit {
if(DocumentToSave.length == 0){ if(DocumentToSave.length == 0){
this.afterSave(); this.afterSave();
} }
this.toastService._successMessage('Evento criado'); this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = { let data = {
"subject": this.postEvent.Subject, "subject": this.postEvent.Subject,
"start": this.postEvent.StartDate, "start": this.postEvent.StartDate,
@@ -597,17 +594,11 @@ export class NewEventPage implements OnInit {
if(this.roomId) { if(this.roomId) {
this.chatMethodService.sendMessage(this.roomId,data); this.chatMethodService.sendMessage(this.roomId,data);
} }
this.toastService._successMessage('Evento criado')
},(error) => { },(error) => {
//const connectionToServer = this.ServerConnectionService.BaseAPI() //const connectionToServer = this.ServerConnectionService.BaseAPI()
if(error.status == 0) { this.hhtpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
@@ -651,7 +642,7 @@ export class NewEventPage implements OnInit {
this.afterSave(); this.afterSave();
} }
this.toastService._successMessage('Evento criado'); this.hhtpErrorHandle.httpsSucessMessagge('new event')
let data = { let data = {
"subject": this.postEvent.Subject, "subject": this.postEvent.Subject,
"start": this.postEvent.StartDate, "start": this.postEvent.StartDate,
@@ -663,16 +654,11 @@ export class NewEventPage implements OnInit {
if(this.roomId) { if(this.roomId) {
this.chatMethodService.sendMessage(this.roomId,data); this.chatMethodService.sendMessage(this.roomId,data);
} }
this.toastService._successMessage('Evento criado')
},(error)=>{ },(error)=>{
loader.remove() loader.remove()
this.showLoader = false this.showLoader = false
if(error.status == 0) { this.hhtpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não criado')
}
}); });
} }
@@ -14,6 +14,7 @@ import { ExpedientTaskModalPage } from 'src/app/pages/gabinete-digital/expedient
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page'; import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
import { ThemeService } from 'src/app/services/theme.service'; import { ThemeService } from 'src/app/services/theme.service';
import { SessionStore } from 'src/app/store/session.service'; import { SessionStore } from 'src/app/store/session.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
@Component({ @Component({
@@ -58,6 +59,7 @@ export class ViewEventPage implements OnInit {
public popoverController: PopoverController, public popoverController: PopoverController,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private httpErrorHandle: HttpErrorHandle
) { ) {
this.isEventEdited = false; this.isEventEdited = false;
this.loadedEvent = new Event(); this.loadedEvent = new Event();
@@ -115,11 +117,7 @@ export class ViewEventPage implements OnInit {
type: 'close' type: 'close'
}) })
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
}); });
} else { } else {
@@ -141,11 +139,7 @@ export class ViewEventPage implements OnInit {
type: 'close' type: 'close'
}) })
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService.badRequest('Não é possível visualizar este evento no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
}); });
} }
} }
@@ -182,9 +176,11 @@ export class ViewEventPage implements OnInit {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService._successMessage('Evento eliminado'); this.httpErrorHandle.httpsSucessMessagge('delete event')
this.close(); this.close();
},()=>{}, },(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{ ()=>{
loader.remove(); loader.remove();
}); });
@@ -192,9 +188,11 @@ export class ViewEventPage implements OnInit {
if(this.CalendarId) { if(this.CalendarId) {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => { this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => {
this.toastService._successMessage('Evento eliminado'); this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close(); this.close();
},()=>{}, },(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{ ()=>{
loader.remove(); loader.remove();
}); });
@@ -208,17 +206,21 @@ export class ViewEventPage implements OnInit {
if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') { if(this.sesseionStora.user.Profile == 'MDGPR' || this.sesseionStora.user.Profile == 'PR') {
this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => { this.eventsService.deleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName).subscribe(async () => {
this.toastService._successMessage('Evento eliminado'); this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close(); this.close();
},()=>{}, },(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{ ()=>{
loader.remove(); loader.remove();
}); });
} else { } else {
this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => { this.eventsService.genericDeleteEvent(this.loadedEvent.EventId, 0, this.loadedEvent.CalendarName, this.CalendarId).subscribe(async () => {
this.toastService._successMessage('Evento eliminado'); this.httpErrorHandle.httpsSucessMessagge('delete event');
this.close(); this.close();
},()=>{}, },(error)=>{
this.httpErrorHandle.httpStatusHandle(error)
},
()=>{ ()=>{
loader.remove(); loader.remove();
}); });
@@ -211,9 +211,7 @@ export class GroupMessagesPage implements OnInit, OnChanges, AfterViewInit, OnDe
let containerHeight = windowHeight - e.srcElement.clientHeight; let containerHeight = windowHeight - e.srcElement.clientHeight;
if (scroll > this.currentPosition) { if (scroll > this.currentPosition) {
//alert('BOTTOM');
} else { } else {
//alert('UP');
this.scrollingOnce = false; this.scrollingOnce = false;
} }
if ((containerHeight - 100) > scroll) { if ((containerHeight - 100) > scroll) {
@@ -242,9 +242,7 @@ export class MessagesPage implements OnInit, OnChanges, AfterViewInit, OnDestroy
let containerHeight = windowHeight - e.srcElement.clientHeight; let containerHeight = windowHeight - e.srcElement.clientHeight;
if (scroll > this.currentPosition) { if (scroll > this.currentPosition) {
//alert('BOTTOM');
} else { } else {
//alert('UP');
this.scrollingOnce = false; this.scrollingOnce = false;
} }
if ((containerHeight - 100) > scroll) { if ((containerHeight - 100) > scroll) {
@@ -83,7 +83,7 @@ export class AllProcessesPage implements OnInit {
updateAllProcess = () => { updateAllProcess = () => {
this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento) this.AllProcess = this.expedientegbstore.list.concat(this.pedidosstore.listparecer).concat(this.pedidosstore.listdeferimento)
.concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.listmd).concat(this.eventoaprovacaostore.listpr).concat(this.despachoStore.list) .concat(this.despachoprstore.list).concat(this.eventoaprovacaostore.contactList).concat(this.despachoStore.list)
.concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list) .concat(this.deplomasStore.diplomasParaAssinarList).concat(this.deplomasStore.diplomasAssinadoList).concat(this.deplomasStore.DiplomaGerarList).concat(this.pendentesstore.list)
} }
@@ -26,7 +26,7 @@
<ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-location.svg"></ion-icon>
</div> </div>
<div class="ion-input-class"> <div class="ion-input-class">
<ion-input placeholder="Localização*" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input> <ion-input placeholder="Localização" [(ngModel)]="eventProcess.workflowInstanceDataFields.Location"></ion-input>
</div> </div>
</div> </div>
<!-- Error messages --> <!-- Error messages -->
@@ -324,6 +324,6 @@
<ion-footer class="background-whit"> <ion-footer class="background-whit">
<div class="buttons"> <div class="buttons">
<button class="btn-cancel cursor-pointer" shape="round" (click)="close()">Cancelar</button> <button class="btn-cancel cursor-pointer" shape="round" (click)="close()">Cancelar</button>
<button class="btn-ok cursor-pointer" shape="round" (click)="save()">Enviar</button> <button class="btn-ok cursor-pointer" shape="round" (click)="save()">Gravar</button>
</div> </div>
</ion-footer> </ion-footer>
@@ -13,6 +13,7 @@ import { Event, EventToApproveEdit } from '../../../models/event.model';
import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker'; import { NgxMatDateFormats, NGX_MAT_DATE_FORMATS } from '@angular-material-components/datetime-picker';
import { NavigationExtras, Router } from '@angular/router'; import { NavigationExtras, Router } from '@angular/router';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service'
const CUSTOM_DATE_FORMATS: NgxMatDateFormats = { const CUSTOM_DATE_FORMATS: NgxMatDateFormats = {
parse: { parse: {
@@ -117,7 +118,8 @@ export class EditEventToApproveComponent implements OnInit {
private processes:ProcessesService, private processes:ProcessesService,
private toastService: ToastService, private toastService: ToastService,
private router:Router, private router:Router,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHalde: HttpErrorHandle
) { ) {
// Edit event to approve // Edit event to approve
this.serialNumber = this.navParams.get('serialNumber'); this.serialNumber = this.navParams.get('serialNumber');
@@ -153,7 +155,7 @@ export class EditEventToApproveComponent implements OnInit {
this.getAttachments() this.getAttachments()
} catch (error) { } catch (error) {
this.httpErroHalde.httpStatusHandle(error)
} }
@@ -310,14 +312,9 @@ export class EditEventToApproveComponent implements OnInit {
this.eventsService.postEventToApproveEdit(event).subscribe(()=>{ this.eventsService.postEventToApproveEdit(event).subscribe(()=>{
this.toastService._successMessage('Evento editado'); this.httpErroHalde.httpsSucessMessagge('Editar evento')
}, error =>{ }, error =>{
if(error.status == 0) { this.httpErroHalde.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Evento não editado');
}
}) })
@@ -12,11 +12,12 @@
<!-- <ion-segment-button value="MDGPR"> <!-- <ion-segment-button value="MDGPR">
Minha agenda Minha agenda
</ion-segment-button> --> </ion-segment-button> -->
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'MDGPR' : 'PR'">
<ion-segment-button *ngFor="let calendars of eventService.calendarNamesAry; let i index" [value]="i === 'Meu calendario' ? 'Meu calendario' : i.OwnerUserId">
<div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div> <div *ngIf="calendars == 'Meu calendario'"> Minha agenda </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Presidente da República'"> Agenda do PR {{ i.OwnerUserIds }}</div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role == 'Ministro e Director do Gabinete do PR'"> Agenda do MD </div>
<div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname}} </div> <div *ngIf="calendars != 'Meu calendario' && calendars.Role != 'Ministro e Director do Gabinete do PR' && calendars.Role != 'Presidente da República'"> Agenda do {{calendars.Fullname }} </div>
</ion-segment-button> </ion-segment-button>
</ion-segment> </ion-segment>
</ion-toolbar> </ion-toolbar>
@@ -27,20 +28,20 @@
<ion-refresher-content> <ion-refresher-content>
</ion-refresher-content> </ion-refresher-content>
</ion-refresher> </ion-refresher>
<div class="main-content overflow-y-auto height-100" [ngSwitch]="segment" *ngIf="eventaprovacaostore.listpr"> <div class="main-content overflow-y-auto height-100" >
<div *ngSwitchCase="'MDGPR'" class="height-100"> <div class="height-100">
<div *ngIf="eventaprovacaostore.listmd"> <div >
<ion-list class="width-100" *ngIf="eventaprovacaostore.listmd.length != 0" > <ion-list class="width-100" >
<div <div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer" class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listmd" *ngFor="let event of eventoaprovacaostore.get(segment)"
(click)="goToEventDetail(event)" (click)="goToEventDetail(event)"
> >
<!-- (click)="openApproveModal(event)" --> <!-- (click)="openApproveModal(event)" -->
<div class="event-mdgpr-{{event.workflowInstanceDataFields.Agenda}} width-100"> <div class="event-{{color}}-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time"> <div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p> <p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
@@ -55,10 +56,10 @@
</ion-list> </ion-list>
</div> </div>
<div *ngIf="eventaprovacaostore.listmd" class="centered-div"> <div *ngIf="eventoaprovacaostore.get(segment)" class="centered-div">
<div *ngIf="eventaprovacaostore.listmd.length == 0"> <div *ngIf="eventoaprovacaostore.get(segment).length == 0">
<div *ngSwitchCase="'MDGPR'"> <div >
<div class="d-flex height-90 align-center justify-content-center" <div class="d-flex height-90 align-center justify-content-center"
> >
Lista vazia Lista vazia
@@ -67,41 +68,7 @@
</div> </div>
</div> </div>
</div> </div>
<div *ngSwitchCase="'PR'">
<div *ngIf="eventaprovacaostore.listpr.length != 0">
<ion-list class="width-100" *ngSwitchCase="'PR'">
<div class="width-100" *ngIf="eventaprovacaostore.listpr">
<div
class="expediente item-hover ion-no-padding ion-no-margin cursor-pointer"
*ngFor="let event of eventaprovacaostore.listpr"
(click)="goToEventDetail(event)"
>
<div class="item event-pr-{{event.workflowInstanceDataFields.Agenda}} width-100">
<div class="approve-event-time">
<p>{{event.workflowInstanceDataFields.StartDate | date: 'HH:mm'}}</p>
<p>{{event.workflowInstanceDataFields.EndDate | date: 'HH:mm'}}</p>
</div>
<div class="approve-event-detail">
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) != toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} - {{ event.workflowInstanceDataFields.EndDate | date: 'dd/M/yy'}} | {{event.workflowInstanceDataFields.Location}}</p>
<p *ngIf="toDateString(event.workflowInstanceDataFields.StartDate) == toDateString(event.workflowInstanceDataFields.EndDate)">{{event.workflowInstanceDataFields.StartDate | date: 'd/M/yy' }} | {{event.workflowInstanceDataFields.Location}}</p>
<h3>{{event.workflowInstanceDataFields.Subject}}</h3>
</div>
</div>
</div>
</div>
</ion-list>
</div>
<div *ngIf="eventaprovacaostore.listpr.length == 0" class="centered-div d-flex height-90 align-center justify-content-center">
<div *ngSwitchCase="'PR'" >
<div class="d-flex align-center justify-content-center"
*ngIf="eventaprovacaostore.listpr.length < 1">
Lista vazia
</div>
</div>
</div>
</div>
</div> </div>
</ion-content> </ion-content>
@@ -27,10 +27,13 @@ export class EventsToApprovePage implements OnInit {
eventBody: EventBody; eventBody: EventBody;
categories: string[]; categories: string[];
serialnumber:string; serialnumber:string;
loggeduser: LoginUserRespose;
segment:string; segment:string;
eventaprovacaostore = EventoAprovacaoStore; eventaprovacaostore = EventoAprovacaoStore;
eventsList: any = []
color: 'pr' | 'mdgpr'
eventoaprovacaostore = EventoAprovacaoStore;
constructor( constructor(
private processes:ProcessesService, private processes:ProcessesService,
private modalController: ModalController, private modalController: ModalController,
@@ -40,12 +43,17 @@ export class EventsToApprovePage implements OnInit {
private storage: Storage, private storage: Storage,
public eventService: EventsService, public eventService: EventsService,
) )
{ {}
this.loggeduser = SessionStore.user;
}
ngOnInit() { ngOnInit() {
this.segment = this.loggeduser.Profile; if(!this.segment) {
if(this.eventService.calendarNamesAry.includes('Meu calendario')) {
this.segment = 'Meu calendario';
} else {
this.segment = this.eventService.calendarNamesAry[0].OwnerUserId
}
}
this.LoadToApproveEvents(); this.LoadToApproveEvents();
this.router.events.forEach((event) => { this.router.events.forEach((event) => {
@@ -68,37 +76,50 @@ export class EventsToApprovePage implements OnInit {
async LoadToApproveEvents() { async LoadToApproveEvents() {
this.showLoader = true; this.showLoader = true;
const segment = this.segment
this.getFromDB(); if(this.segment == 'Meu calendario') {
if(this.segment != 'PR') { // color
let mdEventsOficial = await this.processes.GetTasksList('Agenda Oficial MDGPR,Agenda Pessoal MDGPR', false).toPromise(); if(SessionStore.user.Profile == 'PR') {
this.eventsMDGPRList = mdEventsOficial this.color = 'pr'
this.eventsMDGPRList = this.sortService.sortArrayByDate(this.eventsMDGPRList) } else {
this.eventsMDGPRList = ( this.eventsMDGPRList || []).filter(function(item) { this.color = 'mdgpr'
}
let genericEvents = await this.processes.GetTasksList('Agendar Evento', false).toPromise();
try {
this.eventsList = this.sortService.sortArrayByDate(genericEvents).reverse();
} catch (error) {
this.eventsList = [];
}
this.eventsList = this.eventsList.filter(function(item) {
return item.activityInstanceName != 'Editar Evento' return item.activityInstanceName != 'Editar Evento'
}) || [] }) || []
this.storage.set('event-to-aproveMD',this.eventsMDGPRList).then(() => { this.eventoaprovacaostore.save(segment, this.eventsList)
} else {
})
this.eventaprovacaostore.resetmd(this.sortService.sortDate(this.eventsMDGPRList, 'CreateDate')); this.color = 'pr'
}
else if(this.segment == 'PR') { let allEvents = await this.processes.eventsToApprove(segment).toPromise()
let prEventsOficial = await this.processes.GetTasksList('Agenda Oficial PR,Agenda Pessoal PR', false).toPromise(); try {
// console.log(prEventsOficial) this.eventsList = this.sortService.sortArrayByDate(allEvents).reverse();
// console.log(prEventsPessoal) } catch(error) {
this.eventsPRList = prEventsOficial this.eventsList = []
this.eventsPRList = this.sortService.sortArrayByDate(this.eventsPRList) }
this.eventsPRList = (this.eventsPRList || []).filter(function(item) {
this.eventsList = this.eventsList.filter(function(item) {
return item.activityInstanceName != 'Editar Evento' return item.activityInstanceName != 'Editar Evento'
}) }) || []
this.storage.set('event-to-aprovePR',this.eventsPRList).then(() => { this.eventsList = this.eventsList
this.eventsList = this.eventsList
}) this.showLoader = false;
this.eventaprovacaostore.resetpr(this.sortService.sortDate(this.eventsPRList, 'CreateDate')); this.eventoaprovacaostore.save(segment, this.eventsList)
} }
this.showLoader = false; this.showLoader = false;
} }
@@ -11,6 +11,7 @@ import { customTask, fullTask } from 'src/app/models/dailyworktask.model';
import { PermissionService } from 'src/app/services/permission.service'; import { PermissionService } from 'src/app/services/permission.service';
import { ThemeService } from 'src/app/services/theme.service' import { ThemeService } from 'src/app/services/theme.service'
import { RouteService } from 'src/app/services/route.service'; import { RouteService } from 'src/app/services/route.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-despachos-options', selector: 'app-despachos-options',
@@ -32,6 +33,7 @@ export class DespachosOptionsPage implements OnInit {
public p: PermissionService, public p: PermissionService,
public ThemeService: ThemeService, public ThemeService: ThemeService,
private RouteService: RouteService, private RouteService: RouteService,
private httpErrorHandle: HttpErrorHandle,
) { ) {
this.task = this.navParams.get('task') this.task = this.navParams.get('task')
this.fulltask = this.navParams.get('fulltask') this.fulltask = this.navParams.get('fulltask')
@@ -74,18 +76,13 @@ export class DespachosOptionsPage implements OnInit {
const loader = this.toastService.loading() const loader = this.toastService.loading()
this.popoverController.dismiss(); this.popoverController.dismiss();
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{ this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
this.toastService._successMessage() this.httpErrorHandle.httpsSucessMessagge('Enviar para Pendentes')
loader.remove() loader.remove()
this.close(); this.close();
},(error)=>{ },(error)=>{
loader.remove() loader.remove()
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Processo não encontrado')
}
}); });
} }
@@ -96,7 +96,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-textarea-class flex-grow-1"> <div class="ion-textarea-class flex-grow-1">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="folder.Detail" rows="12" cols="20" placeholder="Descrição da acção..."></ion-textarea> <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>
</div> </div>
</div> </div>
@@ -4,6 +4,7 @@ import * as moment from 'moment';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-edit-action', selector: 'app-edit-action',
@@ -40,6 +41,7 @@ export class EditActionPage implements OnInit {
constructor( constructor(
private publicationsService: PublicationsService, private publicationsService: PublicationsService,
private toastService: ToastService, private toastService: ToastService,
private httpErrorHandle: HttpErrorHandle,
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
} }
@@ -107,15 +109,11 @@ export class EditActionPage implements OnInit {
await this.publicationsService.UpdatePresidentialAction(body).toPromise() await this.publicationsService.UpdatePresidentialAction(body).toPromise()
this.close(); this.close();
this.updateDesktopComponent.emit(); this.updateDesktopComponent.emit();
this.toastService._successMessage('Acção presidencial atualizada') this.httpErrorHandle.httpsSucessMessagge('Editar Acção')
this.getActions.emit() this.getActions.emit()
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Não foi possivel atualizar a acção presidencial')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -101,7 +101,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Detail')?.invalid && validateFrom "> <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> <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>
</div> </div>
</div> </div>
@@ -4,6 +4,7 @@ import * as moment from 'moment';
import { PublicationFolder } from 'src/app/models/publicationfolder'; import { PublicationFolder } from 'src/app/models/publicationfolder';
import { PublicationsService } from 'src/app/services/publications.service'; import { PublicationsService } from 'src/app/services/publications.service';
import { ToastService } from 'src/app/services/toast.service'; import { ToastService } from 'src/app/services/toast.service';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
@@ -36,7 +37,8 @@ export class NewActionPage implements OnInit {
constructor( constructor(
private publication: PublicationsService, private publication: PublicationsService,
private toastService: ToastService private toastService: ToastService,
private httpErrorHandle: HttpErrorHandle,
) { ) {
this.folder = new PublicationFolder(); this.folder = new PublicationFolder();
@@ -121,16 +123,11 @@ export class NewActionPage implements OnInit {
try { try {
await this.publication.CreatePublicationFolder(this.folder).toPromise() await this.publication.CreatePublicationFolder(this.folder).toPromise()
this.close(); this.close();
this.toastService._successMessage('Acção presidencial criada') this.httpErrorHandle.httpsSucessMessagge('Acção criada')
this.getActions.emit() this.getActions.emit()
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErrorHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest('Não foi possivel criar a acção presidencial')
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -23,7 +23,7 @@
<ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon> <ion-icon slot="start" src="assets/images/icons-description.svg"></ion-icon>
</div> </div>
<div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Message')?.invalid && validateFrom "> <div class="ion-textarea-class flex-grow-1" [class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message" name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto..."></ion-textarea> <ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message" name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
</div> </div>
</div> </div>
</div> </div>
@@ -8,6 +8,7 @@ import { ToastService } from 'src/app/services/toast.service';
import { FormControl, FormGroup, Validators } from '@angular/forms'; import { FormControl, FormGroup, Validators } from '@angular/forms';
import { ThemeService } from 'src/app/services/theme.service'; import { ThemeService } from 'src/app/services/theme.service';
import { Camera, CameraResultType, CameraSource} from '@capacitor/camera'; import { Camera, CameraResultType, CameraSource} from '@capacitor/camera';
import { HttpErrorHandle } from 'src/app/services/http-error-handle.service';
@Component({ @Component({
selector: 'app-new-publication', selector: 'app-new-publication',
templateUrl: './new-publication.page.html', templateUrl: './new-publication.page.html',
@@ -48,7 +49,8 @@ export class NewPublicationPage implements OnInit {
public photoService: PhotoService, public photoService: PhotoService,
private publications: PublicationsService, private publications: PublicationsService,
private toastService: ToastService, private toastService: ToastService,
public ThemeService: ThemeService public ThemeService: ThemeService,
private httpErroHandle: HttpErrorHandle
) { ) {
this.publicationTitle = 'Nova Publicação'; this.publicationTitle = 'Nova Publicação';
} }
@@ -115,11 +117,11 @@ export class NewPublicationPage implements OnInit {
this.Form = new FormGroup({ this.Form = new FormGroup({
Subject: new FormControl(this.pub.Title, [ Subject: new FormControl(this.pub.Title, [
// Validators.required, Validators.required,
// Validators.minLength(4) // Validators.minLength(4)
]), ]),
Message: new FormControl(this.pub.Message, [ Message: new FormControl(this.pub.Message, [
// Validators.required Validators.required,
Validators.maxLength(1000) Validators.maxLength(1000)
]) ])
}) })
@@ -131,7 +133,11 @@ export class NewPublicationPage implements OnInit {
this.injectValidation() this.injectValidation()
this.runValidation() this.runValidation()
if(this.Form.invalid) return false if(this.Form.invalid) {
return false
} else {
}
if(this.publicationType == '3') { if(this.publicationType == '3') {
@@ -155,15 +161,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Criar publicação')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -188,15 +190,11 @@ export class NewPublicationPage implements OnInit {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Criar publicação')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -220,15 +218,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise() await this.publications.UpdatePublication(this.publication.ProcessId, this.publication).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Criar publicação')
this.goBack(); this.goBack();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
@@ -255,15 +249,11 @@ export class NewPublicationPage implements OnInit {
try { try {
await this.publications.CreatePublication(this.folderId, this.publication).toPromise() await this.publications.CreatePublication(this.folderId, this.publication).toPromise()
this.toastService._successMessage() this.httpErroHandle.httpsSucessMessagge('Criar publicação')
this.goBackToViewPublications.emit(); this.goBackToViewPublications.emit();
} catch (error) { } catch (error) {
if(error.status == 0) { this.httpErroHandle.httpStatusHandle(error)
this.toastService._badRequest('Sem acesso à internet. Por favor verifique sua conexão')
} else {
this.toastService._badRequest()
}
} finally { } finally {
loader.remove() loader.remove()
} }
+59 -72
View File
@@ -9,109 +9,96 @@ import { isArray } from 'ionic-angular/umd/util/util';
export class EventoaprovacaoStoreService { export class EventoaprovacaoStoreService {
// main data // main data
private _listPr: any[] = [] private _list: {[key: string]: any[]} = {}
private _listMd: any[] = [] private _concatList = []
// local storage keyName // local storage keyName
private keyNamemd: string; private keyNameAll: string;
private keyNamepr: string;
private _count = 0 private _counts : {[key: string]: number} = {}
private _countPr = 0 private _countsAll = 0
private _countMd = 0
constructor() { constructor() {
this.keyNamemd = (SHA1("EventoaprovacaoStoreService"+"md")).toString() this.keyNameAll = (SHA1("EventoaprovacaoStoreService"+"all")).toString()
this.keyNamepr = (SHA1("EventoaprovacaoStoreService"+"pr")).toString()
setTimeout(()=>{ setTimeout(()=>{
let restoreMd = localstoreService.get(this.keyNamemd, []) let {list , counts} = localstoreService.get(this.keyNameAll, {})
let restorePr = localstoreService.get(this.keyNamepr, [])
this._listPr = restorePr.listPr || [] this._list = list || {}
this._listMd = restoreMd.lisMd || []
this._countMd = parseInt(restoreMd.countListMd) || 0 this.updateCount();
this._countPr = parseInt(restorePr.countListPr) || 0
this._count = (this._countMd + this._countPr) || 0
}, 10) }, 10)
} }
get listpr() { return this._listPr || [] } get countAll() {
get listmd() { return this._listMd || [] } return this._countsAll
get count() { return this._count || 0 }
set count(value: number) {
this._count = value
} }
get countPr() { return this._countPr || 0 } get contactList() {
set countPr (value: number) { return this._concatList
this._countPr = value
} }
get countMd() { return this._countMd || 0 }
set countMd (value) {
this._countMd = value
}
resetpr(eventsList: any) { save(segment, value: []) {
if(Array.isArray(eventsList)) {
this._listPr = eventsList
this.countPr = this._listPr.length if(!this._list[segment]) {
this.count = this.countPr + this.countMd this._list[segment] = []
this._counts[segment] = 0
this.savePr()
if(window['all-process']) {
window['all-process']()
}
if(window['all-process-gabinete']) {
window['all-process-gabinete']()
}
} }
} this._list[segment] = value
this._counts[segment] = value.length
resetmd(eventsList: any) { this.updateCount();
if(Array.isArray(eventsList)) {
this._listMd = eventsList
this.countMd = this._listMd.length setTimeout(() => {
this.count = this.countPr + this.countMd localstoreService.set(this.keyNameAll,{
this.saveMd() list: this._list,
counts: this._counts
if(window['all-process']) {
window['all-process']()
}
if(window['all-process-gabinete']) {
window['all-process-gabinete']()
}
}
}
private saveMd() {
setTimeout(()=>{
localstoreService.set(this.keyNamemd,{
lisMd: this._listMd,
countListMd: this._countMd
}) })
}, 10) }, 10)
if(window['all-process']) {
window['all-process']()
}
if(window['all-process-gabinete']) {
window['all-process-gabinete']()
}
} }
private savePr() { clear() {
setTimeout(()=>{ this._list = {}
localstoreService.set(this.keyNamepr,{ this._counts = {}
listPr: this._listPr,
countListPr: this._countPr setTimeout(() => {
localstoreService.set(this.keyNameAll,{
list: this._list,
counts: this._counts
}) })
}, 10) }, 10)
} }
get(segment) {
return this._list[segment] || []
}
updateCount() {
let allList = []
for(let [name, value] of Object.entries(this._list)) {
allList = allList.concat(value)
}
this._countsAll = allList.length
this._concatList = allList
}
} }
export const EventoAprovacaoStore = new EventoaprovacaoStoreService() export const EventoAprovacaoStore = new EventoaprovacaoStoreService()
-1
View File
@@ -1588,7 +1588,6 @@
if (!this.pdfViewer.pageViewsReady) { if (!this.pdfViewer.pageViewsReady) {
this.l10n.get('printing_not_ready', null, 'Warning: The PDF is not fully loaded for printing.').then(function (notReadyMessage) { this.l10n.get('printing_not_ready', null, 'Warning: The PDF is not fully loaded for printing.').then(function (notReadyMessage) {
window.alert(notReadyMessage);
}); });
return; return;
} }
File diff suppressed because one or more lines are too long