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 {
// return pagination(body);
case url.indexOf(basePath + '/connection/data') !== -1 && method === 'GET ':
return ok({});
case url.indexOf(basePath + '/country') !== -1 && method === 'GET':
return ok(countries);
case url.indexOf(basePath + '/') !== -1 && method === 'GET':
return ok(data);
// case url.indexOf(basePath + '/country') !== -1 && method === 'GET':
// return ok(countries);
// case url.indexOf(basePath + '/') !== -1 && method === 'GET':
// return ok(data);
default:
// pass through any requests not handled above
return next.handle(request);
......
......@@ -23,7 +23,6 @@ const routes: Routes = [
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
dataForWizard: AgentDataForWizardResolver,
countryData : CountryDataForWizardResolver
},
canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
......@@ -40,8 +39,8 @@ const routes: Routes = [
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver
agentDetail: AgentDetailResolver,
countryData : CountryDataForWizardResolver
},
canActivate: [AuthGuard, ResourceAuthGuard], canDeactivate: [DirtyGuard],
data:
......@@ -56,8 +55,8 @@ const routes: Routes = [
//component: AgentDetailComponent,
component: AgentComponent,
resolve: {
externalSystemDetail: AgentDetailResolver,
dataForWizard: AgentDataForWizardResolver
agentDetail: AgentDetailResolver,
countryData : CountryDataForWizardResolver
},
canActivate: [AuthGuard, ResourceAuthGuard],
data:
......
......@@ -8,10 +8,10 @@ export class AgentStatusPipe implements PipeTransform {
transform(value: any, ...args: any[]): any {
if (value) {
switch (value) {
case 'AC':
return 'label.active';
case 'IN':
return 'label.inactive';
case 'CR':
return 'label.created';
case 'DP':
return 'label.deployed';
}
}
......
......@@ -14,7 +14,7 @@ export class AgentDetailResolver implements Resolve<any> {
): Observable<any>|Promise<any>|any {
let code = route.paramMap.get('code');
return this.service.getResult(code);
}
}
......@@ -26,7 +26,7 @@ export class AgentService extends DynaDataService {
}
getCountryDataForWizard() {
return this.httpClient.get(this.serviceURL + '/country');
return this.httpClient.get(this.serviceURL + '/countries');
}
}
......@@ -50,7 +50,7 @@
<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>
<span
*ngIf="template['name'] !== 'status'">{{ item[template['name']] }}</span>
......
......@@ -34,7 +34,7 @@ export class AgentComponent implements OnInit, IDirty {
@ViewChild('stepper', { static: true }) stepper: MatStepper;
externalSystemDetail: any;
agentDetail: any;
isLinear = true;
isNew = true;
......@@ -91,24 +91,23 @@ export class AgentComponent implements OnInit, IDirty {
this.isNew = this._activatedRoute.snapshot.data.mode === 'create';
if (this.isNew) {
this.externalSystemDetail = {
connections: []
this.agentDetail = {
};
} 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.entitiesComponent.setDataForWizard(dataForWizard);
this.generalInformationComponent.buildForm(this.externalSystemDetail);
this.frequentQuestionsComponent.buildForm(this.externalSystemDetail);
//this.stepsComponent.buildForm(this.externalSystemDetail, this.resourceAuth);
//this.entitiesComponent.buildForm(this.externalSystemDetail);
//this.summaryComponent.buildForm(this.externalSystemDetail);
this.generalInformationComponent.buildForm(this.agentDetail);
this.frequentQuestionsComponent.buildForm(this.agentDetail);
//this.stepsComponent.buildForm(this.agentDetail, this.resourceAuth);
//this.entitiesComponent.buildForm(this.agentDetail);
//this.summaryComponent.buildForm(this.agentDetail);
}
......
......@@ -75,7 +75,7 @@
<div class="col-12">
<mat-form-field class="amd-form-control">
<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">
{{country.name | translate}}
</mat-option>
......
......@@ -57,6 +57,7 @@ export class CaGeneralInformationComponent implements OnInit {
) {
this.viewMode = this._activatedRoute.snapshot.data.mode === 'view';
this.countries = this._activatedRoute.snapshot.data.countryData;
this.formGroup = this.formBuilder.group({
name: new FormControl({ value: "", disabled: this.viewMode }),
......@@ -72,7 +73,6 @@ export class CaGeneralInformationComponent implements OnInit {
}
ngOnInit() {
this.countries = this._activatedRoute.snapshot.data.countryData;
}
buildForm(agentDetail: any) {
......@@ -88,6 +88,8 @@ export class CaGeneralInformationComponent implements OnInit {
language: agentDetail.language,
type: agentDetail.type
});
this.onCountryChange(this.formGroup.controls.country);
}
}
......@@ -125,10 +127,14 @@ export class CaGeneralInformationComponent implements OnInit {
}
}
onCountryChange(obj) {
onCountryChange(obj, deleteTimeZone?: boolean) {
let selectedCountry = obj.value;
this.timezones = [];
this.formGroup.controls['timezone'].setValue(null);
if (deleteTimeZone) {
this.formGroup.controls['timezone'].setValue(null);
}
if (selectedCountry) {
for (var index in this.countries) {
if (selectedCountry === this.countries[index].id) {
......
......@@ -22,5 +22,7 @@
"label.deployment-channels.configuration.description": "Seleccione un canal de despliegue",
"label.status.active" : "Activo",
"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