This commit is contained in:
tiago.kayaya
2021-07-28 16:27:48 +01:00
19 changed files with 352 additions and 173 deletions
+16
View File
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { DespachoMdService } from './despacho-md.service';
describe('DespachoMdService', () => {
let service: DespachoMdService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(DespachoMdService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+73
View File
@@ -0,0 +1,73 @@
import { Injectable } from '@angular/core';
import { ProcessesService } from '../services/processes.service';
@Injectable({
providedIn: 'root'
})
export class DespachoMdService {
/**
* @description para terminar o
* 95 - signfica
* 98 - significa
*/
ActionTypeId: 95 | 98
action: "Arquivo" | "Reencaminhar"
constructor(
private processes: ProcessesService,
) { }
arquivar(note:string, documents:any, serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Arquivo",
"ActionTypeId": 95,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
reencaminhar(note:string, documents:any, serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Reencaminhar",
"ActionTypeId": 98,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
executado(note:string, documents:any , serialnumber) {
let body = {
"serialNumber": serialnumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
return this.processes.CompleteTask(body)
}
sendExpedienteToPending(serialnumber) {
return this.processes.SetTaskToPending(serialnumber)
}
}
+50
View File
@@ -0,0 +1,50 @@
export class CallMeeting {
"EventProcess": {
"SerialNumber": "sample string 1",
"Body": "sample string 2",
"Location": "sample string 3",
"Subject": "sample string 4",
"StartDate": "2021-07-28T13:22:55.031857+01:00",
"EndDate": "2021-07-28T13:22:55.031857+01:00",
"ReviewUserComment": "sample string 7",
"MDName": "sample string 8",
"MDEmail": "sample string 9",
"IsAllDayEvent": true,
"Status": "sample string 11",
"EventType": "sample string 12",
"IsRecurring": true,
"ParticipantsList": [
{
"Id": 1,
"EmailAddress": "sample string 2",
"Name": "sample string 3",
"IsRequired": true
},
{
"Id": 1,
"EmailAddress": "sample string 2",
"Name": "sample string 3",
"IsRequired": true
}
],
"Message": "sample string 14",
"EventRecurrence": {
"Type": 0,
"Day": 1,
"DayOfWeek": 0,
"Month": 1,
"LastOccurrence": "2021-07-28T13:22:55.031857+01:00"
},
"Participants": "sample string 15",
"CC": "sample string 16"
}
"Attachment": {
"Id": 1,
"ParentId": "sample string 2",
"Source": 0,
"SourceId": "sample string 3",
"SourceName": "sample string 4",
"ApplicationId": 1
}
}
+10
View File
@@ -0,0 +1,10 @@
export class Excludetask{
serialNumber: any;
action: string;
ActionTypeId: any;
dataFields: {
ReviewUserComment?: string,
Note?: any
}
AttachmentList?: any
}
+4 -1
View File
@@ -409,6 +409,9 @@
(closeComponent)="approveEventDismissGoBack()"
(setIntervenient)="setIntervenient($event)"
(setIntervenientCC)="setIntervenientCC($event)"
(closeEventToApprove)="closeEventToApproveGoBack()"
></app-edit-event-to-approve>
<app-attendee-modal
@@ -429,4 +432,4 @@
</div>
</ion-content>
</ion-content>
+1 -9
View File
@@ -338,15 +338,7 @@ export class AgendaPage implements OnInit {
let classs = [];
events.forEach(element => {
const startTimeSamp = new Date(element.startTime).toLocaleDateString()
const endTimeSamp = new Date(element.endTime).toLocaleDateString()
const endMinutes = new Date(element.endTime).getMinutes()
const endHours = new Date(element.endTime).getHours()
const endDay: number = new Date(element.endTime).getDate()
const startDay = new Date(element.startTime).getDate()
const profile_ = element.profile == 'md'? 'mdgpr': 'pr';
const eventtype = element.event.CalendarName;
@@ -15,6 +15,7 @@ import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-
import { ActivatedRoute, NavigationExtras, Router } from '@angular/router';
import { ToastService } from 'src/app/services/toast.service';
import { EliminateEventPage } from 'src/app/modals/eliminate-event/eliminate-event.page';
import { Location } from '@angular/common'
@Component({
selector: 'app-view-event',
@@ -58,6 +59,7 @@ export class ViewEventPage implements OnInit {
private activatedRoute: ActivatedRoute,
private router: Router,
private toastService: ToastService,
private location: Location
)
{
this.isEventEdited = false;
@@ -109,14 +111,16 @@ export class ViewEventPage implements OnInit {
if(this.isModal) {
this.close()
} else {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].caller == 'expediente'){
window.history.back();
}
else{
this.router.navigate(['/home',params["params"].caller]);
}
});
// this.activatedRoute.paramMap.subscribe(params => {
// if(params["params"].caller == 'expediente'){
// window.history.back();
// }
// else{
// this.router.navigate(['/home',params["params"].caller]);
// }
// });
this.location.back();
}
}
@@ -128,13 +132,17 @@ export class ViewEventPage implements OnInit {
/* this.today = new Date(res.StartDate);
this.customDate = this.days[this.today.getDay()]+ ", " + this.today.getDate() +" de " + ( this.months[this.today.getMonth()]); */
loader.remove()
}, ()=>{
}, (error)=>{
loader.remove()
this.toastService.badRequest('Este evento já não existe na sua agenda')
this.modalController.dismiss('Eevent not Foud');
this.router.navigate(['/home/agenda']);
if(error.status == 0) {
this.toastService.badRequest('não é possível vizualizar este event no modo offline')
} else {
this.toastService.badRequest('Este evento já não existe na sua agenda')
}
loader.remove()
this.modalController.dismiss('Eevent not Foud');
this.location.back();
});
}
@@ -15,6 +15,9 @@ import { DelegarPage } from 'src/app/modals/delegar/delegar.page';
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
import { DespachosOptionsPage } from 'src/app/shared/popover/despachos-options/despachos-options.page';
import { ToastService } from 'src/app/services/toast.service';
import { DespachoMdService } from 'src/app/Rules/despacho-md.service'
import { NavigationService } from 'src/app/services/navigation.service';
import { Location } from '@angular/common'
@Component({
selector: 'app-despacho',
@@ -50,6 +53,10 @@ export class DespachoPage implements OnInit {
private router: Router,
private animationController: AnimationController,
private toastService: ToastService,
private despachoMdService: DespachoMdService,
private navigationService: NavigationService,
private location: Location
) {
this.activatedRoute.paramMap.subscribe(params => {
if(params["params"].SerialNumber) {
@@ -80,31 +87,35 @@ export class DespachoPage implements OnInit {
}
goBack() {
if(this.task.Status == "Pending" && this.caller == 'gabinete-digital'){
if (window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/pendentes']);
}
else {
let navigationExtras: NavigationExtras = {
queryParams: {
"pendentes": true,
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
else{
if (window.innerWidth < 801) {
this.router.navigate(['/home/gabinete-digital/despachos']);
} else {
let navigationExtras: NavigationExtras = {
queryParams: {
'despachos': true
}
}
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
//this.navigationService.back()
this.location.back();
// if(this.task.Status == "Pending" && this.caller == 'gabinete-digital'){
// if (window.innerWidth < 801) {
// this.router.navigate(['/home/gabinete-digital/pendentes']);
// }
// else {
// let navigationExtras: NavigationExtras = {
// queryParams: {
// "pendentes": true,
// }
// }
// this.router.navigate(['/home/gabinete-digital'], navigationExtras);
// }
// }
// else{
// if (window.innerWidth < 801) {
// this.router.navigate(['/home/gabinete-digital/despachos']);
// } else {
// let navigationExtras: NavigationExtras = {
// queryParams: {
// 'despachos': true
// }
// }
// this.router.navigate(['/home/gabinete-digital'], navigationExtras);
// }
// }
}
async LoadTaskDetail(serial: string) {
@@ -188,21 +199,12 @@ export class DespachoPage implements OnInit {
this.modalController.dismiss();
}
async executado(note:string, documents:any){
let body = {
"serialNumber": this.serialnumber,
"action": "Conhecimento",
"ActionTypeId": 104,
"dataFields": {
"ReviewUserComment": note,
},
"AttachmentList" :documents,
}
async executado(note:string, documents:any) {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(body).toPromise()
await this.despachoMdService.executado(note, documents, this.serialnumber)
this.toastService.successMessage('Processo criado')
this.close();
} catch(error) {
@@ -213,7 +215,7 @@ export class DespachoPage implements OnInit {
}
}
async arquivar(note:string, documents:any){
async arquivar(note:string, documents:any) {
let body = {
"serialNumber": this.serialnumber,
"action": "Arquivo",
@@ -236,6 +238,7 @@ export class DespachoPage implements OnInit {
loader.remove()
}
}
async reencaminhar(note:string, documents:any) {
@@ -296,13 +299,15 @@ export class DespachoPage implements OnInit {
}
async sendExpedienteToPending() {
this.processes.SetTaskToPending(this.serialnumber).subscribe(res=>{
this.despachoMdService.sendExpedienteToPending(this.serialnumber).subscribe(res=>{
this.goBack();
this.toastService.successMessage('Processo enviado para despacho')
},
error => {
this.toastService.badRequest("Processo não enviado para despacho")
});
}
async openAddNoteModal(actionName:string) {
@@ -270,7 +270,7 @@ export class ExpedienteDetailPage implements OnInit {
const loader = this.toastService.loading()
try {
await this.processes.CompleteTask(otherbody).toPromise()
await this.processes.CompleteTask(otherbody)
this.toastService.successMessage('Processo descartado');
this.goBack();
} catch (error) {
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { NavigationService } from './navigation.service';
describe('NavigationService', () => {
let service: NavigationService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(NavigationService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
+26
View File
@@ -0,0 +1,26 @@
import { Injectable } from '@angular/core'
import { Location } from '@angular/common'
import { Router, NavigationEnd } from '@angular/router'
@Injectable({ providedIn: 'root' })
export class NavigationService {
private history: string[] = []
constructor(private router: Router, private location: Location) {
this.router.events.subscribe((event) => {
if (event instanceof NavigationEnd) {
this.history.push(event.urlAfterRedirects)
}
})
}
back(): void {
this.history.pop()
if (this.history.length > 0) {
this.location.back()
} else {
this.router.navigateByUrl('/')
}
}
}
+16 -3
View File
@@ -5,6 +5,8 @@ import { AuthService } from '../services/auth.service';
import { User } from '../models/user.model';
import { environment } from 'src/environments/environment';
import { Observable } from 'rxjs';
import { CallMeeting } from '../models/CallMeeting';
import { Excludetask } from '../models/Excludetask';
@Injectable({
providedIn: 'root'
@@ -49,6 +51,7 @@ export class ProcessesService {
};
return this.http.get<any>(`${geturl}`, options);
}
SetTaskToPending(serialNumber:string): Observable<any>{
const geturl = environment.apiURL + 'Tasks/SetTaskPending';
let params = new HttpParams();
@@ -154,7 +157,7 @@ export class ProcessesService {
return this.http.post<any>(`${geturl}`, body, options)
}
CompleteTask(body:any){
CompleteTask(body:Excludetask) {
const geturl = environment.apiURL + 'Tasks/CompleteTask';
let options = {
@@ -239,7 +242,6 @@ export class ProcessesService {
return this.http.post<any>(`${geturl}`, body, options)
}
GetActionsList(){
const geturl = environment.apiURL + 'presidentialActions';
let options = {
@@ -249,7 +251,8 @@ export class ProcessesService {
return this.http.get<any>(`${geturl}`, options);
}
GetSubjectType(){
GetSubjectType() {
const geturl = environment.apiURL + 'ecm/SubjectType';
let options = {
headers: this.headers,
@@ -272,4 +275,14 @@ export class ProcessesService {
return this.http.get<any>(`${geturl}`, options);
}
CallMeeting(body: CallMeeting) {
const geturl = environment.apiURL + 'Processes/CallMeeting';
let options: any = {
headers: this.headers,
}
return this.http.post<any>(`${geturl}`,body, options);
}
}
@@ -22,11 +22,19 @@
<div class="header-title flex-grow-1 cursor-pointer">
<label>{{loadedEvent.workflowInstanceDataFields.Subject}} </label>
</div>
<div (click)="editar(loadedEvent.serialNumber)" class="header-icon-right display-none-{{showAside}}">
<button class="btn-no-color">
<ion-icon src="assets/images/icons-edit.svg"></ion-icon>
</button>
</div>
<div (click)="rejectTask(loadedEvent.serialNumber)" class="header-icon-right display-none-{{showAside}}">
<button class="btn-no-color" >
<ion-icon class="delete" name="trash-sharp"></ion-icon>
</button>
</div>
</div>
<div class="upper-content d-flex flex-column">
<div class="content-location">
@@ -114,9 +122,8 @@
</ion-content>
<ion-footer class="display-none-{{showAside}} ion-no-border">
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Adicionar Nota</button>
<button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
<button class="btn-delete" shape="round" (click)="rejectTask(loadedEvent.serialNumber)">Rejeitar</button>
</div>
<div class="buttons">
<button class="btn-cancel" shape="round" (click)="emendTask(loadedEvent.serialNumber)">Adicionar Nota</button>
<button class="btn-ok" shape="round" (click)="approveTask(loadedEvent.serialNumber)">Aprovar</button>
</div>
</ion-footer>
@@ -207,4 +207,13 @@ ion-menu{
width: 25%;
}
} */
.delete{
padding: 7px;
font-size: 21px;
color:#fff;
background: #d30606;
border-radius: 20px;
}
@@ -69,12 +69,12 @@ export class ApproveEventPage implements OnInit {
setTimeout(()=>{
this.getTask();
this.getAttachments();
}, 4000)
}, 6000)
setTimeout(()=>{
this.getTask();
this.getAttachments();
}, 6000)
}, 10000)
}
@@ -135,7 +135,6 @@ export class ApproveEventPage implements OnInit {
try {
await this.processes.PostTaskAction(body).toPromise()
this.router.navigate(['/home/gabinete-digital/event-list']);
this.toastService.successMessage('Evento rejeitado')
} catch (error) {
this.toastService.badRequest('Processo não efectuado')
@@ -218,12 +217,17 @@ export class ApproveEventPage implements OnInit {
}
goToEventsToApprove() {
let navigationExtras: NavigationExtras = {
queryParams: {
if(window.location.pathname.startsWith('/home/agenda')) {
this.close()
} else {
let navigationExtras: NavigationExtras = {
queryParams: {
"eventos": true,
}
};
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
};
this.router.navigate(['/home/gabinete-digital'], navigationExtras);
}
}
@@ -109,6 +109,7 @@ export class EditEventToApprovePage implements OnInit {
@Output() setIntervenient = new EventEmitter<any>();
@Output() setIntervenientCC = new EventEmitter<any>();
@Output() closeComponent = new EventEmitter<any>();
@Output() closeEventToApprove = new EventEmitter<any>();
@Input() saveData: any;
@Input() serialNumber: string
@@ -210,7 +211,10 @@ export class EditEventToApprovePage implements OnInit {
window['temp.path:/shared/agenda/edit-event-to-approve.ts'] = {}
this.closeComponent.emit();
// this.closeComponent.emit();
this.closeEventToApprove.emit();
/* this.setIntervenient.emit([]);
this.setIntervenientCC.emit([]);
this.clearContact.emit(); */
@@ -254,8 +258,6 @@ export class EditEventToApprovePage implements OnInit {
}
async save() {
this.close()
this.injectValidation()
this.runValidation()
@@ -303,8 +305,9 @@ export class EditEventToApprovePage implements OnInit {
try {
await this.eventsService.postEventToApproveEdit(event).toPromise()
this.close()
this.toastService.successMessage('Evento editado');
} catch(e) {
this.toastService.badRequest('Evento não editado');
@@ -168,100 +168,41 @@ export class ViewEventPage implements OnInit {
});
}
async openExpedientActionsModal(taskAction: any, task: any) {
let classs;
if( window.innerWidth <= 800){
classs = 'modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const doc = this.loadedAttachments[ this.dicIndex];
task = {
serialNumber: doc.SourceId,
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
const modal = await this.modalController.create({
component: ExpedientTaskModalPage,
componentProps: {
taskAction: taskAction,
task: task,
profile: this.profile,
},
cssClass: classs,
});
await modal.present();
modal.onDidDismiss().then(res=>{
console.log(res['data']);
if(res['data']=='openDiscart'){
console.log('open discart');
// this.distartExpedientModal();
}
});
}
async openBookMeetingModal(task: any) {
const doc = this.loadedAttachments[ this.dicIndex];
const Customtask = {
serialNumber: doc.SourceId,
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
Subject: doc.SourceName
},
}
let classs;
if( window.innerWidth <= 800){
classs = 'book-meeting-modal modal modal-desktop'
} else {
classs = 'modal modal-desktop showAsideOptions'
}
const modal = await this.modalController.create({
component: BookMeetingModalPage,
componentProps: {
task: task,
},
cssClass: classs,
backdropDismiss: false
});
await modal.present();
modal.onDidDismiss();
}
async openTaskOptions() {
const doc = this.loadedAttachments[ this.dicIndex];
let customTask = {
serialNumber: doc.SourceId,
taskStartDate: doc.CreateDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationId,
FolderID: null,
DocId: doc.SourceId,
Subject: doc.SourceName
},
let customTask;
if(doc.ApplicationID == 361 || doc.ApplicationId == 361) {
customTask = {
serialNumber: doc.DispatchNumber,
taskStartDate: doc.DateDispatch,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationID,
FolderID: null,
DocId: doc.DispatchNumber,
Subject: doc.Assunto
},
}
} else if (doc.ApplicationID == 8 || doc.ApplicationId == 8) {
customTask = {
serialNumber: doc.DocId,
taskStartDate: doc.DocDate,
isEvent: true,
workflowInstanceDataFields: {
FsId: doc.ApplicationID || doc.ApplicationId,
FolderID: null,
DocId: doc.DocId,
Subject: doc.Assunto
}
}
}
console.log(doc)
customTask.Status = ''
const popover = await this.modalController.create({
component: OptsExpedientePage,
cssClass: 'model aside-modal search-submodal',
@@ -104,7 +104,6 @@ export class OptsExpedientePage implements OnInit {
}
}
sendExpedienteToPending() {
this.close();
this.processes.SetTaskToPending(this.task.SerialNumber).subscribe(res=>{
@@ -136,6 +135,10 @@ export class OptsExpedientePage implements OnInit {
}
async openExpedientActionsModal(taskAction: any, task: any) {
alert('save')
console.log(taskAction, task)
this.close();
let classs;
if( window.innerWidth <= 800){
@@ -20,7 +20,7 @@ export class ToDayEventStorageService {
this.keyName = (SHA1(this.constructor.name+ 'home/eventSource')).toString()
setTimeout(()=>{
setTimeout(() => {
let restore = localstoreService.get(this.keyName, {})
this._eventsList = restore.eventsList || []
this._count = this._eventsList.length || 0