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:
+1
-1
@@ -50,7 +50,7 @@
|
||||
<div class="ion-icon-class">
|
||||
<ion-icon class="icon-time" slot="start" name="time-outline"></ion-icon>
|
||||
</div>
|
||||
<div class="ion-input-class" [class.input-error]="Form?.get('Priority')?.invalid && validateFrom ">
|
||||
<div class="ion-input-class" [class.input-error]="Form?.get('Priority')?.invalid && validateFrom || validateField ">
|
||||
<ion-select
|
||||
placeholder="Prazo*"
|
||||
[(ngModel)]="postData.Priority"
|
||||
|
||||
+23
-16
@@ -88,7 +88,8 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
toppings = new FormControl();
|
||||
|
||||
Form: FormGroup;
|
||||
validateFrom = false
|
||||
validateFrom = false;
|
||||
validateField = false;
|
||||
|
||||
get toppingsValues() {
|
||||
return this.toppings.value;
|
||||
@@ -133,7 +134,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
SubjectTypes: this.selectedTypes,
|
||||
NumberPDPP: this.task.workflowInstanceDataFields.DispatchNumber,
|
||||
};
|
||||
|
||||
|
||||
this.postData.DispatchFolder = this.dispatchFolder;
|
||||
this.postData.UsersSelected = this.participants;
|
||||
/* By Default TypeDeadline should be 'Normal' */
|
||||
@@ -187,7 +188,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
|
||||
runValidation() {
|
||||
this.validateFrom = true
|
||||
this.validateFrom = true;
|
||||
}
|
||||
|
||||
injectValidation() {
|
||||
@@ -277,7 +278,7 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
} else { // 8
|
||||
docs.Attachments.push({
|
||||
ApplicationId: 8,
|
||||
@@ -429,17 +430,23 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
} catch (error) {
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
if(this.postData.DispatchFolder.Message){
|
||||
try {
|
||||
this.taskResult = await this.despachoService.createDespacho(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Processo efetuado');
|
||||
this.modalController.dismiss(action_despacho_pr);
|
||||
} catch (error) {
|
||||
|
||||
console.log('this.taskResult', this.taskResult);
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
//loader.remove()
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.validateField = true;
|
||||
this.toastService.badRequest('Por favor adicione uma nota');
|
||||
}
|
||||
loader.remove();
|
||||
break;
|
||||
|
||||
case '1': // parecer
|
||||
@@ -463,7 +470,6 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
this.taskResult = await this.processes.postParecerPr(this.postData).toPromise();
|
||||
await this.toastService.successMessage('Pedido enviado');
|
||||
this.modalController.dismiss(action_parecer_pr);
|
||||
@@ -471,8 +477,9 @@ export class ExpedientTaskModalPage implements OnInit {
|
||||
|
||||
await this.toastService.badRequest('Processo não efetuado')
|
||||
} finally {
|
||||
loader.remove()
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
+138
-83
@@ -9,7 +9,7 @@ import { ModalController, PopoverController } from '@ionic/angular';
|
||||
import { ExpedientTaskModalPage } from '../expedient-task-modal/expedient-task-modal.page';
|
||||
import { BookMeetingModalPage } from '../book-meeting-modal/book-meeting-modal.page';
|
||||
import { ViewEventPage } from 'src/app/pages/agenda/view-event/view-event.page';
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { momentG } from 'src/plugin/momentG'
|
||||
import { DiscartExpedientModalPage } from '../../discart-expedient-modal/discart-expedient-modal.page';
|
||||
import { OptsExpedientePage } from 'src/app/shared/popover/opts-expediente/opts-expediente.page';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
@@ -26,6 +26,10 @@ import { PermissionService } from 'src/app/services/worker/permission.service';
|
||||
import { ViewDocumentPage } from 'src/app/modals/view-document/view-document.page';
|
||||
|
||||
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from 'src/app/services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
templateUrl: './expediente-detail.page.html',
|
||||
@@ -36,22 +40,25 @@ export class ExpedienteDetailPage 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: expedienteTask;
|
||||
fulltask: any;
|
||||
eventsList: Event[];
|
||||
serialNumber: string;
|
||||
caller:string;
|
||||
caller: string;
|
||||
profile: string;
|
||||
intervenientes: any;
|
||||
cc: any = [];
|
||||
documents:SearchList[] = [];
|
||||
attachments:any;
|
||||
documents: SearchList[] = [];
|
||||
attachments: any;
|
||||
|
||||
hideSendToPendentes = true
|
||||
searchDocumentPipe = new SearchDocumentPipe()
|
||||
|
||||
synch = synchro
|
||||
onlinecheck: boolean;
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private iab: InAppBrowser,
|
||||
@@ -66,20 +73,22 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private attachmentsService: AttachmentsService,
|
||||
public p: PermissionService,
|
||||
private taskService: TaskService,
|
||||
private expedienteService: ExpedienteService
|
||||
private expedienteService: ExpedienteService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
) {
|
||||
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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
this.getFromDB();
|
||||
|
||||
}
|
||||
|
||||
@@ -91,16 +100,60 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.toastService.presentToast('Não foi possível fazer login');
|
||||
}
|
||||
|
||||
getFromDB() {
|
||||
|
||||
async approve(note:string, documents:any) {
|
||||
if(synchro.connected === true) {
|
||||
this.LoadTaskDetail(this.serialNumber);
|
||||
}
|
||||
|
||||
|
||||
synchro.registerCallback('Offline', () => {
|
||||
this.platform.ready().then(() => {
|
||||
this.onlinecheck = false;
|
||||
this.sqliteservice.getProcessById(this.serialNumber).then((process) => {
|
||||
console.log("expedient ditail", process)
|
||||
|
||||
var workflow = JSON.parse(process[0].workflowInstanceDataFields);
|
||||
var origina
|
||||
if (process[0].originator === "undefined") {
|
||||
origina = ""
|
||||
} else {
|
||||
origina = JSON.parse(process[0].originator)
|
||||
}
|
||||
|
||||
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,
|
||||
"WorkflowName": process[0].workflowDisplayName,
|
||||
"Status": workflow.Status,
|
||||
"DispatchNumber": workflow.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": workflow.AttachmentsProcessLastInstanceID,
|
||||
"InstanceID": workflow.InstanceID
|
||||
}
|
||||
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
async approve(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Aprovar",
|
||||
"ActionTypeId": 100000004 ,
|
||||
"ActionTypeId": 100000004,
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
console.log(body);
|
||||
@@ -111,15 +164,15 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
this.close();
|
||||
this.toastService.successMessage('Processo aprovado')
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não aprovado')
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async sendToReview(note:string, documents:any) {
|
||||
async sendToReview(note: string, documents: any) {
|
||||
let body = {
|
||||
"serialNumber": this.serialNumber,
|
||||
"action": "Retificar",
|
||||
@@ -127,7 +180,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
"dataFields": {
|
||||
"ReviewUserComment": note,
|
||||
},
|
||||
"AttachmentList" :documents,
|
||||
"AttachmentList": documents,
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
@@ -136,7 +189,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
await this.processes.CompleteTask(body).toPromise()
|
||||
this.close();
|
||||
this.toastService.successMessage()
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
loader.remove()
|
||||
@@ -144,16 +197,16 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
|
||||
async openAddNoteModal(actionName:string) {
|
||||
async openAddNoteModal(actionName: string) {
|
||||
let classs;
|
||||
if( window.innerWidth < 701) {
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'add-note-modal'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
component: AddNotePage,
|
||||
componentProps:{
|
||||
componentProps: {
|
||||
showAttachmentBtn: false,
|
||||
},
|
||||
cssClass: classs,
|
||||
@@ -164,7 +217,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
modal.onDidDismiss().then(res => {
|
||||
console.log(res);
|
||||
if(res.data){
|
||||
if (res.data) {
|
||||
const DocumentToSave = res.data.documents.map((e) => {
|
||||
return {
|
||||
ApplicationId: e.ApplicationType,
|
||||
@@ -177,10 +230,10 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
Attachments: DocumentToSave,
|
||||
}
|
||||
|
||||
if(actionName == 'Aprovar'){
|
||||
if (actionName == 'Aprovar') {
|
||||
this.approve(res.data.note, docs);
|
||||
}
|
||||
else if(actionName == 'Revisão'){
|
||||
else if (actionName == 'Revisão') {
|
||||
this.sendToReview(res.data.note, docs);
|
||||
}
|
||||
this.goBack();
|
||||
@@ -230,14 +283,14 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
sendExpedienteToPending() {
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res=>{
|
||||
this.processes.SetTaskToPending(this.serialNumber).subscribe(res => {
|
||||
console.log(res);
|
||||
this.toastService.successMessage('Processo enviado para pendentes')
|
||||
this.goBack();
|
||||
},
|
||||
(error)=>{
|
||||
this.toastService.badRequest('Processo não enviado para pendentes')
|
||||
});
|
||||
(error) => {
|
||||
this.toastService.badRequest('Processo não enviado para pendentes')
|
||||
});
|
||||
}
|
||||
|
||||
async LoadTaskDetail(serial: string) {
|
||||
@@ -249,7 +302,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
"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,
|
||||
@@ -264,16 +317,17 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
this.fulltask = 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.intervenientes = users.filter(user => {
|
||||
return user.Type == 'I';
|
||||
});
|
||||
this.cc = users.filter(user=>{
|
||||
this.cc = users.filter(user => {
|
||||
return user.Type == 'CC';
|
||||
});
|
||||
})
|
||||
@@ -281,14 +335,14 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log('this.task', this.task.InstanceID)
|
||||
console.log('this.task.DocumentURL', this.task.DocumentURL)
|
||||
|
||||
}, (error)=>{
|
||||
}, (error) => {
|
||||
try {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
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')
|
||||
@@ -320,7 +374,8 @@ export class ExpedienteDetailPage 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'
|
||||
});
|
||||
@@ -336,7 +391,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
getAttachments(serialNumber) {
|
||||
console.log(serialNumber);
|
||||
|
||||
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res=>{
|
||||
this.attachmentsService.getAttachmentsBySerial(serialNumber).subscribe(res => {
|
||||
this.attachments = res;
|
||||
console.log('res', res);
|
||||
});
|
||||
@@ -357,45 +412,45 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=> {
|
||||
if(res){
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
this.documents.forEach((element: any) => {
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
if (res) {
|
||||
const data = res.data;
|
||||
this.documents.push(data.selected);
|
||||
this.documents.forEach((element: any) => {
|
||||
|
||||
let body = {
|
||||
"InstanceID": this.task.InstanceID,
|
||||
"WorkflowDisplayName": this.task.WorkflowName,
|
||||
"FolderID": this.task.FolderId,
|
||||
"DispatchNumber": this.task.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
|
||||
"Attachments": []
|
||||
}
|
||||
let body = {
|
||||
"InstanceID": this.task.InstanceID,
|
||||
"WorkflowDisplayName": this.task.WorkflowName,
|
||||
"FolderID": this.task.FolderId,
|
||||
"DispatchNumber": this.task.DispatchNumber,
|
||||
"AttachmentsProcessLastInstanceID": this.task.AttachmentsProcessLastInstanceID,
|
||||
"Attachments": []
|
||||
}
|
||||
|
||||
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
|
||||
body.Attachments = Attachments;
|
||||
const Attachments = this.searchDocumentPipe.transformToAttachment(element)
|
||||
body.Attachments = Attachments;
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
this.attachmentsService.AddAttachment(body).subscribe((res)=> {
|
||||
this.toastService.successMessage()
|
||||
}, ()=> {
|
||||
this.toastService.badRequest()
|
||||
}, ()=> {
|
||||
loader.remove()
|
||||
});
|
||||
this.attachmentsService.AddAttachment(body).subscribe((res) => {
|
||||
this.toastService.successMessage()
|
||||
}, () => {
|
||||
this.toastService.badRequest()
|
||||
}, () => {
|
||||
loader.remove()
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
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({
|
||||
@@ -408,9 +463,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
cssClass: classs,
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async(res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
let body = res['data'];
|
||||
if(res['data']) {
|
||||
if (res['data']) {
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
await this.processes.CompleteTask(body).toPromise();
|
||||
@@ -421,47 +476,47 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
else{
|
||||
else {
|
||||
this.close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async distartExpedientModal(body:any) {
|
||||
async distartExpedientModal(body: any) {
|
||||
const modal = await this.modalController.create({
|
||||
component: DiscartExpedientModalPage,
|
||||
componentProps: {
|
||||
componentProps: {
|
||||
},
|
||||
cssClass: 'discart-expedient-modal',
|
||||
backdropDismiss: false
|
||||
});
|
||||
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
modal.onDidDismiss().then(async (res) => {
|
||||
console.log(res['data']);
|
||||
|
||||
if(body == 'descartar') {
|
||||
if(res['data']== 'Yes') {
|
||||
if (body == 'descartar') {
|
||||
if (res['data'] == 'Yes') {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.expedienteService.discard({SerialNumber: this.task.SerialNumber}).toPromise()
|
||||
await this.expedienteService.discard({ SerialNumber: this.task.SerialNumber }).toPromise()
|
||||
this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não descartado')
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
}
|
||||
else if(res['data'] == 'No'){
|
||||
else if (res['data'] == 'No') {
|
||||
//Do nothing
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(res['data']== 'Yes') {
|
||||
else {
|
||||
if (res['data'] == 'Yes') {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
@@ -475,7 +530,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
}
|
||||
|
||||
}
|
||||
else if(res['data'] == 'No') {
|
||||
else if (res['data'] == 'No') {
|
||||
console.log('Update');
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
@@ -484,7 +539,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
this.toastService.badRequest()
|
||||
} finally {
|
||||
} finally {
|
||||
loader.remove()
|
||||
}
|
||||
}
|
||||
@@ -496,9 +551,9 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
console.log(task);
|
||||
|
||||
let classs;
|
||||
if( window.innerWidth < 701){
|
||||
if (window.innerWidth < 701) {
|
||||
classs = 'book-meeting-modal modal modal-desktop'
|
||||
} else {
|
||||
} else {
|
||||
classs = 'modal modal-desktop showAsideOptions'
|
||||
}
|
||||
const modal = await this.modalController.create({
|
||||
@@ -510,12 +565,12 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
backdropDismiss: false
|
||||
});
|
||||
await modal.present();
|
||||
modal.onDidDismiss().then(res=>{
|
||||
modal.onDidDismiss().then(res => {
|
||||
this.goBack();
|
||||
});
|
||||
}
|
||||
|
||||
goToEvent(eventId:any) {
|
||||
goToEvent(eventId: any) {
|
||||
this.router.navigate(['/home/events', eventId, 'expediente']);
|
||||
}
|
||||
|
||||
@@ -545,7 +600,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
componentProps: {
|
||||
task: this.task,
|
||||
fulltask: this.fulltask,
|
||||
taskAction:taskAction,
|
||||
taskAction: taskAction,
|
||||
},
|
||||
translucent: true
|
||||
});
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
|
||||
<ion-list>
|
||||
<div
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of expedienteGdStore.list"
|
||||
class="expediente ion-no-padding ion-no-margin cursor-pointer"
|
||||
*ngFor = "let task of listToPresent"
|
||||
(click)="goToExpediente(task.SerialNumber)"
|
||||
>
|
||||
<div class="item width-100">
|
||||
@@ -65,13 +65,13 @@
|
||||
</ion-list>
|
||||
|
||||
<div
|
||||
*ngIf="!skeletonLoader && expedienteGdStore.list.length == 0 && expedienteGdStore.list.length == 0"
|
||||
*ngIf="!skeletonLoader && listToPresent.length == 0 && listToPresent.length == 0"
|
||||
class="empty-list d-flex height-100 align-center justify-content-center"
|
||||
>
|
||||
<span>Lista vazia</span>
|
||||
</div>
|
||||
|
||||
<div *ngIf="skeletonLoader && expedienteGdStore.list.length == 0">
|
||||
<div *ngIf="skeletonLoader && listToPresent.length == 0">
|
||||
|
||||
<ion-list>
|
||||
<ion-item>
|
||||
|
||||
@@ -4,6 +4,9 @@ import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
import { ExpedienteGdStore } from 'src/app/store/expedientegd-store.service';
|
||||
import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
import { SqliteService } from 'src/app/services/sqlite.service';
|
||||
import { Platform } from '@ionic/angular';
|
||||
import { synchro } from '../../../services/socket/synchro.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente',
|
||||
@@ -12,40 +15,33 @@ import { ExpedienteTaskPipe } from 'src/app/pipes/expediente-task.pipe';
|
||||
})
|
||||
export class ExpedientePage implements OnInit {
|
||||
|
||||
segment:string;
|
||||
segment: string;
|
||||
skeletonLoader = true
|
||||
//profile:string;
|
||||
showLoader:boolean;
|
||||
showLoader: boolean;
|
||||
|
||||
taskslist = [];
|
||||
serialNumber:string;
|
||||
serialNumber: string;
|
||||
|
||||
expedienteGdStore = ExpedienteGdStore
|
||||
expedienteTaskPipe = new ExpedienteTaskPipe()
|
||||
|
||||
onlinecheck: boolean;
|
||||
|
||||
listToPresent;
|
||||
synch = synchro
|
||||
constructor(
|
||||
private processes:ProcessesService,
|
||||
private processes: ProcessesService,
|
||||
private router: Router,
|
||||
private toastService: ToastService
|
||||
) {}
|
||||
private toastService: ToastService,
|
||||
public platform: Platform,
|
||||
private sqliteservice: SqliteService,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
this.getEventsFromLocalDb();
|
||||
console.log("segrsgre")
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if(window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async LoadList() {
|
||||
@@ -54,17 +50,19 @@ export class ExpedientePage implements OnInit {
|
||||
try {
|
||||
const expediente: object[] = await this.processes.GetTaskListExpediente(false).toPromise()
|
||||
const result = expediente
|
||||
|
||||
|
||||
this.taskslist = new Array();
|
||||
let res = result.reverse().filter((data: any) => data.workflowInstanceDataFields.Status == "Active");
|
||||
|
||||
res.forEach((element: any) => {
|
||||
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
let task = this.expedienteTaskPipe.transform(element)
|
||||
this.taskslist.push(task);
|
||||
this.sqliteservice.addProcess(task);
|
||||
});
|
||||
|
||||
this.expedienteGdStore.reset(this.taskslist);
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
console.log('expediente list', this.listToPresent)
|
||||
|
||||
} catch (error) {
|
||||
this.toastService.badRequest('Processo não encontrado')
|
||||
@@ -92,9 +90,80 @@ export class ExpedientePage implements OnInit {
|
||||
this.router.navigate(['/home/gabinete-digital']);
|
||||
}
|
||||
|
||||
goToExpediente(serialNumber:any){
|
||||
goToExpediente(serialNumber: any) {
|
||||
//console.log('ABRE');
|
||||
this.router.navigate(['/home/gabinete-digital/expediente',serialNumber,'gabinete-digital']);
|
||||
this.router.navigate(['/home/gabinete-digital/expediente', serialNumber, 'gabinete-digital']);
|
||||
}
|
||||
|
||||
SqliteAddExpediente(list) {
|
||||
list.forEach((expediente) => {
|
||||
let data = {
|
||||
serialNumber: expediente.serialNumber,
|
||||
workflowInstanceFolio: expediente.workflowInstanceFolio,
|
||||
Documents: expediente.Documents,
|
||||
actions: expediente.actions,
|
||||
activityInstanceName: expediente.activityInstanceName,
|
||||
formURL: expediente.formURL,
|
||||
originator: expediente.originator,
|
||||
taskStartDate: expediente.taskStartDate,
|
||||
totalDocuments: expediente.totalDocuments,
|
||||
workflowDisplayName: expediente.workflowDisplayName,
|
||||
workflowID: expediente.workflowID,
|
||||
workflowInstanceDataFields: expediente.workflowInstanceDataFields,
|
||||
workflowInstanceID: expediente.workflowInstanceID,
|
||||
workflowName: expediente.workflowName
|
||||
}
|
||||
|
||||
this.sqliteservice.addExpediente(data);
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
getEventsFromLocalDb() {
|
||||
|
||||
if (synchro.connected === true) {
|
||||
const location = window.location
|
||||
const pathname = location.pathname + location.search
|
||||
|
||||
this.LoadList()
|
||||
|
||||
this.router.events.forEach((event) => {
|
||||
if (event instanceof NavigationStart && event.url.startsWith(pathname)) {
|
||||
if (window.location.pathname.split('/').length >= 4 && window.location.pathname.startsWith('/home/gabinete-digital')) {
|
||||
this.refreshing()
|
||||
} else {
|
||||
this.LoadList()
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.taskslist = new Array();
|
||||
this.sqliteservice.getprocessByworkflow("Expediente").then((expediente: any[]) => {
|
||||
console.log("All expedientes from local,", expediente)
|
||||
|
||||
expediente.forEach((element) => {
|
||||
|
||||
var workflow = JSON.parse(element.workflowInstanceDataFields);
|
||||
|
||||
let exped = {
|
||||
"CreateDate": element.taskStartDate,
|
||||
"DocumentsQty": element.totalDocuments,
|
||||
"Senders": workflow.Senders,
|
||||
"SerialNumber": element.serialNumber,
|
||||
"Status": workflow.Status,
|
||||
"Subject": workflow.Subject,
|
||||
"WorkflowName": element.workflowDisplayName,
|
||||
"activityInstanceName": element.activityInstanceName
|
||||
}
|
||||
|
||||
this.taskslist.push(exped)
|
||||
|
||||
});
|
||||
|
||||
this.listToPresent = this.taskslist
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user