mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
Merge branch 'developer' of bitbucket.org:equilibriumito/gabinete-digital into developer
This commit is contained in:
@@ -8,7 +8,7 @@ import { ActivatedRoute, Router } from '@angular/router';
|
||||
|
||||
import { Event } from '../../../../models/event.model';
|
||||
import { MenuController, ModalController, PopoverController } from '@ionic/angular';
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { BookMeetingModalPage } from '../../expediente/book-meeting-modal/book-meeting-modal.page';
|
||||
import { CreateProcessPage } from 'src/app/modals/create-process/create-process.page';
|
||||
@@ -20,6 +20,9 @@ import { Location } from '@angular/common'
|
||||
import { DespachoService } from 'src/app/Rules/despacho.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho-pr',
|
||||
templateUrl: './despacho-pr.page.html',
|
||||
@@ -29,7 +32,7 @@ export class DespachoPrPage implements OnInit {
|
||||
months = ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"];
|
||||
days = ["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"];
|
||||
|
||||
customDate:any;
|
||||
customDate: any;
|
||||
|
||||
task: any;
|
||||
fulltask: any;
|
||||
@@ -52,34 +55,25 @@ export class DespachoPrPage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private toastService: ToastService,
|
||||
private location: Location,
|
||||
private despachoService: DespachoService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
this.serialNumber = params["params"].SerialNumber;
|
||||
}
|
||||
if(params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
private despachoService: DespachoService,
|
||||
private sqliteservice: SqliteService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if (params["params"].SerialNumber) {
|
||||
this.serialNumber = params["params"].SerialNumber;
|
||||
}
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
|
||||
console.log('DespachoPrPage SerialNumber', this.serialNumber)
|
||||
}
|
||||
console.log('DespachoPrPage SerialNumber', this.serialNumber)
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.profile = "mdgpr";
|
||||
console.log(this.serialNumber);
|
||||
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
this.getFromDB();
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -92,12 +86,12 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
this.processes.GetTask(serial).subscribe((res:fullTask) => {
|
||||
this.processes.GetTask(serial).subscribe((res: fullTask) => {
|
||||
this.task = {
|
||||
"SerialNumber": res.serialNumber,
|
||||
"Folio": res.workflowInstanceDataFields.Subject,
|
||||
"Senders": res.originator.email,
|
||||
"CreateDate": momentG(new Date(res.taskStartDate),'yyyy-MM-dd HH:mm:ss'),
|
||||
"CreateDate": momentG(new Date(res.taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": res.workflowInstanceDataFields.ViewerRequest,
|
||||
"Remetente": res.workflowInstanceDataFields.Sender,
|
||||
"Note": res.workflowInstanceDataFields.TaskMessage || res.workflowInstanceDataFields.Note,
|
||||
@@ -114,32 +108,36 @@ export class DespachoPrPage implements OnInit {
|
||||
console.log(this.task);
|
||||
|
||||
console.log('GetTask', res);
|
||||
this.sqliteservice.updateProcess(res)
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()]+ ", " + thedate.getDate() +" de " + ( this.months[thedate.getMonth()]);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
|
||||
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users=>{
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.processes.GetTaskParticipants(this.task.FolderId).subscribe(users => {
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialNumber), JSON.stringify(users)).then(() => {
|
||||
console.log('internen despacho pr ')
|
||||
})
|
||||
this.intervenientes = users.filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
return user.Type == 'CC';
|
||||
}) || []
|
||||
|
||||
|
||||
if(!this.cc) {
|
||||
this.cc = []
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
window.history.back();
|
||||
} finally {
|
||||
if(error.status == 0) {
|
||||
if (error.status == 0) {
|
||||
this.toastService.badRequest('Não é possível visualizar este processo no modo offline')
|
||||
} else {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
@@ -148,6 +146,71 @@ export class DespachoPrPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
if (synchro.connected === true) {
|
||||
this.activateRoute.paramMap.subscribe(paramMap => {
|
||||
if (!paramMap.has('SerialNumber')) {
|
||||
return;
|
||||
}
|
||||
/* this.serialNumber = paramMap.get('SerialNumber'); */
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
});
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
// this.LoadRelatedEvents(this.serialNumber);
|
||||
|
||||
} else {
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process: any[]) => {
|
||||
console.log('OFFLINE', process)
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": JSON.parse(process[0].workflowInstanceDataFields).Subject,
|
||||
"Senders": JSON.parse(process[0].originator).email,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": JSON.parse(process[0].workflowInstanceDataFields).ViewerRequest,
|
||||
"Remetente": JSON.parse(process[0].workflowInstanceDataFields).Sender,
|
||||
"Note": JSON.parse(process[0].workflowInstanceDataFields).TaskMessage || JSON.parse(process[0].workflowInstanceDataFields).Note,
|
||||
"FolderId": JSON.parse(process[0].workflowInstanceDataFields).FolderID,
|
||||
"FsId": '361',
|
||||
"DocId": JSON.parse(process[0].workflowInstanceDataFields).DispatchDocId,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": JSON.parse(process[0].workflowInstanceDataFields).DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
}
|
||||
console.log("OFFLINE TASK", this.task)
|
||||
let fulltak = {
|
||||
Documents: JSON.parse(process[0].Documents),
|
||||
actions: JSON.parse(process[0].actions),
|
||||
activityInstanceName: process[0].activityInstanceName,
|
||||
formURL: process[0].formURL,
|
||||
originator: JSON.parse(process[0].originator),
|
||||
serialNumber: process[0].serialNumber,
|
||||
taskStartDate: process[0].taskStartDate,
|
||||
totalDocuments: process[0].totalDocuments,
|
||||
workflowDisplayName: process[0].workflowDisplayName,
|
||||
workflowID: process[0].workflowID,
|
||||
workflowInstanceDataFields: JSON.parse(process[0].workflowInstanceDataFields),
|
||||
workflowInstanceFolio: process[0].workflowInstanceFolio,
|
||||
workflowInstanceID: process[0].workflowInstanceID,
|
||||
workflowName: process[0].workflowName
|
||||
}
|
||||
this.fulltask = fulltak;
|
||||
console.log(this.task);
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
this.intervenientes = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = JSON.parse(process[0].interveners).filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async viewDocument(DocId:string, Document) {
|
||||
|
||||
const modal = await this.modalController.create({
|
||||
@@ -162,12 +225,13 @@ export class DespachoPrPage implements OnInit {
|
||||
Document,
|
||||
applicationId: Document.ApplicationId,
|
||||
docId: Document.DocId || Document.SourceId,
|
||||
folderId: this.task.FolderId
|
||||
folderId: this.task.FolderId,
|
||||
task: this.fulltask
|
||||
},
|
||||
cssClass: 'modal modal-desktop'
|
||||
});
|
||||
await modal.present();
|
||||
|
||||
|
||||
}
|
||||
|
||||
openMenu() {
|
||||
@@ -175,7 +239,7 @@ export class DespachoPrPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async executado(note:string, documents:any) {
|
||||
async executado(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Conhecimento",
|
||||
@@ -183,7 +247,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -192,7 +256,7 @@ export class DespachoPrPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
}
|
||||
finally {
|
||||
@@ -201,7 +265,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async arquivar(note:string, documents:any){
|
||||
async arquivar(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Arquivo",
|
||||
@@ -209,7 +273,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -228,7 +292,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async generateDiploma(note:string, documents:any){
|
||||
async generateDiploma(note: string, documents: any) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
@@ -250,7 +314,7 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async concluir(note:string, documents:any){
|
||||
async concluir(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Executado",
|
||||
@@ -258,7 +322,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -277,7 +341,7 @@ export class DespachoPrPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
async reexecutar(note:string, documents:any) {
|
||||
async reexecutar(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Reexecutar",
|
||||
@@ -285,7 +349,7 @@ export class DespachoPrPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -307,27 +371,27 @@ export class DespachoPrPage implements OnInit {
|
||||
return new Date(e).toDateString()
|
||||
}
|
||||
|
||||
sendExpedienteToPending(){
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
|
||||
sendExpedienteToPending() {
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
|
||||
this.popoverController.dismiss('close')
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack()
|
||||
},()=>{
|
||||
}, () => {
|
||||
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
});
|
||||
}
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
async openAddNoteModal(actionName: string) {
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'add-note-modal-no-height'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: AddNotePage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
showAttachmentBtn: true,
|
||||
},
|
||||
cssClass: classs,
|
||||
@@ -336,9 +400,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res);
|
||||
if(res.data) {
|
||||
if (res.data) {
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
@@ -352,19 +416,19 @@ export class DespachoPrPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Executado'){
|
||||
if (actionName == 'Executado') {
|
||||
await this.executado(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Arquivar'){
|
||||
else if (actionName == 'Arquivar') {
|
||||
await this.arquivar(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Gerar Diploma'){
|
||||
else if (actionName == 'Gerar Diploma') {
|
||||
await this.generateDiploma(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Concluido'){
|
||||
else if (actionName == 'Concluido') {
|
||||
await this.concluir(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Reexecução'){
|
||||
else if (actionName == 'Reexecução') {
|
||||
await this.reexecutar(res.data.note, docs);
|
||||
}
|
||||
this.goBack();
|
||||
@@ -375,9 +439,9 @@ export class DespachoPrPage implements OnInit {
|
||||
async openExpedientActionsModal(taskAction: any, task: any) {
|
||||
//this.modalController.dismiss();
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -391,9 +455,9 @@ export class DespachoPrPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
console.log(res['data']);
|
||||
if(res['data']=='openDiscart'){
|
||||
if (res['data'] == 'openDiscart') {
|
||||
console.log('open discart');
|
||||
this.distartExpedientModal();
|
||||
}
|
||||
@@ -403,10 +467,10 @@ export class DespachoPrPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
async distartExpedientModal2(task: any){
|
||||
async distartExpedientModal2(task: any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
serialNumber: task.serialNumber,
|
||||
folderId: task.workflowInstanceDataFields.FolderID,
|
||||
action: 'discart',
|
||||
@@ -421,9 +485,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
async openBookMeetingModal(task: any) {
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -440,9 +504,9 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
async openDelegarModal(task: any) {
|
||||
let classs;
|
||||
if( window.innerWidth <= 800){
|
||||
if (window.innerWidth <= 800) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -457,11 +521,11 @@ export class DespachoPrPage implements OnInit {
|
||||
modal.onDidDismiss();
|
||||
}
|
||||
|
||||
async distartExpedientModal(){
|
||||
async distartExpedientModal() {
|
||||
console.log(this.fulltask);
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
serialNumber: this.fulltask.serialNumber,
|
||||
folderId: this.fulltask.workflowInstanceDataFields.FolderID,
|
||||
action: 'complete',
|
||||
@@ -471,8 +535,8 @@ export class DespachoPrPage implements OnInit {
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
if(res['data']=='close'){
|
||||
modal.onDidDismiss().then(res => {
|
||||
if (res['data'] == 'close') {
|
||||
this.close();
|
||||
/* console.log('2Expedient Discard closed2');
|
||||
this.close();
|
||||
@@ -488,7 +552,7 @@ export class DespachoPrPage implements OnInit {
|
||||
componentProps: {
|
||||
task: this.task,
|
||||
fulltask: this.fulltask,
|
||||
taskAction:taskAction,
|
||||
taskAction: taskAction,
|
||||
showEnviarPendentes: false
|
||||
},
|
||||
translucent: true
|
||||
@@ -496,11 +560,11 @@ export class DespachoPrPage implements OnInit {
|
||||
|
||||
await popover.present();
|
||||
|
||||
popover.onDidDismiss().then(( res =>{
|
||||
popover.onDidDismiss().then((res => {
|
||||
|
||||
if (res['data'] == 'close') {
|
||||
this.goBack()
|
||||
|
||||
if( res['data'] == 'close') {
|
||||
this.goBack()
|
||||
|
||||
}
|
||||
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user