Commit b6cf1368 authored by Sebastian Chicoma's avatar Sebastian Chicoma

Correcciones en la sección Informacion general del wizard de agentes

parent 227251a9
...@@ -105,10 +105,10 @@ export class AgentFakeBackendInterceptor implements HttpInterceptor { ...@@ -105,10 +105,10 @@ export class AgentFakeBackendInterceptor implements HttpInterceptor {
// return pagination(body); // return pagination(body);
case url.indexOf(basePath + '/connection/data') !== -1 && method === 'GET ': case url.indexOf(basePath + '/connection/data') !== -1 && method === 'GET ':
return ok({}); return ok({});
case url.indexOf(basePath + '/country') !== -1 && method === 'GET': // case url.indexOf(basePath + '/country') !== -1 && method === 'GET':
return ok(countries); // return ok(countries);
case url.indexOf(basePath + '/') !== -1 && method === 'GET': // case url.indexOf(basePath + '/') !== -1 && method === 'GET':
return ok(data); // return ok(data);
default: default:
// pass through any requests not handled above // pass through any requests not handled above
return next.handle(request); return next.handle(request);
......
...@@ -23,7 +23,6 @@ const routes: Routes = [ ...@@ -23,7 +23,6 @@ const routes: Routes = [
//component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent, component: AgentComponent,
resolve: { resolve: {
dataForWizard: AgentDataForWizardResolver,
countryData : CountryDataForWizardResolver countryData : CountryDataForWizardResolver
}, },
canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard], canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
...@@ -40,8 +39,8 @@ const routes: Routes = [ ...@@ -40,8 +39,8 @@ const routes: Routes = [
//component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent, component: AgentComponent,
resolve: { resolve: {
externalSystemDetail: AgentDetailResolver, agentDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver countryData : CountryDataForWizardResolver
}, },
canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard], canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
data: data:
...@@ -56,8 +55,8 @@ const routes: Routes = [ ...@@ -56,8 +55,8 @@ const routes: Routes = [
//component: AgentDetailComponent, //component: AgentDetailComponent,
component: AgentComponent, component: AgentComponent,
resolve: { resolve: {
externalSystemDetail: AgentDetailResolver, agentDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver countryData : CountryDataForWizardResolver
}, },
canActivate: [AuthGuard, ResourceAuthGuard], canActivate: [AuthGuard, ResourceAuthGuard],
data: data:
......
...@@ -8,10 +8,10 @@ export class AgentStatusPipe implements PipeTransform { ...@@ -8,10 +8,10 @@ export class AgentStatusPipe implements PipeTransform {
transform(value: any, ...args: any[]): any { transform(value: any, ...args: any[]): any {
if (value) { if (value) {
switch (value) { switch (value) {
case 'AC': case 'CR':
return 'label.active'; return 'label.created';
case 'IN': case 'DP':
return 'label.inactive'; return 'label.deployed';
} }
} }
......
...@@ -14,7 +14,7 @@ export class AgentDetailResolver implements Resolve<any> { ...@@ -14,7 +14,7 @@ export class AgentDetailResolver implements Resolve<any> {
): Observable<any>|Promise<any>|any { ): Observable<any>|Promise<any>|any {
let code = route.paramMap.get('code'); let code = route.paramMap.get('code');
return this.service.getResult(code); return this.service.getResult(code);
} }
} }
...@@ -26,7 +26,7 @@ export class AgentService extends DynaDataService { ...@@ -26,7 +26,7 @@ export class AgentService extends DynaDataService {
} }
getCountryDataForWizard() { getCountryDataForWizard() {
return this.httpClient.get(this.serviceURL + '/country'); return this.httpClient.get(this.serviceURL + '/countries');
} }
} }
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<div *ngIf="template['name'] !== 'avatar'"> <div *ngIf="template['name'] !== 'avatar'">
<span class="label" [ngClass]="{'label-success': item[template['name']] === 'AC', 'label-default': item[template['name']] === 'IN'}" <span class="label" [ngClass]="{'label-success': item[template['name']] === 'DP', 'label-default': item[template['name']] === 'CR'}"
*ngIf="template['name'] === 'status'">{{ item[template['name']] | agentStatus | translate }}</span> *ngIf="template['name'] === 'status'">{{ item[template['name']] | agentStatus | translate }}</span>
<span <span
*ngIf="template['name'] !== 'status'">{{ item[template['name']] }}</span> *ngIf="template['name'] !== 'status'">{{ item[template['name']] }}</span>
......
...@@ -34,7 +34,7 @@ export class AgentComponent implements OnInit, IDirty { ...@@ -34,7 +34,7 @@ export class AgentComponent implements OnInit, IDirty {
@ViewChild('stepper', { static: true }) stepper: MatStepper; @ViewChild('stepper', { static: true }) stepper: MatStepper;
externalSystemDetail: any; agentDetail: any;
isLinear = true; isLinear = true;
isNew = true; isNew = true;
...@@ -91,24 +91,23 @@ export class AgentComponent implements OnInit, IDirty { ...@@ -91,24 +91,23 @@ export class AgentComponent implements OnInit, IDirty {
this.isNew = this._activatedRoute.snapshot.data.mode === 'create'; this.isNew = this._activatedRoute.snapshot.data.mode === 'create';
if (this.isNew) { if (this.isNew) {
this.externalSystemDetail = { this.agentDetail = {
connections: []
}; };
} else { } else {
this.externalSystemDetail = this._activatedRoute.snapshot.data.externalSystemDetail; this.agentDetail = this._activatedRoute.snapshot.data.agentDetail;
} }
let dataForWizard = this._activatedRoute.snapshot.data.dataForWizard; //let dataForWizard = this._activatedRoute.snapshot.data.dataForWizard;
this.frequentQuestionsComponent.setDataForWizard(dataForWizard); //this.frequentQuestionsComponent.setDataForWizard(dataForWizard);
//this.stepsComponent.setDataForWizard(dataForWizard); //this.stepsComponent.setDataForWizard(dataForWizard);
//this.entitiesComponent.setDataForWizard(dataForWizard); //this.entitiesComponent.setDataForWizard(dataForWizard);
this.generalInformationComponent.buildForm(this.externalSystemDetail); this.generalInformationComponent.buildForm(this.agentDetail);
this.frequentQuestionsComponent.buildForm(this.externalSystemDetail); this.frequentQuestionsComponent.buildForm(this.agentDetail);
//this.stepsComponent.buildForm(this.externalSystemDetail, this.resourceAuth); //this.stepsComponent.buildForm(this.agentDetail, this.resourceAuth);
//this.entitiesComponent.buildForm(this.externalSystemDetail); //this.entitiesComponent.buildForm(this.agentDetail);
//this.summaryComponent.buildForm(this.externalSystemDetail); //this.summaryComponent.buildForm(this.agentDetail);
} }
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="col-12"> <div class="col-12">
<mat-form-field class="amd-form-control"> <mat-form-field class="amd-form-control">
<mat-select [placeholder]="'label.country' | translate" formControlName="country" <mat-select [placeholder]="'label.country' | translate" formControlName="country"
required (selectionChange)="onCountryChange($event)"> required (selectionChange)="onCountryChange($event, true)">
<mat-option *ngFor="let country of countries" [value]="country.id"> <mat-option *ngFor="let country of countries" [value]="country.id">
{{country.name | translate}} {{country.name | translate}}
</mat-option> </mat-option>
......
...@@ -57,6 +57,7 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -57,6 +57,7 @@ export class CaGeneralInformationComponent implements OnInit {
) { ) {
this.viewMode = this._activatedRoute.snapshot.data.mode === 'view'; this.viewMode = this._activatedRoute.snapshot.data.mode === 'view';
this.countries = this._activatedRoute.snapshot.data.countryData;
this.formGroup = this.formBuilder.group({ this.formGroup = this.formBuilder.group({
name: new FormControl({ value: "", disabled: this.viewMode }), name: new FormControl({ value: "", disabled: this.viewMode }),
...@@ -72,7 +73,6 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -72,7 +73,6 @@ export class CaGeneralInformationComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.countries = this._activatedRoute.snapshot.data.countryData;
} }
buildForm(agentDetail: any) { buildForm(agentDetail: any) {
...@@ -88,6 +88,8 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -88,6 +88,8 @@ export class CaGeneralInformationComponent implements OnInit {
language: agentDetail.language, language: agentDetail.language,
type: agentDetail.type type: agentDetail.type
}); });
this.onCountryChange(this.formGroup.controls.country);
} }
} }
...@@ -125,10 +127,14 @@ export class CaGeneralInformationComponent implements OnInit { ...@@ -125,10 +127,14 @@ export class CaGeneralInformationComponent implements OnInit {
} }
} }
onCountryChange(obj) { onCountryChange(obj, deleteTimeZone?: boolean) {
let selectedCountry = obj.value; let selectedCountry = obj.value;
this.timezones = []; this.timezones = [];
this.formGroup.controls['timezone'].setValue(null);
if (deleteTimeZone) {
this.formGroup.controls['timezone'].setValue(null);
}
if (selectedCountry) { if (selectedCountry) {
for (var index in this.countries) { for (var index in this.countries) {
if (selectedCountry === this.countries[index].id) { if (selectedCountry === this.countries[index].id) {
......
...@@ -22,5 +22,7 @@ ...@@ -22,5 +22,7 @@
"label.deployment-channels.configuration.description": "Seleccione un canal de despliegue", "label.deployment-channels.configuration.description": "Seleccione un canal de despliegue",
"label.status.active" : "Activo", "label.status.active" : "Activo",
"label.status.loaded" : "Cargado", "label.status.loaded" : "Cargado",
"label.status.off" : "En Baja" "label.status.off" : "En Baja",
"label.created": "Creado",
"label.deployed": "Desplegado"
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment