mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
Improve expediente descart
This commit is contained in:
@@ -1,9 +1,40 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
import { ProcessDocumentService } from './process-document.service';
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ExpedienteService {
|
||||
|
||||
constructor() { }
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
private processDocumentService: ProcessDocumentService,
|
||||
) { }
|
||||
|
||||
|
||||
discard({SerialNumber, Note =''}) {
|
||||
let otherbody = {
|
||||
"serialNumber": SerialNumber,
|
||||
"action": "Passivo",
|
||||
"ActionTypeId": 99999877,
|
||||
"dataFields": {
|
||||
"Note": Note,
|
||||
}
|
||||
}
|
||||
|
||||
return this.processes.CompleteTask(otherbody)
|
||||
}
|
||||
|
||||
viewDocument({DocId, ApplicationId}) {
|
||||
this.processDocumentService.viewDocument({DocId, ApplicationId})
|
||||
}
|
||||
|
||||
CompleteTask({body}) {
|
||||
return this.processes.CompleteTask(body)
|
||||
}
|
||||
|
||||
|
||||
UpdateTaskStatus({FolderId}){
|
||||
return this.processes.UpdateTaskStatus(FolderId)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ExpedientesService } from './expedientes.service';
|
||||
|
||||
describe('ExpedientesService', () => {
|
||||
let service: ExpedientesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(ExpedientesService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -1,30 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { InAppBrowser } from '@ionic-native/in-app-browser/ngx';
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
import { ProcessDocumentService } from './process-document.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ExpedientesService {
|
||||
|
||||
constructor(
|
||||
private iab: InAppBrowser,
|
||||
private processDocumentService: ProcessDocumentService,
|
||||
private processes: ProcessesService,
|
||||
) { }
|
||||
|
||||
viewDocument({DocId, ApplicationId}) {
|
||||
this.processDocumentService.viewDocument({DocId, ApplicationId})
|
||||
}
|
||||
|
||||
CompleteTask({body}) {
|
||||
return this.processes.CompleteTask(body)
|
||||
}
|
||||
|
||||
|
||||
UpdateTaskStatus({FolderId}){
|
||||
return this.processes.UpdateTaskStatus(FolderId)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DatabaseService } from './database.service';
|
||||
import { TaskService } from './task.service';
|
||||
|
||||
describe('DatabaseService', () => {
|
||||
let service: DatabaseService;
|
||||
describe('TaskService', () => {
|
||||
let service: TaskService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(DatabaseService);
|
||||
service = TestBed.inject(TaskService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ProcessesService } from '../services/processes.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TaskService {
|
||||
|
||||
constructor(
|
||||
private processes: ProcessesService,
|
||||
) { }
|
||||
|
||||
|
||||
|
||||
}
|
||||
+9
-15
@@ -19,8 +19,9 @@ import { SearchList } from 'src/app/models/search-document';
|
||||
import { AddNotePage } from 'src/app/modals/add-note/add-note.page';
|
||||
import { PermissionService } from 'src/app/OtherService/permission.service';
|
||||
import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
|
||||
import { ExpedientesService } from 'src/app/Rules/expedientes.service';
|
||||
import { ExpedienteService } from 'src/app/Rules/expediente.service';
|
||||
import { expedienteTask } from 'src/app/models/dailyworktask.model';
|
||||
import { TaskService } from 'src/app/Rules/task.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-expediente-detail',
|
||||
@@ -61,7 +62,8 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
private location: Location,
|
||||
private attachmentsService: AttachmentsService,
|
||||
public p: PermissionService,
|
||||
private expedientesService: ExpedientesService
|
||||
private taskService: TaskService,
|
||||
private expedienteService: ExpedienteService
|
||||
) {
|
||||
this.activatedRoute.paramMap.subscribe(params => {
|
||||
if(params["params"].SerialNumber) {
|
||||
@@ -301,7 +303,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
viewDocument(DocId:string) {
|
||||
|
||||
this.expedientesService.viewDocument({ApplicationId:'361', DocId})
|
||||
this.expedienteService.viewDocument({ApplicationId:'361', DocId})
|
||||
}
|
||||
|
||||
getAttachments(serialNumber) {
|
||||
@@ -414,21 +416,13 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
modal.onDidDismiss().then( async (res)=>{
|
||||
console.log(res['data']);
|
||||
|
||||
if(body == 'descartar'){
|
||||
if(res['data']== 'Yes'){
|
||||
let otherbody = {
|
||||
"serialNumber": this.task.SerialNumber,
|
||||
"action": "Passivo",
|
||||
"ActionTypeId": 99999877,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
if(body == 'descartar') {
|
||||
if(res['data']== 'Yes') {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(otherbody)
|
||||
await this.expedienteService.discard({SerialNumber: this.task.SerialNumber}).toPromise()
|
||||
this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
@@ -447,7 +441,7 @@ export class ExpedienteDetailPage implements OnInit {
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
try {
|
||||
await this.expedientesService.CompleteTask(body).toPromise();
|
||||
await this.expedienteService.CompleteTask(body).toPromise();
|
||||
//this.toastService.successMessage('Processo descartado');
|
||||
this.goBack();
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class DatabaseService {
|
||||
|
||||
constructor() { }
|
||||
}
|
||||
@@ -13,7 +13,9 @@ import { SearchDocumentPipe } from 'src/app/pipes/search-document.pipe';
|
||||
import { AttachmentsService } from 'src/app/services/attachments.service';
|
||||
import { ProcessesService } from 'src/app/services/processes.service';
|
||||
import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { Location } from '@angular/common';
|
||||
import { TaskService } from 'src/app/Rules/task.service'
|
||||
import { ExpedienteService } from 'src/app/Rules/expediente.service';
|
||||
@Component({
|
||||
selector: 'app-opts-expediente',
|
||||
templateUrl: './opts-expediente.page.html',
|
||||
@@ -40,6 +42,9 @@ export class OptsExpedientePage implements OnInit {
|
||||
private activatedRoute: ActivatedRoute,
|
||||
public p: PermissionService,
|
||||
private attachmentsService: AttachmentsService,
|
||||
private location: Location,
|
||||
private TaskService: TaskService,
|
||||
private expedienteService: ExpedienteService
|
||||
) {
|
||||
this.task = this.navParams.get('task');
|
||||
this.fulltask = this.navParams.get('fulltask');
|
||||
@@ -81,7 +86,8 @@ export class OptsExpedientePage implements OnInit {
|
||||
}
|
||||
}
|
||||
else {
|
||||
window.history.back();
|
||||
this.location.back()
|
||||
|
||||
|
||||
/* this.activatedRoute.paramMap.subscribe(params => {
|
||||
console.log('YES');
|
||||
@@ -354,24 +360,16 @@ export class OptsExpedientePage implements OnInit {
|
||||
|
||||
if(body == 'descartar') {
|
||||
if(res['data']== 'Yes') {
|
||||
let otherbody = {
|
||||
"serialNumber": this.task.SerialNumber,
|
||||
"action": "Passivo",
|
||||
"ActionTypeId": 99999877,
|
||||
"dataFields": {
|
||||
"Note": "",
|
||||
}
|
||||
}
|
||||
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
await this.processes.CompleteTask(otherbody).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()
|
||||
}
|
||||
|
||||
@@ -382,7 +380,7 @@ export class OptsExpedientePage implements OnInit {
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(res['data']== 'Yes'){
|
||||
if(res['data']== 'Yes') {
|
||||
const loader = this.toastService.loading()
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user