mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
merge with branchBug
This commit is contained in:
@@ -4,7 +4,7 @@ import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { ActivatedRoute } 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';
|
||||
@@ -18,6 +18,10 @@ import { fullTask } from 'src/app/models/dailyworktask.model';
|
||||
import { AttachmentList } from 'src/app/models/Excludetask';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
|
||||
@Component({
|
||||
selector: 'app-despacho',
|
||||
templateUrl: './despacho.page.html',
|
||||
@@ -27,20 +31,22 @@ export class DespachoPage 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: customTask;
|
||||
task;
|
||||
|
||||
attachments:any;
|
||||
attachments: any;
|
||||
fulltask: any;
|
||||
eventsList: Event[] = [];
|
||||
serialnumber: string;
|
||||
caller:string;
|
||||
caller: string;
|
||||
profile: string;
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
|
||||
synch = synchro;
|
||||
|
||||
constructor(private activateRoute: ActivatedRoute,
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
@@ -51,13 +57,17 @@ export class DespachoPage implements OnInit {
|
||||
private toastService: ToastService,
|
||||
private despachoService: DespachoService,
|
||||
private location: Location,
|
||||
public p: PermissionService) {
|
||||
|
||||
public p: PermissionService,
|
||||
private sqliteservice: SqliteService,
|
||||
private platform: Platform
|
||||
|
||||
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
if (params["params"].SerialNumber) {
|
||||
this.serialnumber = params["params"].SerialNumber;
|
||||
}
|
||||
if(params["params"].caller) {
|
||||
if (params["params"].caller) {
|
||||
this.caller = params["params"].caller;
|
||||
}
|
||||
});
|
||||
@@ -70,8 +80,8 @@ export class DespachoPage implements OnInit {
|
||||
return;
|
||||
}
|
||||
});
|
||||
this.getFromDb()
|
||||
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
}
|
||||
|
||||
close() {
|
||||
@@ -111,12 +121,13 @@ export class DespachoPage implements OnInit {
|
||||
}
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
this.processes.GetTask(serial).subscribe( (res: fullTask) => {
|
||||
this.processes.GetTask(serial).subscribe((res: fullTask) => {
|
||||
console.log('despacho detail', res)
|
||||
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,
|
||||
@@ -129,27 +140,33 @@ export class DespachoPage implements OnInit {
|
||||
"activityInstanceName": res.activityInstanceName,
|
||||
"Status": res.workflowInstanceDataFields.Status,
|
||||
}
|
||||
|
||||
this.sqliteservice.updateProcess(res);
|
||||
this.fulltask = 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.processes.GetTaskParticipants(this.task.FolderID).subscribe(users => {
|
||||
this.sqliteservice.updateProcessInterveners(JSON.stringify(this.serialnumber), JSON.stringify(users))
|
||||
console.log('interveniers online', users)
|
||||
|
||||
this.intervenientes = users.filter(user=>{
|
||||
this.intervenientes = users.filter(user => {
|
||||
console.log('interveniers online 2', users)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
console.log('interveniers online 3', users)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
});
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.goBack()
|
||||
} catch (e) {
|
||||
this.location.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')
|
||||
@@ -158,10 +175,84 @@ export class DespachoPage implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
viewDocument(docId:string) {
|
||||
this.processes.GetDocumentUrl(docId, '361').subscribe(res=>{
|
||||
const url: string = res.replace("webTRIX.Viewer","webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create('https://equilibrium.dyndns.info/FileShare/pdfjs/web/viewer.html?file=https://equilibrium.dyndns.info/FileShare/merged_fastview.pdf', "_blank", 'location=yes,x=0,y=200,width=437,height=650,fullscreen=no');
|
||||
getFromDb() {
|
||||
if (synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialnumber)
|
||||
}
|
||||
|
||||
if (synchro.connected === false) {
|
||||
this.platform.ready().then(() => {
|
||||
this.sqliteservice.getProcessById(this.serialnumber).then((process) => {
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var intervine = JSON.parse(process[0].interveners)
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
console.log('sqlite', process)
|
||||
|
||||
this.task = {
|
||||
"SerialNumber": process[0].serialNumber,
|
||||
"Folio": workflow.Subject,
|
||||
"Senders": origina.email || process[0].originator,
|
||||
"CreateDate": momentG(new Date(process[0].taskStartDate), 'yyyy-MM-dd HH:mm:ss'),
|
||||
"DocumentURL": workflow.ViewerRequest,
|
||||
"Remetente": workflow.Sender,
|
||||
"Note": workflow.TaskMessage || workflow.Note,
|
||||
"FolderId": workflow.FolderID,
|
||||
"FsId": workflow.FsId,
|
||||
"DocId": workflow.DocID,
|
||||
"DocumentsQty": process[0].DocumentsQty,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"DeadlineType": workflow.DeadlineType,
|
||||
"activityInstanceName": process[0].activityInstanceName,
|
||||
"Status": workflow.Status,
|
||||
}
|
||||
|
||||
let thedate = new Date(this.task.CreateDate);
|
||||
this.customDate = this.days[thedate.getDay()] + ", " + thedate.getDate() + " de " + (this.months[thedate.getMonth()]);
|
||||
|
||||
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('interveniers offline', intervine)
|
||||
this.intervenientes = intervine.filter(user => {
|
||||
console.log('interveniers offline 2', user)
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = intervine.filter(user => {
|
||||
console.log('interveniers offline 3', user)
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
viewDocument(docId: string) {
|
||||
this.processes.GetDocumentUrl(docId, '361').subscribe(res => {
|
||||
const url: string = res.replace("webTRIX.Viewer", "webTRIX.Viewer.Branch1");
|
||||
const browser = this.iab.create(url, "_blank");
|
||||
browser.show();
|
||||
});
|
||||
}
|
||||
@@ -171,7 +262,7 @@ export class DespachoPage implements OnInit {
|
||||
this.modalController.dismiss();
|
||||
}
|
||||
|
||||
async executado(note:string, documents:any) {
|
||||
async executado(note: string, documents: any) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
@@ -179,7 +270,7 @@ export class DespachoPage implements OnInit {
|
||||
await this.despachoService.executado(note, documents, this.serialnumber).toPromise();
|
||||
this.toastService.successMessage('Processo criado')
|
||||
this.close();
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest("Processo não criado")
|
||||
}
|
||||
finally {
|
||||
@@ -187,12 +278,12 @@ export class DespachoPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
async arquivar(note:string, documents: AttachmentList) {
|
||||
async arquivar(note: string, documents: AttachmentList) {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
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.close();
|
||||
} catch (error) {
|
||||
@@ -204,7 +295,7 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
}
|
||||
|
||||
async reexecute(note:string, documents:any) {
|
||||
async reexecute(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialnumber,
|
||||
"action": "Reexecução",
|
||||
@@ -212,7 +303,7 @@ export class DespachoPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -237,26 +328,26 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
async sendExpedienteToPending() {
|
||||
|
||||
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res=>{
|
||||
this.despachoService.sendExpedienteToPending(this.serialnumber).subscribe(res => {
|
||||
this.goBack();
|
||||
this.toastService.successMessage()
|
||||
},
|
||||
error => {
|
||||
this.toastService.badRequest("Processo não enviado para despacho")
|
||||
});
|
||||
error => {
|
||||
this.toastService.badRequest("Processo não enviado para despacho")
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -265,8 +356,8 @@ export class DespachoPage implements OnInit {
|
||||
|
||||
await modal.present();
|
||||
|
||||
modal.onDidDismiss().then( async (res) => {
|
||||
if(res.data){
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res.data) {
|
||||
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
@@ -280,16 +371,16 @@ export class DespachoPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Executado'){
|
||||
if (actionName == 'Executado') {
|
||||
|
||||
await this.executado(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
else if(actionName == 'Arquivar'){
|
||||
else if (actionName == 'Arquivar') {
|
||||
await this.arquivar(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
else if(actionName == 'Reexecução'){
|
||||
else if (actionName == 'Reexecução') {
|
||||
await this.reexecute(res.data.note, docs);
|
||||
this.goBack();
|
||||
}
|
||||
@@ -300,9 +391,9 @@ export class DespachoPage implements OnInit {
|
||||
async openExpedientActionsModal(taskAction: any, task: any) {
|
||||
|
||||
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({
|
||||
@@ -316,10 +407,10 @@ export class DespachoPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res['data']);
|
||||
|
||||
if(res['data']=='openDiscart'){
|
||||
if (res['data'] == 'openDiscart') {
|
||||
await this.distartExpedientModal();
|
||||
}
|
||||
|
||||
@@ -329,9 +420,9 @@ export class DespachoPage 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({
|
||||
@@ -348,9 +439,9 @@ export class DespachoPage 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({
|
||||
@@ -362,7 +453,7 @@ export class DespachoPage implements OnInit {
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
@@ -371,7 +462,7 @@ export class DespachoPage implements OnInit {
|
||||
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',
|
||||
@@ -381,8 +472,8 @@ export class DespachoPage 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();
|
||||
|
||||
Reference in New Issue
Block a user