From 077ebab33eba2d0059662fe2e8d0af61f534a706 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:42:34 -0500 Subject: [PATCH 01/54] add component by delivery supplies by Cadastral authorization --- .../supplies-delivery.component.html | 384 ++++++++++++++++++ .../supplies-delivery.component.scss | 0 .../supplies-delivery.component.spec.ts | 25 ++ .../supplies-delivery.component.ts | 268 ++++++++++++ 4 files changed, 677 insertions(+) create mode 100644 src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html create mode 100644 src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.scss create mode 100644 src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.spec.ts create mode 100644 src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.ts diff --git a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html new file mode 100644 index 00000000..81d5e560 --- /dev/null +++ b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html @@ -0,0 +1,384 @@ +
+ + +
+
+

Entrega de insumos - Habilitación Catastral

+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+ Autoridad Catastral, cargue aquí la información que requiere + entregar al Gestor para iniciar la Gestión Catastral del municipio. +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +
+ Cargue el archivo con la información a entregar. +
+
+
+ +
+
+
+
+
Credenciales
+
+ +
+
+
+
+
+ +
+ Cargue la evidencia de la entrega fisica de la + información. +
+
+
+
+
+
+
+
* Nombre
+
+ +
+
+
+
+
+
+ * Observaciones
+ (max. 255 caracteres) +
+
+ +
+
+
+ +
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
#Entregado porNombreFecha de cargueObservaciónEliminar
{{ index + 1 }}AUTORIDAD CATASTRAL{{ item.name }}{{ formatDate(item.createdAt) }} + + + + delete_forever + + + + + + +
+
+
+
+
+ +
+
+
+
+ +
+
+
+ + + + + +
diff --git a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.scss b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.spec.ts b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.spec.ts new file mode 100644 index 00000000..1abcb5d3 --- /dev/null +++ b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SuppliesDeliveryComponent } from './supplies-delivery.component'; + +describe('SuppliesDeliveryComponent', () => { + let component: SuppliesDeliveryComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ SuppliesDeliveryComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SuppliesDeliveryComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.ts b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.ts new file mode 100644 index 00000000..3bff7b13 --- /dev/null +++ b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.ts @@ -0,0 +1,268 @@ +import { Component, OnInit } from '@angular/core'; +import { ToastrService } from 'ngx-toastr'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { environment } from 'src/environments/environment'; +import { WorkspacesService } from 'src/app/services/workspaces/workspaces.service'; +import { SuppliesService } from 'src/app/services/supplies/supplies.service'; +import * as _moment from 'moment'; +import { ManagersService } from 'src/app/services/managers/managers.service'; +import { JwtHelper } from 'src/app/helpers/jwt'; +import { RoleModel } from 'src/app/helpers/role.model'; + +const moment = _moment; + +@Component({ + selector: 'app-supplies-delivery', + templateUrl: './supplies-delivery.component.html', + styleUrls: ['./supplies-delivery.component.scss'], +}) +export class SuppliesDeliveryComponent implements OnInit { + selectAttachments: number; + ftpAttachmentsTypes: string; + fileAttachmentsTypes: any; + validInputAttachmentsTypes: boolean; + observationsAttachmentsTypes: string; + nameAttachmentsTypes: string; + passftpAttachments: string; + selectMunicipality: number; + suppliesAttachmentsData: any; + dataAttachmentsTypes: any; + idSupplieDelete: number; + idWorkspace: number; + isSearch: boolean; + activeManagers: any; + isAdministrator: boolean; + selectManager: number; + munucipalities: any; + isActive: boolean; + isActiveSearch: boolean; + constructor( + private modalService: NgbModal, + private toastr: ToastrService, + private serviceWorkspaces: WorkspacesService, + private insumosService: SuppliesService, + private serviceManagers: ManagersService, + private roles: RoleModel + ) { + this.selectAttachments = 0; + this.ftpAttachmentsTypes = ''; + this.validInputAttachmentsTypes = false; + this.observationsAttachmentsTypes = ''; + this.nameAttachmentsTypes = ''; + this.passftpAttachments = ''; + this.selectMunicipality = 0; + this.suppliesAttachmentsData = []; + this.dataAttachmentsTypes = []; + this.idWorkspace = 0; + this.isSearch = false; + this.activeManagers = []; + this.selectManager = 0; + this.munucipalities = 0; + this.isAdministrator = false; + this.isActiveSearch = false; + } + + ngOnInit(): void { + this.serviceManagers.getManagers().subscribe((data: any) => { + this.activeManagers = data; + }); + const rol = JwtHelper.getUserPublicInformation(); + const role = rol.roles.find((elem) => { + return elem.id === this.roles.administrador; + }); + this.isAdministrator = false; + if (role) { + this.isAdministrator = true; + } + } + + changeDepartament() { + this.serviceWorkspaces + .getMunicipalitiesByManager(this.selectManager) + .subscribe((data) => { + this.munucipalities = data; + }); + } + searchWorkSpaceActive() { + this.serviceWorkspaces + .getWorkSpaceByMunicipality(this.selectMunicipality.toString()) + .subscribe((response: any) => { + if (response.length > 0) { + this.isActive = true; + this.idWorkspace = response[0].id; + console.log('getWorkSpaceByMunicipality: ', response); + + this.search(); + this.isSearch = true; + } else { + this.isSearch = false; + this.isActive = false; + this.idWorkspace = 0; + } + }); + } + changeMunicipalitie() { + this.isActiveSearch = false; + if (this.selectMunicipality !== 0) { + this.isActiveSearch = true; + } + } + formatDate(date: string) { + moment.locale('es'); + return moment(date).format('DD/MM/YYYY'); + } + search() { + this.insumosService.GetAttachmentsTypes().subscribe((data) => { + this.dataAttachmentsTypes = data; + }); + this.serviceWorkspaces + .getSuppliesAttachments(this.selectMunicipality) + .subscribe((response) => { + this.suppliesAttachmentsData = response; + this.suppliesAttachmentsData = this.suppliesAttachmentsData.filter( + (element) => { + const isCadastral = element.owners.find( + (data) => data.ownerType === 'CADASTRAL_AUTHORITY' + ); + if (isCadastral) { + return element; + } + } + ); + }); + } + docSoportAttachmentsTypes(files: FileList) { + if (this.selectAttachments === 1 || this.selectAttachments === 3) { + this.ftpAttachmentsTypes = ''; + } + this.ftpAttachmentsTypes = ''; + if (files[0].size / 1024 / 1024 <= environment.sizeFile) { + var re = /zip*/; + if (files[0].type.match(re)) { + this.fileAttachmentsTypes = files[0]; + } else { + if (files[0].size / 1024 / 1024 > environment.sizeFileUnZip) { + this.fileAttachmentsTypes = undefined; + this.toastr.error( + 'Por favor convierta el archivo en .zip antes de subirlo, ya que supera el tamaño de cargue permitido.' + ); + } else { + this.fileAttachmentsTypes = files[0]; + this.validInputAttachmentsTypes = false; + if ( + this.selectAttachments !== 0 && + this.observationsAttachmentsTypes !== '' && + (this.fileAttachmentsTypes !== undefined || + this.ftpAttachmentsTypes !== '') + ) { + this.validInputAttachmentsTypes = true; + } + } + } + } else { + this.toastr.error( + 'No se puede cargar el archivo, supera el tamaño máximo permitido de 190 MB.' + ); + } + } + validAttachmentsTypes() { + this.validInputAttachmentsTypes = false; + if (this.selectAttachments === 2) { + this.fileAttachmentsTypes = undefined; + } + if (this.selectAttachments === 1 || this.selectAttachments === 3) { + this.ftpAttachmentsTypes = ''; + } + if ( + this.selectAttachments !== 0 && + this.observationsAttachmentsTypes !== '' && + this.nameAttachmentsTypes !== '' && + (this.fileAttachmentsTypes !== undefined || + this.ftpAttachmentsTypes !== '') + ) { + this.validInputAttachmentsTypes = true; + } + } + createAttachmentsTypes() { + const form = new FormData(); + form.append('attachmentTypeId', this.selectAttachments.toString()); + if (this.selectAttachments === 2) { + form.append( + 'ftp', + this.ftpAttachmentsTypes + ' ' + this.passftpAttachments + ); + } + if (this.selectAttachments === 1 || this.selectAttachments === 3) { + form.append('file', this.fileAttachmentsTypes); + } + form.append('name', this.nameAttachmentsTypes); + form.append('observations', this.observationsAttachmentsTypes); + this.serviceWorkspaces + .createAttachmentsSupply(this.selectMunicipality, form) + .subscribe((_) => { + this.toastr.success('Ha agregado correctamente el registro.'); + this.validInputAttachmentsTypes = false; + this.serviceWorkspaces + .getSuppliesAttachments(this.selectMunicipality) + .subscribe((response) => { + this.suppliesAttachmentsData = response; + this.selectAttachments = 0; + this.nameAttachmentsTypes = ''; + this.ftpAttachmentsTypes = ''; + this.observationsAttachmentsTypes = ''; + this.fileAttachmentsTypes = undefined; + this.suppliesAttachmentsData = this.suppliesAttachmentsData.filter( + (element) => { + const isCadastral = element.owners.find( + (data) => data.ownerType === 'CADASTRAL_AUTHORITY' + ); + if (isCadastral) { + return element; + } + } + ); + }); + }); + } + openModalDeliveryInfo(modal: any) { + this.modalService.open(modal, { centered: true, scrollable: true }); + } + closeModalDeliveryInfo(option: boolean) { + this.modalService.dismissAll(); + if (option) { + this.createAttachmentsTypes(); + } + } + openModalDelete(idSupplieDelete: number, modal: any) { + this.idSupplieDelete = idSupplieDelete; + this.modalService.open(modal, { centered: true, scrollable: true }); + } + deleteSupplies(idSupplie: number, index?: number) { + console.log('this.idWorkspace: ', this.idWorkspace); + + this.serviceWorkspaces + .deleteSupplies(this.idWorkspace, idSupplie) + .subscribe((_) => { + this.suppliesAttachmentsData.splice(index, 1); + this.toastr.success('Se ha eliminado el insumo'); + }); + } + closeModalDelete(option: boolean, index?: number) { + this.modalService.dismissAll(); + if (option) { + this.deleteSupplies(this.idSupplieDelete, index); + } + } + downloadGetReportAuthority() { + this.serviceWorkspaces + .getReportAuthority(this.selectMunicipality) + .subscribe((data: any) => { + const contentType = data.headers.get('content-type'); + const type = contentType.split(',')[0]; + const dataFile = data.body; + const blob = new Blob([dataFile], { type }); + const url = window.URL.createObjectURL(blob); + saveAs(blob, 'reporte-autoridad.pdf'); + }); + } +} From c637783b64bb89301d9749e8b20d9c711eb0d9df Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:43:13 -0500 Subject: [PATCH 02/54] add component by refuse workspace in municipalities --- .../workspace-refuse.component.html | 82 +++++++++++++++++++ .../workspace-refuse.component.scss | 0 .../workspace-refuse.component.spec.ts | 24 ++++++ .../workspace-refuse.component.ts | 66 +++++++++++++++ 4 files changed, 172 insertions(+) create mode 100644 src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html create mode 100644 src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.scss create mode 100644 src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.spec.ts create mode 100644 src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.ts diff --git a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html new file mode 100644 index 00000000..3255f60f --- /dev/null +++ b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html @@ -0,0 +1,82 @@ +
+ + +
+
+

Denegar espacio de trabajo

+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+ +
+
+
+
diff --git a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.scss b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.spec.ts b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.spec.ts new file mode 100644 index 00000000..754b92dc --- /dev/null +++ b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WorkspaceRefuseComponent } from './workspace-refuse.component'; + +describe('WorkspaceRefuseComponent', () => { + let component: WorkspaceRefuseComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [WorkspaceRefuseComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WorkspaceRefuseComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.ts b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.ts new file mode 100644 index 00000000..e37b81ad --- /dev/null +++ b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.ts @@ -0,0 +1,66 @@ +import { Component, OnInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { ToastrService } from 'ngx-toastr'; +import { JwtHelper } from 'src/app/helpers/jwt'; +import { RoleModel } from 'src/app/helpers/role.model'; +import { ManagersService } from 'src/app/services/managers/managers.service'; +import { WorkspacesService } from 'src/app/services/workspaces/workspaces.service'; + +@Component({ + selector: 'app-workspace-refuse', + templateUrl: './workspace-refuse.component.html', + styleUrls: ['./workspace-refuse.component.scss'], +}) +export class WorkspaceRefuseComponent implements OnInit { + activeManagers: any; + selectManager: number; + munucipalities: any; + selectMunicipality: number; + isAdministrator: boolean; + isActive: boolean; + isActiveSearch: boolean; + constructor( + private serviceWorkspaces: WorkspacesService, + private roles: RoleModel, + private router: Router, + public toastrService: ToastrService, + private serviceManagers: ManagersService + ) { + this.activeManagers = []; + this.selectManager = 0; + this.munucipalities = 0; + this.isAdministrator = false; + this.selectMunicipality = 0; + this.isActiveSearch = false; + } + + ngOnInit(): void { + this.serviceManagers.getManagers().subscribe((data: any) => { + this.activeManagers = data; + }); + const rol = JwtHelper.getUserPublicInformation(); + const role = rol.roles.find((elem) => { + return elem.id === this.roles.administrador; + }); + this.isAdministrator = false; + if (role) { + this.isAdministrator = true; + } + } + + changeDepartament() { + this.serviceWorkspaces + .getMunicipalitiesByManager(this.selectManager) + .subscribe((data) => { + this.munucipalities = data; + }); + } + refuseWorkSpaceActive() { + } + changeMunicipalitie() { + this.isActiveSearch = false; + if (this.selectMunicipality !== 0) { + this.isActiveSearch = true; + } + } +} From e3ec7de1baf4e1acbc46673704b095e831975481 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:46:55 -0500 Subject: [PATCH 03/54] change component by search workspace --- .../workspace-active/workspace-active.component.html | 2 +- .../workspace-active/workspace-active.component.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.html b/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.html index 0ac8a468..239c253c 100644 --- a/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.html +++ b/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.html @@ -6,7 +6,7 @@
-

Entrega de información

+

Búsqueda de Municipios

diff --git a/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.ts b/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.ts index c19ea429..feb5a4b5 100644 --- a/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.ts +++ b/src/app/layout/sections/municipality-management/workspace-active/workspace-active.component.ts @@ -63,7 +63,6 @@ export class WorkspaceActiveComponent implements OnInit { this.isActive = true; this.router.navigate([ 'gestion/workspace/' + this.selectMunicipality + '/operador', - { tab: 4 }, ]); } else { this.isActive = false; From d0dbb4c2bad07a71be03b95c7316e79c3bc411b5 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:47:25 -0500 Subject: [PATCH 04/54] add routes in menu --- .../components/sidebar/sidebar.component.html | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/app/layout/components/sidebar/sidebar.component.html b/src/app/layout/components/sidebar/sidebar.component.html index 577e0b7c..3505dc1b 100644 --- a/src/app/layout/components/sidebar/sidebar.component.html +++ b/src/app/layout/components/sidebar/sidebar.component.html @@ -38,12 +38,33 @@ href="" [routerLink]="['/gestion/workspace/active']" (click)="isCollapsed(listMenu.gestion)" + > +   + Busqueda de
+ municipios + + +
  • +   Entrega de
    información
  • +
  • + +   + Denegar + +
  • Date: Fri, 22 Jan 2021 15:48:16 -0500 Subject: [PATCH 05/54] delete delivery information --- .../operator-assignment.component.html | 339 +----------------- .../operator-assignment.component.ts | 188 +--------- 2 files changed, 3 insertions(+), 524 deletions(-) diff --git a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html index a064d4aa..df663ec8 100644 --- a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html +++ b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html @@ -62,19 +62,6 @@ people Operador
  • - @@ -384,328 +371,6 @@

    Gestor

    -
    -
    -
    -
    -
    - -
    - Autoridad Catastral, cargue aquí la información que requiere - entregar al Gestor para iniciar la Gestión Catastral del - municipio. -
    -
    -
    -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - -
    - Cargue el archivo con la información a entregar. -
    -
    -
    - -
    -
    -
    -
    -
    Credenciales
    -
    - -
    -
    -
    -
    -
    - -
    - Cargue la evidencia de la entrega fisica de la - información. -
    -
    -
    -
    -
    -
    -
    -
    * Nombre
    -
    - -
    -
    -
    -
    -
    -
    - * Observaciones
    - (max. 255 caracteres) -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    #Entregado porNombreFecha de cargueObservaciónEliminar
    {{ index + 1 }}AUTORIDAD CATASTRAL{{ item.name }}{{ formatDate(item.createdAt) }} - - - - delete_forever - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    - - - - -

    diff --git a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts index 351a6b3a..414af56f 100644 --- a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts +++ b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts @@ -36,18 +36,9 @@ export class OperatorAssignmentComponent implements OnInit { @ViewChild('myInput') myInputVariable: ElementRef; assingOperator: boolean; - dataAttachmentsTypes: any; - selectAttachments: number; - observationsAttachmentsTypes: string; - ftpAttachmentsTypes: string; - validInputAttachmentsTypes: boolean; - fileAttachmentsTypes: any; suppliesAttachmentsData: any; - idSupplieDelete: number; idWorkSpaceMunicipality: number; isChangeDataOperator: boolean; - nameAttachmentsTypes: string; - passftpAttachments: string; isActiveAssignOperator: boolean; constructor( private router: Router, @@ -56,8 +47,7 @@ export class OperatorAssignmentComponent implements OnInit { private toastr: ToastrService, private serviceOperators: OperatorsService, private roles: RoleModel, - private modalService: NgbModal, - private insumosService: SuppliesService + private modalService: NgbModal ) { this.dataWorkSpace = { manager: {}, @@ -91,15 +81,8 @@ export class OperatorAssignmentComponent implements OnInit { this.updateInfoBasic = false; this.assingOperator = false; this.replaceOperator = false; - this.dataAttachmentsTypes = []; - this.selectAttachments = 0; - this.observationsAttachmentsTypes = ''; - this.ftpAttachmentsTypes = ''; - this.validInputAttachmentsTypes = false; this.suppliesAttachmentsData = []; this.isChangeDataOperator = false; - this.nameAttachmentsTypes = ''; - this.passftpAttachments = ''; this.isActiveAssignOperator = false; } @@ -172,26 +155,6 @@ export class OperatorAssignmentComponent implements OnInit { this.operators = response; }); } - if (this.tab === 4) { - this.insumosService.GetAttachmentsTypes().subscribe((data) => { - this.dataAttachmentsTypes = data; - }); - this.serviceWorkspaces - .getSuppliesAttachments(this.selectMunicipality) - .subscribe((response) => { - this.suppliesAttachmentsData = response; - this.suppliesAttachmentsData = this.suppliesAttachmentsData.filter( - (element) => { - const isCadastral = element.owners.find( - (data) => data.ownerType === 'CADASTRAL_AUTHORITY' - ); - if (isCadastral) { - return element; - } - } - ); - }); - } if (this.tab === 5) { this.serviceWorkspaces .getSuppliesAttachments(this.selectMunicipality) @@ -525,31 +488,6 @@ export class OperatorAssignmentComponent implements OnInit { this.modalService.dismissAll(); } } - tab4() { - this.tab = 4; - this.router.navigate([ - 'gestion/workspace/' + this.selectMunicipality + '/operador', - { tab: 4 }, - ]); - this.insumosService.GetAttachmentsTypes().subscribe((data) => { - this.dataAttachmentsTypes = data; - }); - this.serviceWorkspaces - .getSuppliesAttachments(this.selectMunicipality) - .subscribe((response) => { - this.suppliesAttachmentsData = response; - this.suppliesAttachmentsData = this.suppliesAttachmentsData.filter( - (element) => { - const isCadastral = element.owners.find( - (data) => data.ownerType === 'CADASTRAL_AUTHORITY' - ); - if (isCadastral) { - return element; - } - } - ); - }); - } tab5() { this.tab = 5; this.router.navigate([ @@ -572,99 +510,6 @@ export class OperatorAssignmentComponent implements OnInit { ); }); } - docSoportAttachmentsTypes(files: FileList) { - if (this.selectAttachments === 1 || this.selectAttachments === 3) { - this.ftpAttachmentsTypes = ''; - } - this.ftpAttachmentsTypes = ''; - if (files[0].size / 1024 / 1024 <= environment.sizeFile) { - var re = /zip*/; - if (files[0].type.match(re)) { - this.fileAttachmentsTypes = files[0]; - } else { - if (files[0].size / 1024 / 1024 > environment.sizeFileUnZip) { - this.fileAttachmentsTypes = undefined; - this.toastr.error( - 'Por favor convierta el archivo en .zip antes de subirlo, ya que supera el tamaño de cargue permitido.' - ); - } else { - this.fileAttachmentsTypes = files[0]; - this.validInputAttachmentsTypes = false; - if ( - this.selectAttachments !== 0 && - this.observationsAttachmentsTypes !== '' && - (this.fileAttachmentsTypes !== undefined || - this.ftpAttachmentsTypes !== '') - ) { - this.validInputAttachmentsTypes = true; - } - } - } - } else { - this.toastr.error( - 'No se puede cargar el archivo, supera el tamaño máximo permitido de 190 MB.' - ); - } - } - validAttachmentsTypes() { - this.validInputAttachmentsTypes = false; - if (this.selectAttachments === 2) { - this.fileAttachmentsTypes = undefined; - } - if (this.selectAttachments === 1 || this.selectAttachments === 3) { - this.ftpAttachmentsTypes = ''; - } - if ( - this.selectAttachments !== 0 && - this.observationsAttachmentsTypes !== '' && - this.nameAttachmentsTypes !== '' && - (this.fileAttachmentsTypes !== undefined || - this.ftpAttachmentsTypes !== '') - ) { - this.validInputAttachmentsTypes = true; - } - } - createAttachmentsTypes() { - const form = new FormData(); - form.append('attachmentTypeId', this.selectAttachments.toString()); - if (this.selectAttachments === 2) { - form.append( - 'ftp', - this.ftpAttachmentsTypes + ' ' + this.passftpAttachments - ); - } - if (this.selectAttachments === 1 || this.selectAttachments === 3) { - form.append('file', this.fileAttachmentsTypes); - } - form.append('name', this.nameAttachmentsTypes); - form.append('observations', this.observationsAttachmentsTypes); - this.serviceWorkspaces - .createAttachmentsSupply(this.selectMunicipality, form) - .subscribe((_) => { - this.toastr.success('Ha agregado correctamente el registro.'); - this.validInputAttachmentsTypes = false; - this.serviceWorkspaces - .getSuppliesAttachments(this.selectMunicipality) - .subscribe((response) => { - this.suppliesAttachmentsData = response; - this.selectAttachments = 0; - this.nameAttachmentsTypes = ''; - this.ftpAttachmentsTypes = ''; - this.observationsAttachmentsTypes = ''; - this.fileAttachmentsTypes = undefined; - this.suppliesAttachmentsData = this.suppliesAttachmentsData.filter( - (element) => { - const isCadastral = element.owners.find( - (data) => data.ownerType === 'CADASTRAL_AUTHORITY' - ); - if (isCadastral) { - return element; - } - } - ); - }); - }); - } deleteSupplies(idSupplie: number, index?: number) { this.serviceWorkspaces .deleteSupplies(this.idWorkspace, idSupplie) @@ -673,16 +518,6 @@ export class OperatorAssignmentComponent implements OnInit { this.toastr.success('Se ha eliminado el insumo'); }); } - closeModalDelete(option: boolean, index?: number) { - this.modalService.dismissAll(); - if (option) { - this.deleteSupplies(this.idSupplieDelete, index); - } - } - openModalDelete(idSupplieDelete: number, modal: any) { - this.idSupplieDelete = idSupplieDelete; - this.modalService.open(modal, { centered: true, scrollable: true }); - } changeDataOperator() { this.isChangeDataOperator = false; this.isActiveAssignOperator = false; @@ -708,25 +543,4 @@ export class OperatorAssignmentComponent implements OnInit { saveAs(blob, nameSupplie + '.zip'); }); } - downloadGetReportAuthority() { - this.serviceWorkspaces - .getReportAuthority(this.selectMunicipality) - .subscribe((data: any) => { - const contentType = data.headers.get('content-type'); - const type = contentType.split(',')[0]; - const dataFile = data.body; - const blob = new Blob([dataFile], { type }); - const url = window.URL.createObjectURL(blob); - saveAs(blob, 'reporte-autoridad.pdf'); - }); - } - openModalDeliveryInfo(modal: any) { - this.modalService.open(modal, { centered: true, scrollable: true }); - } - closeModalDeliveryInfo(option: boolean) { - this.modalService.dismissAll(); - if (option) { - this.createAttachmentsTypes(); - } - } } From cab5e93bce385e04a85566f445103823aa3eb060 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:49:18 -0500 Subject: [PATCH 06/54] is authority change by strong --- .../sections/supplies/search/search.component.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/layout/sections/supplies/search/search.component.html b/src/app/layout/sections/supplies/search/search.component.html index 0e66939e..96aa9c00 100644 --- a/src/app/layout/sections/supplies/search/search.component.html +++ b/src/app/layout/sections/supplies/search/search.component.html @@ -118,7 +118,15 @@
    Resultados de Búsqueda
    let index = index " > - {{ item.typeSupply.provider.name }} + + {{ + item.typeSupply.provider.name + }}{{ + item.typeSupply.provider.name + }} + {{ item.name }}{{ From 7d77ef8a1298445a49cd92cb54d1f2541f915dfc Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Fri, 22 Jan 2021 15:49:29 -0500 Subject: [PATCH 07/54] add components --- .../gestion-municipio-routing.module.ts | 10 ++++++++++ .../gestion-municipio.module.ts | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/app/layout/sections/municipality-management/gestion-municipio-routing.module.ts b/src/app/layout/sections/municipality-management/gestion-municipio-routing.module.ts index bc6ae222..5b9fc212 100644 --- a/src/app/layout/sections/municipality-management/gestion-municipio-routing.module.ts +++ b/src/app/layout/sections/municipality-management/gestion-municipio-routing.module.ts @@ -1,3 +1,5 @@ +import { SuppliesDeliveryComponent } from './supplies-delivery/supplies-delivery.component'; +import { WorkspaceRefuseComponent } from './workspace-refuse/workspace-refuse.component'; import { SearchWorkspaceComponent } from './search-workspace/search-workspace.component'; import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; @@ -22,6 +24,14 @@ const routes: Routes = [ path: 'workspace/asignado', component: SearchWorkspaceComponent, }, + { + path: 'workspace/delivery', + component: SuppliesDeliveryComponent, + }, + { + path: 'workspace/refuse', + component: WorkspaceRefuseComponent, + }, ]; @NgModule({ diff --git a/src/app/layout/sections/municipality-management/gestion-municipio.module.ts b/src/app/layout/sections/municipality-management/gestion-municipio.module.ts index 5791f9ba..8dd33e50 100644 --- a/src/app/layout/sections/municipality-management/gestion-municipio.module.ts +++ b/src/app/layout/sections/municipality-management/gestion-municipio.module.ts @@ -1,3 +1,4 @@ +import { WorkspaceRefuseComponent } from './workspace-refuse/workspace-refuse.component'; import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -10,6 +11,7 @@ import { BsComponentModule } from '../../bs-component/bs-component.module'; import { WorkspaceActiveComponent } from './workspace-active/workspace-active.component'; import { NgSelect2Module } from 'ng-select2'; import { SearchWorkspaceComponent } from './search-workspace/search-workspace.component'; +import { SuppliesDeliveryComponent } from './supplies-delivery/supplies-delivery.component'; @NgModule({ declarations: [ @@ -17,6 +19,8 @@ import { SearchWorkspaceComponent } from './search-workspace/search-workspace.co OperatorAssignmentComponent, WorkspaceActiveComponent, SearchWorkspaceComponent, + WorkspaceRefuseComponent, + SuppliesDeliveryComponent, ], imports: [ CommonModule, From 7202f4a0e8528555c95f93ca6e8b0079aeb9c146 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Tue, 26 Jan 2021 12:40:55 -0500 Subject: [PATCH 08/54] change name --- src/app/layout/components/sidebar/sidebar.component.html | 4 ++-- .../supplies-delivery/supplies-delivery.component.html | 2 +- .../workspace-refuse/workspace-refuse.component.html | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/layout/components/sidebar/sidebar.component.html b/src/app/layout/components/sidebar/sidebar.component.html index 3505dc1b..462d4002 100644 --- a/src/app/layout/components/sidebar/sidebar.component.html +++ b/src/app/layout/components/sidebar/sidebar.component.html @@ -40,7 +40,7 @@ (click)="isCollapsed(listMenu.gestion)" >   - Busqueda de
    + Búsqueda de
    municipios @@ -62,7 +62,7 @@ (click)="isCollapsed(listMenu.gestion)" >   - Denegar + Desasignar
  • diff --git a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html index 81d5e560..3ca78fe6 100644 --- a/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html +++ b/src/app/layout/sections/municipality-management/supplies-delivery/supplies-delivery.component.html @@ -6,7 +6,7 @@
    -

    Entrega de insumos - Habilitación Catastral

    +

    Entrega de información - Habilitación Catastral

    diff --git a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html index 3255f60f..449fb720 100644 --- a/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html +++ b/src/app/layout/sections/municipality-management/workspace-refuse/workspace-refuse.component.html @@ -6,7 +6,7 @@
    -

    Denegar espacio de trabajo

    +

    Desasignar espacio de trabajo

    @@ -68,7 +68,7 @@

    Denegar espacio de trabajo

    (click)="refuseWorkSpaceActive()" [disabled]="!isActiveSearch" > - Denegar + Desasignar
    From 4f3e7e2943c7d28cba148985bcf8178b535712a6 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Tue, 26 Jan 2021 13:11:32 -0500 Subject: [PATCH 09/54] change text --- .../operator-assignment/operator-assignment.component.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html index df663ec8..8771b7f1 100644 --- a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html +++ b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html @@ -71,7 +71,7 @@ (click)="tab5()" aria-controls="messages" > - view_list Insumos - + view_list Información - Habilitación Catastral
  • @@ -385,7 +385,7 @@

    Gestor

    >
    Gestor, descargue o consulte la información suministrada por - la Autoridad Catastral para la Gestión Catastral del + la Autoridad Catastral para iniciar la Gestión Catastral del municipio asignado.
    From 38658a1922d3025ab6249e8e44672588360e412d Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Wed, 27 Jan 2021 11:57:20 -0500 Subject: [PATCH 10/54] feat: add recover and reset password --- src/app/login/login.component.html | 290 ++++++++++++++++++++++--- src/app/login/login.component.ts | 81 ++++++- src/app/services/auth/login.service.ts | 28 ++- 3 files changed, 354 insertions(+), 45 deletions(-) diff --git a/src/app/login/login.component.html b/src/app/login/login.component.html index 42f96316..d210d0e7 100644 --- a/src/app/login/login.component.html +++ b/src/app/login/login.component.html @@ -3,48 +3,105 @@ diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 009ccc0f..bf9ffa6f 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -1,5 +1,7 @@ import { Component, OnInit } from '@angular/core'; import { Router } from '@angular/router'; +import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { ToastrService } from 'ngx-toastr'; import { environment } from 'src/environments/environment'; import { LoginService } from '../services/auth/login.service'; @@ -11,27 +13,88 @@ import { LoginService } from '../services/auth/login.service'; export class LoginComponent implements OnInit { loginData = { username: '', - password: '' + password: '', }; - + emailByRecover: string; + buttonRecover: boolean; + codeRecover: string; + newPassword: string; + confirmationNewPassword: string; + buttonReset: boolean; constructor( public router: Router, - private serviceAUTH: LoginService - ) { } + private serviceAUTH: LoginService, + private modalService: NgbModal, + private toast: ToastrService + ) { + this.emailByRecover = ''; + this.buttonRecover = false; + this.codeRecover = ''; + this.newPassword = ''; + this.confirmationNewPassword = ''; + } - ngOnInit() { } + ngOnInit() {} onLoggedin() { - this.serviceAUTH.login(this.loginData.username.toLowerCase(), this.loginData.password).subscribe( - data => { + this.serviceAUTH + .login(this.loginData.username.toLowerCase(), this.loginData.password) + .subscribe((data) => { localStorage.setItem(environment.nameTokenSession, data.access_token); this.router.navigate(['inicio']); - } - ); + }); } public onKey(event: any) { if (event.key === 'Enter') { this.onLoggedin(); } } + recoverPassword(modal: any) { + this.modalService.open(modal, { centered: true, scrollable: true }); + } + closeModalRecover(modal: any) { + if (this.buttonRecover) { + this.serviceAUTH + .recoverPassword(this.emailByRecover) + .subscribe((response: any) => { + console.log(response); + this.toast.success(response.message); + this.modalService.dismissAll(); + this.modalService.open(modal, { centered: true, scrollable: true }); + }); + } + } + validateEmail(email) { + var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + return re.test(email); + } + validfield() { + this.buttonRecover = false; + if (this.validateEmail(this.emailByRecover)) { + this.buttonRecover = true; + } + } + validfield2() { + this.buttonReset = false; + if ( + this.codeRecover !== '' && + this.newPassword !== '' && + this.confirmationNewPassword !== '' + ) { + this.buttonReset = true; + } + } + closeModalReset() { + if (this.newPassword === this.confirmationNewPassword) { + this.serviceAUTH + .ResetPassword(this.emailByRecover, this.codeRecover, this.newPassword) + .subscribe((response: any) => { + console.log(response); + this.toast.success(response.message); + this.modalService.dismissAll(); + }); + } else { + this.toast.error('Las contraseñas no son iguales.'); + } + } } diff --git a/src/app/services/auth/login.service.ts b/src/app/services/auth/login.service.ts index a7a7d5bc..3ec2953f 100644 --- a/src/app/services/auth/login.service.ts +++ b/src/app/services/auth/login.service.ts @@ -4,9 +4,8 @@ import { environment } from 'src/environments/environment'; import { Observable } from 'rxjs'; @Injectable({ - providedIn: 'root' + providedIn: 'root', }) - export class LoginService { data = []; url: string; @@ -15,26 +14,43 @@ export class LoginService { this.url = environment.apiBaseUrlPrefix; } login(username: string, password: string): Observable { - const encoded = btoa(environment.clientUsername + ':' + environment.clientPassword); + const encoded = btoa( + environment.clientUsername + ':' + environment.clientPassword + ); const body = new HttpParams() .set('username', username) .set('password', password) .set('grant_type', 'password'); - return this.httpClient.post(this.url + '/security/oauth/token', + return this.httpClient.post( + this.url + '/security/oauth/token', body.toString(), { headers: new HttpHeaders() .set('Content-Type', 'application/x-www-form-urlencoded') - .set('Authorization', 'Basic ' + encoded) + .set('Authorization', 'Basic ' + encoded), } ); } getSessions() { - return this.httpClient.get(this.url + '/auth/session', { observe: 'response' }); + return this.httpClient.get(this.url + '/auth/session', { + observe: 'response', + }); } logout() { localStorage.removeItem(environment.nameTokenSession); localStorage.removeItem('showMenu'); } + recoverPassword(email: string) { + return this.httpClient.put(this.url + '/administration/v1/users/recover', { + email: email, + }); + } + ResetPassword(email: string, code: string, newPassword: string) { + return this.httpClient.put(this.url + '/administration/v1/users/reset', { + email: email, + code: code, + newPassword: newPassword, + }); + } } From ab8eb68ecfcd62411c1d7a153477c2e7d229a95c Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Sun, 21 Feb 2021 23:55:38 -0500 Subject: [PATCH 11/54] feat: assign manager by workspace --- .../assign-workspace/workspace.component.html | 54 ++++++- .../assign-workspace/workspace.component.ts | 137 ++++++++++++++---- .../updateInformationByWorkspace.interface.ts | 4 + .../validateMunicipalities.interface.ts | 8 + .../cadastral-authority.service.spec.ts | 16 ++ .../cadastral-authority.service.ts | 90 ++++++++++++ 6 files changed, 275 insertions(+), 34 deletions(-) create mode 100644 src/app/models/updateInformationByWorkspace.interface.ts create mode 100644 src/app/models/validateMunicipalities.interface.ts create mode 100644 src/app/services/cadastral-authority/cadastral-authority.service.spec.ts create mode 100644 src/app/services/cadastral-authority/cadastral-authority.service.ts diff --git a/src/app/layout/sections/municipality-management/assign-workspace/workspace.component.html b/src/app/layout/sections/municipality-management/assign-workspace/workspace.component.html index 8217e4b1..b05bbd0a 100644 --- a/src/app/layout/sections/municipality-management/assign-workspace/workspace.component.html +++ b/src/app/layout/sections/municipality-management/assign-workspace/workspace.component.html @@ -21,7 +21,7 @@

    Asignación de Gestor Catastral

    name="managers" id="managers" [(ngModel)]="dataCreateWorkSpace.managerCode" - (change)="changeData()" + (change)="changeDepartament()" >
    +
    + +
    + + + + + + + + + + + + + + + +
    MunicipioGestores asignadosObservación
    {{ item.municipalityName }} +
    + {{ element.manager.alias }} +
    +
    +
    + +
    +
    +
    +
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - - -
    -

    Gestor

    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    {{ formatDate(dataWorkSpace.manager.createdAt) }}
    -
    -
    - -
    -
    -
    -
    -
    - - - - - - - - - - - - - - + +
    IDRepositorio DocumentalHitoEntregado porFecha de Creación
    {{ i + 1 }} - soporte - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - -
    GestorNITFecha de AsignaciónSoporteFecha de inicioObservacionesOpciones
    {{ item.manager.alias }} + {{ item.manager.taxIdentificationNumber }} + + {{ formatDate(item.manager.createdAt) }} + + soporte + + preview + + + + + + +
    + + +
    +
    {{ item.milestone.name }} -
    - AUTORIDAD CATASTRAL -
    -
    - {{ dataWorkSpace.manager.alias }} -
    -
    {{ formatDate(item.createdAt) }}
    - - + No + + +
    + +
    + + +
    @@ -492,45 +494,4 @@
    - - - - - -
    diff --git a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts index 414af56f..ab7c2041 100644 --- a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts +++ b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.ts @@ -9,7 +9,7 @@ import { RoleModel } from 'src/app/helpers/role.model'; import { saveAs } from 'file-saver'; import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { environment } from 'src/environments/environment'; -import { SuppliesService } from 'src/app/services/supplies/supplies.service'; +import { CadastralAuthorityService } from 'src/app/services/cadastral-authority/cadastral-authority.service'; const moment = _moment; @Component({ @@ -47,7 +47,8 @@ export class OperatorAssignmentComponent implements OnInit { private toastr: ToastrService, private serviceOperators: OperatorsService, private roles: RoleModel, - private modalService: NgbModal + private modalService: NgbModal, + private cadastralAuthorityService: CadastralAuthorityService ) { this.dataWorkSpace = { manager: {}, @@ -61,12 +62,7 @@ export class OperatorAssignmentComponent implements OnInit { this.munucipalities = []; this.selectDepartment = 0; this.selectMunicipality = 0; - this.editForm = { - municipalityArea: true, - numberAlphanumericParcels: true, - startDate: true, - observations: true, - }; + this.editForm = []; this.dataSoports = []; this.operators = []; this.selectOperator = 0; @@ -123,6 +119,8 @@ export class OperatorAssignmentComponent implements OnInit { .getWorkSpace(this.idWorkspace) .subscribe((response: any) => { this.dataWorkSpace = response; + console.log(this.dataWorkSpace); + this.selectDepartment = this.dataWorkSpace.municipality.department.id; if (this.dataWorkSpace.operators.length > 0) { this.replaceOperator = true; @@ -143,13 +141,6 @@ export class OperatorAssignmentComponent implements OnInit { ); } }); - if (this.tab === 2) { - this.serviceWorkspaces - .getSupportsByWorkSpace(this.idWorkspace) - .subscribe((response) => { - this.dataSoports = response; - }); - } if (this.tab === 3) { this.serviceOperators.getOperatorsByFilters().subscribe((response) => { this.operators = response; @@ -214,6 +205,12 @@ export class OperatorAssignmentComponent implements OnInit { .getWorkSpace(this.idWorkspace) .subscribe((response: any) => { this.dataWorkSpace = response; + this.dataWorkSpace.managers.forEach((_) => { + this.editForm.push({ + startDate: true, + observations: true, + }); + }); if (this.dataWorkSpace.operators.length > 0) { this.replaceOperator = true; this.dataOperatorsWorkSpace = this.clone( @@ -233,13 +230,6 @@ export class OperatorAssignmentComponent implements OnInit { ); } }); - if (this.tab === 2) { - this.serviceWorkspaces - .getSupportsByWorkSpace(this.idWorkspace) - .subscribe((response) => { - this.dataSoports = response; - }); - } if (this.tab === 3) { this.serviceOperators.getOperatorsByFilters().subscribe((response) => { this.operators = response; @@ -315,29 +305,20 @@ export class OperatorAssignmentComponent implements OnInit { ]); } } - changeUpdate() { - this.editForm = { - municipalityArea: false, - numberAlphanumericParcels: false, + changeUpdate(index: number) { + this.editForm[index] = { startDate: false, observations: false, }; } - update() { + update(index: number) { const dataUpdate = new FormData(); dataUpdate.append('startDate', this.dataWorkSpace.startDate); dataUpdate.append('observations', this.dataWorkSpace.observations); - dataUpdate.append( - 'numberAlphanumericParcels', - this.dataWorkSpace.numberAlphanumericParcels - ); - dataUpdate.append('municipalityArea', this.dataWorkSpace.municipalityArea); this.serviceWorkspaces .updateWorkSpace(this.idWorkspace, dataUpdate) .subscribe((_) => { - this.editForm = { - municipalityArea: true, - numberAlphanumericParcels: true, + this.editForm[index] = { startDate: true, observations: true, }; @@ -351,14 +332,6 @@ export class OperatorAssignmentComponent implements OnInit { { tab: 1 }, ]); } - getSopports() { - this.tab = 2; - this.router.navigate([ - 'gestion/workspace/' + this.selectMunicipality + '/operador', - { tab: 2 }, - ]); - this.init(); - } getOperator() { this.tab = 3; this.router.navigate([ @@ -449,14 +422,14 @@ export class OperatorAssignmentComponent implements OnInit { openModal(modal: any) { this.modalService.open(modal, { centered: true, scrollable: true }); } - public onKey(event: any) { + public onKey(event: any, modal: any) { if (event.key === 'Enter') { - this.update(); + this.openModalUpdate(modal); } } - previewSupplies(idSupport: number, item: any) { - this.serviceWorkspaces - .downloadSupport(this.idWorkspace, idSupport) + previewSupplies(managerCode: number, index: number) { + this.cadastralAuthorityService + .downloadSupportFromManager(this.idWorkspace, managerCode) .subscribe((data: any) => { const contentType = data.headers.get('content-type'); const type = contentType.split(',')[0]; @@ -464,25 +437,25 @@ export class OperatorAssignmentComponent implements OnInit { const blob = new Blob([dataFile], { type }); const url = window.URL.createObjectURL(blob); const preview = window.open(url, 'soporte'); - if (item.milestone.id === 1) { - setTimeout(() => { - preview.document.title = 'Soporte Autoridad Catastral'; - }, 500); - } - if (item.milestone.id === 3) { - setTimeout(() => { - preview.document.title = - 'Soporte Gestor ' + this.dataWorkSpace.manager.alias; - }, 500); - } + // if (item.milestone.id === 1) { + // setTimeout(() => { + // preview.document.title = 'Soporte Autoridad Catastral'; + // }, 500); + // } + // if (item.milestone.id === 3) { + setTimeout(() => { + preview.document.title = + 'Soporte Gestor ' + this.dataWorkSpace.managers[index].alias; + }, 500); + // } }); } openModalUpdate(modal: any) { this.modalService.open(modal, { centered: true, scrollable: true }); } - closeModalUpdate(option: boolean) { + closeModalUpdate(option: boolean, index?: number) { if (option) { - this.update(); + this.update(index); this.modalService.dismissAll(); } else { this.modalService.dismissAll(); diff --git a/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.html b/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.html index 737a51dd..7f5a5ad4 100644 --- a/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.html +++ b/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.html @@ -64,69 +64,11 @@

    Búsqueda de Municipios

    -
    -
    - -
    -
    -
    -
    -

    Espacios de Trabajo

    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    IDGestorDepartamentoMunicipioFecha de InicioObservacionesVer
    {{ i + 1 }}{{ item.manager.alias }}{{ item.municipality.department.name }}{{ item.municipality.name }}{{ formatDate(item.startDate) }} - - - double_arrow -
    -
    -
    -
    -
    -
    diff --git a/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.ts b/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.ts index dcb82f9b..69d444e4 100644 --- a/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.ts +++ b/src/app/layout/sections/municipality-management/search-workspace/search-workspace.component.ts @@ -63,26 +63,7 @@ export class SearchWorkspaceComponent implements OnInit { moment.locale('es'); return moment(date).format('DD/MM/YYYY'); } - searchWorkSpaceActive() { - this.serviceWorkspaces - .GetWorkspacesByLocation( - this.selectDepartment, - this.selectMunicipality === 0 ? null : this.selectMunicipality - ) - .subscribe((response: any) => { - if (response.length > 0) { - this.listWorkSpace = response; - this.isActive = true; - } else { - this.isActive = false; - this.toastrService.error( - 'No existe un espacio de trabajo para el municipio.' - ); - } - }); - } - updateWorkSpace(item: any) { - this.selectMunicipality = item.municipality.id; + updateWorkSpace() { this.router.navigate([ 'gestion/workspace/' + this.selectMunicipality + '/operador', ]); diff --git a/src/app/services/cadastral-authority/cadastral-authority.service.ts b/src/app/services/cadastral-authority/cadastral-authority.service.ts index 79644b79..3f4a9f3c 100644 --- a/src/app/services/cadastral-authority/cadastral-authority.service.ts +++ b/src/app/services/cadastral-authority/cadastral-authority.service.ts @@ -67,7 +67,8 @@ export class CadastralAuthorityService { '/workspaces/v2/workspaces/' + workspaceId + '/download-support-manager/' + - managerCode + managerCode, + { responseType: 'arraybuffer', observe: 'response' } ); } /** From 3c19663989a06a04b38ae30348404c486e06cbf6 Mon Sep 17 00:00:00 2001 From: MauricioAcosta Date: Mon, 22 Feb 2021 20:34:40 -0500 Subject: [PATCH 14/54] :success: finish edit information workspace all managers --- .../operator-assignment.component.html | 33 +++++------- .../operator-assignment.component.ts | 53 ++++++++----------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html index cd86ef83..70e998c4 100644 --- a/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html +++ b/src/app/layout/sections/municipality-management/operator-assignment/operator-assignment.component.html @@ -38,18 +38,6 @@ home Información Básica
    -